[PATCH -next] iommu/vt-d: Remove unused function intel_svm_capable()
This is unused since commit 404837741416 ("iommu/vt-d: Use iommu_sva_alloc(free)_pasid() helpers") Signed-off-by: YueHaibing --- drivers/iommu/intel/svm.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c index 5b5d69b04fcc..2c53689da461 100644 --- a/drivers/iommu/intel/svm.c +++ b/drivers/iommu/intel/svm.c @@ -168,11 +168,6 @@ int intel_svm_finish_prq(struct intel_iommu *iommu) return 0; } -static inline bool intel_svm_capable(struct intel_iommu *iommu) -{ - return iommu->flags & VTD_FLAG_SVM_CAPABLE; -} - void intel_svm_check(struct intel_iommu *iommu) { if (!pasid_supported(iommu)) -- 2.17.1 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH -next] iommu/vt-d: use DEVICE_ATTR_RO macro
Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Signed-off-by: YueHaibing --- drivers/iommu/intel/iommu.c | 42 - 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index be35284a2016..0638ea8f6f7d 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -4138,62 +4138,56 @@ static inline struct intel_iommu *dev_to_intel_iommu(struct device *dev) return container_of(iommu_dev, struct intel_iommu, iommu); } -static ssize_t intel_iommu_show_version(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t version_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct intel_iommu *iommu = dev_to_intel_iommu(dev); u32 ver = readl(iommu->reg + DMAR_VER_REG); return sprintf(buf, "%d:%d\n", DMAR_VER_MAJOR(ver), DMAR_VER_MINOR(ver)); } -static DEVICE_ATTR(version, S_IRUGO, intel_iommu_show_version, NULL); +static DEVICE_ATTR_RO(version); -static ssize_t intel_iommu_show_address(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t address_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct intel_iommu *iommu = dev_to_intel_iommu(dev); return sprintf(buf, "%llx\n", iommu->reg_phys); } -static DEVICE_ATTR(address, S_IRUGO, intel_iommu_show_address, NULL); +static DEVICE_ATTR_RO(address); -static ssize_t intel_iommu_show_cap(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t cap_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct intel_iommu *iommu = dev_to_intel_iommu(dev); return sprintf(buf, "%llx\n", iommu->cap); } -static DEVICE_ATTR(cap, S_IRUGO, intel_iommu_show_cap, NULL); +static DEVICE_ATTR_RO(cap); -static ssize_t intel_iommu_show_ecap(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t ecap_show(struct device *dev, +struct device_attribute *attr, char *buf) { struct intel_iommu *iommu = dev_to_intel_iommu(dev); return sprintf(buf, "%llx\n", iommu->ecap); } -static DEVICE_ATTR(ecap, S_IRUGO, intel_iommu_show_ecap, NULL); +static DEVICE_ATTR_RO(ecap); -static ssize_t intel_iommu_show_ndoms(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t domains_supported_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct intel_iommu *iommu = dev_to_intel_iommu(dev); return sprintf(buf, "%ld\n", cap_ndoms(iommu->cap)); } -static DEVICE_ATTR(domains_supported, S_IRUGO, intel_iommu_show_ndoms, NULL); +static DEVICE_ATTR_RO(domains_supported); -static ssize_t intel_iommu_show_ndoms_used(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t domains_used_show(struct device *dev, +struct device_attribute *attr, char *buf) { struct intel_iommu *iommu = dev_to_intel_iommu(dev); return sprintf(buf, "%d\n", bitmap_weight(iommu->domain_ids, cap_ndoms(iommu->cap))); } -static DEVICE_ATTR(domains_used, S_IRUGO, intel_iommu_show_ndoms_used, NULL); +static DEVICE_ATTR_RO(domains_used); static struct attribute *intel_iommu_attrs[] = { &dev_attr_version.attr, -- 2.17.1 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH -next] iommu/amd: use DEVICE_ATTR_RO macro
Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Signed-off-by: YueHaibing --- drivers/iommu/amd/init.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index d006724f4dc2..4ffb694bd297 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -1731,23 +1731,21 @@ static void init_iommu_perf_ctr(struct amd_iommu *iommu) return; } -static ssize_t amd_iommu_show_cap(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t cap_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct amd_iommu *iommu = dev_to_amd_iommu(dev); return sprintf(buf, "%x\n", iommu->cap); } -static DEVICE_ATTR(cap, S_IRUGO, amd_iommu_show_cap, NULL); +static DEVICE_ATTR_RO(cap); -static ssize_t amd_iommu_show_features(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t features_show(struct device *dev, +struct device_attribute *attr, char *buf) { struct amd_iommu *iommu = dev_to_amd_iommu(dev); return sprintf(buf, "%llx\n", iommu->features); } -static DEVICE_ATTR(features, S_IRUGO, amd_iommu_show_features, NULL); +static DEVICE_ATTR_RO(features); static struct attribute *amd_iommu_attrs[] = { &dev_attr_cap.attr, -- 2.17.1 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH -next] iommu/amd: Remove set but not used variable 'iommu'
Fixes gcc '-Wunused-but-set-variable' warning: drivers/iommu/amd_iommu.c: In function 'amd_iommu_uninit_device': drivers/iommu/amd_iommu.c:422:20: warning: variable 'iommu' set but not used [-Wunused-but-set-variable] commit dce8d6964ebd ("iommu/amd: Convert to probe/release_device() call-backs") involved this, remove it. Signed-off-by: YueHaibing --- drivers/iommu/amd_iommu.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index fef3689ee535..2b8eb58d2bea 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -419,15 +419,12 @@ static void iommu_ignore_device(struct device *dev) static void amd_iommu_uninit_device(struct device *dev) { struct iommu_dev_data *dev_data; - struct amd_iommu *iommu; int devid; devid = get_device_id(dev); if (devid < 0) return; - iommu = amd_iommu_rlookup_table[devid]; - dev_data = search_dev_data(devid); if (!dev_data) return; ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH -next] iommu/ipmmu-vmsa: Remove dev_err() on platform_get_irq() failure
platform_get_irq() will call dev_err() itself on failure, so there is no need for the driver to also do this. This is detected by coccinelle. Signed-off-by: YueHaibing --- drivers/iommu/ipmmu-vmsa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index a8b7957..5904c23 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -1110,10 +1110,8 @@ static int ipmmu_probe(struct platform_device *pdev) /* Root devices have mandatory IRQs */ if (ipmmu_is_root(mmu)) { irq = platform_get_irq(pdev, 0); - if (irq < 0) { - dev_err(&pdev->dev, "no IRQ found\n"); + if (irq < 0) return irq; - } ret = devm_request_irq(&pdev->dev, irq, ipmmu_irq, 0, dev_name(&pdev->dev), mmu); -- 2.7.4 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH] media: staging: tegra-vde: Disable building with COMPILE_TEST
On 2019/9/6 21:38, Dmitry Osipenko wrote: > 29.08.2019 18:49, Thierry Reding пишет: >> On Thu, Aug 29, 2019 at 04:58:22PM +0300, Dmitry Osipenko wrote: >>> 29.08.2019 15:40, Thierry Reding пишет: >>>> On Thu, Aug 29, 2019 at 01:39:32PM +0200, Hans Verkuil wrote: >>>>> On 8/26/19 3:31 PM, YueHaibing wrote: >>>>>> If COMPILE_TEST is y and IOMMU_SUPPORT is n, selecting TEGRA_VDE >>>>>> to m will set IOMMU_IOVA to m, this fails the building of >>>>>> TEGRA_HOST1X and DRM_TEGRA which is y like this: >>>>>> >>>>>> drivers/gpu/host1x/cdma.o: In function `host1x_cdma_init': >>>>>> cdma.c:(.text+0x66c): undefined reference to `alloc_iova' >>>>>> cdma.c:(.text+0x698): undefined reference to `__free_iova' >>>>>> >>>>>> drivers/gpu/drm/tegra/drm.o: In function `tegra_drm_unload': >>>>>> drm.c:(.text+0xeb0): undefined reference to `put_iova_domain' >>>>>> drm.c:(.text+0xeb4): undefined reference to `iova_cache_put' >>>>>> >>>>>> Reported-by: Hulk Robot >>>>>> Fixes: 6b2265975239 ("media: staging: tegra-vde: Fix build error") >>>>>> Fixes: b301f8de1925 ("media: staging: media: tegra-vde: Add IOMMU >>>>>> support") >>>>>> Signed-off-by: YueHaibing >>>>>> --- >>>>>> drivers/staging/media/tegra-vde/Kconfig | 4 ++-- >>>>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>>>> >>>>>> diff --git a/drivers/staging/media/tegra-vde/Kconfig >>>>>> b/drivers/staging/media/tegra-vde/Kconfig >>>>>> index ba49ea5..a41d30c 100644 >>>>>> --- a/drivers/staging/media/tegra-vde/Kconfig >>>>>> +++ b/drivers/staging/media/tegra-vde/Kconfig >>>>>> @@ -1,9 +1,9 @@ >>>>>> # SPDX-License-Identifier: GPL-2.0 >>>>>> config TEGRA_VDE >>>>>> tristate "NVIDIA Tegra Video Decoder Engine driver" >>>>>> -depends on ARCH_TEGRA || COMPILE_TEST >>>>>> +depends on ARCH_TEGRA >>>>> >>>>> What happens if you drop this change, >>>>> >>>>>> select DMA_SHARED_BUFFER >>>>>> -select IOMMU_IOVA if (IOMMU_SUPPORT || COMPILE_TEST) >>>>>> +select IOMMU_IOVA if IOMMU_SUPPORT >>>>> >>>>> but keep this change? >>>>> >>>>> iova.h has stubs that are used if IOMMU_IOVA is not set, so it should >>>>> work when compile testing this tegra-vde driver. >>>>> >>>>> Haven't tried it, but making sure that compile testing keep working is >>>>> really important. >>> >>> The driver's code compilation works okay, it's the linkage stage which >>> fails during compile-testing. >>> >>>> Yeah, that variant seems to work for me. I think it's also more correct >>>> because the IOMMU_IOVA if IOMMU_SUPPORT dependency really says that the >>>> IOVA usage is bound to IOMMU support. If IOMMU support is not enabled, >>>> then IOVA is not needed either, so the dummies will do just fine. >>> >>> Am I understanding correctly that you're suggesting to revert [1][2] and >>> get back to the other problem? >>> >>> [1] >>> https://lore.kernel.org/linux-media/dd547b44-7abb-371f-aeee-a82b96f82...@gmail.com/T/ >>> [2] https://patchwork.ozlabs.org/patch/1136619/ >>> >>> If we want to keep compile testing, I guess the only reasonable variant >>> right now is to select IOMMU_IOVA unconditionally in all of the drivers >>> (vde, host1x, drm and etc) and then just ignore that IOVA will be >>> compiled-and-unused if IOMMU_SUPPORT=n (note that IOMMU_SUPPORT=y in all >>> of default kernel configurations). >> >> Agreed. I think we should just select IOMMU_IOVA unconditionally. We >> really do want IOMMU_SUPPORT always as well, but it might be nice to be >> able to switch it off for testing or so. In the cases that really matter >> we will be enabling both IOMMU_SUPPORT and IOMMU_IOVA anyway, so might >> as well select IOMMU_IOVA always. It's not terribly big and I can't >> imagine anyone wanting to run a kernel without IOMMU_SUPPORT for >> anything other than testing. > > Hello Yue, > > Could you please make an updated version of the fix in accordance to the > above comments? > > Alternatively, we can go with the current patch and temporarily remove the > compile-testing. I'll make > patches to properly re-add compile-testing sometime later then. I prefer to do this choice, thanks. > > . > ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH v2 -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS
If CONFIG_PCI_ATS is not set, building fails: drivers/iommu/arm-smmu-v3.c: In function arm_smmu_ats_supported: drivers/iommu/arm-smmu-v3.c:2325:35: error: struct pci_dev has no member named ats_cap; did you mean msi_cap? return !pdev->untrusted && pdev->ats_cap; ^~~ ats_cap should only used when CONFIG_PCI_ATS is defined, so use #ifdef block to guard this. Fixes: bfff88ec1afe ("iommu/arm-smmu-v3: Rework enabling/disabling of ATS for PCI masters") Signed-off-by: YueHaibing --- v2: Add arm_smmu_ats_supported() of no CONFIG_PCI_ATS --- drivers/iommu/arm-smmu-v3.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 66bf641..8da93e7 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -2311,6 +2311,7 @@ static void arm_smmu_install_ste_for_dev(struct arm_smmu_master *master) } } +#ifdef CONFIG_PCI_ATS static bool arm_smmu_ats_supported(struct arm_smmu_master *master) { struct pci_dev *pdev; @@ -2324,6 +2325,12 @@ static bool arm_smmu_ats_supported(struct arm_smmu_master *master) pdev = to_pci_dev(master->dev); return !pdev->untrusted && pdev->ats_cap; } +#else +static bool arm_smmu_ats_supported(struct arm_smmu_master *master) +{ + return false; +} +#endif static void arm_smmu_enable_ats(struct arm_smmu_master *master) { -- 2.7.4
Re: [PATCH -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS
On 2019/9/3 14:30, Will Deacon wrote: > On Tue, Sep 03, 2019 at 10:42:12AM +0800, YueHaibing wrote: >> If CONFIG_PCI_ATS is not set, building fails: >> >> drivers/iommu/arm-smmu-v3.c: In function arm_smmu_ats_supported: >> drivers/iommu/arm-smmu-v3.c:2325:35: error: struct pci_dev has no member >> named ats_cap; did you mean msi_cap? >> return !pdev->untrusted && pdev->ats_cap; >>^~~ >> >> ats_cap should only used when CONFIG_PCI_ATS is defined, >> so use #ifdef block to guard this. >> >> Fixes: bfff88ec1afe ("iommu/arm-smmu-v3: Rework enabling/disabling of ATS >> for PCI masters") >> Signed-off-by: YueHaibing >> --- >> drivers/iommu/arm-smmu-v3.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c >> index 66bf641..44ac9ac 100644 >> --- a/drivers/iommu/arm-smmu-v3.c >> +++ b/drivers/iommu/arm-smmu-v3.c >> @@ -2313,7 +2313,7 @@ static void arm_smmu_install_ste_for_dev(struct >> arm_smmu_master *master) >> >> static bool arm_smmu_ats_supported(struct arm_smmu_master *master) >> { >> -struct pci_dev *pdev; >> +struct pci_dev *pdev __maybe_unused; >> struct arm_smmu_device *smmu = master->smmu; >> struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(master->dev); >> >> @@ -2321,8 +2321,10 @@ static bool arm_smmu_ats_supported(struct >> arm_smmu_master *master) >> !(fwspec->flags & IOMMU_FWSPEC_PCI_RC_ATS) || pci_ats_disabled()) >> return false; >> >> +#ifdef CONFIG_PCI_ATS >> pdev = to_pci_dev(master->dev); >> return !pdev->untrusted && pdev->ats_cap; >> +#endif >> } > > Hmm, I really don't like the missing return statement here, even though we > never get this far thanks to the feature not getting set during ->probe(). > I'd actually prefer just to duplicate the function: > > #ifndef CONFIG_PCI_ATS > static bool > arm_smmu_ats_supported(struct arm_smmu_master *master) { return false; } > #else > > #endif > > Can you send a v2 like that, please? Ok, will send v2 as your suggestion. > > Will > > . >
[PATCH -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS
If CONFIG_PCI_ATS is not set, building fails: drivers/iommu/arm-smmu-v3.c: In function arm_smmu_ats_supported: drivers/iommu/arm-smmu-v3.c:2325:35: error: struct pci_dev has no member named ats_cap; did you mean msi_cap? return !pdev->untrusted && pdev->ats_cap; ^~~ ats_cap should only used when CONFIG_PCI_ATS is defined, so use #ifdef block to guard this. Fixes: bfff88ec1afe ("iommu/arm-smmu-v3: Rework enabling/disabling of ATS for PCI masters") Signed-off-by: YueHaibing --- drivers/iommu/arm-smmu-v3.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 66bf641..44ac9ac 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -2313,7 +2313,7 @@ static void arm_smmu_install_ste_for_dev(struct arm_smmu_master *master) static bool arm_smmu_ats_supported(struct arm_smmu_master *master) { - struct pci_dev *pdev; + struct pci_dev *pdev __maybe_unused; struct arm_smmu_device *smmu = master->smmu; struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(master->dev); @@ -2321,8 +2321,10 @@ static bool arm_smmu_ats_supported(struct arm_smmu_master *master) !(fwspec->flags & IOMMU_FWSPEC_PCI_RC_ATS) || pci_ats_disabled()) return false; +#ifdef CONFIG_PCI_ATS pdev = to_pci_dev(master->dev); return !pdev->untrusted && pdev->ats_cap; +#endif } static void arm_smmu_enable_ats(struct arm_smmu_master *master) -- 2.7.4
[PATCH] media: staging: tegra-vde: Disable building with COMPILE_TEST
If COMPILE_TEST is y and IOMMU_SUPPORT is n, selecting TEGRA_VDE to m will set IOMMU_IOVA to m, this fails the building of TEGRA_HOST1X and DRM_TEGRA which is y like this: drivers/gpu/host1x/cdma.o: In function `host1x_cdma_init': cdma.c:(.text+0x66c): undefined reference to `alloc_iova' cdma.c:(.text+0x698): undefined reference to `__free_iova' drivers/gpu/drm/tegra/drm.o: In function `tegra_drm_unload': drm.c:(.text+0xeb0): undefined reference to `put_iova_domain' drm.c:(.text+0xeb4): undefined reference to `iova_cache_put' Reported-by: Hulk Robot Fixes: 6b2265975239 ("media: staging: tegra-vde: Fix build error") Fixes: b301f8de1925 ("media: staging: media: tegra-vde: Add IOMMU support") Signed-off-by: YueHaibing --- drivers/staging/media/tegra-vde/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/tegra-vde/Kconfig b/drivers/staging/media/tegra-vde/Kconfig index ba49ea5..a41d30c 100644 --- a/drivers/staging/media/tegra-vde/Kconfig +++ b/drivers/staging/media/tegra-vde/Kconfig @@ -1,9 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 config TEGRA_VDE tristate "NVIDIA Tegra Video Decoder Engine driver" - depends on ARCH_TEGRA || COMPILE_TEST + depends on ARCH_TEGRA select DMA_SHARED_BUFFER - select IOMMU_IOVA if (IOMMU_SUPPORT || COMPILE_TEST) + select IOMMU_IOVA if IOMMU_SUPPORT select SRAM help Say Y here to enable support for the NVIDIA Tegra video decoder -- 2.7.4
[PATCH] media: staging: tegra-vde: Fix build error
If IOMMU_SUPPORT is not set, and COMPILE_TEST is y, IOMMU_IOVA may be set to m. So building will fails: drivers/staging/media/tegra-vde/iommu.o: In function `tegra_vde_iommu_map': iommu.c:(.text+0x41): undefined reference to `alloc_iova' iommu.c:(.text+0x56): undefined reference to `__free_iova' Select IOMMU_IOVA while COMPILE_TEST is set to fix this. Reported-by: Hulk Robot Suggested-by: Dmitry Osipenko Fixes: b301f8de1925 ("media: staging: media: tegra-vde: Add IOMMU support") Signed-off-by: YueHaibing --- drivers/staging/media/tegra-vde/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/tegra-vde/Kconfig b/drivers/staging/media/tegra-vde/Kconfig index 2e7f644..ba49ea5 100644 --- a/drivers/staging/media/tegra-vde/Kconfig +++ b/drivers/staging/media/tegra-vde/Kconfig @@ -3,7 +3,7 @@ config TEGRA_VDE tristate "NVIDIA Tegra Video Decoder Engine driver" depends on ARCH_TEGRA || COMPILE_TEST select DMA_SHARED_BUFFER - select IOMMU_IOVA if IOMMU_SUPPORT + select IOMMU_IOVA if (IOMMU_SUPPORT || COMPILE_TEST) select SRAM help Say Y here to enable support for the NVIDIA Tegra video decoder -- 2.7.4 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH] media: staging: ipu3: Enable IOVA API only when IOMMU support is enabled
On 2019/7/24 21:49, Robin Murphy wrote: > On 24/07/2019 11:30, Sakari Ailus wrote: >> Hi Yue, >> >> On Mon, Jul 22, 2019 at 09:47:49PM +0800, YueHaibing wrote: >>> If IOMMU_SUPPORT is not set, ipu3 driver may select IOMMU_IOVA to m. >>> But for many drivers, they use "select IOMMU_IOVA if IOMMU_SUPPORT" >>> in the Kconfig, for example, CONFIG_TEGRA_VDE is set to y but IOMMU_IOVA >>> is m, then the building fails like this: >>> >>> drivers/staging/media/tegra-vde/iommu.o: In function `tegra_vde_iommu_map': >>> iommu.c:(.text+0x41): undefined reference to `alloc_iova' >>> iommu.c:(.text+0x56): undefined reference to `__free_iova' >>> >>> Reported-by: Hulk Robot >>> Fixes: 7fc7af649ca7 ("media: staging/intel-ipu3: Add imgu top level pci >>> device driver") >>> Signed-off-by: YueHaibing >>> --- >>> drivers/staging/media/ipu3/Kconfig | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/staging/media/ipu3/Kconfig >>> b/drivers/staging/media/ipu3/Kconfig >>> index 4b51c67..b7df18f 100644 >>> --- a/drivers/staging/media/ipu3/Kconfig >>> +++ b/drivers/staging/media/ipu3/Kconfig >>> @@ -4,7 +4,7 @@ config VIDEO_IPU3_IMGU >>> depends on PCI && VIDEO_V4L2 >>> depends on MEDIA_CONTROLLER && VIDEO_V4L2_SUBDEV_API >>> depends on X86 >>> -select IOMMU_IOVA >>> +select IOMMU_IOVA if IOMMU_SUPPORT >> >> This doesn't seem right: the ipu3-cio2 driver needs IOMMU_IOVA >> independently of IOMMU_SUPPORT. >> >> Looking at tegra-vde, it seems to depend on IOMMU_SUPPORT but that's not >> declared in its Kconfig entry. I wonder if adding that would be the right >> way to fix this. >> >> Cc'ing the IOMMU list. > > Right, I also had the impression that we'd made the IOVA library completely > standalone. And what does the IPU3 driver's Kconfig have to do with some > *other* driver failing to link anyway? Oh, I misunderstand that IOMMU_IOVA is depend on IOMMU_SUPPORT, thank you for clarification. I will try to fix this in tegra-vde. > > Robin. > >> >>> select VIDEOBUF2_DMA_SG >>> help >>> This is the Video4Linux2 driver for Intel IPU3 image processing >>> unit, >> > > . > ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH v2 -next] swiotlb: drop pointless static qualifier in swiotlb_create_debugfs()
There is no need to have the 'struct dentry *d_swiotlb_usage' variable static since new value always be assigned before use it. Signed-off-by: YueHaibing --- v2: fix patch title --- kernel/dma/swiotlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index a7b53786db9f..02fa517c47d9 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -689,7 +689,7 @@ swiotlb_dma_supported(struct device *hwdev, u64 mask) static int __init swiotlb_create_debugfs(void) { - static struct dentry *d_swiotlb_usage; + struct dentry *d_swiotlb_usage; struct dentry *ent; d_swiotlb_usage = debugfs_create_dir("swiotlb", NULL); ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH -next] swiotlb: drop pointless static qualifier in swiotlb_dma_supported()
On 2019/2/14 15:26, Christoph Hellwig wrote: > On Thu, Feb 14, 2019 at 01:41:47AM +0000, YueHaibing wrote: >> There is no need to have the 'struct dentry *d_swiotlb_usage' variable >> static since new value always be assigned before use it. > > FYI, this is in swiotlb_create_debugfs, not swiotlb_dma_supported. Thank you, I will fix it. > > . > ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH -next] swiotlb: drop pointless static qualifier in swiotlb_dma_supported()
There is no need to have the 'struct dentry *d_swiotlb_usage' variable static since new value always be assigned before use it. Signed-off-by: YueHaibing --- kernel/dma/swiotlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index a7b53786db9f..02fa517c47d9 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -689,7 +689,7 @@ swiotlb_dma_supported(struct device *hwdev, u64 mask) static int __init swiotlb_create_debugfs(void) { - static struct dentry *d_swiotlb_usage; + struct dentry *d_swiotlb_usage; struct dentry *ent; d_swiotlb_usage = debugfs_create_dir("swiotlb", NULL); ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH -next] iommu/amd: Add missed 'tag' to error msg in iommu_print_event
Fixes gcc '-Wunused-but-set-variable' warning: drivers/iommu/amd_iommu.c: In function 'iommu_print_event': drivers/iommu/amd_iommu.c:550:33: warning: variable 'tag' set but not used [-Wunused-but-set-variable] It was introduced in e7f63ffc1bf1 ("iommu/amd: Update logging information for new event type") seems just missed in the error message, add it as suggested by Joerg. Signed-off-by: YueHaibing --- drivers/iommu/amd_iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 1167ff0..872b76e 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -622,9 +622,9 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) pasid = ((event[0] >> 16) & 0x) | ((event[1] << 6) & 0xF); tag = event[1] & 0x03FF; - dev_err(dev, "INVALID_PPR_REQUEST device=%02x:%02x.%x pasid=0x%05x address=0x%016llx flags=0x%04x]\n", + dev_err(dev, "INVALID_PPR_REQUEST device=%02x:%02x.%x pasid=0x%05x address=0x%016llx flags=0x%04x tag=0x%08x]\n", PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), - pasid, address, flags); + pasid, address, flags, tag); break; default: dev_err(dev, "UNKNOWN event[0]=0x%08x event[1]=0x%08x event[2]=0x%08x event[3]=0x%08x\n", ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH -next] iommu/amd: remove set but not used variable 'tag'
On 2018/11/8 17:32, Joerg Roedel wrote: > On Thu, Nov 08, 2018 at 06:12:40AM +0000, YueHaibing wrote: >> -tag = event[1] & 0x03FF; >> dev_err(dev, "INVALID_PPR_REQUEST device=%02x:%02x.%x >> pasid=0x%05x address=0x%016llx flags=0x%04x]\n", >> PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), >> pasid, address, flags); > > This looks like tag was just missed in the error message. It is better > to add it there instead of removing it. Ok, will post a new patch. > > Regards, > > Joerg > > . > ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH -next] iommu/amd: remove set but not used variable 'tag'
From: Yue Haibing Fixes gcc '-Wunused-but-set-variable' warning: drivers/iommu/amd_iommu.c: In function 'iommu_print_event': drivers/iommu/amd_iommu.c:550:33: warning: variable 'tag' set but not used [-Wunused-but-set-variable] It never used since introduction in commit e7f63ffc1bf1 ("iommu/amd: Update logging information for new event type") Signed-off-by: Yue Haibing --- drivers/iommu/amd_iommu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 4e04fff..58a7834 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -547,7 +547,7 @@ static void amd_iommu_report_page_fault(u16 devid, u16 domain_id, static void iommu_print_event(struct amd_iommu *iommu, void *__evt) { struct device *dev = iommu->iommu.dev; - int type, devid, pasid, flags, tag; + int type, devid, pasid, flags; volatile u32 *event = __evt; int count = 0; u64 address; @@ -615,7 +615,6 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) case EVENT_TYPE_INV_PPR_REQ: pasid = ((event[0] >> 16) & 0x) | ((event[1] << 6) & 0xF); - tag = event[1] & 0x03FF; dev_err(dev, "INVALID_PPR_REQUEST device=%02x:%02x.%x pasid=0x%05x address=0x%016llx flags=0x%04x]\n", PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), pasid, address, flags); ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH] iommu/io-pgtable-arm: Use for_each_set_bit to simplify code
We can use for_each_set_bit() to simplify code slightly in the ARM io-pgtable self tests while unmapping. Signed-off-by: YueHaibing --- drivers/iommu/io-pgtable-arm-v7s.c | 5 + drivers/iommu/io-pgtable-arm.c | 5 + 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index 10e4a3d..50e3a9f 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -898,8 +898,7 @@ static int __init arm_v7s_do_selftests(void) /* Full unmap */ iova = 0; - i = find_first_bit(&cfg.pgsize_bitmap, BITS_PER_LONG); - while (i != BITS_PER_LONG) { + for_each_set_bit(i, &cfg.pgsize_bitmap, BITS_PER_LONG) { size = 1UL << i; if (ops->unmap(ops, iova, size) != size) @@ -916,8 +915,6 @@ static int __init arm_v7s_do_selftests(void) return __FAIL(ops); iova += SZ_16M; - i++; - i = find_next_bit(&cfg.pgsize_bitmap, BITS_PER_LONG, i); } free_io_pgtable_ops(ops); diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index 39c2a05..4ffdd88 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -1120,8 +1120,7 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg) /* Full unmap */ iova = 0; - j = find_first_bit(&cfg->pgsize_bitmap, BITS_PER_LONG); - while (j != BITS_PER_LONG) { + for_each_set_bit(j, &cfg->pgsize_bitmap, BITS_PER_LONG) { size = 1UL << j; if (ops->unmap(ops, iova, size) != size) @@ -1138,8 +1137,6 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg) return __FAIL(ops, i); iova += SZ_1G; - j++; - j = find_next_bit(&cfg->pgsize_bitmap, BITS_PER_LONG, j); } free_io_pgtable_ops(ops); -- 2.7.0 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu