答复: 答复: 答复: [PATCH v3 2/2] iommu/vt-d:Add support for probing ACPI device in RMRR

2020-09-03 Thread FelixCui-oc
hi baolu, We run this on zhaoxin X86 paltform. There are some MCUS on our platforms that read and write data to the system memory. During this process, the MCU is invisible to the host kernel. And the MCU needs to report through ACPI_NAMESPACE_DEVICE in RMRR.

Re: [PATCH v2 1/1] iommu/vt-d: Use device numa domain if RHSA is missing

2020-09-03 Thread Lu Baolu
Hi Kevin, On 9/4/20 10:16 AM, Tian, Kevin wrote: From: Lu Baolu Sent: Friday, September 4, 2020 9:03 AM If there are multiple NUMA domains but the RHSA is missing in ACPI/DMAR table, we could default to the device NUMA domain as fall back. This could also benefit a vIOMMU use case where only

RE: [PATCH v2 1/1] iommu/vt-d: Use device numa domain if RHSA is missing

2020-09-03 Thread Tian, Kevin
> From: Lu Baolu > Sent: Friday, September 4, 2020 9:03 AM > > If there are multiple NUMA domains but the RHSA is missing in ACPI/DMAR > table, we could default to the device NUMA domain as fall back. This could > also benefit a vIOMMU use case where only single vIOMMU is exposed, > hence > no

[PATCH v2 1/1] iommu/vt-d: Use device numa domain if RHSA is missing

2020-09-03 Thread Lu Baolu
If there are multiple NUMA domains but the RHSA is missing in ACPI/DMAR table, we could default to the device NUMA domain as fall back. This could also benefit a vIOMMU use case where only single vIOMMU is exposed, hence no RHSA will be present but device numa domain can be correct. Cc: Jacob Pan

Re: [PATCH v7 9/9] x86/mmu: Allocate/free PASID

2020-09-03 Thread Fenghua Yu
Hi, Thomas, Andy, et al, On Thu, Aug 27, 2020 at 08:06:34AM -0700, Fenghua Yu wrote: > A PASID is allocated for an "mm" the first time any thread binds > to an SVM capable device and is freed from the "mm" when the SVM is > unbound by the last thread. It's possible for the "mm" to have different

Re: [PATCH v2 3/9] iommu/ioasid: Introduce ioasid_set APIs

2020-09-03 Thread Jacob Pan
On Tue, 1 Sep 2020 13:51:26 +0200 Auger Eric wrote: > Hi Jacob, > > On 8/22/20 6:35 AM, Jacob Pan wrote: > > ioasid_set was introduced as an arbitrary token that are shared by > > a > that is got it > > group of IOASIDs. For example, if IOASID #1 and #2 are allocated > > via the same

[PATCH V2 3/5] iommu: allow the dma-iommu api to use bounce buffers

2020-09-03 Thread Tom Murphy
Allow the dma-iommu api to use bounce buffers for untrusted devices. This is a copy of the intel bounce buffer code. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 94 ++--- drivers/iommu/intel/iommu.c | 6 +++ drivers/iommu/iommu.c | 10

[PATCH V2 2/5] iommu: Add iommu_dma_free_cpu_cached_iovas function

2020-09-03 Thread Tom Murphy
to dma-iommu ops Add a iommu_dma_free_cpu_cached_iovas function to allow drivers which use the dma-iommu ops to free cached cpu iovas. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 9 + include/linux/dma-iommu.h | 3 +++ 2 files changed, 12 insertions(+) diff --git

Re: [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api

2020-09-03 Thread Tom Murphy
On Fri, 28 Aug 2020 at 00:34, Tom Murphy wrote: > > On Thu, 27 Aug 2020 at 22:36, Logan Gunthorpe wrote: > > > > > > > > On 2020-08-23 6:04 p.m., Tom Murphy wrote: > > > I have added a check for the sg_dma_len == 0 : > > > """ > > > } __sgt_iter(struct scatterlist *sgl, bool dma) { > > >

[PATCH V2 0/5] Convert the intel iommu driver to the dma-iommu api

2020-09-03 Thread Tom Murphy
This patchset converts the intel iommu driver to the dma-iommu api. While converting the driver I exposed a bug in the intel i915 driver which causes a huge amount of artifacts on the screen of my laptop. You can see a picture of it here:

[PATCH V2 1/5] iommu: Handle freelists when using deferred flushing in iommu drivers

2020-09-03 Thread Tom Murphy
Allow the iommu_unmap_fast to return newly freed page table pages and pass the freelist to queue_iova in the dma-iommu ops path. This is useful for iommu drivers (in this case the intel iommu driver) which need to wait for the ioTLB to be flushed before newly free/unmapped page table pages can be

[PATCH V2 5/5] DO NOT MERGE: iommu: disable list appending in dma-iommu

2020-09-03 Thread Tom Murphy
Disable combining sg segments in the dma-iommu api. Combining the sg segments exposes a bug in the intel i915 driver which causes visual artifacts and the screen to freeze. This is most likely because of how the i915 handles the returned list. It probably doesn't respect the returned value

[PATCH V2 4/5] iommu/vt-d: Convert intel iommu driver to the iommu ops

2020-09-03 Thread Tom Murphy
Convert the intel iommu driver to the dma-iommu api. Remove the iova handling and reserve region code from the intel iommu driver. Signed-off-by: Tom Murphy --- drivers/iommu/Kconfig | 1 + drivers/iommu/intel/iommu.c | 756 +++- 2 files changed, 51

Re: [patch V2 00/46] x86, PCI, XEN, genirq ...: Prepare for device MSI

2020-09-03 Thread Thomas Gleixner
Ashok, On Thu, Sep 03 2020 at 09:35, Ashok Raj wrote: > On Wed, Aug 26, 2020 at 01:16:28PM +0200, Thomas Gleixner wrote: >> This is the second version of providing a base to support device MSI (non >> PCI based) and on top of that support for IMS (Interrupt Message Storm) > > s/Storm/Store > >

Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-03 Thread Jim Quinlan via iommu
On Wed, Sep 2, 2020 at 8:52 PM Nathan Chancellor wrote: > > On Wed, Sep 02, 2020 at 05:36:29PM -0700, Florian Fainelli wrote: > > > > > > On 9/2/2020 3:38 PM, Nathan Chancellor wrote: > > [snip] > > > > Hello Nathan, > > > > > > > > Can you tell me how much memory your RPI has and if all of it is

Re: [PATCH] iommu/dma: Remove broken huge page handling

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 12:34:04PM +0100, Robin Murphy wrote: > The attempt to handle huge page allocations was originally added since > the comments around stripping __GFP_COMP in other implementations were > nonsensical, and we naively assumed that split_huge_page() could simply > be called

Re: [patch V2 00/46] x86, PCI, XEN, genirq ...: Prepare for device MSI

2020-09-03 Thread Raj, Ashok
Hi Thomas, Thanks a ton for jumping in helping on straightening it for IMS!!! On Wed, Aug 26, 2020 at 01:16:28PM +0200, Thomas Gleixner wrote: > This is the second version of providing a base to support device MSI (non > PCI based) and on top of that support for IMS (Interrupt Message Storm)

Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-03 Thread Christoph Hellwig
FYI, I've moved it off for-next and into its own dma-ranges branch for now until we sort out the regressions. I still hope to bring it back soon. ___ iommu mailing list iommu@lists.linux-foundation.org

[PATCH] iommu/dma: Remove broken huge page handling

2020-09-03 Thread Robin Murphy
The attempt to handle huge page allocations was originally added since the comments around stripping __GFP_COMP in other implementations were nonsensical, and we naively assumed that split_huge_page() could simply be called equivalently to split_page(). It turns out that this doesn't actually work

Re: [PATCH 2/2] ARM: dts: r8a7742: Add IPMMU DT nodes

2020-09-03 Thread Geert Uytterhoeven
On Tue, Aug 25, 2020 at 4:19 PM Lad Prabhakar wrote: > Add the five IPMMU instances found in the r8a7742 to DT with a disabled > status. > > Signed-off-by: Lad Prabhakar > Reviewed-by: Chris Paterson Reviewed-by: Geert Uytterhoeven i.e. will queue in renesas-devel for v5.10.

Re: [PATCH 1/2] dt-bindings: iommu: renesas, ipmmu-vmsa: Add r8a7742 support

2020-09-03 Thread Geert Uytterhoeven
On Tue, Aug 25, 2020 at 4:19 PM Lad Prabhakar wrote: > Document RZ/G1H (R8A7742) SoC bindings. > > No driver change is needed due to the fallback compatible value > "renesas,ipmmu-vmsa". > > Signed-off-by: Lad Prabhakar > Reviewed-by: Chris Paterson Reviewed-by: Geert Uytterhoeven

[PATCH 1/2 v2] iommu: amd: Restore IRTE.RemapEn bit after programming IRTE

2020-09-03 Thread Suravee Suthikulpanit
Currently, the RemapEn (valid) bit is accidentally cleared when programming IRTE w/ guestMode=0. It should be restored to the prior state. Reviewed-by: Joao Martins Signed-off-by: Suravee Suthikulpanit Fixes: b9fc6b56f478 ("iommu/amd: Implements irq_set_vcpu_affinity() hook to setup vapic mode

[PATCH 0/2 v2] iommu: amd: Fix intremap IO_PAGE_FAULT for VMs

2020-09-03 Thread Suravee Suthikulpanit
Interrupt remapping IO_PAGE_FAULT has been observed under system w/ large number of VMs w/ pass-through devices. This can be reproduced with 64 VMs + 64 pass-through VFs of Mellanox MT28800 Family [ConnectX-5 Ex], where each VM runs small-packet netperf test via the pass-through device to the

[PATCH 2/2 v2] iommu: amd: Use cmpxchg_double() when updating 128-bit IRTE

2020-09-03 Thread Suravee Suthikulpanit
When using 128-bit interrupt-remapping table entry (IRTE) (a.k.a GA mode), current driver disables interrupt remapping when it updates the IRTE so that the upper and lower 64-bit values can be updated safely. However, this creates a small window, where the interrupt could arrive and result in

Re: [PATCH v8 6/7] iommu/uapi: Handle data and argsz filled by users

2020-09-03 Thread Auger Eric
Hi Jacob, On 8/31/20 8:24 PM, Jacob Pan wrote: > IOMMU user APIs are responsible for processing user data. This patch > changes the interface such that user pointers can be passed into IOMMU > code directly. Separate kernel APIs without user pointers are introduced > for in-kernel users of the

Re: [PATCH v8 7/7] iommu/vt-d: Check UAPI data processed by IOMMU core

2020-09-03 Thread Auger Eric
Hi Jacob, On 8/31/20 8:25 PM, Jacob Pan wrote: > IOMMU generic layer already does sanity checks on UAPI data for version > match and argsz range based on generic information. > > This patch adjusts the following data checking responsibilities: > - removes the redundant version check from VT-d

Re: [PATCH 2/2] iommu: amd: Use cmpxchg_double() when updating 128-bit IRTE

2020-09-03 Thread Suravee Suthikulpanit
Hi, I'll send out V2 with fixes to the review comments below ... On 9/2/20 10:26 PM, Joao Martins wrote: On 9/2/20 5:51 AM, Suravee Suthikulpanit wrote: When using 128-bit interrupt-remapping table entry (IRTE) (a.k.a GA mode), current driver disables interrupt remapping when it updates the

Re: [PATCH 22/28] sgiseeq: convert from dma_cache_sync to dma_sync_single_for_device

2020-09-03 Thread Christoph Hellwig
On Thu, Sep 03, 2020 at 10:43:02AM +0200, Christoph Hellwig wrote: > On Tue, Sep 01, 2020 at 07:38:10PM +0200, Thomas Bogendoerfer wrote: > > this is the problem: > > > >/* Always check for received packets. */ > > sgiseeq_rx(dev, sp, hregs, sregs); > > > > so the driver will

Re: [PATCH 22/28] sgiseeq: convert from dma_cache_sync to dma_sync_single_for_device

2020-09-03 Thread Christoph Hellwig
On Wed, Sep 02, 2020 at 11:38:09PM +0200, Thomas Bogendoerfer wrote: > the patch below fixes the problem. But is very wrong unfortunately. > static inline void dma_sync_desc_cpu(struct net_device *dev, void *addr) > { > - dma_cache_sync(dev->dev.parent, addr, sizeof(struct

Re: [PATCH 22/28] sgiseeq: convert from dma_cache_sync to dma_sync_single_for_device

2020-09-03 Thread Christoph Hellwig
On Tue, Sep 01, 2020 at 07:38:10PM +0200, Thomas Bogendoerfer wrote: > this is the problem: > >/* Always check for received packets. */ > sgiseeq_rx(dev, sp, hregs, sregs); > > so the driver will look at the rx descriptor on every interrupt, so > we cache the rx descriptor on the

Re: [PATCH 1/1] iommu/vt-d: Fix NULL pointer dereference in dev_iommu_priv_set()

2020-09-03 Thread Torsten Hilbrich
On 03.09.20 08:51, Lu Baolu wrote: > The dev_iommu_priv_set() must be called after probe_device(). This fixes > a NULL pointer deference bug when booting a system with kernel cmdline > "intel_iommu=on,igfx_off", where the dev_iommu_priv_set() is abused. [...] > > Fixes: 01b9d4e21148c

Re: 答复: 答复: [PATCH v3 2/2] iommu/vt-d:Add support for probing ACPI device in RMRR

2020-09-03 Thread Lu Baolu
Hi Felix, On 9/2/20 11:24 AM, FelixCui-oc wrote: hi baolu, So you have a hidden device (invisible to host kernel). But you need to setup some identity mappings for this device, so that the firmware could keep working, right? The platform designs this by putting that range in the RMRR

[PATCH 1/1] iommu/vt-d: Fix NULL pointer dereference in dev_iommu_priv_set()

2020-09-03 Thread Lu Baolu
The dev_iommu_priv_set() must be called after probe_device(). This fixes a NULL pointer deference bug when booting a system with kernel cmdline "intel_iommu=on,igfx_off", where the dev_iommu_priv_set() is abused. The following stacktrace was produced: [0.00] Command line:

Re: [PATCH] iommu: Allocate dev_iommu before accessing priv data

2020-09-03 Thread Lu Baolu
Hi Robin, On 9/2/20 7:31 PM, Robin Murphy wrote: On 2020-09-02 06:32, Torsten Hilbrich wrote: After updating from v5.8 to v5.9-rc2 I noticed some problems when booting a system with kernel cmdline "intel_iommu=on,igfx_off". The following stacktrace was produced: <6>[    0.00] Command