Commit 8f23f5db authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Joerg Roedel
Browse files

iommu: Change kconfig around IOMMU_SVA

Linus suggested that the kconfig here is confusing:

https://lore.kernel.org/all/CAHk-=wgUiAtiszwseM1p2fCJ+sC4XWQ+YN4TanFhUgvUqjr9Xw@mail.gmail.com/



Let's break it into three kconfigs controlling distinct things:

 - CONFIG_IOMMU_MM_DATA controls if the mm_struct has the additional
   fields for the IOMMU. Currently only PASID, but later patches store
   a struct iommu_mm_data *

 - CONFIG_ARCH_HAS_CPU_PASID controls if the arch needs the scheduling bit
   for keeping track of the ENQCMD instruction. x86 will select this if
   IOMMU_SVA is enabled

 - IOMMU_SVA controls if the IOMMU core compiles in the SVA support code
   for iommu driver use and the IOMMU exported API

This way ARM will not enable CONFIG_ARCH_HAS_CPU_PASID

Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20231027000525.1278806-2-tina.zhang@intel.com


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 61f054f3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -301,6 +301,11 @@ config ARCH_HAS_DMA_CLEAR_UNCACHED
config ARCH_HAS_CPU_FINALIZE_INIT
	bool

# The architecture has a per-task state that includes the mm's PASID
config ARCH_HAS_CPU_PASID
	bool
	select IOMMU_MM_DATA

# Select if arch init_task must go in the __init_task_data section
config ARCH_TASK_STRUCT_ON_STACK
	bool
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ config X86
	select ARCH_HAS_CACHE_LINE_SIZE
	select ARCH_HAS_CPU_CACHE_INVALIDATE_MEMREGION
	select ARCH_HAS_CPU_FINALIZE_INIT
	select ARCH_HAS_CPU_PASID		if IOMMU_SVA
	select ARCH_HAS_CURRENT_STACK_POINTER
	select ARCH_HAS_DEBUG_VIRTUAL
	select ARCH_HAS_DEBUG_VM_PGTABLE	if !X86_PAE
+1 −1
Original line number Diff line number Diff line
@@ -565,7 +565,7 @@ static bool fixup_iopl_exception(struct pt_regs *regs)
 */
static bool try_fixup_enqcmd_gp(void)
{
#ifdef CONFIG_IOMMU_SVA
#ifdef CONFIG_ARCH_HAS_CPU_PASID
	u32 pasid;

	/*
+1 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ config IOMMU_DMA

# Shared Virtual Addressing
config IOMMU_SVA
	select IOMMU_MM_DATA
	bool

config FSL_PAMU
+1 −1
Original line number Diff line number Diff line
@@ -1337,7 +1337,7 @@ static inline bool tegra_dev_iommu_get_stream_id(struct device *dev, u32 *stream
	return false;
}

#ifdef CONFIG_IOMMU_SVA
#ifdef CONFIG_IOMMU_MM_DATA
static inline void mm_pasid_init(struct mm_struct *mm)
{
	mm->pasid = IOMMU_PASID_INVALID;
Loading