Re: [PATCH] driver core: platform: expose numa_node to users in sysfs

2020-06-02 Thread Greg KH
On Tue, Jun 02, 2020 at 05:09:57AM +, Song Bao Hua (Barry Song) wrote: > > > > > > Platform devices are NUMA? That's crazy, and feels like a total abuse > > > of platform devices and drivers that really should belong on a "real" > > > bus. > > > > I am not sure if it is an abuse of platform

RE: [PATCH] driver core: platform: expose numa_node to users in sysfs

2020-06-02 Thread Song Bao Hua (Barry Song)
> -Original Message- > From: Greg KH [mailto:gre...@linuxfoundation.org] > Sent: Tuesday, June 2, 2020 6:11 PM > To: Song Bao Hua (Barry Song) > Cc: raf...@kernel.org; iommu@lists.linux-foundation.org; > linux-arm-ker...@lists.infradead.org; linux-ker...@vger.kernel.org; Linuxarm > ;

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-06-02 Thread Bjorn Andersson
On Wed 27 May 04:03 PDT 2020, Will Deacon wrote: > Hi John, Bjorn, > > On Tue, May 26, 2020 at 01:34:45PM -0700, John Stultz wrote: > > On Thu, May 14, 2020 at 12:34 PM wrote: > > > > > > On Thu 27 Feb 18:57 PST 2020, Bjorn Andersson wrote: > > > > > > Rob, Will, we're reaching the point where

RE: [PATCH] driver core: platform: expose numa_node to users in sysfs

2020-06-02 Thread Song Bao Hua (Barry Song)
> > > > On Tue, Jun 02, 2020 at 05:09:57AM +, Song Bao Hua (Barry Song) > wrote: > > > > > > > > > > Platform devices are NUMA? That's crazy, and feels like a total > > > > > abuse of platform devices and drivers that really should belong > > > > > on a > > "real" > > > > > bus. > > > > > > >

Re: iommu: Improve exception handling in iommu_group_alloc()

2020-06-02 Thread Markus Elfring
>> Do you disagree to the application of the Linux coding style then >> for the recommended exception handling? > > No, that's not what I mean. My point is the exception handling in this > patch is simple and no need to add 'goto' statement which does not help > to improve readability. Do we come

Re: [PATCH] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Lu Baolu
On 2020/6/2 13:45, Rajat Jain wrote: Currently, an external malicious PCI device can masquerade the VID:PID of faulty gfx devices, and thus apply iommu quirks to effectively disable the IOMMU restrictions for itself. Thus we need to ensure that the device we are applying quirks to, is indeed an

Re: [PATCH v2] iommu: Improve exception handling in iommu_group_alloc()

2020-06-02 Thread Markus Elfring
> Improve the exception handling to free the resources correctly when > failed to allocate an iommu group. I propose to avoid the specification of duplicate function calls. Will it become helpful to add a few jump targets?

[PATCH 2/2] iommu/vt-d: Move Intel IOMMU driver into subdirectory

2020-06-02 Thread Joerg Roedel
From: Joerg Roedel Move all files related to the Intel IOMMU driver into its own subdirectory. Signed-off-by: Joerg Roedel --- drivers/iommu/Makefile | 12 ++-- .../iommu/{intel-iommu-debugfs.c => intel/debugfs.c} | 0 drivers/iommu/{ => intel}/dmar.c

[PATCH 0/2] iommu: Move Intel and AMD drivers into their own subdirectory

2020-06-02 Thread Joerg Roedel
Hi, two small patches to move the Intel and AMD IOMMU drivers into their own subdirectory under drivers/iommu/ to make the file structure a bit less cluttered. Regards, Joerg Joerg Roedel (2): iommu/amd: Move AMD IOMMU driver into subdirectory iommu/vt-d: Move Intel IOMMU driver

[PATCH 1/2] iommu/amd: Move AMD IOMMU driver into subdirectory

2020-06-02 Thread Joerg Roedel
From: Joerg Roedel Move all files related to the AMD IOMMU driver into its own subdirectory. Signed-off-by: Joerg Roedel --- drivers/iommu/Makefile | 6 +++--- drivers/iommu/{ => amd}/amd_iommu.h | 0 drivers/iommu/{ => amd}/amd_iommu_types.h

RE: [PATCH v7 21/24] iommu/arm-smmu-v3: Add stall support for platform devices

2020-06-02 Thread Shameerali Kolothum Thodi
Hi Jean, > -Original Message- > From: linux-arm-kernel [mailto:linux-arm-kernel-boun...@lists.infradead.org] > On Behalf Of Jean-Philippe Brucker > Sent: 02 June 2020 10:39 > To: Shameerali Kolothum Thodi > Cc: devicet...@vger.kernel.org; kevin.t...@intel.com; w...@kernel.org; >

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

2020-06-02 Thread Joerg Roedel
Hi Jerry, On Mon, Jun 01, 2020 at 05:02:36PM -0700, Jerry Snitselaar wrote: > > Yeah, that will solve the panic. > If you still see the kdump faults, can you please try with the attached diff? I was not able to reproduce them in my setup. Regards, Joerg diff --git

Re: [PATCH] iommu/dma: limit iova free size to unmmaped iova

2020-06-02 Thread guptap
On 2020-05-26 12:49, gup...@codeaurora.org wrote: On 2020-05-22 14:54, Robin Murphy wrote: On 2020-05-22 07:25, gup...@codeaurora.org wrote: On 2020-05-22 01:46, Robin Murphy wrote: On 2020-05-21 12:30, Prakash Gupta wrote: I agree, we shouldn't be freeing the partial iova. Instead just

[PATCH] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Rajat Jain via iommu
Currently, an external malicious PCI device can masquerade the VID:PID of faulty gfx devices, and thus apply iommu quirks to effectively disable the IOMMU restrictions for itself. Thus we need to ensure that the device we are applying quirks to, is indeed an internal trusted device.

Re: [PATCH] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Mika Westerberg
On Mon, Jun 01, 2020 at 10:45:17PM -0700, Rajat Jain wrote: > Currently, an external malicious PCI device can masquerade the VID:PID > of faulty gfx devices, and thus apply iommu quirks to effectively > disable the IOMMU restrictions for itself. > > Thus we need to ensure that the device we are

RE: [PATCH v7 21/24] iommu/arm-smmu-v3: Add stall support for platform devices

2020-06-02 Thread Shameerali Kolothum Thodi
> -Original Message- > From: linux-arm-kernel [mailto:linux-arm-kernel-boun...@lists.infradead.org] > On Behalf Of Jean-Philippe Brucker > Sent: 02 June 2020 12:46 > To: Shameerali Kolothum Thodi > Cc: devicet...@vger.kernel.org; kevin.t...@intel.com; fenghua...@intel.com; >

[PATCH] iommu/iova: Don't BUG on invalid PFNs

2020-06-02 Thread Robin Murphy
Unlike the other instances which represent a complete loss of consistency within the rcache mechanism itself, or a fundamental and obvious misconfiguration by an IOMMU driver, the BUG_ON() in iova_magazine_free_pfns() can be provoked at more or less any time in a "spooky action-at-a-distance"

Re: [PATCH v7 21/24] iommu/arm-smmu-v3: Add stall support for platform devices

2020-06-02 Thread Jean-Philippe Brucker
Hi Shameer, On Mon, Jun 01, 2020 at 12:42:15PM +, Shameerali Kolothum Thodi wrote: > > /* IRQ and event handlers */ > > +static int arm_smmu_handle_evt(struct arm_smmu_device *smmu, u64 *evt) > > +{ > > + int ret; > > + u32 perm = 0; > > + struct arm_smmu_master *master; > > + bool

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-06-02 Thread Thierry Reding
On Wed, May 27, 2020 at 12:03:44PM +0100, Will Deacon wrote: > Hi John, Bjorn, > > On Tue, May 26, 2020 at 01:34:45PM -0700, John Stultz wrote: > > On Thu, May 14, 2020 at 12:34 PM wrote: > > > > > > On Thu 27 Feb 18:57 PST 2020, Bjorn Andersson wrote: > > > > > > Rob, Will, we're reaching the

Re: [PATCH v7 21/24] iommu/arm-smmu-v3: Add stall support for platform devices

2020-06-02 Thread Jean-Philippe Brucker
On Tue, Jun 02, 2020 at 10:31:29AM +, Shameerali Kolothum Thodi wrote: > Hi Jean, > > > -Original Message- > > From: linux-arm-kernel [mailto:linux-arm-kernel-boun...@lists.infradead.org] > > On Behalf Of Jean-Philippe Brucker > > Sent: 02 June 2020 10:39 > > To: Shameerali Kolothum

Re: [PATCH] iommu/dma: limit iova free size to unmmaped iova

2020-06-02 Thread Robin Murphy
On 2020-05-26 08:19, gup...@codeaurora.org wrote: On 2020-05-22 14:54, Robin Murphy wrote: On 2020-05-22 07:25, gup...@codeaurora.org wrote: On 2020-05-22 01:46, Robin Murphy wrote: On 2020-05-21 12:30, Prakash Gupta wrote: I agree, we shouldn't be freeing the partial iova. Instead just

Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings

2020-06-02 Thread Bjorn Andersson
On Tue 02 Jun 04:02 PDT 2020, Thierry Reding wrote: > On Wed, May 27, 2020 at 12:03:44PM +0100, Will Deacon wrote: > > Hi John, Bjorn, > > > > On Tue, May 26, 2020 at 01:34:45PM -0700, John Stultz wrote: > > > On Thu, May 14, 2020 at 12:34 PM wrote: > > > > > > > > On Thu 27 Feb 18:57 PST 2020,

[PATCH v2] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Rajat Jain via iommu
Currently, an external malicious PCI device can masquerade the VID:PID of faulty gfx devices, and thus apply iommu quirks to effectively disable the IOMMU restrictions for itself. Thus we need to ensure that the device we are applying quirks to, is indeed an internal trusted device.

Re: [PATCH] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Rajat Jain via iommu
Hi MIka, Thanks for taking a look. On Tue, Jun 2, 2020 at 2:50 AM Mika Westerberg wrote: > > On Mon, Jun 01, 2020 at 10:45:17PM -0700, Rajat Jain wrote: > > Currently, an external malicious PCI device can masquerade the VID:PID > > of faulty gfx devices, and thus apply iommu quirks to

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

2020-06-02 Thread Jerry Snitselaar
On Tue Jun 02 20, Joerg Roedel wrote: Hi Jerry, On Mon, Jun 01, 2020 at 05:02:36PM -0700, Jerry Snitselaar wrote: Yeah, that will solve the panic. If you still see the kdump faults, can you please try with the attached diff? I was not able to reproduce them in my setup. Regards,

Re: [PATCH] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Raj, Ashok
On Tue, Jun 02, 2020 at 06:43:00PM +, Rajat Jain wrote: > Hi MIka, > > Thanks for taking a look. > > On Tue, Jun 2, 2020 at 2:50 AM Mika Westerberg > wrote: > > > > On Mon, Jun 01, 2020 at 10:45:17PM -0700, Rajat Jain wrote: > > > Currently, an external malicious PCI device can masquerade

Re: [PATCH v3] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Prashant Malani via iommu
Hi Rajat, On Tue, Jun 02, 2020 at 04:26:02PM -0700, Rajat Jain wrote: > Currently, an external malicious PCI device can masquerade the VID:PID > of faulty gfx devices, and thus apply iommu quirks to effectively > disable the IOMMU restrictions for itself. > > Thus we need to ensure that the

[PATCH v3] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Rajat Jain via iommu
Currently, an external malicious PCI device can masquerade the VID:PID of faulty gfx devices, and thus apply iommu quirks to effectively disable the IOMMU restrictions for itself. Thus we need to ensure that the device we are applying quirks to, is indeed an internal trusted device.

Re: [PATCH v3] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Raj, Ashok
On Tue, Jun 02, 2020 at 04:26:02PM -0700, Rajat Jain wrote: > Currently, an external malicious PCI device can masquerade the VID:PID > of faulty gfx devices, and thus apply iommu quirks to effectively > disable the IOMMU restrictions for itself. > > Thus we need to ensure that the device we are

Re: [PATCH] iommu/amd: Fix event counter availability check

2020-06-02 Thread Shuah Khan
On 5/31/20 1:22 AM, Alexander Monakov wrote: Hi, Adding Shuah Khan to Cc: I've noticed you've seen this issue on Ryzen 2400GE; can you have a look at the patch? Would be nice to know if it fixes the problem for you too. I am not seeing any change in behavior on my system. I still see: I

Re: [PATCH v3] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Prashant Malani via iommu
(Trimming text) On Wed, Jun 03, 2020 at 12:23:48AM +, Rajat Jain wrote: > On Tue, Jun 2, 2020 at 4:49 PM Prashant Malani wrote: > > > > Hi Rajat, > > Hi Prashant, thanks for taking a look. > > > > > On Tue, Jun 02, 2020 at 04:26:02PM -0700, Rajat Jain wrote: > > > +static bool

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

2020-06-02 Thread Jerry Snitselaar
On Tue Jun 02 20, Jerry Snitselaar wrote: On Tue Jun 02 20, Joerg Roedel wrote: Hi Jerry, On Mon, Jun 01, 2020 at 05:02:36PM -0700, Jerry Snitselaar wrote: Yeah, that will solve the panic. If you still see the kdump faults, can you please try with the attached diff? I was not able to

Re: [PATCH v2] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Raj, Ashok
Hi Rajat On Tue, Jun 02, 2020 at 11:41:33AM -0700, Rajat Jain wrote: > Currently, an external malicious PCI device can masquerade the VID:PID > of faulty gfx devices, and thus apply iommu quirks to effectively > disable the IOMMU restrictions for itself. > > Thus we need to ensure that the

Re: [PATCH v3] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Rajat Jain
On Tue, Jun 2, 2020 at 4:49 PM Prashant Malani wrote: > > Hi Rajat, Hi Prashant, thanks for taking a look. > > On Tue, Jun 02, 2020 at 04:26:02PM -0700, Rajat Jain wrote: > > Currently, an external malicious PCI device can masquerade the VID:PID > > of faulty gfx devices, and thus apply iommu

Re: [PATCH 2/3] arm64: mm: reserve hugetlb CMA after numa_init

2020-06-02 Thread Roman Gushchin via iommu
On Wed, Jun 03, 2020 at 02:42:30PM +1200, Barry Song wrote: > hugetlb_cma_reserve() is called at the wrong place. numa_init has not been > done yet. so all reserved memory will be located at node0. > > Cc: Roman Gushchin > Signed-off-by: Barry Song Acked-by: Roman Gushchin Thanks! > --- >

Re: [PATCH v3] iommu/vt-d: Don't apply gfx quirks to untrusted devices

2020-06-02 Thread Mika Westerberg
On Tue, Jun 02, 2020 at 04:26:02PM -0700, Rajat Jain wrote: > +static bool risky_device(struct pci_dev *pdev) > +{ > + if (pdev->untrusted) { > + pci_warn(pdev, > + "Skipping IOMMU quirk for dev (%04X:%04X) on untrusted" > + " PCI link.

[PATCH 2/3] arm64: mm: reserve hugetlb CMA after numa_init

2020-06-02 Thread Barry Song
hugetlb_cma_reserve() is called at the wrong place. numa_init has not been done yet. so all reserved memory will be located at node0. Cc: Roman Gushchin Signed-off-by: Barry Song --- arch/arm64/mm/init.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH 0/3] support per-numa CMA for ARM server

2020-06-02 Thread Barry Song
Right now, smmu is using dma_alloc_coherent() to get memory to save queues and tables. Typically, on ARM64 server, there is a default CMA located at node0, which could be far away from node2, node3 etc. Saving queues and tables remotely will increase the latency of ARM SMMU significantly. For

[PATCH 1/3] dma-direct: provide the ability to reserve per-numa CMA

2020-06-02 Thread Barry Song
This is useful for two scenarios: 1. ARM64 smmu will get memory from local numa node, it can save its command queues and page tables locally. Tests show it can decrease dma_unmap latency at lot. For example, without this patch, smmu on node2 will get memory from node0 by calling

[PATCH 3/3] arm64: mm: reserve per-numa CMA after numa_init

2020-06-02 Thread Barry Song
Right now, smmu is using dma_alloc_coherent() to get memory to save queues and tables. Typically, on ARM64 server, there is a default CMA located at node0, which could be far away from node2, node3 etc. with this patch, smmu will get memory from local numa node to save command queues and page

Re: [PATCH 1/4] dma-mapping: move the remaining DMA API calls out of line

2020-06-02 Thread Alexey Kardashevskiy
On 09/05/2020 18:19, Christoph Hellwig wrote: > On Tue, May 05, 2020 at 02:18:37PM +1000, Alexey Kardashevskiy wrote: >> >> >> On 17/04/2020 17:58, Christoph Hellwig wrote: >>> On Wed, Apr 15, 2020 at 09:21:37PM +1000, Alexey Kardashevskiy wrote: And the fact they were exported leaves