Re: [PATCH v2 00/33] iommu: Move iommu_group setup to IOMMU core code

2020-04-18 Thread j...@8bytes.org
Hi Jonathan, Hi Daniel, On Fri, Apr 17, 2020 at 01:14:30AM +, Derrick, Jonathan wrote: > Hi Daniel> I should have CCed you on this, but it should temporarily resolve > that > issue: > https://lists.linuxfoundation.org/pipermail/iommu/2020-April/043253.html Yes, this is an issue in the

Re: [PATCH] iommu: spapr_tce: Disable compile testing to fix build on book3s_32 config

2020-04-18 Thread Joerg Roedel
On Tue, Apr 14, 2020 at 04:26:30PM +0200, Krzysztof Kozlowski wrote: > Reported-by: Geert Uytterhoeven > Fixes: e93a1695d7fb ("iommu: Enable compile testing for some of drivers") > Signed-off-by: Krzysztof Kozlowski > --- > drivers/iommu/Kconfig | 2 +- > 1 file changed, 1 insertion(+), 1

Re: [RFC PATCH] iommu/amd: fix a race in fetch_pte()

2020-04-18 Thread Qian Cai
> On Apr 18, 2020, at 8:10 AM, Joerg Roedel wrote: > > Yes, your patch still looks racy. You need to atomically read > domain->pt_root to a stack variable and derive the pt_root pointer and > the mode from that variable instead of domain->pt_root directly. If you > read the domain->pt_root

Re: [PATCH] iommu/qcom:fix local_base status check

2020-04-18 Thread Joerg Roedel
On Thu, Apr 16, 2020 at 02:42:23PM +0800, Tang Bin wrote: >     The function qcom_iommu_device_probe() does not perform sufficient > error checking after executing devm_ioremap_resource(), which can result in > crashes if a critical error path is encountered. > > Fixes: 0ae349a0("iommu/qcom:

Re: [PATCH 3/4] dma-mapping: add a dma_ops_bypass flag to struct device

2020-04-18 Thread Joerg Roedel
Hi Christoph, On Tue, Apr 14, 2020 at 02:25:05PM +0200, Christoph Hellwig wrote: > +static inline bool dma_map_direct(struct device *dev, > + const struct dma_map_ops *ops) > +{ > + if (likely(!ops)) > + return true; > + if (!dev->dma_ops_bypass) > +

Re: [PATCH 1/1] iommu/vt-d: use DMA domain for real DMA devices and subdevices

2020-04-18 Thread Joerg Roedel
On Mon, Apr 13, 2020 at 10:48:55AM +0800, Lu Baolu wrote: > I have sync'ed with Joerg. This patch set will be replaced with Joerg's > proposal due to a race concern between domain switching and driver > binding. I will rebase all vt-d patches in this set on top of Joerg's > change. Okay, but is

Re: [PATCH] iommu: Fix MTK_IOMMU dependencies

2020-04-18 Thread Joerg Roedel
On Fri, Apr 10, 2020 at 04:30:47PM +0200, Geert Uytterhoeven wrote: > Fixes: e93a1695d7fb5513 ("iommu: Enable compile testing for some of drivers") > Signed-off-by: Geert Uytterhoeven > --- > drivers/iommu/Kconfig | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied, thanks.

Re: [PATCH] iommu/qcom:fix local_base status check

2020-04-18 Thread Tang Bin
On 2020/4/18 19:54, Joerg Roedel wrote: On Thu, Apr 16, 2020 at 02:42:23PM +0800, Tang Bin wrote:     The function qcom_iommu_device_probe() does not perform sufficient error checking after executing devm_ioremap_resource(), which can result in crashes if a critical error path is

Re: [PATCH] iommu: Fix the memory leak in dev_iommu_free()

2020-04-18 Thread Joerg Roedel
On Thu, Apr 02, 2020 at 10:37:49PM +0800, Kevin Hao wrote: > Fixes: 72acd9df18f1 ("iommu: Move iommu_fwspec to struct dev_iommu") > Signed-off-by: Kevin Hao > --- > drivers/iommu/iommu.c | 1 + > 1 file changed, 1 insertion(+) Applied, thanks. ___

[PATCH v2]iommu/qcom:fix local_base status check

2020-04-18 Thread Tang Bin
The function qcom_iommu_device_probe() does not perform sufficient error checking after executing devm_ioremap_resource(), which can result in crashes if a critical error path is encountered. Fixes: 0ae349a0f33f ("iommu/qcom: Add qcom_iommu") Signed-off-by: Tang Bin --- v2: - fix commit

Re: [RFC PATCH] iommu/amd: fix a race in fetch_pte()

2020-04-18 Thread Joerg Roedel
On Thu, Apr 16, 2020 at 09:42:41PM -0400, Qian Cai wrote: > So, this is still not enough that would still trigger storage driver offline > under > memory pressure for a bit longer. It looks to me that in fetch_pte() there are > could still racy? Yes, your patch still looks racy. You need to

Re: [RFC PATCH] iommu/amd: fix a race in fetch_pte()

2020-04-18 Thread Joerg Roedel
On Sat, Apr 18, 2020 at 09:01:35AM -0400, Qian Cai wrote: > Hard to tell without testing further. I’ll leave that optimization in > the future, and focus on fixing those races first. Yeah right, we should fix the existing races first before introducing new ones ;) Btw, THANKS A LOT for tracking

[PATCH AUTOSEL 5.6 05/73] iommu/vt-d: Fix page request descriptor size

2020-04-18 Thread Sasha Levin
From: Jacob Pan [ Upstream commit 52355fb1919ef7ed9a38e0f3de6e928de1f57217 ] Intel VT-d might support PRS (Page Reqest Support) when it's running in the scalable mode. Each page request descriptor occupies 32 bytes and is 32-bytes aligned. The page request descriptor offset mask should be

[PATCH AUTOSEL 5.6 25/73] dma-direct: fix data truncation in dma_direct_get_required_mask()

2020-04-18 Thread Sasha Levin
From: Kishon Vijay Abraham I [ Upstream commit cdcda0d1f8f4ab84efe7cd9921c98364398aefd7 ] The upper 32-bit physical address gets truncated inadvertently when dma_direct_get_required_mask() invokes phys_to_dma_direct(). This results in dma_addressing_limited() return incorrect value when used in

[PATCH AUTOSEL 5.6 26/73] dma-debug: fix displaying of dma allocation type

2020-04-18 Thread Sasha Levin
From: Grygorii Strashko [ Upstream commit 9bb50ed7470944238ec8e30a94ef096caf9056ee ] The commit 2e05ea5cdc1a ("dma-mapping: implement dma_map_single_attrs using dma_map_page_attrs") removed "dma_debug_page" enum, but missed to update type2name string table. This causes incorrect displaying of

[PATCH AUTOSEL 5.6 07/73] iommu/vt-d: Fix mm reference leak

2020-04-18 Thread Sasha Levin
From: Jacob Pan [ Upstream commit 902baf61adf6b187f0a6b789e70d788ea71ff5bc ] Move canonical address check before mmget_not_zero() to avoid mm reference leak. Fixes: 9d8c3af31607 ("iommu/vt-d: IOMMU Page Request needs to check if address is canonical.") Signed-off-by: Jacob Pan Acked-by: Lu

[PATCH AUTOSEL 5.6 48/73] iommu/virtio: Fix freeing of incomplete domains

2020-04-18 Thread Sasha Levin
From: Jean-Philippe Brucker [ Upstream commit 7062af3ed2ba451029e3733d9f677c68f5ea9e77 ] Calling viommu_domain_free() on a domain that hasn't been finalised (not attached to any device, for example) can currently cause an Oops, because we attempt to call ida_free() on ID 0, which may either be

[PATCH AUTOSEL 5.6 51/73] iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()

2020-04-18 Thread Sasha Levin
From: Qian Cai [ Upstream commit c6f4ebdeba4cff590594df931ff1ee610c426431 ] dmar_find_atsr() calls list_for_each_entry_rcu() outside of an RCU read side critical section but with dmar_global_lock held. Silence this false positive. drivers/iommu/intel-iommu.c:4504 RCU-list traversed in

[PATCH AUTOSEL 5.5 45/75] iommu/virtio: Fix freeing of incomplete domains

2020-04-18 Thread Sasha Levin
From: Jean-Philippe Brucker [ Upstream commit 7062af3ed2ba451029e3733d9f677c68f5ea9e77 ] Calling viommu_domain_free() on a domain that hasn't been finalised (not attached to any device, for example) can currently cause an Oops, because we attempt to call ida_free() on ID 0, which may either be

[PATCH AUTOSEL 5.5 05/75] iommu/vt-d: Fix page request descriptor size

2020-04-18 Thread Sasha Levin
From: Jacob Pan [ Upstream commit 52355fb1919ef7ed9a38e0f3de6e928de1f57217 ] Intel VT-d might support PRS (Page Reqest Support) when it's running in the scalable mode. Each page request descriptor occupies 32 bytes and is 32-bytes aligned. The page request descriptor offset mask should be

[PATCH AUTOSEL 5.5 24/75] dma-debug: fix displaying of dma allocation type

2020-04-18 Thread Sasha Levin
From: Grygorii Strashko [ Upstream commit 9bb50ed7470944238ec8e30a94ef096caf9056ee ] The commit 2e05ea5cdc1a ("dma-mapping: implement dma_map_single_attrs using dma_map_page_attrs") removed "dma_debug_page" enum, but missed to update type2name string table. This causes incorrect displaying of

[PATCH AUTOSEL 5.5 01/75] iommu/amd: Fix the configuration of GCR3 table root pointer

2020-04-18 Thread Sasha Levin
From: Adrian Huang [ Upstream commit c20f36534666e37858a14e591114d93cc1be0d34 ] The SPA of the GCR3 table root pointer[51:31] masks 20 bits. However, this requires 21 bits (Please see the AMD IOMMU specification). This leads to the potential failure when the bit 51 of SPA of the GCR3 table root

[PATCH AUTOSEL 5.5 47/75] iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()

2020-04-18 Thread Sasha Levin
From: Qian Cai [ Upstream commit c6f4ebdeba4cff590594df931ff1ee610c426431 ] dmar_find_atsr() calls list_for_each_entry_rcu() outside of an RCU read side critical section but with dmar_global_lock held. Silence this false positive. drivers/iommu/intel-iommu.c:4504 RCU-list traversed in

[PATCH AUTOSEL 5.4 23/78] dma-debug: fix displaying of dma allocation type

2020-04-18 Thread Sasha Levin
From: Grygorii Strashko [ Upstream commit 9bb50ed7470944238ec8e30a94ef096caf9056ee ] The commit 2e05ea5cdc1a ("dma-mapping: implement dma_map_single_attrs using dma_map_page_attrs") removed "dma_debug_page" enum, but missed to update type2name string table. This causes incorrect displaying of

[PATCH AUTOSEL 5.4 22/78] dma-direct: fix data truncation in dma_direct_get_required_mask()

2020-04-18 Thread Sasha Levin
From: Kishon Vijay Abraham I [ Upstream commit cdcda0d1f8f4ab84efe7cd9921c98364398aefd7 ] The upper 32-bit physical address gets truncated inadvertently when dma_direct_get_required_mask() invokes phys_to_dma_direct(). This results in dma_addressing_limited() return incorrect value when used in

[PATCH AUTOSEL 4.9 01/23] iommu/amd: Fix the configuration of GCR3 table root pointer

2020-04-18 Thread Sasha Levin
From: Adrian Huang [ Upstream commit c20f36534666e37858a14e591114d93cc1be0d34 ] The SPA of the GCR3 table root pointer[51:31] masks 20 bits. However, this requires 21 bits (Please see the AMD IOMMU specification). This leads to the potential failure when the bit 51 of SPA of the GCR3 table root

[PATCH AUTOSEL 4.14 03/28] iommu/vt-d: Fix mm reference leak

2020-04-18 Thread Sasha Levin
From: Jacob Pan [ Upstream commit 902baf61adf6b187f0a6b789e70d788ea71ff5bc ] Move canonical address check before mmget_not_zero() to avoid mm reference leak. Fixes: 9d8c3af31607 ("iommu/vt-d: IOMMU Page Request needs to check if address is canonical.") Signed-off-by: Jacob Pan Acked-by: Lu

[PATCH AUTOSEL 4.14 01/28] iommu/amd: Fix the configuration of GCR3 table root pointer

2020-04-18 Thread Sasha Levin
From: Adrian Huang [ Upstream commit c20f36534666e37858a14e591114d93cc1be0d34 ] The SPA of the GCR3 table root pointer[51:31] masks 20 bits. However, this requires 21 bits (Please see the AMD IOMMU specification). This leads to the potential failure when the bit 51 of SPA of the GCR3 table root

[PATCH AUTOSEL 4.19 01/47] iommu/amd: Fix the configuration of GCR3 table root pointer

2020-04-18 Thread Sasha Levin
From: Adrian Huang [ Upstream commit c20f36534666e37858a14e591114d93cc1be0d34 ] The SPA of the GCR3 table root pointer[51:31] masks 20 bits. However, this requires 21 bits (Please see the AMD IOMMU specification). This leads to the potential failure when the bit 51 of SPA of the GCR3 table root

[PATCH AUTOSEL 4.19 04/47] iommu/vt-d: Fix mm reference leak

2020-04-18 Thread Sasha Levin
From: Jacob Pan [ Upstream commit 902baf61adf6b187f0a6b789e70d788ea71ff5bc ] Move canonical address check before mmget_not_zero() to avoid mm reference leak. Fixes: 9d8c3af31607 ("iommu/vt-d: IOMMU Page Request needs to check if address is canonical.") Signed-off-by: Jacob Pan Acked-by: Lu

Re: [PATCH] iommu: spapr_tce: Disable compile testing to fix build on book3s_32 config

2020-04-18 Thread Christophe Leroy
On 04/14/2020 02:26 PM, Krzysztof Kozlowski wrote: Although SPAPR_TCE_IOMMU itself can be compile tested on certain PowerPC configurations, its presence makes arch/powerpc/kvm/Makefile to select modules which do not build in such configuration. The arch/powerpc/kvm/ modules use

[PATCH AUTOSEL 5.6 01/73] iommu/amd: Fix the configuration of GCR3 table root pointer

2020-04-18 Thread Sasha Levin
From: Adrian Huang [ Upstream commit c20f36534666e37858a14e591114d93cc1be0d34 ] The SPA of the GCR3 table root pointer[51:31] masks 20 bits. However, this requires 21 bits (Please see the AMD IOMMU specification). This leads to the potential failure when the bit 51 of SPA of the GCR3 table root

[PATCH AUTOSEL 5.5 07/75] iommu/vt-d: Fix mm reference leak

2020-04-18 Thread Sasha Levin
From: Jacob Pan [ Upstream commit 902baf61adf6b187f0a6b789e70d788ea71ff5bc ] Move canonical address check before mmget_not_zero() to avoid mm reference leak. Fixes: 9d8c3af31607 ("iommu/vt-d: IOMMU Page Request needs to check if address is canonical.") Signed-off-by: Jacob Pan Acked-by: Lu

[PATCH AUTOSEL 5.5 23/75] dma-direct: fix data truncation in dma_direct_get_required_mask()

2020-04-18 Thread Sasha Levin
From: Kishon Vijay Abraham I [ Upstream commit cdcda0d1f8f4ab84efe7cd9921c98364398aefd7 ] The upper 32-bit physical address gets truncated inadvertently when dma_direct_get_required_mask() invokes phys_to_dma_direct(). This results in dma_addressing_limited() return incorrect value when used in

[PATCH AUTOSEL 4.4 14/19] iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()

2020-04-18 Thread Sasha Levin
From: Qian Cai [ Upstream commit c6f4ebdeba4cff590594df931ff1ee610c426431 ] dmar_find_atsr() calls list_for_each_entry_rcu() outside of an RCU read side critical section but with dmar_global_lock held. Silence this false positive. drivers/iommu/intel-iommu.c:4504 RCU-list traversed in

[PATCH AUTOSEL 4.4 01/19] iommu/amd: Fix the configuration of GCR3 table root pointer

2020-04-18 Thread Sasha Levin
From: Adrian Huang [ Upstream commit c20f36534666e37858a14e591114d93cc1be0d34 ] The SPA of the GCR3 table root pointer[51:31] masks 20 bits. However, this requires 21 bits (Please see the AMD IOMMU specification). This leads to the potential failure when the bit 51 of SPA of the GCR3 table root

[PATCH AUTOSEL 4.9 16/23] iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()

2020-04-18 Thread Sasha Levin
From: Qian Cai [ Upstream commit c6f4ebdeba4cff590594df931ff1ee610c426431 ] dmar_find_atsr() calls list_for_each_entry_rcu() outside of an RCU read side critical section but with dmar_global_lock held. Silence this false positive. drivers/iommu/intel-iommu.c:4504 RCU-list traversed in

[PATCH AUTOSEL 5.6 49/73] iommu/vt-d: Add build dependency on IOASID

2020-04-18 Thread Sasha Levin
From: Jacob Pan [ Upstream commit 4a663dae47316ae8b97d5b77025fe7dfd9d3487f ] IOASID code is needed by VT-d scalable mode for PASID allocation. Add explicit dependency such that IOASID is built-in whenever Intel IOMMU is enabled. Otherwise, aux domain code will fail when IOMMU is built-in and

[PATCH AUTOSEL 5.4 07/78] iommu/vt-d: Fix mm reference leak

2020-04-18 Thread Sasha Levin
From: Jacob Pan [ Upstream commit 902baf61adf6b187f0a6b789e70d788ea71ff5bc ] Move canonical address check before mmget_not_zero() to avoid mm reference leak. Fixes: 9d8c3af31607 ("iommu/vt-d: IOMMU Page Request needs to check if address is canonical.") Signed-off-by: Jacob Pan Acked-by: Lu

[PATCH AUTOSEL 5.4 01/78] iommu/amd: Fix the configuration of GCR3 table root pointer

2020-04-18 Thread Sasha Levin
From: Adrian Huang [ Upstream commit c20f36534666e37858a14e591114d93cc1be0d34 ] The SPA of the GCR3 table root pointer[51:31] masks 20 bits. However, this requires 21 bits (Please see the AMD IOMMU specification). This leads to the potential failure when the bit 51 of SPA of the GCR3 table root

[PATCH AUTOSEL 5.4 05/78] iommu/vt-d: Fix page request descriptor size

2020-04-18 Thread Sasha Levin
From: Jacob Pan [ Upstream commit 52355fb1919ef7ed9a38e0f3de6e928de1f57217 ] Intel VT-d might support PRS (Page Reqest Support) when it's running in the scalable mode. Each page request descriptor occupies 32 bytes and is 32-bytes aligned. The page request descriptor offset mask should be

[PATCH AUTOSEL 5.4 42/78] iommu/virtio: Fix freeing of incomplete domains

2020-04-18 Thread Sasha Levin
From: Jean-Philippe Brucker [ Upstream commit 7062af3ed2ba451029e3733d9f677c68f5ea9e77 ] Calling viommu_domain_free() on a domain that hasn't been finalised (not attached to any device, for example) can currently cause an Oops, because we attempt to call ida_free() on ID 0, which may either be

[PATCH AUTOSEL 5.4 43/78] iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()

2020-04-18 Thread Sasha Levin
From: Qian Cai [ Upstream commit c6f4ebdeba4cff590594df931ff1ee610c426431 ] dmar_find_atsr() calls list_for_each_entry_rcu() outside of an RCU read side critical section but with dmar_global_lock held. Silence this false positive. drivers/iommu/intel-iommu.c:4504 RCU-list traversed in

Re: [PATCH v2] of_device: removed #include that caused a recursion in included headers

2020-04-18 Thread Jonathan Cameron
On Thu, 16 Apr 2020 12:49:03 +0300 Hadar Gat wrote: > Both of_platform.h and of_device.h were included each other. > In of_device.h, removed unneeded #include to of_platform.h > and added include to of_platform.h in the files that needs it. > > Signed-off-by: Hadar Gat Hmm. I guess the