]> Git Repo - J-linux.git/commitdiff
Merge tag 'iommu-updates-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <[email protected]>
Fri, 26 Oct 2018 17:50:10 +0000 (10:50 -0700)
committerLinus Torvalds <[email protected]>
Fri, 26 Oct 2018 17:50:10 +0000 (10:50 -0700)
Pull IOMMU updates from Joerg Roedel:

 - Debugfs support for the Intel VT-d driver.

   When enabled, it now also exposes some of its internal data
   structures to user-space for debugging purposes.

 - ARM-SMMU driver now uses the generic deferred flushing and fast-path
   iova allocation code.

   This is expected to be a major performance improvement, as this
   allocation path scales a lot better.

 - Support for r8a7744 in the Renesas iommu driver

 - Couple of minor fixes and improvements all over the place

* tag 'iommu-updates-v4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (39 commits)
  iommu/arm-smmu-v3: Remove unnecessary wrapper function
  iommu/arm-smmu-v3: Add SPDX header
  iommu/amd: Add default branch in amd_iommu_capable()
  dt-bindings: iommu: ipmmu-vmsa: Add r8a7744 support
  iommu/amd: Move iommu_init_pci() to .init section
  iommu/arm-smmu: Support non-strict mode
  iommu/io-pgtable-arm-v7s: Add support for non-strict mode
  iommu/arm-smmu-v3: Add support for non-strict mode
  iommu/io-pgtable-arm: Add support for non-strict mode
  iommu: Add "iommu.strict" command line option
  iommu/dma: Add support for non-strict mode
  iommu/arm-smmu: Ensure that page-table updates are visible before TLBI
  iommu/arm-smmu-v3: Implement flush_iotlb_all hook
  iommu/arm-smmu-v3: Avoid back-to-back CMD_SYNC operations
  iommu/arm-smmu-v3: Fix unexpected CMD_SYNC timeout
  iommu/io-pgtable-arm: Fix race handling in split_blk_unmap()
  iommu/arm-smmu-v3: Fix a couple of minor comment typos
  iommu: Fix a typo
  iommu: Remove .domain_{get,set}_windows
  iommu: Tidy up window attributes
  ...

1  2 
Documentation/admin-guide/kernel-parameters.txt
drivers/bus/fsl-mc/fsl-mc-bus.c
drivers/iommu/Kconfig
drivers/iommu/amd_iommu_init.c
drivers/iommu/intel-iommu.c
include/linux/fsl/mc.h

index 8022d902e770c09c8cc7668645aabbc77736106d,7c992b6d27fa5d429c6c1895302299227e9de5d6..5b5f1ba76bba1ff9fc92d19c46c3e3a75f7c9d57
                        causing system reset or hang due to sending
                        INIT from AP to BSP.
  
 +      disable_counter_freezing [HW]
 +                      Disable Intel PMU counter freezing feature.
 +                      The feature only exists starting from
 +                      Arch Perfmon v4 (Skylake and newer).
 +
        disable_ddw     [PPC/PSERIES]
                        Disable Dynamic DMA Window support. Use this if
                        to workaround buggy firmware.
        hvc_iucv_allow= [S390]  Comma-separated list of z/VM user IDs.
                                If specified, z/VM IUCV HVC accepts connections
                                from listed z/VM user IDs only.
 +
 +      hv_nopvspin     [X86,HYPER_V] Disables the paravirt spinlock optimizations
 +                                    which allow the hypervisor to 'idle' the
 +                                    guest on lock contention.
 +
        keep_bootcon    [KNL]
                        Do not unregister boot console at start. This is only
                        useful for debugging when something happens in the window
                nobypass        [PPC/POWERNV]
                        Disable IOMMU bypass, using IOMMU for PCI devices.
  
+       iommu.strict=   [ARM64] Configure TLB invalidation behaviour
+                       Format: { "0" | "1" }
+                       0 - Lazy mode.
+                         Request that DMA unmap operations use deferred
+                         invalidation of hardware TLBs, for increased
+                         throughput at the cost of reduced device isolation.
+                         Will fall back to strict mode if not supported by
+                         the relevant IOMMU driver.
+                       1 - Strict mode (default).
+                         DMA unmap operations invalidate IOMMU hardware TLBs
+                         synchronously.
        iommu.passthrough=
                        [ARM64] Configure DMA to bypass the IOMMU by default.
                        Format: { "0" | "1" }
                        0 - Use IOMMU translation for DMA.
                        1 - Bypass the IOMMU for DMA.
 -                      unset - Use IOMMU translation for DMA.
 +                      unset - Use value of CONFIG_IOMMU_DEFAULT_PASSTHROUGH.
  
        io7=            [HW] IO7 for Marvel based alpha systems
                        See comment before marvel_specify_io7 in
        ltpc=           [NET]
                        Format: <io>,<irq>,<dma>
  
 +      lsm.debug       [SECURITY] Enable LSM initialization debugging output.
 +
        machvec=        [IA-64] Force the use of a particular machine-vector
                        (machvec) in a generic kernel.
                        Example: machvec=hpzx1_swiotlb
  
                        In kernels built with CONFIG_RCU_NOCB_CPU=y, set
                        the specified list of CPUs to be no-callback CPUs.
 -                      Invocation of these CPUs' RCU callbacks will
 -                      be offloaded to "rcuox/N" kthreads created for
 -                      that purpose, where "x" is "b" for RCU-bh, "p"
 -                      for RCU-preempt, and "s" for RCU-sched, and "N"
 -                      is the CPU number.  This reduces OS jitter on the
 -                      offloaded CPUs, which can be useful for HPC and
 -                      real-time workloads.  It can also improve energy
 -                      efficiency for asymmetric multiprocessors.
 +                      Invocation of these CPUs' RCU callbacks will be
 +                      offloaded to "rcuox/N" kthreads created for that
 +                      purpose, where "x" is "p" for RCU-preempt, and
 +                      "s" for RCU-sched, and "N" is the CPU number.
 +                      This reduces OS jitter on the offloaded CPUs,
 +                      which can be useful for HPC and real-time
 +                      workloads.  It can also improve energy efficiency
 +                      for asymmetric multiprocessors.
  
        rcu_nocb_poll   [KNL]
                        Rather than requiring that offloaded CPUs
                        Set required age in jiffies for a
                        given grace period before RCU starts
                        soliciting quiescent-state help from
 -                      rcu_note_context_switch().
 +                      rcu_note_context_switch().  If not specified, the
 +                      kernel will calculate a value based on the most
 +                      recent settings of rcutree.jiffies_till_first_fqs
 +                      and rcutree.jiffies_till_next_fqs.
 +                      This calculated value may be viewed in
 +                      rcutree.jiffies_to_sched_qs.  Any attempt to
 +                      set rcutree.jiffies_to_sched_qs will be
 +                      cheerfully overwritten.
  
        rcutree.jiffies_till_first_fqs= [KNL]
                        Set delay from grace-period initialization to
        rcupdate.rcu_self_test= [KNL]
                        Run the RCU early boot self tests
  
 -      rcupdate.rcu_self_test_bh= [KNL]
 -                      Run the RCU bh early boot self tests
 -
 -      rcupdate.rcu_self_test_sched= [KNL]
 -                      Run the RCU sched early boot self tests
 -
        rdinit=         [KNL]
                        Format: <full_path>
                        Run specified binary instead of /init from the ramdisk,
  
        usbcore.old_scheme_first=
                        [USB] Start with the old device initialization
 -                      scheme (default 0 = off).
 +                      scheme,  applies only to low and full-speed devices
 +                       (default 0 = off).
  
        usbcore.usbfs_memory_mb=
                        [USB] Memory limit (in MB) for buffers allocated by
index 4552b06fe601a16616b50c73c8f599ced891df0f,624828b1d21fd63621c2048878f16c42d2431f15..439ba5c23693be5c137212c391a90f96267f376f
@@@ -127,6 -127,16 +127,16 @@@ static int fsl_mc_bus_uevent(struct dev
        return 0;
  }
  
+ static int fsl_mc_dma_configure(struct device *dev)
+ {
+       struct device *dma_dev = dev;
+       while (dev_is_fsl_mc(dma_dev))
+               dma_dev = dma_dev->parent;
+       return of_dma_configure(dev, dma_dev->of_node, 0);
+ }
  static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
                             char *buf)
  {
@@@ -148,6 -158,7 +158,7 @@@ struct bus_type fsl_mc_bus_type = 
        .name = "fsl-mc",
        .match = fsl_mc_bus_match,
        .uevent = fsl_mc_bus_uevent,
+       .dma_configure  = fsl_mc_dma_configure,
        .dev_groups = fsl_mc_dev_groups,
  };
  EXPORT_SYMBOL_GPL(fsl_mc_bus_type);
@@@ -188,10 -199,6 +199,10 @@@ struct device_type fsl_mc_bus_dprtc_typ
        .name = "fsl_mc_bus_dprtc"
  };
  
 +struct device_type fsl_mc_bus_dpseci_type = {
 +      .name = "fsl_mc_bus_dpseci"
 +};
 +
  static struct device_type *fsl_mc_get_device_type(const char *type)
  {
        static const struct {
                { &fsl_mc_bus_dpmcp_type, "dpmcp" },
                { &fsl_mc_bus_dpmac_type, "dpmac" },
                { &fsl_mc_bus_dprtc_type, "dprtc" },
 +              { &fsl_mc_bus_dpseci_type, "dpseci" },
                { NULL, NULL }
        };
        int i;
@@@ -621,6 -627,7 +632,7 @@@ int fsl_mc_device_add(struct fsl_mc_obj
                mc_dev->icid = parent_mc_dev->icid;
                mc_dev->dma_mask = FSL_MC_DEFAULT_DMA_MASK;
                mc_dev->dev.dma_mask = &mc_dev->dma_mask;
+               mc_dev->dev.coherent_dma_mask = mc_dev->dma_mask;
                dev_set_msi_domain(&mc_dev->dev,
                                   dev_get_msi_domain(&parent_mc_dev->dev));
        }
                        goto error_cleanup_dev;
        }
  
-       /* Objects are coherent, unless 'no shareability' flag set. */
-       if (!(obj_desc->flags & FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY))
-               arch_setup_dma_ops(&mc_dev->dev, 0, 0, NULL, true);
        /*
         * The device-specific probe callback will get invoked by device_add()
         */
diff --combined drivers/iommu/Kconfig
index 83e6d993fca5db328ad91cb1fe2c3bd7a27c2ee7,51ba19c8847bc8be2d7dfa40f32a95a11b67e968..d9a25715650e40565ea0ac99884a5f87b3317d06
@@@ -186,6 -186,19 +186,19 @@@ config INTEL_IOMM
          and include PCI device scope covered by these DMA
          remapping devices.
  
+ config INTEL_IOMMU_DEBUGFS
+       bool "Export Intel IOMMU internals in Debugfs"
+       depends on INTEL_IOMMU && IOMMU_DEBUGFS
+       help
+         !!!WARNING!!!
+         DO NOT ENABLE THIS OPTION UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!!!
+         Expose Intel IOMMU internals in Debugfs.
+         This option is -NOT- intended for production environments, and should
+         only be enabled for debugging Intel IOMMU.
  config INTEL_IOMMU_SVM
        bool "Support for Shared Virtual Memory with Intel IOMMU"
        depends on INTEL_IOMMU && X86
@@@ -372,14 -385,6 +385,14 @@@ config S390_CCW_IOMM
          Enables bits of IOMMU API required by VFIO. The iommu_ops
          is not implemented as it is not necessary for VFIO.
  
 +config S390_AP_IOMMU
 +      bool "S390 AP IOMMU Support"
 +      depends on S390 && ZCRYPT
 +      select IOMMU_API
 +      help
 +        Enables bits of IOMMU API required by VFIO. The iommu_ops
 +        is not implemented as it is not necessary for VFIO.
 +
  config MTK_IOMMU
        bool "MTK IOMMU Support"
        depends on ARM || ARM64
index 3931c7de7c69c03c9a9cbb7cdbdcd8385adbbbd8,9c3d610e1e19be74bda8794c3764ba789060efd5..bb2cd29e165885d1697e4d77614a42333c5457dc
@@@ -902,22 -902,12 +902,22 @@@ static bool copy_device_table(void
                }
        }
  
 -      old_devtb_phys = entry & PAGE_MASK;
 +      /*
 +       * When SME is enabled in the first kernel, the entry includes the
 +       * memory encryption mask(sme_me_mask), we must remove the memory
 +       * encryption mask to obtain the true physical address in kdump kernel.
 +       */
 +      old_devtb_phys = __sme_clr(entry) & PAGE_MASK;
 +
        if (old_devtb_phys >= 0x100000000ULL) {
                pr_err("The address of old device table is above 4G, not trustworthy!\n");
                return false;
        }
 -      old_devtb = memremap(old_devtb_phys, dev_table_size, MEMREMAP_WB);
 +      old_devtb = (sme_active() && is_kdump_kernel())
 +                  ? (__force void *)ioremap_encrypted(old_devtb_phys,
 +                                                      dev_table_size)
 +                  : memremap(old_devtb_phys, dev_table_size, MEMREMAP_WB);
 +
        if (!old_devtb)
                return false;
  
@@@ -1719,7 -1709,7 +1719,7 @@@ static const struct attribute_group *am
        NULL,
  };
  
- static int iommu_init_pci(struct amd_iommu *iommu)
+ static int __init iommu_init_pci(struct amd_iommu *iommu)
  {
        int cap_ptr = iommu->cap_ptr;
        u32 range, misc, low, high;
index 76f0a5d16ed3ba816490fc49a1296d9d83ed39b9,08af313c8ee65330d7d53ca12de6ee0d8d393fc7..f3ccf025108b4c377f2f9bc6de80e8222b817a01
@@@ -185,16 -185,6 +185,6 @@@ static int rwbf_quirk
  static int force_on = 0;
  int intel_iommu_tboot_noforce;
  
- /*
-  * 0: Present
-  * 1-11: Reserved
-  * 12-63: Context Ptr (12 - (haw-1))
-  * 64-127: Reserved
-  */
- struct root_entry {
-       u64     lo;
-       u64     hi;
- };
  #define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry))
  
  /*
@@@ -220,21 -210,6 +210,6 @@@ static phys_addr_t root_entry_uctp(stru
  
        return re->hi & VTD_PAGE_MASK;
  }
- /*
-  * low 64 bits:
-  * 0: present
-  * 1: fault processing disable
-  * 2-3: translation type
-  * 12-63: address space root
-  * high 64 bits:
-  * 0-2: address width
-  * 3-6: aval
-  * 8-23: domain id
-  */
- struct context_entry {
-       u64 lo;
-       u64 hi;
- };
  
  static inline void context_clear_pasid_enable(struct context_entry *context)
  {
@@@ -261,7 -236,7 +236,7 @@@ static inline bool __context_present(st
        return (context->lo & 1);
  }
  
static inline bool context_present(struct context_entry *context)
+ bool context_present(struct context_entry *context)
  {
        return context_pasid_enabled(context) ?
             __context_present(context) :
@@@ -788,8 -763,8 +763,8 @@@ static void domain_update_iommu_cap(str
        domain->iommu_superpage = domain_update_iommu_superpage(NULL);
  }
  
- static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu,
-                                                      u8 bus, u8 devfn, int alloc)
+ struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
+                                        u8 devfn, int alloc)
  {
        struct root_entry *root = &iommu->root_entry[bus];
        struct context_entry *context;
@@@ -3895,7 -3870,7 +3870,7 @@@ static int intel_mapping_error(struct d
        return !dma_addr;
  }
  
 -const struct dma_map_ops intel_dma_ops = {
 +static const struct dma_map_ops intel_dma_ops = {
        .alloc = intel_alloc_coherent,
        .free = intel_free_coherent,
        .map_sg = intel_map_sg,
        .map_page = intel_map_page,
        .unmap_page = intel_unmap_page,
        .mapping_error = intel_mapping_error,
 -#ifdef CONFIG_X86
        .dma_supported = dma_direct_supported,
 -#endif
  };
  
  static inline int iommu_domain_cache_init(void)
@@@ -4860,6 -4837,7 +4835,7 @@@ int __init intel_iommu_init(void
        cpuhp_setup_state(CPUHP_IOMMU_INTEL_DEAD, "iommu/intel:dead", NULL,
                          intel_iommu_cpu_dead);
        intel_iommu_enabled = 1;
+       intel_iommu_debugfs_init();
  
        return 0;
  
diff --combined include/linux/fsl/mc.h
index 5160f06ffbac9ae6230f125f76c237783ea3085b,dddaca17d68496a3144b41e63e398e82345bde49..9d3f668df7dfbe47419121883649cf8711b56143
@@@ -351,6 -351,14 +351,14 @@@ int mc_send_command(struct fsl_mc_io *m
  #define dev_is_fsl_mc(_dev) (0)
  #endif
  
+ /* Macro to check if a device is a container device */
+ #define fsl_mc_is_cont_dev(_dev) (to_fsl_mc_device(_dev)->flags & \
+       FSL_MC_IS_DPRC)
+ /* Macro to get the container device of a MC device */
+ #define fsl_mc_cont_dev(_dev) (fsl_mc_is_cont_dev(_dev) ? \
+       (_dev) : (_dev)->parent)
  /*
   * module_fsl_mc_driver() - Helper macro for drivers that don't do
   * anything special in module init/exit.  This eliminates a lot of
@@@ -405,7 -413,6 +413,7 @@@ extern struct device_type fsl_mc_bus_dp
  extern struct device_type fsl_mc_bus_dpmcp_type;
  extern struct device_type fsl_mc_bus_dpmac_type;
  extern struct device_type fsl_mc_bus_dprtc_type;
 +extern struct device_type fsl_mc_bus_dpseci_type;
  
  static inline bool is_fsl_mc_bus_dprc(const struct fsl_mc_device *mc_dev)
  {
@@@ -452,11 -459,6 +460,11 @@@ static inline bool is_fsl_mc_bus_dprtc(
        return mc_dev->dev.type == &fsl_mc_bus_dprtc_type;
  }
  
 +static inline bool is_fsl_mc_bus_dpseci(const struct fsl_mc_device *mc_dev)
 +{
 +      return mc_dev->dev.type == &fsl_mc_bus_dpseci_type;
 +}
 +
  /*
   * Data Path Buffer Pool (DPBP) API
   * Contains initialization APIs and runtime control APIs for DPBP
This page took 0.164106 seconds and 4 git commands to generate.