Skip to content

Commit a2cdecd

Browse files
yiliu1765jgunthorpe
authored andcommitted
iommu/vt-d: Enhance capability check for nested parent domain allocation
This adds the scalable mode check before allocating the nested parent domain as checking nested capability is not enough. User may turn off scalable mode which also means no nested support even if the hardware supports it. Fixes: c97d1b2 ("iommu/vt-d: Add domain_alloc_user op") Link: https://lore.kernel.org/r/20231024150011.44642-1-yi.l.liu@intel.com Signed-off-by: Yi Liu <yi.l.liu@intel.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 55a0165 commit a2cdecd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4095,7 +4095,7 @@ intel_iommu_domain_alloc_user(struct device *dev, u32 flags,
40954095
if (!iommu)
40964096
return ERR_PTR(-ENODEV);
40974097

4098-
if ((flags & IOMMU_HWPT_ALLOC_NEST_PARENT) && !ecap_nest(iommu->ecap))
4098+
if ((flags & IOMMU_HWPT_ALLOC_NEST_PARENT) && !nested_supported(iommu))
40994099
return ERR_PTR(-EOPNOTSUPP);
41004100

41014101
dirty_tracking = (flags & IOMMU_HWPT_ALLOC_DIRTY_TRACKING);

drivers/iommu/intel/iommu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ enum {
544544
ecap_pasid((iommu)->ecap))
545545
#define ssads_supported(iommu) (sm_supported(iommu) && \
546546
ecap_slads((iommu)->ecap))
547+
#define nested_supported(iommu) (sm_supported(iommu) && \
548+
ecap_nest((iommu)->ecap))
547549

548550
struct pasid_entry;
549551
struct pasid_state_entry;

0 commit comments

Comments
 (0)