iommu/t-d: Use SL for GPA->HPA translation
Subsystems (2)
Lu Baolu
maintainerv2 cover iommu/t-d: Use SL for GPA->HPA translation
v1:
https://lore.kernel.org/linux-iommu/[email protected]/
Change log:v1->v2:
- Split the cleanup into a separated patch
- Add a patch to check sanity of capabilities
- Consider capabilities when determining FL or SL
Best regards,
Baolu
Lu Baolu (3):
iommu/vt-d: Remove duplicate identity domain flag iommu/vt-d: Check FL and SL capability sanity in scalable mode iommu/vt-d: Use second level for GPA->HPA translation
include/linux/intel-iommu.h | 3 --- drivers/iommu/intel/cap_audit.h | 1 + drivers/iommu/intel/cap_audit.c | 13 +++++++++++++ drivers/iommu/intel/iommu.c | 21 +++++++++++++-------- 4 files changed, 27 insertions(+), 11 deletions(-)
Signature · 1 line
2.25.1
Lu Baolu
maintainerPATCH v2 1/3 iommu/vt-d: Remove duplicate identity domain flag
The iommu_domain data structure already has the "type" field to keep the type of a domain. It's unnecessary to have the DOMAIN_FLAG_STATIC_IDENTITY flag in the vt-d implementation. This cleans it up with no functionality change.
--- include/linux/intel-iommu.h | 3 --- drivers/iommu/intel/iommu.c | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-)
include/linux/intel-iommu.h +0 -3
@@ -517,9 +517,6 @@ struct context_entry {u64 hi; }; -/* si_domain contains mulitple devices */ -#define DOMAIN_FLAG_STATIC_IDENTITY BIT(0) -/* * When VT-d works in the scalable mode, it allows DMA translation to * happen through either first level or second level page table. This
drivers/iommu/intel/iommu.c +4 -5
@@ -528,7 +528,7 @@ static inline void free_devinfo_mem(void *vaddr)static inline int domain_type_is_si (struct dmar_domain *domain) { -return domain->flags &DOMAIN_FLAG_STATIC_IDENTITY ; +return domain->domain.type ==IOMMU_DOMAIN_IDENTITY ; }static inline bool domain_use_first_level (struct dmar_domain *domain)
@@ -1996,7 +1996,7 @@ static bool first_level_by_default(void)return scalable_mode_support () &&intel_cap_flts_sanity (); } -static struct dmar_domain *alloc_domain (int flags) +static struct dmar_domain *alloc_domain (unsigned int type) {struct dmar_domain *domain;
@@ -2006,7 +2006,6 @@ static struct dmar_domain *alloc_domain(int flags)memset (domain,0 ,sizeof (*domain)); domain->nid =NUMA_NO_NODE ; - domain->flags = flags;if (first_level_by_default ()) domain->flags |=DOMAIN_FLAG_USE_FIRST_LEVEL ; domain->has_iotlb_device = false;
@@ -2830,7 +2829,7 @@ static int __init si_domain_init(int hw)struct device *dev;int i, nid, ret; - si_domain =alloc_domain (DOMAIN_FLAG_STATIC_IDENTITY ); + si_domain =alloc_domain (IOMMU_DOMAIN_IDENTITY );if (!si_domain)return -EFAULT ;
@@ -4639,7 +4638,7 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)case IOMMU_DOMAIN_DMA :case IOMMU_DOMAIN_DMA_FQ :case IOMMU_DOMAIN_UNMANAGED : - dmar_domain =alloc_domain (0 ); + dmar_domain =alloc_domain (type);if (!dmar_domain) {pr_err ("Can't allocate dmar_domain\n" );return NULL ;
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
RE: [PATCH v2 1/3] iommu/vt-d: Remove duplicate identity domain flag
Quoted 10 lines
From: Lu Baolu <[email protected]>
Sent: Sunday, September 26, 2021 7:46 PMThe
iommu_domaindata structure already has the "type" field to keep the type of a domain. It's unnecessary to have theDOMAIN_FLAG_STATIC_IDENTITY
flag in the vt-d implementation. This cleans it up with no functionality change.Signed-off-by Lu Baolu <[email protected]>
Quoted 67 lines
--- include/linux/intel-iommu.h | 3 --- drivers/iommu/intel/iommu.c | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-)include/linux/intel-iommu.h +0
-3@@ -517,9 +517,6 @@ struct context_entry {u64 hi; }; -/* si_domain contains mulitple devices */ -#define DOMAIN_FLAG_STATIC_IDENTITY BIT(0) -/* * When VT-d works in the scalable mode, it allows DMA translation to * happen through either first level or second level page table. This drivers/iommu/intel/iommu.c +4
-5@@ -528,7 +528,7 @@ static inline void free_devinfo_mem(void *vaddr)static inline int domain_type_is_si (struct dmar_domain *domain) { -return domain->flags &DOMAIN_FLAG_STATIC_IDENTITY ; +return domain->domain.type ==IOMMU_DOMAIN_IDENTITY ; }static inline bool domain_use_first_level (struct dmar_domain *domain)@@ -1996,7 +1996,7 @@ static bool first_level_by_default(void)return scalable_mode_support () &&intel_cap_flts_sanity (); } -static struct dmar_domain *alloc_domain (int flags) +static struct dmar_domain *alloc_domain (unsigned int type) {struct dmar_domain *domain;@@ -2006,7 +2006,6 @@ static struct dmar_domain *alloc_domain(int flags)memset (domain,0 ,sizeof (*domain)); domain->nid =NUMA_NO_NODE ; - domain->flags = flags;if (first_level_by_default ()) domain->flags |=DOMAIN_FLAG_USE_FIRST_LEVEL ; domain->has_iotlb_device = false;@@ -2830,7 +2829,7 @@ static int __init si_domain_init(int hw)struct device *dev;int i, nid, ret; - si_domain =alloc_domain (DOMAIN_FLAG_STATIC_IDENTITY ); + si_domain =alloc_domain (IOMMU_DOMAIN_IDENTITY );if (!si_domain)return -EFAULT ;@@ -4639,7 +4638,7 @@ static struct iommu_domain *intel_iommu_domain_alloc(unsigned type)case IOMMU_DOMAIN_DMA :case IOMMU_DOMAIN_DMA_FQ :case IOMMU_DOMAIN_UNMANAGED : - dmar_domain =alloc_domain (0 ); + dmar_domain =alloc_domain (type);if (!dmar_domain) {pr_err ("Can't allocate dmar_domain\n" );
Quoted 3 lines
return NULL;
--
2.25.1
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Lu Baolu
maintainerPATCH v2 2/3 iommu/vt-d: Check FL and SL capability sanity in scalable mode
In reply to Lu BaoluAn iommu domain could be allocated and mapped before it's attached to any device. This requires that in scalable mode, when the domain is allocated, the format (FL or SL) of the page table must be determined. In order to achieve this, the platform should support consistent SL or FL capabilities on all IOMMU's. This adds a check for this and aborts IOMMU probing if it doesn't meet this requirement.
--- drivers/iommu/intel/cap_audit.h | 1 + drivers/iommu/intel/cap_audit.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)
drivers/iommu/intel/cap_audit.h +1 -0
@@ -111,6 +111,7 @@ bool intel_cap_smts_sanity(void);bool intel_cap_pasid_sanity (void );bool intel_cap_nest_sanity (void );bool intel_cap_flts_sanity (void ); +bool intel_cap_slts_sanity (void );static inline bool scalable_mode_support (void ) {
drivers/iommu/intel/cap_audit.c +13 -0
@@ -163,6 +163,14 @@ static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type)check_irq_capabilities (iommu, i); } +/* +* If the system is sane to support scalable mode, either SL or FL +* should be sane. +*/ +if (intel_cap_smts_sanity () && + !intel_cap_flts_sanity () && !intel_cap_slts_sanity ()) +return -EFAULT ; + out:rcu_read_unlock ();return 0 ;
@@ -203,3 +211,8 @@ bool intel_cap_flts_sanity(void) {return ecap_flts (intel_iommu_ecap_sanity); } + +bool intel_cap_slts_sanity (void ) +{ +return ecap_slts (intel_iommu_ecap_sanity); +}
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
RE: [PATCH v2 2/3] iommu/vt-d: Check FL and SL capability sanity in scalable mode
Quoted 10 lines
From: Lu Baolu <[email protected]>
Sent: Sunday, September 26, 2021 7:46 PMAn iommu domain could be allocated and mapped before it's attached to any
device. This requires that in scalable mode, when the domain is allocated, the format (FL or SL) of the page table must be determined. In order to achieve this, the platform should support consistent SL or FL capabilities on all IOMMU's. This adds a check for this and aborts IOMMU probing if it doesn't meet this requirement.
Is this a must? Looks the requirement comes from how the current code is implemented. It sets DOMAIN_FLAG_USE_FIRST_LEVEL flag in alloc_domain. But actually the pgtable is not allocated until the 1st device is attached. If this understanding is correct, you can also postpone the flag setting until pgtable is actually allocated.
of course how to handle inconsistent IOMMU capabilities is another orthogonal problem. Addressing it should not be only applied to SL/FL difference. especially this patch doesn't check consistency. it just checks that an IOMMU must support either SL or FL which doesn't match the commit msg here.
Quoted 52 lines
Signed-off-by Lu Baolu <[email protected]>--- drivers/iommu/intel/cap_audit.h | 1 + drivers/iommu/intel/cap_audit.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)drivers/iommu/intel/cap_audit.h +1
-0@@ -111,6 +111,7 @@ bool intel_cap_smts_sanity(void);bool intel_cap_pasid_sanity (void );bool intel_cap_nest_sanity (void );bool intel_cap_flts_sanity (void ); +bool intel_cap_slts_sanity (void );static inline bool scalable_mode_support (void ) {drivers/iommu/intel/cap_audit.c +8
-0@@ -163,6 +163,14 @@ static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type)check_irq_capabilities (iommu ,i ); } +/* +* If the system is sane to support scalable mode, either SL or FL +* should be sane. +*/ +if (intel_cap_smts_sanity () && + !intel_cap_flts_sanity () && !intel_cap_slts_sanity ()) +return -EFAULT ; + out:rcu_read_unlock ();drivers/iommu/intel/cap_audit.c +5
-1return 0 ;@@ -203,3 +211,8 @@ bool intel_cap_flts_sanity(void) {return ecap_flts (intel_iommu_ecap_sanity); } + +bool intel_cap_slts_sanity (void ) +{ +return ecap_slts (intel_iommu_ecap_sanity); +} --2.25.1
RE: [PATCH v2 2/3] iommu/vt-d: Check FL and SL capability sanity in scalable mode
In reply to Lu BaoluQuoted 14 lines
From: Tian, Kevin
Sent: Monday, September 27, 2021 9:12 AMQuoted 10 lines
From: Lu Baolu <[email protected]>
Sent: Sunday, September 26, 2021 7:46 PMAn iommu domain could be allocated and mapped before it's attached to any
device. This requires that in scalable mode, when the domain is allocated, the format (FL or SL) of the page table must be determined. In order to achieve this, the platform should support consistent SL or FL capabilities on all IOMMU's. This adds a check for this and aborts IOMMU probing if it doesn't meet this requirement.
Quoted 5 lines
Is this a must? Looks the requirement comes from how the current code is implemented. It sets
DOMAIN_FLAG_USE_FIRST_LEVELflag inalloc_domain. But actually the pgtable is not allocated until the 1st device is attached. If this understanding is correct, you can also postpone the flag setting until pgtable is actually allocated.
Baolu explained to me that RMRR regions are mapped before device attach. So this check is necessary
Quoted 6 lines
of course how to handle inconsistent IOMMU capabilities is another orthogonal problem. Addressing it should not be only applied to SL/FL difference. especially this patch doesn't check consistency. it just checks that an IOMMU must support either SL or FL which doesn't match the commit msg here.
and the overall inconsistency check mechanism is already in place. and the logic here just extends it to cover SL/FL. Given that,
Quoted 53 lines
Quoted 53 lines
Signed-off-by Lu Baolu <[email protected]>--- drivers/iommu/intel/cap_audit.h | 1 + drivers/iommu/intel/cap_audit.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)drivers/iommu/intel/cap_audit.h +1
-0@@ -111,6 +111,7 @@ bool intel_cap_smts_sanity(void);bool intel_cap_pasid_sanity (void );bool intel_cap_nest_sanity (void );bool intel_cap_flts_sanity (void ); +bool intel_cap_slts_sanity (void );static inline bool scalable_mode_support (void ) {drivers/iommu/intel/cap_audit.c +8
-0@@ -163,6 +163,14 @@ static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type)check_irq_capabilities (iommu ,i ); } +/* +* If the system is sane to support scalable mode, either SL or FL +* should be sane. +*/ +if (intel_cap_smts_sanity () && + !intel_cap_flts_sanity () && !intel_cap_slts_sanity ()) +return -EFAULT ; + out:rcu_read_unlock ();drivers/iommu/intel/cap_audit.c +5
-1return 0 ;@@ -203,3 +211,8 @@ bool intel_cap_flts_sanity(void) {return ecap_flts (intel_iommu_ecap_sanity); } + +bool intel_cap_slts_sanity (void ) +{ +return ecap_slts (intel_iommu_ecap_sanity); +} --2.25.1
RE: [PATCH v2 2/3] iommu/vt-d: Check FL and SL capability sanity in scalable mode
In reply to Lu BaoluQuoted 70 lines
From: Tian, Kevin
Sent: Monday, September 27, 2021 9:30 AMQuoted 14 lines
From: Tian, Kevin
Sent: Monday, September 27, 2021 9:12 AMQuoted 10 lines
From: Lu Baolu <[email protected]>
Sent: Sunday, September 26, 2021 7:46 PMAn iommu domain could be allocated and mapped before it's attached to any
device. This requires that in scalable mode, when the domain is allocated, the format (FL or SL) of the page table must be determined. In order to achieve this, the platform should support consistent SL or FL capabilities on all IOMMU's. This adds a check for this and aborts IOMMU probing if it doesn't meet this requirement.Quoted 5 lines
Is this a must? Looks the requirement comes from how the current code is implemented. It sets
DOMAIN_FLAG_USE_FIRST_LEVELflag inalloc_domain. But actually the pgtable is not allocated until the 1st device is attached. If this understanding is correct, you can also postpone the flag setting until pgtable is actually allocated.Baolu explained to me that RMRR regions are mapped before device attach. So this check is necessary
Quoted 6 lines
of course how to handle inconsistent IOMMU capabilities is another orthogonal problem. Addressing it should not be only applied to SL/FL difference. especially this patch doesn't check consistency. it just checks that an IOMMU must support either SL or FL which doesn't match the commit msg here.
and the overall inconsistency check mechanism is already in place. and the logic here just extends it to cover SL/FL. Given that,
Reviewed-by Kevin Tian <[email protected]>Quoted 31 lines
Quoted 31 lines
Signed-off-by Lu Baolu <[email protected]>--- drivers/iommu/intel/cap_audit.h | 1 + drivers/iommu/intel/cap_audit.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)drivers/iommu/intel/cap_audit.h +1
-0@@ -111,6 +111,7 @@ bool intel_cap_smts_sanity(void);bool intel_cap_pasid_sanity (void );bool intel_cap_nest_sanity (void );bool intel_cap_flts_sanity (void ); +bool intel_cap_slts_sanity (void );static inline bool scalable_mode_support (void ) {drivers/iommu/intel/cap_audit.c +0
-0@@ -163,6 +163,14 @@ static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type)check_irq_capabilities (iommu ,i ); }
Quoted 7 lines
Quoted 7 lines
drivers/iommu/intel/cap_audit.c static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type) · line 172
Quoted 7 lines
drivers/iommu/intel/cap_audit.c +7
-0+/* +* If the system is sane to support scalable mode, either SL or FL +* should be sane. +*/ +if (intel_cap_smts_sanity () && + !intel_cap_flts_sanity () && !intel_cap_slts_sanity ()) +return -EFAULT ;
btw this should not be -EFAULT.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/iommu/intel/cap_audit.c +1
-0+ out:rcu_read_unlock ();drivers/iommu/intel/cap_audit.c +5
-1return 0 ;@@ -203,3 +211,8 @@ bool intel_cap_flts_sanity(void) {return ecap_flts (intel_iommu_ecap_sanity); } + +bool intel_cap_slts_sanity (void ) +{ +return ecap_slts (intel_iommu_ecap_sanity); +} --2.25.1
Lu Baolu
maintainerRe: [PATCH v2 2/3] iommu/vt-d: Check FL and SL capability sanity in scalable mode
Quoted 70 lines · Kevin
Quoted 70 lines
From: Tian, Kevin
Sent: Monday, September 27, 2021 9:30 AMQuoted 14 lines
From: Tian, Kevin
Sent: Monday, September 27, 2021 9:12 AMQuoted 10 lines
From: Lu Baolu <[email protected]>
Sent: Sunday, September 26, 2021 7:46 PMAn iommu domain could be allocated and mapped before it's attached to any
device. This requires that in scalable mode, when the domain is allocated, the format (FL or SL) of the page table must be determined. In order to achieve this, the platform should support consistent SL or FL capabilities on all IOMMU's. This adds a check for this and aborts IOMMU probing if it doesn't meet this requirement.Quoted 5 lines
Is this a must? Looks the requirement comes from how the current code is implemented. It sets
DOMAIN_FLAG_USE_FIRST_LEVELflag inalloc_domain. But actually the pgtable is not allocated until the 1st device is attached. If this understanding is correct, you can also postpone the flag setting until pgtable is actually allocated.Baolu explained to me that RMRR regions are mapped before device attach. So this check is necessary
Quoted 6 lines
of course how to handle inconsistent IOMMU capabilities is another orthogonal problem. Addressing it should not be only applied to SL/FL difference. especially this patch doesn't check consistency. it just checks that an IOMMU must support either SL or FL which doesn't match the commit msg here.
and the overall inconsistency check mechanism is already in place. and the logic here just extends it to cover SL/FL. Given that,
Reviewed-by Kevin Tian <[email protected]>Quoted 31 lines
Quoted 31 lines
Signed-off-by Lu Baolu <[email protected]>--- drivers/iommu/intel/cap_audit.h | 1 + drivers/iommu/intel/cap_audit.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)drivers/iommu/intel/cap_audit.h +1
-0@@ -111,6 +111,7 @@ bool intel_cap_smts_sanity(void);bool intel_cap_pasid_sanity (void );bool intel_cap_nest_sanity (void );bool intel_cap_flts_sanity (void ); +bool intel_cap_slts_sanity (void );static inline bool scalable_mode_support (void ) {drivers/iommu/intel/cap_audit.c +0
-0@@ -163,6 +163,14 @@ static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type)check_irq_capabilities (iommu ,i ); }
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
drivers/iommu/intel/cap_audit.c static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type) · line 172
Quoted 7 lines
drivers/iommu/intel/cap_audit.c +7
-0+/* +* If the system is sane to support scalable mode, either SL or FL +* should be sane. +*/ +if (intel_cap_smts_sanity () && + !intel_cap_flts_sanity () && !intel_cap_slts_sanity ()) +return -EFAULT ;btw this should not be
-EFAULT.
Agreed. I will change it to -ENOTSUPP.
Best regards,
baolu
Quoted 17 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
drivers/iommu/intel/cap_audit.c +1
-0+ out:rcu_read_unlock ();return 0;
drivers/iommu/intel/cap_audit.c +5
-1@@ -203,3 +211,8 @@ bool intel_cap_flts_sanity(void) {return ecap_flts (intel_iommu_ecap_sanity); } + +bool intel_cap_slts_sanity (void ) +{ +return ecap_slts (intel_iommu_ecap_sanity); +} --2.25.1
Lu Baolu
maintainerPATCH v2 3/3 iommu/vt-d: Use second level for GPA->HPA translation
In reply to Lu BaoluThe IOMMU VT-d implementation uses the first level for GPA->HPA translation by default. Although both the first level and the second level could handle the DMA translation, they're different in some way. For example, the second level translation has separate controls for the Access/Dirty page tracking. With the first level translation, there's no such control. On the other hand, the second level translation has the page-level control for forcing snoop, but the first level only has global control with pasid granularity.
This uses the second level for GPA->HPA translation so that we can provide a consistent hardware interface for use cases like dirty page tracking for live migration.
--- drivers/iommu/intel/iommu.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/iommu/intel/iommu.c +9 -3
@@ -1991,9 +1991,15 @@ static void free_dmar_iommu(struct intel_iommu *iommu)* Check and return whether first level is used by default for * DMA translation. */ -static bool first_level_by_default (void ) +static bool first_level_by_default (unsigned int type) { -return scalable_mode_support () &&intel_cap_flts_sanity (); +if (!scalable_mode_support ()) +return false; + +if (intel_cap_flts_sanity () ^intel_cap_slts_sanity ()) +return intel_cap_flts_sanity (); + +return type !=IOMMU_DOMAIN_UNMANAGED ; }static struct dmar_domain *alloc_domain (unsigned int type)
@@ -2006,7 +2012,7 @@ static struct dmar_domain *alloc_domain(unsigned int type)memset (domain,0 ,sizeof (*domain)); domain->nid =NUMA_NO_NODE ; -if (first_level_by_default ()) +if (first_level_by_default (type)) domain->flags |=DOMAIN_FLAG_USE_FIRST_LEVEL ; domain->has_iotlb_device = false;INIT_LIST_HEAD (&domain->devices);
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
RE: [PATCH v2 3/3] iommu/vt-d: Use second level for GPA->HPA translation
Quoted 26 lines
From: Lu Baolu <[email protected]>
Sent: Sunday, September 26, 2021 7:46 PMThe IOMMU VT-d implementation uses the first level for
GPA->HPAtranslation
by default. Although both the first level and the second level could handle the DMA translation, they're different in some way. For example, the second level translation has separate controls for the Access/Dirty page tracking. With the first level translation, there's no such control. On the other hand, the second level translation has the page-level control for forcing snoop, but the first level only has global control with pasid granularity.This uses the second level for
GPA->HPAtranslation so that we can provide a consistent hardware interface for use cases like dirty page tracking for live migration.Signed-off-by Lu Baolu <[email protected]>--- drivers/iommu/intel/iommu.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)drivers/iommu/intel/iommu.c +0
-0
drivers/iommu/intel/iommu.c static void free_dmar_iommu(struct intel_iommu · line 1997
Quoted 8 lines
drivers/iommu/intel/iommu.c +1
-2@@ -1991,9 +1991,15 @@ static void free_dmar_iommu(struct intel_iommu*iommu) * Check and return whether first level is used by default for * DMA translation. */ -static bool first_level_by_default (void ) +static bool first_level_by_default (unsigned int type) { -return scalable_mode_support () &&intel_cap_flts_sanity ();
/* Only SL is available in legacy mode */
drivers/iommu/intel/iommu.c static void free_dmar_iommu(struct intel_iommu *iommu) · line 1998
Quoted 3 lines
drivers/iommu/intel/iommu.c +3
-0+if (!scalable_mode_support ()) +return false; +
/* if only level (either FL or SL) is available, just use it */
drivers/iommu/intel/iommu.c static void free_dmar_iommu(struct intel_iommu *iommu) · line 2001
Quoted 3 lines
drivers/iommu/intel/iommu.c +3
-0+if (intel_cap_flts_sanity () ^intel_cap_slts_sanity ()) +return intel_cap_flts_sanity (); +
/* if both levels are available, decide it based on domain type */
drivers/iommu/intel/iommu.c static void free_dmar_iommu(struct intel_iommu *iommu) · line 2003
Quoted 2 lines
drivers/iommu/intel/iommu.c +1
-0+return type !=IOMMU_DOMAIN_UNMANAGED ; }
with above comments added:
Quoted 14 lines
drivers/iommu/intel/iommu.c +1
-1static struct dmar_domain *alloc_domain (unsigned int type)@@ -2006,7 +2012,7 @@ static struct dmar_domain *alloc_domain(unsigned int type)memset (domain,0 ,sizeof (*domain)); domain->nid =NUMA_NO_NODE ; -if (first_level_by_default ()) +if (first_level_by_default (type)) domain->flags |=DOMAIN_FLAG_USE_FIRST_LEVEL ; domain->has_iotlb_device = false;
INIT_LIST_HEAD(&domain->devices);
--
2.25.1