1. 28 5月, 2019 12 次提交
  2. 27 5月, 2019 7 次提交
    • J
      iommu/vt-d: Implement apply_resv_region iommu ops entry · 73bcbdc9
      James Sewart 提交于
      Used by iommu.c before creating identity mappings for reserved
      ranges to ensure dma-ops won't ever remap these ranges.
      Signed-off-by: NJames Sewart <jamessewart@arista.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      73bcbdc9
    • L
      iommu: Add API to request DMA domain for device · 7423e017
      Lu Baolu 提交于
      Normally during iommu probing a device, a default doamin will
      be allocated and attached to the device. The domain type of
      the default domain is statically defined, which results in a
      situation where the allocated default domain isn't suitable
      for the device due to some limitations. We already have API
      iommu_request_dm_for_dev() to replace a DMA domain with an
      identity one. This adds iommu_request_dma_domain_for_dev()
      to request a dma domain if an allocated identity domain isn't
      suitable for the device in question.
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      7423e017
    • S
      iommu/vt-d: Add debugfs support to show scalable mode DMAR table internals · dd5142ca
      Sai Praneeth Prakhya 提交于
      A DMAR table walk would typically follow the below process.
      1. Bus number is used to index into root table which points to a context
         table.
      2. Device number and Function number are used together to index into
         context table which then points to a pasid directory.
      3. PASID[19:6] is used to index into PASID directory which points to a
         PASID table.
      4. PASID[5:0] is used to index into PASID table which points to all levels
         of page tables.
      
      Whenever a user opens the file
      "/sys/kernel/debug/iommu/intel/dmar_translation_struct", the above
      described DMAR table walk is performed and the contents of the table are
      dumped into the file. The dump could be handy while dealing with devices
      that use PASID.
      
      Example of such dump:
      cat /sys/kernel/debug/iommu/intel/dmar_translation_struct
      
      (Please note that because of 80 char limit, entries that should have been
      in the same line are broken into different lines)
      
      IOMMU dmar0: Root Table Address: 0x436f7c000
      B.D.F	Root_entry				Context_entry
      PASID	PASID_table_entry
      00:0a.0	0x0000000000000000:0x000000044dd3f001	0x0000000000100000:0x0000000435460e1d
      0	0x000000044d6e1089:0x0000000000000003:0x0000000000000001
      00:0a.0	0x0000000000000000:0x000000044dd3f001	0x0000000000100000:0x0000000435460e1d
      1	0x0000000000000049:0x0000000000000001:0x0000000003c0e001
      
      Note that the above format is followed even for legacy DMAR table dump
      which doesn't support PASID and hence in such cases PASID is defaulted to
      -1 indicating that PASID and it's related fields are invalid.
      
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Cc: Lu Baolu <baolu.lu@linux.intel.com>
      Cc: Sohil Mehta <sohil.mehta@intel.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: NLu Baolu <baolu.lu@linux.intel.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      dd5142ca
    • S
      iommu/vt-d: Introduce macros useful for dumping DMAR table · cdd3a249
      Sai Praneeth Prakhya 提交于
      A scalable mode DMAR table walk would involve looking at bits in each stage
      of walk, like,
      1. Is PASID enabled in the context entry?
      2. What's the size of PASID directory?
      3. Is the PASID directory entry present?
      4. Is the PASID table entry present?
      5. Number of PASID table entries?
      
      Hence, add these macros that will later be used during this walk.
      Apart from adding new macros, move existing macros (like
      pasid_pde_is_present(), get_pasid_table_from_pde() and pasid_supported())
      to appropriate header files so that they could be reused.
      
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Cc: Lu Baolu <baolu.lu@linux.intel.com>
      Cc: Sohil Mehta <sohil.mehta@intel.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: NLu Baolu <baolu.lu@linux.intel.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      cdd3a249
    • S
      iommu/vt-d: Modify the format of intel DMAR tables dump · ea09506c
      Sai Praneeth Prakhya 提交于
      Presently, "/sys/kernel/debug/iommu/intel/dmar_translation_struct" file
      dumps DMAR tables in the below format
      
      IOMMU dmar2: Root Table Address:4362cc000
      Root Table Entries:
       Bus: 0 H: 0 L: 4362f0001
       Context Table Entries for Bus: 0
        Entry	B:D.F	High	Low
        160   00:14.0	102     4362ef001
        184   00:17.0	302     435ec4001
        248   00:1f.0	202     436300001
      
      This format has few short comings like
      1. When extended for dumping scalable mode DMAR table it will quickly be
         very clumsy, making it unreadable.
      2. It has information like the Bus number and Entry which are basically
         part of B:D.F, hence are a repetition and are not so useful.
      
      So, change it to a new format which could be easily extended to dump
      scalable mode DMAR table. The new format looks as below:
      
      IOMMU dmar2: Root Table Address: 0x436f7d000
      B.D.F	Root_entry				Context_entry
      00:14.0	0x0000000000000000:0x0000000436fbd001	0x0000000000000102:0x0000000436fbc001
      00:17.0	0x0000000000000000:0x0000000436fbd001	0x0000000000000302:0x0000000436af4001
      00:1f.0	0x0000000000000000:0x0000000436fbd001	0x0000000000000202:0x0000000436fcd001
      
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Cc: Lu Baolu <baolu.lu@linux.intel.com>
      Cc: Sohil Mehta <sohil.mehta@intel.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: NLu Baolu <baolu.lu@linux.intel.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      ea09506c
    • L
      iommu/vt-d: Remove unnecessary rcu_read_locks · f780a8dc
      Lukasz Odzioba 提交于
      We use RCU's for rarely updated lists like iommus, rmrr, atsr units.
      
      I'm not sure why domain_remove_dev_info() in domain_exit() was surrounded
      by rcu_read_lock. Lock was present before refactoring in d160aca5,
      but it was related to rcu list, not domain_remove_dev_info function.
      
      dmar_remove_one_dev_info() doesn't touch any of those lists, so it doesn't
      require a lock. In fact it is called 6 times without it anyway.
      
      Fixes: d160aca5 ("iommu/vt-d: Unify domain->iommu attach/detachment")
      Signed-off-by: NLukasz Odzioba <lukasz.odzioba@intel.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      f780a8dc
    • J
      iommu/vt-d: Fix bind svm with multiple devices · d7af4d98
      Jacob Pan 提交于
      If multiple devices try to bind to the same mm/PASID, we need to
      set up first level PASID entries for all the devices. The current
      code does not consider this case which results in failed DMA for
      devices after the first bind.
      Signed-off-by: NJacob Pan <jacob.jun.pan@linux.intel.com>
      Reported-by: NMike Campin <mike.campin@intel.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      d7af4d98
  3. 26 5月, 2019 1 次提交
  4. 24 5月, 2019 20 次提交