Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 4 Feb 2015 17:42:55 +0000 (09:42 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 4 Feb 2015 17:42:55 +0000 (09:42 -0800)
Pull ARM fixes from Russell King:
 "A number of ARM fixes, the biggest is fixing a regression caused by
  appended DT blobs exceeding 64K, causing the decompressor fixup code
  to fail to patch the DT blob.  Another important fix is for the ASID
  allocator from Will Deacon which prevents some rare crashes seen on
  some systems.  Lastly, there's a build fix for v7M systems when printk
  support is disabled.

  The last two remaining fixes are more cosmetic - the IOMMU one
  prevents an annoying harmless warning message, and we disable the
  kernel strict memory permissions on non-MMU which can't support it
  anyway"

* 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
  ARM: 8299/1: mm: ensure local active ASID is marked as allocated on rollover
  ARM: 8298/1: ARM_KERNMEM_PERMS only works with MMU enabled
  ARM: 8295/1: fix v7M build for !CONFIG_PRINTK
  ARM: 8294/1: ATAG_DTB_COMPAT: remove the DT workspace's hardcoded 64KB size
  ARM: 8288/1: dma-mapping: don't detach devices without an IOMMU during teardown

1  2 
arch/arm/mm/dma-mapping.c

@@@ -1940,32 -1940,13 +1940,32 @@@ void arm_iommu_release_mapping(struct d
  }
  EXPORT_SYMBOL_GPL(arm_iommu_release_mapping);
  
 +static int __arm_iommu_attach_device(struct device *dev,
 +                                   struct dma_iommu_mapping *mapping)
 +{
 +      int err;
 +
 +      err = iommu_attach_device(mapping->domain, dev);
 +      if (err)
 +              return err;
 +
 +      kref_get(&mapping->kref);
 +      dev->archdata.mapping = mapping;
 +
 +      pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev));
 +      return 0;
 +}
 +
  /**
   * arm_iommu_attach_device
   * @dev: valid struct device pointer
   * @mapping: io address space mapping structure (returned from
   *    arm_iommu_create_mapping)
   *
 - * Attaches specified io address space mapping to the provided device,
 + * Attaches specified io address space mapping to the provided device.
 + * This replaces the dma operations (dma_map_ops pointer) with the
 + * IOMMU aware version.
 + *
   * More than one client might be attached to the same io address space
   * mapping.
   */
@@@ -1974,16 -1955,25 +1974,16 @@@ int arm_iommu_attach_device(struct devi
  {
        int err;
  
 -      err = iommu_attach_device(mapping->domain, dev);
 +      err = __arm_iommu_attach_device(dev, mapping);
        if (err)
                return err;
  
 -      kref_get(&mapping->kref);
 -      dev->archdata.mapping = mapping;
 -
 -      pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev));
 +      set_dma_ops(dev, &iommu_ops);
        return 0;
  }
  EXPORT_SYMBOL_GPL(arm_iommu_attach_device);
  
 -/**
 - * arm_iommu_detach_device
 - * @dev: valid struct device pointer
 - *
 - * Detaches the provided device from a previously attached map.
 - */
 -void arm_iommu_detach_device(struct device *dev)
 +static void __arm_iommu_detach_device(struct device *dev)
  {
        struct dma_iommu_mapping *mapping;
  
  
        pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev));
  }
 +
 +/**
 + * arm_iommu_detach_device
 + * @dev: valid struct device pointer
 + *
 + * Detaches the provided device from a previously attached map.
 + * This voids the dma operations (dma_map_ops pointer)
 + */
 +void arm_iommu_detach_device(struct device *dev)
 +{
 +      __arm_iommu_detach_device(dev);
 +      set_dma_ops(dev, NULL);
 +}
  EXPORT_SYMBOL_GPL(arm_iommu_detach_device);
  
  static struct dma_map_ops *arm_get_iommu_dma_map_ops(bool coherent)
@@@ -2034,7 -2011,7 +2034,7 @@@ static bool arm_setup_iommu_dma_ops(str
                return false;
        }
  
 -      if (arm_iommu_attach_device(dev, mapping)) {
 +      if (__arm_iommu_attach_device(dev, mapping)) {
                pr_warn("Failed to attached device %s to IOMMU_mapping\n",
                                dev_name(dev));
                arm_iommu_release_mapping(mapping);
@@@ -2048,7 -2025,10 +2048,10 @@@ static void arm_teardown_iommu_dma_ops(
  {
        struct dma_iommu_mapping *mapping = dev->archdata.mapping;
  
 -      arm_iommu_detach_device(dev);
+       if (!mapping)
+               return;
 +      __arm_iommu_detach_device(dev);
        arm_iommu_release_mapping(mapping);
  }