From: Joerg Roedel Date: Fri, 15 Nov 2024 08:27:43 +0000 (+0100) Subject: Merge branches 'intel/vt-d', 'amd/amd-vi' and 'iommufd/arm-smmuv3-nested' into next X-Git-Url: https://repo.jachan.dev/J-linux.git/commitdiff_plain/42f0cbb2a253bcd7d4f20e80462014622f19d88e Merge branches 'intel/vt-d', 'amd/amd-vi' and 'iommufd/arm-smmuv3-nested' into next --- 42f0cbb2a253bcd7d4f20e80462014622f19d88e diff --cc drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 826db8894fb7,f70165f544df,8a193141f003,b4b03206afbf..7ee3cbbe3744 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@@@@ -3084,8 -3082,7 -3084,8 -3102,8 +3100,9 @@@@@ arm_smmu_domain_alloc_user(struct devic const struct iommu_user_data *user_data) { struct arm_smmu_master *master = dev_iommu_priv_get(dev); - const u32 PAGING_FLAGS = IOMMU_HWPT_ALLOC_DIRTY_TRACKING; + const u32 PAGING_FLAGS = IOMMU_HWPT_ALLOC_DIRTY_TRACKING | - - IOMMU_HWPT_ALLOC_PASID; ++++ IOMMU_HWPT_ALLOC_PASID | +++ IOMMU_HWPT_ALLOC_NEST_PARENT; struct arm_smmu_domain *smmu_domain; int ret; diff --cc drivers/iommu/intel/iommu.c index e860bc9439a2,b380b38315b2,9f6b0780f2ef,9f6b0780f2ef..527f6f89d8a1 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@@@@ -1908,23 -1792,12 -1908,23 -1908,23 +1792,12 @@@@@ static int domain_setup_passthrough(str static int domain_setup_first_level(struct intel_iommu *iommu, struct dmar_domain *domain, struct device *dev, - -- u32 pasid) + ++ u32 pasid, struct iommu_domain *old) { struct dma_pte *pgd = domain->pgd; - -- int agaw, level; - -- int flags = 0; - - /* - * Skip top levels of page tables for iommu which has - * less agaw than default. Unnecessary for PT mode. - */ - for (agaw = domain->agaw; agaw > iommu->agaw; agaw--) { - pgd = phys_to_virt(dma_pte_addr(pgd)); - if (!dma_pte_present(pgd)) - return -ENOMEM; - } + ++ int level, flags = 0; -- /* -- * Skip top levels of page tables for iommu which has -- * less agaw than default. Unnecessary for PT mode. -- */ -- for (agaw = domain->agaw; agaw > iommu->agaw; agaw--) { -- pgd = phys_to_virt(dma_pte_addr(pgd)); -- if (!dma_pte_present(pgd)) -- return -ENOMEM; -- } -- - -- level = agaw_to_level(agaw); + ++ level = agaw_to_level(domain->agaw); if (level != 4 && level != 5) return -EINVAL; diff --cc include/linux/iommu.h index 9a3215b5c1e5,27f923450a7c,8cce372a33f1,4ad9b9ec6c9b..0c3bfb66dc7c --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@@@@ -782,14 -785,12 -782,14 -782,12 +781,14 @@@@@ static inline void iommu_iotlb_gather_i }; } ---extern int bus_iommu_probe(const struct bus_type *bus); + extern bool iommu_present(const struct bus_type *bus); extern bool device_iommu_capable(struct device *dev, enum iommu_cap cap); extern bool iommu_group_has_isolated_msi(struct iommu_group *group); - -extern struct iommu_domain *iommu_domain_alloc(const struct bus_type *bus); - -struct iommu_domain *iommu_paging_domain_alloc(struct device *dev); + +struct iommu_domain *iommu_paging_domain_alloc_flags(struct device *dev, unsigned int flags); + +static inline struct iommu_domain *iommu_paging_domain_alloc(struct device *dev) + +{ + + return iommu_paging_domain_alloc_flags(dev, 0); + +} extern void iommu_domain_free(struct iommu_domain *domain); extern int iommu_attach_device(struct iommu_domain *domain, struct device *dev);