lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 12 Dec 2018 09:30:42 +1100
From:   Stephen Rothwell <sfr@...b.auug.org.au>
To:     David Miller <davem@...emloft.net>, Christoph Hellwig <hch@....de>
Cc:     Linux Next Mailing List <linux-next@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Rob Herring <robh@...nel.org>
Subject: linux-next: manual merge of the sparc-next tree with the
 dma-mapping tree

Hi all,

Today's linux-next merge of the sparc-next tree got a conflict in:

  arch/sparc/kernel/ioport.c

between commit:

  53b7670e5735 ("sparc: factor the dma coherent mapping into helper")

from the dma-mapping tree and commit:

  86ef771ed543 ("sparc: Use DT node full_name instead of name for resources")

from the sparc-next tree.

I fixed it up (see below - the resolution looks more complex than it
is) and can carry the fix as necessary. This is now fixed as far as
linux-next is concerned, but any non trivial conflicts should be
mentioned to your upstream maintainer when your tree is submitted for
merging.  You may also want to consider cooperating with the maintainer
of the conflicting tree to minimise any particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/sparc/kernel/ioport.c
index 51c128d80193,aeaad04fdd14..000000000000
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@@ -245,46 -247,97 +245,46 @@@ static void _sparc_free_io(struct resou
  	release_resource(res);
  }
  
 -#ifdef CONFIG_SBUS
 -
 -void sbus_set_sbus64(struct device *dev, int x)
 -{
 -	printk("sbus_set_sbus64: unsupported\n");
 -}
 -EXPORT_SYMBOL(sbus_set_sbus64);
 -
 -/*
 - * Allocate a chunk of memory suitable for DMA.
 - * Typically devices use them for control blocks.
 - * CPU may access them without any explicit flushing.
 - */
 -static void *sbus_alloc_coherent(struct device *dev, size_t len,
 -				 dma_addr_t *dma_addrp, gfp_t gfp,
 -				 unsigned long attrs)
 +unsigned long sparc_dma_alloc_resource(struct device *dev, size_t len)
  {
 -	struct platform_device *op = to_platform_device(dev);
 -	unsigned long len_total = PAGE_ALIGN(len);
 -	unsigned long va;
  	struct resource *res;
 -	int order;
 -
 -	/* XXX why are some lengths signed, others unsigned? */
 -	if (len <= 0) {
 -		return NULL;
 -	}
 -	/* XXX So what is maxphys for us and how do drivers know it? */
 -	if (len > 256*1024) {			/* __get_free_pages() limit */
 -		return NULL;
 -	}
 -
 -	order = get_order(len_total);
 -	va = __get_free_pages(gfp, order);
 -	if (va == 0)
 -		goto err_nopages;
  
 -	if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
 -		goto err_nomem;
 +	res = kzalloc(sizeof(*res), GFP_KERNEL);
 +	if (!res)
 +		return 0;
- 	res->name = dev->of_node->name;
++	res->name = dev->of_node->full_name;
  
 -	if (allocate_resource(&_sparc_dvma, res, len_total,
 -	    _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
 -		printk("sbus_alloc_consistent: cannot occupy 0x%lx", len_total);
 -		goto err_nova;
 +	if (allocate_resource(&_sparc_dvma, res, len, _sparc_dvma.start,
 +			      _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
 +		printk("%s: cannot occupy 0x%zx", __func__, len);
 +		kfree(res);
 +		return 0;
  	}
  
 -	// XXX The sbus_map_dma_area does this for us below, see comments.
 -	// srmmu_mapiorange(0, virt_to_phys(va), res->start, len_total);
 -	/*
 -	 * XXX That's where sdev would be used. Currently we load
 -	 * all iommu tables with the same translations.
 -	 */
 -	if (sbus_map_dma_area(dev, dma_addrp, va, res->start, len_total) != 0)
 -		goto err_noiommu;
 -
 -	res->name = op->dev.of_node->full_name;
 -
 -	return (void *)(unsigned long)res->start;
 -
 -err_noiommu:
 -	release_resource(res);
 -err_nova:
 -	kfree(res);
 -err_nomem:
 -	free_pages(va, order);
 -err_nopages:
 -	return NULL;
 +	return res->start;
  }
  
 -static void sbus_free_coherent(struct device *dev, size_t n, void *p,
 -			       dma_addr_t ba, unsigned long attrs)
 +bool sparc_dma_free_resource(void *cpu_addr, size_t size)
  {
 +	unsigned long addr = (unsigned long)cpu_addr;
  	struct resource *res;
 -	struct page *pgv;
  
 -	if ((res = lookup_resource(&_sparc_dvma,
 -	    (unsigned long)p)) == NULL) {
 -		printk("sbus_free_consistent: cannot free %p\n", p);
 -		return;
 +	res = lookup_resource(&_sparc_dvma, addr);
 +	if (!res) {
 +		printk("%s: cannot free %p\n", __func__, cpu_addr);
 +		return false;
  	}
  
 -	if (((unsigned long)p & (PAGE_SIZE-1)) != 0) {
 -		printk("sbus_free_consistent: unaligned va %p\n", p);
 -		return;
 +	if ((addr & (PAGE_SIZE - 1)) != 0) {
 +		printk("%s: unaligned va %p\n", __func__, cpu_addr);
 +		return false;
  	}
  
 -	n = PAGE_ALIGN(n);
 -	if (resource_size(res) != n) {
 -		printk("sbus_free_consistent: region 0x%lx asked 0x%zx\n",
 -		    (long)resource_size(res), n);
 -		return;
 +	size = PAGE_ALIGN(size);
 +	if (resource_size(res) != size) {
 +		printk("%s: region 0x%lx asked 0x%zx\n",
 +			__func__, (long)resource_size(res), size);
 +		return false;
  	}
  
  	release_resource(res);

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ