linux-imx/drivers/iommu/intel
Jacob Pan 7cfa7abb24 iommu/vt-d: Handle volatile descriptor status read
[ Upstream commit b5e86a9554 ]

Queued invalidation wait descriptor status is volatile in that IOMMU
hardware writes the data upon completion.

Use READ_ONCE() to prevent compiler optimizations which ensures memory
reads every time. As a side effect, READ_ONCE() also enforces strict
types and may add an extra instruction. But it should not have negative
performance impact since we use cpu_relax anyway and the extra time(by
adding an instruction) may allow IOMMU HW request cacheline ownership
easier.

e.g. gcc 12.3
BEFORE:
	81 38 ad de 00 00       cmpl   $0x2,(%rax)

AFTER (with READ_ONCE())
    772f:       8b 00                   mov    (%rax),%eax
    7731:       3d ad de 00 00          cmp    $0x2,%eax
                                        //status data is 32 bit

Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Yi Liu <yi.l.liu@intel.com>
Link: https://lore.kernel.org/r/20240607173817.3914600-1-jacob.jun.pan@linux.intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20240702130839.108139-2-baolu.lu@linux.intel.com
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-12 11:11:35 +02:00
..
cap_audit.c iommu/vt-d: Remove virtual command interface 2023-03-31 10:03:21 +02:00
cap_audit.h
debugfs.c
dmar.c iommu/vt-d: Handle volatile descriptor status read 2024-09-12 11:11:35 +02:00
iommu.c iommu/vt-d: Fix identity map bounds in si_domain_init() 2024-08-03 08:54:03 +02:00
iommu.h iommu/vt-d: Support enforce_cache_coherency only for empty domains 2024-01-10 17:16:57 +01:00
irq_remapping.c x86/vector: Rename send_cleanup_vector() to vector_schedule_cleanup() 2023-08-06 14:15:09 +02:00
Kconfig IOMMU Updates for Linux 6.4 2023-04-30 13:00:38 -07:00
Makefile iommu: Fix compilation without CONFIG_IOMMU_INTEL 2024-03-26 18:19:39 -04:00
pasid.c iommu/vt-d: Don't issue ATS Invalidation request when device is disconnected 2024-03-26 18:19:36 -04:00
pasid.h iommu: Generalize PASID 0 for normal DMA w/o PASID 2023-08-09 17:44:34 +02:00
perf.c
perf.h
perfmon.c iommu/vt-d: Fix wrong use of pasid config 2024-04-17 11:19:33 +02:00
perfmon.h iommu/vt-d: Add IOMMU perfmon support 2023-02-03 11:06:06 +01:00
svm.c iommu/vt-d: Allocate local memory for page request queue 2024-04-17 11:19:33 +02:00
trace.c
trace.h