Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-08 Thread Eric Auger
Hi Jason, On 12/8/21 7:31 PM, Jason Gunthorpe wrote: > On Wed, Dec 08, 2021 at 05:20:39PM +, Jean-Philippe Brucker wrote: >> On Wed, Dec 08, 2021 at 08:56:16AM -0400, Jason Gunthorpe wrote: >>> From a progress perspective I would like to start with simple 'page >>> tables in userspace', ie no

[PATCH v8 6/6] iommu/tegra-smmu: Add pagetable mappings to debugfs

2021-12-08 Thread Nicolin Chen via iommu
This patch dumps all active mapping entries from pagetable to a debugfs directory named "mappings". Part of this patch for listing all swgroup names in a group_soc is provided by Dmitry Osipenko Attaching an example: [SWGROUP: xusb_host] [as: (id: 5), (attr: R|W|-), (pd_dma: 0x80005000)

[PATCH v8 4/6] iommu/tegra-smmu: Use swgrp pointer instead of swgroup id

2021-12-08 Thread Nicolin Chen via iommu
This patch changes in struct tegra_smmu_group to use swgrp pointer instead of swgroup, as a preparational change for the "mappings" debugfs feature. Acked-by: Thierry Reding Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 12 1 file changed, 8 insertions(+), 4 deletion

[PATCH v8 2/6] iommu/tegra-smmu: Rename tegra_smmu_find_group to tegra_smmu_find_group_soc

2021-12-08 Thread Nicolin Chen via iommu
The existing function tegra_smmu_find_group really finds group->soc pointer, so naming it "find_group" might not be clear by looking at it alone. This patch renames it to tegra_smmu_group_soc in order to disambiguate the use of "group" in this driver. Signed-off-by: Nicolin Chen --- drivers/iomm

[PATCH v8 3/6] iommu/tegra-smmu: Rename struct tegra_smmu_swgroup *group to *swgrp

2021-12-08 Thread Nicolin Chen via iommu
There are both tegra_smmu_swgroup and tegra_smmu_group structs using "group" for their pointer instances. This gets confusing to read the driver sometimes. So this patch renames "group" of struct tegra_smmu_swgroup to "swgrp" as a cleanup. Also renames its "find" function. Note that we already ha

[PATCH v8 5/6] iommu/tegra-smmu: Attach as pointer to tegra_smmu_group

2021-12-08 Thread Nicolin Chen via iommu
This could ease driver to access corresponding as pointer when having tegra_smmu_group pointer only, which can help new mappings debugfs nodes. Also moving tegra_smmu_find_group_soc() upward, for using it in new tegra_smmu_attach_as(); and it's better to have all tegra_smmu_find_* functions togeth

[PATCH v8 0/6] iommu/tegra-smmu: Add pagetable mappings to debugfs

2021-12-08 Thread Nicolin Chen via iommu
This series of patches adds a new mappings node to debugfs for tegra-smmu driver. The first five patches are all preparational changes for PATCH-6, based on Thierry's review feedback against v5. Changelog v8: * No changes for PATCH 1-4 * PATCH-5: * * bypassed "group->as == as" to fix KMSG bug r

[PATCH v8 1/6] iommu/tegra-smmu: Rename struct iommu_group *group to *grp

2021-12-08 Thread Nicolin Chen via iommu
There are a few structs using "group" for their pointer instances. This gets confusing sometimes. The instance of struct iommu_group is used in local function with an alias "grp", which can separate it from others. So this patch simply renames "group" to "grp" as a cleanup. Acked-by: Thierry Redi

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Maxim Levitsky
On Thu, 2021-12-09 at 00:04 +, Sean Christopherson wrote: > On Thu, Dec 09, 2021, Maxim Levitsky wrote: > > Host crash while running 32 bit VM and another 32 bit VM nested in it: > > > > [ 751.182290] BUG: kernel NULL pointer dereference, address: > > 0025 > > [ 751.198234] #PF:

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Maxim Levitsky
On Wed, 2021-12-08 at 23:43 +, Sean Christopherson wrote: > On Thu, Dec 09, 2021, Maxim Levitsky wrote: > > > KVM: SVM: Remove unnecessary APICv/AVIC update in vCPU unblocking path > > ... > > > Probably just luck (can't reproduce this anymore) but > > while running some kvm unit tests with

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Maxim Levitsky
On Thu, 2021-12-09 at 01:37 +, Sean Christopherson wrote: > On Thu, Dec 09, 2021, Maxim Levitsky wrote: > > On Thu, 2021-12-09 at 01:00 +0200, Maxim Levitsky wrote: > > > Probably just luck (can't reproduce this anymore) but > > > while running some kvm unit tests with this patch series (and fe

RE: [patch 21/32] NTB/msi: Convert to msi_on_each_desc()

2021-12-08 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Saturday, December 4, 2021 12:41 AM > > > Or has each queue and controlblock and whatever access to a shared large > > array where the messages are stored and the indices are handed out to > > the queues and controlblocks? > > > If each of them have their own smal

Re: [patch 21/32] NTB/msi: Convert to msi_on_each_desc()

2021-12-08 Thread Jason Wang
On Thu, Dec 9, 2021 at 1:41 PM Tian, Kevin wrote: > > > From: Jason Gunthorpe > > Sent: Thursday, December 2, 2021 9:55 PM > > > > Further, there is no reason why IMS should be reserved exclusively for > > VFIO! > > This is correct. Just as what you agreed with Thomas, the only difference > betwe

RE: [patch 21/32] NTB/msi: Convert to msi_on_each_desc()

2021-12-08 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Thursday, December 2, 2021 9:55 PM > > Further, there is no reason why IMS should be reserved exclusively for > VFIO! This is correct. Just as what you agreed with Thomas, the only difference between IMS and MSI is on where the messages are stored. Physically it

RE: [patch 21/32] NTB/msi: Convert to msi_on_each_desc()

2021-12-08 Thread Tian, Kevin
> From: Thomas Gleixner > Sent: Thursday, December 2, 2021 5:45 AM > > On Wed, Dec 01 2021 at 14:21, Dave Jiang wrote: > > On 12/1/2021 1:25 PM, Thomas Gleixner wrote: > >>> The hardware implementation does not have enough MSIX vectors for > >>> guests. There are only 9 MSIX vectors total (8 for

RE: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-08 Thread Tian, Kevin
> From: Tian, Kevin > Sent: Thursday, December 9, 2021 10:58 AM > > For ARM it's SMMU's PASID table format. There is no step-2 since PASID > is already within the address space covered by the user PASID table. > One correction here. 'no step-2' is definitely wrong here as it means more than user

RE: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-08 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Wednesday, December 8, 2021 8:56 PM > > On Wed, Dec 08, 2021 at 08:33:33AM +0100, Eric Auger wrote: > > Hi Baolu, > > > > On 12/8/21 3:44 AM, Lu Baolu wrote: > > > Hi Eric, > > > > > > On 12/7/21 6:22 PM, Eric Auger wrote: > > >> On 12/6/21 11:48 AM, Joerg Roedel w

RE: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-08 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Thursday, December 9, 2021 2:31 AM > > On Wed, Dec 08, 2021 at 05:20:39PM +, Jean-Philippe Brucker wrote: > > On Wed, Dec 08, 2021 at 08:56:16AM -0400, Jason Gunthorpe wrote: > > > From a progress perspective I would like to start with simple 'page > > > tables

Re: [PATCH 3/4] iommu/vt-d: Support PASID DMA for in-kernel usage

2021-12-08 Thread Lu Baolu
On 12/9/21 3:16 AM, Jacob Pan wrote: Hi Jason, On Wed, 8 Dec 2021 09:22:55 -0400, Jason Gunthorpe wrote: On Tue, Dec 07, 2021 at 05:47:13AM -0800, Jacob Pan wrote: Between DMA requests with and without PASID (legacy), DMA mapping APIs are used indiscriminately on a device. Therefore, we shou

Re: [PATCH 2/4] iommu: Add PASID support for DMA mapping API users

2021-12-08 Thread Lu Baolu
On 12/9/21 9:56 AM, Tian, Kevin wrote: From: Jacob Pan Sent: Thursday, December 9, 2021 2:50 AM Can a device issue DMA requests with PASID even there's no system IOMMU or the system IOMMU is disabled? Good point. If IOMMU is not enabled, device cannot issue DMA requests with PASID. This AP

RE: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Tian, Kevin
> From: Jiang, Dave > Sent: Thursday, December 9, 2021 8:12 AM > >>> > >> Do you mean wq completion record address? It is already using DMA API. > >>wq->compls = dma_alloc_coherent(dev, wq->compls_size, > >> &wq->compls_addr, GFP_KERNEL); > >>desc->compl_dma = wq->compls_addr + idxd->data-

RE: [PATCH 2/4] iommu: Add PASID support for DMA mapping API users

2021-12-08 Thread Tian, Kevin
> From: Jacob Pan > Sent: Thursday, December 9, 2021 2:50 AM > > > Can a device issue DMA requests with PASID even there's no system > IOMMU > > or the system IOMMU is disabled? > > > Good point. > If IOMMU is not enabled, device cannot issue DMA requests with PASID. This > API will not be availa

RE: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Thursday, December 9, 2021 1:51 AM > > > > > + /* > > > > +* Try to enable both in-kernel and user DMA request with PASID. > > > > +* PASID is supported unless both user and kernel PASID are > > > > +* supported. Do not fail probe here

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Sean Christopherson via iommu
On Thu, Dec 09, 2021, Maxim Levitsky wrote: > On Thu, 2021-12-09 at 01:00 +0200, Maxim Levitsky wrote: > > Probably just luck (can't reproduce this anymore) but > > while running some kvm unit tests with this patch series (and few my patches > > for AVIC co-existance which shouldn't affect this) I

Re: [PATCH v3 04/18] driver core: platform: Add driver dma ownership management

2021-12-08 Thread Lu Baolu
On 12/7/21 9:16 PM, Jason Gunthorpe wrote: On Tue, Dec 07, 2021 at 10:57:25AM +0800, Lu Baolu wrote: On 12/6/21 11:06 PM, Jason Gunthorpe wrote: On Mon, Dec 06, 2021 at 06:36:27AM -0800, Christoph Hellwig wrote: I really hate the amount of boilerplate code that having this in each bus type cau

Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Dave Jiang
On 12/8/2021 4:39 PM, Jason Gunthorpe wrote: On Wed, Dec 08, 2021 at 01:59:45PM -0800, Jacob Pan wrote: Hi Jason, On Wed, 8 Dec 2021 16:30:22 -0400, Jason Gunthorpe wrote: On Wed, Dec 08, 2021 at 11:55:16AM -0800, Jacob Pan wrote: Hi Jason, On Wed, 8 Dec 2021 09:13:58 -0400, Jason Guntho

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Sean Christopherson via iommu
On Thu, Dec 09, 2021, Maxim Levitsky wrote: > Host crash while running 32 bit VM and another 32 bit VM nested in it: > > [ 751.182290] BUG: kernel NULL pointer dereference, address: 0025 > [ 751.198234] #PF: supervisor read access in kernel mode > [ 751.209982] #PF: error_code(0x000

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Sean Christopherson via iommu
On Thu, Dec 09, 2021, Maxim Levitsky wrote: > Also got this while trying a VM with passed through device: > > [mlevitsk@amdlaptop ~]$[ 34.926140] usb 5-3: reset full-speed USB device > number 3 using xhci_hcd > [ 42.583661] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some > data m

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Sean Christopherson via iommu
On Thu, Dec 09, 2021, Maxim Levitsky wrote: > > KVM: SVM: Remove unnecessary APICv/AVIC update in vCPU unblocking path ... > Probably just luck (can't reproduce this anymore) but > while running some kvm unit tests with this patch series (and few my patches > for AVIC co-existance which shouldn

Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Jason Gunthorpe via iommu
On Wed, Dec 08, 2021 at 01:59:45PM -0800, Jacob Pan wrote: > Hi Jason, > > On Wed, 8 Dec 2021 16:30:22 -0400, Jason Gunthorpe wrote: > > > On Wed, Dec 08, 2021 at 11:55:16AM -0800, Jacob Pan wrote: > > > Hi Jason, > > > > > > On Wed, 8 Dec 2021 09:13:58 -0400, Jason Gunthorpe > > > wrote: > >

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Maxim Levitsky
On Thu, 2021-12-09 at 01:16 +0200, Maxim Levitsky wrote: > On Thu, 2021-12-09 at 01:00 +0200, Maxim Levitsky wrote: > > On Wed, 2021-12-08 at 01:52 +, Sean Christopherson wrote: > > > Overhaul and cleanup APIC virtualization (Posted Interrupts on Intel VMX, > > > AVIC on AMD SVM) to streamline

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Maxim Levitsky
On Thu, 2021-12-09 at 01:00 +0200, Maxim Levitsky wrote: > On Wed, 2021-12-08 at 01:52 +, Sean Christopherson wrote: > > Overhaul and cleanup APIC virtualization (Posted Interrupts on Intel VMX, > > AVIC on AMD SVM) to streamline things as much as possible, remove a bunch > > of cruft, and docu

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Maxim Levitsky
On Wed, 2021-12-08 at 01:52 +, Sean Christopherson wrote: > Overhaul and cleanup APIC virtualization (Posted Interrupts on Intel VMX, > AVIC on AMD SVM) to streamline things as much as possible, remove a bunch > of cruft, and document the lurking gotchas along the way. > > Patch 01 is a fix fr

Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Jacob Pan
Hi Jason, On Wed, 8 Dec 2021 16:30:22 -0400, Jason Gunthorpe wrote: > On Wed, Dec 08, 2021 at 11:55:16AM -0800, Jacob Pan wrote: > > Hi Jason, > > > > On Wed, 8 Dec 2021 09:13:58 -0400, Jason Gunthorpe > > wrote: > > > > This patch utilizes iommu_enable_pasid_dma() to enable DSA to > > > > pe

Re: [PATCH v7 6/6] iommu/tegra-smmu: Add pagetable mappings to debugfs

2021-12-08 Thread Nicolin Chen via iommu
On Wed, Dec 08, 2021 at 07:09:37PM +0300, Dmitry Osipenko wrote: > External email: Use caution opening links or attachments > > > 08.12.2021 11:47, Nicolin Chen пишет: > > static void tegra_smmu_attach_as(struct tegra_smmu *smmu, > >struct tegra_smmu_as *as, > >

Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Jason Gunthorpe via iommu
On Wed, Dec 08, 2021 at 11:55:16AM -0800, Jacob Pan wrote: > Hi Jason, > > On Wed, 8 Dec 2021 09:13:58 -0400, Jason Gunthorpe wrote: > > > > This patch utilizes iommu_enable_pasid_dma() to enable DSA to perform > > > DMA requests with PASID under the same mapping managed by DMA mapping > > > API

RE: [PATCH V6 5/5] net: netvsc: Add Isolation VM support for netvsc driver

2021-12-08 Thread Haiyang Zhang via iommu
> -Original Message- > From: Tianyu Lan > Sent: Tuesday, December 7, 2021 2:56 AM > To: KY Srinivasan ; Haiyang Zhang > ; Stephen > Hemminger ; wei@kernel.org; Dexuan Cui > ; > t...@linutronix.de; mi...@redhat.com; b...@alien8.de; > dave.han...@linux.intel.com; > x...@kernel.org;

Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Jacob Pan
Hi Jason, On Wed, 8 Dec 2021 09:13:58 -0400, Jason Gunthorpe wrote: > > This patch utilizes iommu_enable_pasid_dma() to enable DSA to perform > > DMA requests with PASID under the same mapping managed by DMA mapping > > API. In addition, SVA-related bits for kernel DMA are removed. As a > > resu

Re: [PATCH 3/4] iommu/vt-d: Support PASID DMA for in-kernel usage

2021-12-08 Thread Jacob Pan
Hi Jason, On Wed, 8 Dec 2021 09:22:55 -0400, Jason Gunthorpe wrote: > On Tue, Dec 07, 2021 at 05:47:13AM -0800, Jacob Pan wrote: > > Between DMA requests with and without PASID (legacy), DMA mapping APIs > > are used indiscriminately on a device. Therefore, we should always match > > the address

Re: [PATCH 2/4] iommu: Add PASID support for DMA mapping API users

2021-12-08 Thread Jacob Pan
Hi Lu, On Wed, 8 Dec 2021 10:31:36 +0800, Lu Baolu wrote: > Hi Jacob, > > On 12/7/21 9:47 PM, Jacob Pan wrote: > > DMA mapping API is the de facto standard for in-kernel DMA. It operates > > on a per device/RID basis which is not PASID-aware. > > > > Some modern devices such as Intel Data Stre

Re: [PATCH v3 1/1] iommu/arm-smmu-v3: Simplify useless instructions in arm_smmu_cmdq_build_cmd()

2021-12-08 Thread Robin Murphy
On 2021-12-08 18:17, John Garry wrote: Did you notice any performance change with this change? Hi John:    Thanks for the tip. I wrote a test case today, and I found that the performance did not go up but down. I very quickly tested on a DMA mapping benchmark very similar to the kernel DMA b

Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread kernel test robot
Hi Jacob, I love your patch! Yet something to improve: [auto build test ERROR on joro-iommu/next] [also build test ERROR on vkoul-dmaengine/next linux/master linus/master v5.16-rc4 next-20211208] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch

Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-08 Thread Jason Gunthorpe via iommu
On Wed, Dec 08, 2021 at 05:20:39PM +, Jean-Philippe Brucker wrote: > On Wed, Dec 08, 2021 at 08:56:16AM -0400, Jason Gunthorpe wrote: > > From a progress perspective I would like to start with simple 'page > > tables in userspace', ie no PASID in this step. > > > > 'page tables in userspace' m

Re: [PATCH v3 1/1] iommu/arm-smmu-v3: Simplify useless instructions in arm_smmu_cmdq_build_cmd()

2021-12-08 Thread John Garry via iommu
Did you notice any performance change with this change? Hi John: Thanks for the tip. I wrote a test case today, and I found that the performance did not go up but down. I very quickly tested on a DMA mapping benchmark very similar to the kernel DMA benchmark module - I got mixed results. F

Re: [PATCH 0/4] Enable PASID for DMA API users

2021-12-08 Thread Jacob Pan
Hi Jason, Thanks for the quick review. On Wed, 8 Dec 2021 09:10:38 -0400, Jason Gunthorpe wrote: > On Tue, Dec 07, 2021 at 05:47:10AM -0800, Jacob Pan wrote: > > Modern accelerators such as Intel's Data Streaming Accelerator (DSA) can > > perform DMA requests with PASID, which is a finer granul

Re: [patch V2 20/36] x86/pci/XEN: Use device MSI properties

2021-12-08 Thread Thomas Gleixner
On Wed, Dec 08 2021 at 11:53, Jason Gunthorpe wrote: > On Mon, Dec 06, 2021 at 11:39:28PM +0100, Thomas Gleixner wrote: >> static void xen_pv_teardown_msi_irqs(struct pci_dev *dev) >> { >> -struct msi_desc *msidesc = first_pci_msi_entry(dev); >> - >> -if (msidesc->pci.msi_attrib.is_msix)

Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Jason Gunthorpe via iommu
On Wed, Dec 08, 2021 at 08:35:49AM -0700, Dave Jiang wrote: > > On 12/8/2021 6:13 AM, Jason Gunthorpe wrote: > > On Tue, Dec 07, 2021 at 05:47:14AM -0800, Jacob Pan wrote: > > > In-kernel DMA should be managed by DMA mapping API. The existing kernel > > > PASID support is based on the SVA machiner

Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Jacob Pan
Hi Vinod, On Wed, 8 Dec 2021 10:26:22 +0530, Vinod Koul wrote: > Pls resend collecting acks. I dont have this in my queue Will do. Sorry I missed the dmaengine list. Thanks, Jacob ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.

Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-08 Thread Jean-Philippe Brucker
On Wed, Dec 08, 2021 at 08:56:16AM -0400, Jason Gunthorpe wrote: > From a progress perspective I would like to start with simple 'page > tables in userspace', ie no PASID in this step. > > 'page tables in userspace' means an iommufd ioctl to create an > iommu_domain where the IOMMU HW is directly

Re: [PATCH v7 6/6] iommu/tegra-smmu: Add pagetable mappings to debugfs

2021-12-08 Thread Dmitry Osipenko
08.12.2021 11:47, Nicolin Chen пишет: > static void tegra_smmu_attach_as(struct tegra_smmu *smmu, >struct tegra_smmu_as *as, >unsigned int swgroup) > @@ -517,6 +646,12 @@ static void tegra_smmu_attach_as(struct tegra_smmu *smmu, >

Re: [patch V2 19/36] PCI/MSI: Store properties in device::msi::data

2021-12-08 Thread Jason Gunthorpe via iommu
On Mon, Dec 06, 2021 at 11:39:26PM +0100, Thomas Gleixner wrote: > Store the properties which are interesting for various places so the MSI > descriptor fiddling can be removed. > > Signed-off-by: Thomas Gleixner > --- > V2: Use the setter function > --- > drivers/pci/msi/msi.c |8 >

Re: [patch V2 23/36] powerpc/cell/axon_msi: Use MSI device properties

2021-12-08 Thread Jason Gunthorpe via iommu
On Mon, Dec 06, 2021 at 11:39:33PM +0100, Thomas Gleixner wrote: > @@ -209,10 +209,10 @@ static int setup_msi_msg_address(struct > return -ENODEV; > } > > - entry = first_pci_msi_entry(dev); > + is_64bit = msi_device_has_property(&dev->dev, MSI_PROP_64BIT); How about

Re: [patch V2 20/36] x86/pci/XEN: Use device MSI properties

2021-12-08 Thread Jason Gunthorpe via iommu
On Mon, Dec 06, 2021 at 11:39:28PM +0100, Thomas Gleixner wrote: > instead of fiddling with MSI descriptors. > > Signed-off-by: Thomas Gleixner > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jason Gunthorpe > arch/x86/pci/xen.c |6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-)

Re: [patch V2 24/36] powerpc/pseries/msi: Use MSI device properties

2021-12-08 Thread Jason Gunthorpe via iommu
On Mon, Dec 06, 2021 at 11:39:34PM +0100, Thomas Gleixner wrote: > instead of fiddling with MSI descriptors. > > Signed-off-by: Thomas Gleixner > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jason Gunthorpe > arch/powerpc/platforms/pseries/msi.c |4 ++-- > 1 file changed, 2 insertions(+)

Re: [PATCH 11/11] dma-direct: add a dma_direct_use_pool helper

2021-12-08 Thread Christoph Hellwig
I've force pushed out the fixed version, thanks! ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [patch V2 21/36] x86/apic/msi: Use device MSI properties

2021-12-08 Thread Jason Gunthorpe via iommu
On Mon, Dec 06, 2021 at 11:39:29PM +0100, Thomas Gleixner wrote: > instead of fiddling with MSI descriptors. > > Signed-off-by: Thomas Gleixner > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Jason Gunthorpe > --- > arch/x86/kernel/apic/msi.c |5 + > 1 file changed, 1 insertion(+), 4

Re: [PATCH 11/11] dma-direct: add a dma_direct_use_pool helper

2021-12-08 Thread Marek Szyprowski
Hi Christoph, On 11.11.2021 07:50, Christoph Hellwig wrote: > Add a helper to check if a potentially blocking operation should > dip into the atomic pools. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Robin Murphy > --- > kernel/dma/direct.c | 18 -- > 1 file changed, 1

Re: [PATCH v3 21/26] KVM: SVM: Drop AVIC's intermediate avic_set_running() helper

2021-12-08 Thread Sean Christopherson via iommu
On Wed, Dec 08, 2021, Paolo Bonzini wrote: > On 12/8/21 02:52, Sean Christopherson wrote: > > + /* > > +* Unload the AVIC when the vCPU is about to block,_before_ the vCPU > > +* actually blocks. The vCPU needs to be marked IsRunning=0 before the > > +* final pass over the vIRR via

Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Dave Jiang
On 12/8/2021 6:13 AM, Jason Gunthorpe wrote: On Tue, Dec 07, 2021 at 05:47:14AM -0800, Jacob Pan wrote: In-kernel DMA should be managed by DMA mapping API. The existing kernel PASID support is based on the SVA machinery in SVA lib that is intended for user process SVA. The binding between a ke

Re: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing

2021-12-08 Thread Jon Nettleton
On Wed, Dec 8, 2021 at 3:37 PM Robin Murphy wrote: > > Jon, > > On 2021-12-08 13:26, Jon Nettleton wrote: > [...] > >>> Even marking them as IOMMU_READ/WRITE is as much of an assumption as > >>> using IOMMU_MMIO or IOMMU_CACHE. It just seems IOMMU_MMIO is the most > >>> popular since all the examp

Re: [PATCH v3 21/26] KVM: SVM: Drop AVIC's intermediate avic_set_running() helper

2021-12-08 Thread Maxim Levitsky
On Wed, 2021-12-08 at 15:43 +0100, Paolo Bonzini wrote: > On 12/8/21 02:52, Sean Christopherson wrote: > > + /* > > +* Unload the AVIC when the vCPU is about to block,_before_ the vCPU > > +* actually blocks. The vCPU needs to be marked IsRunning=0 before the > > +* final pass over

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Paolo Bonzini
On 12/8/21 02:52, Sean Christopherson wrote: Overhaul and cleanup APIC virtualization (Posted Interrupts on Intel VMX, AVIC on AMD SVM) to streamline things as much as possible, remove a bunch of cruft, and document the lurking gotchas along the way. Patch 01 is a fix from Paolo that's already b

Re: [PATCH v7 6/6] iommu/tegra-smmu: Add pagetable mappings to debugfs

2021-12-08 Thread Dmitry Osipenko
08.12.2021 11:47, Nicolin Chen пишет: > + seq_printf(s, "\t\t%-14s | %-4s | %-10s%s | %-10s%s | %-11s\n", > +"PTE RANGE", "ATTR", > +"PHYS", sizeof(phys_addr_t) > 4 ? "" : "", > +"IOVA", sizeof(dma_addr_t)

Re: [PATCH v3 21/26] KVM: SVM: Drop AVIC's intermediate avic_set_running() helper

2021-12-08 Thread Paolo Bonzini
On 12/8/21 02:52, Sean Christopherson wrote: + /* +* Unload the AVIC when the vCPU is about to block,_before_ the vCPU +* actually blocks. The vCPU needs to be marked IsRunning=0 before the +* final pass over the vIRR via kvm_vcpu_check_block(). Any IRQs that +

Re: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing

2021-12-08 Thread Robin Murphy
Jon, On 2021-12-08 13:26, Jon Nettleton wrote: [...] Even marking them as IOMMU_READ/WRITE is as much of an assumption as using IOMMU_MMIO or IOMMU_CACHE. It just seems IOMMU_MMIO is the most popular since all the examples use it for MSI doorbells in the documentation. We don't merge code base

Re: [PATCH v7 6/6] iommu/tegra-smmu: Add pagetable mappings to debugfs

2021-12-08 Thread Dmitry Osipenko
Hi, 08.12.2021 11:47, Nicolin Chen пишет: > This patch dumps all active mapping entries from pagetable to a > debugfs directory named "mappings". > > Attaching an example: > > [SWGROUP: xusb_host] [as: (id: 5), (attr: R|W|-), (pd_dma: > 0x80005000)] > { > [index: 1023] 0xf008004

Re: [PATCH v3 1/1] iommu/arm-smmu-v3: Simplify useless instructions in arm_smmu_cmdq_build_cmd()

2021-12-08 Thread Leizhen (ThunderTown) via iommu
On 2021/12/8 0:17, John Garry wrote: > >> + >>   return 0; >>   } > > Did you notice any performance change with this change? Hi John: Thanks for the tip. I wrote a test case today, and I found that the performance did not go up but down. It's so weird. So I decided not to change it, bec

RE: [RFC v16 0/9] SMMUv3 Nested Stage Setup (IOMMU part)

2021-12-08 Thread Shameerali Kolothum Thodi via iommu
> -Original Message- > From: Eric Auger [mailto:eric.au...@redhat.com] > Sent: 07 December 2021 11:06 > To: Zhangfei Gao ; eric.auger@gmail.com; > iommu@lists.linux-foundation.org; linux-ker...@vger.kernel.org; > k...@vger.kernel.org; kvm...@lists.cs.columbia.edu; j...@8bytes.org; > w

Re: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing

2021-12-08 Thread Jon Nettleton
On Wed, Dec 8, 2021 at 1:19 PM Lorenzo Pieralisi wrote: > > On Tue, Oct 12, 2021 at 10:00:24AM +0200, Jon Nettleton wrote: > > On Mon, Oct 11, 2021 at 4:04 PM Robin Murphy wrote: > > > > > > On 2021-10-09 08:06, Jon Nettleton wrote: > > > [...] > > > >>> + if (rmr->flags & IOMMU_RMR_R

Re: [PATCH 3/4] iommu/vt-d: Support PASID DMA for in-kernel usage

2021-12-08 Thread Jason Gunthorpe via iommu
On Tue, Dec 07, 2021 at 05:47:13AM -0800, Jacob Pan wrote: > Between DMA requests with and without PASID (legacy), DMA mapping APIs > are used indiscriminately on a device. Therefore, we should always match > the addressing mode of the legacy DMA when enabling kernel PASID. > > This patch adds sup

Re: [PATCH 4/4] dmaengine: idxd: Use DMA API for in-kernel DMA with PASID

2021-12-08 Thread Jason Gunthorpe via iommu
On Tue, Dec 07, 2021 at 05:47:14AM -0800, Jacob Pan wrote: > In-kernel DMA should be managed by DMA mapping API. The existing kernel > PASID support is based on the SVA machinery in SVA lib that is intended > for user process SVA. The binding between a kernel PASID and kernel > mapping has many fla

Re: [PATCH 0/4] Enable PASID for DMA API users

2021-12-08 Thread Jason Gunthorpe via iommu
On Tue, Dec 07, 2021 at 05:47:10AM -0800, Jacob Pan wrote: > Modern accelerators such as Intel's Data Streaming Accelerator (DSA) can > perform DMA requests with PASID, which is a finer granularity than the > device's requester ID(RID). In fact, work submissions on DSA shared work > queues require

Re: [RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-12-08 Thread Jason Gunthorpe via iommu
On Wed, Dec 08, 2021 at 08:33:33AM +0100, Eric Auger wrote: > Hi Baolu, > > On 12/8/21 3:44 AM, Lu Baolu wrote: > > Hi Eric, > > > > On 12/7/21 6:22 PM, Eric Auger wrote: > >> On 12/6/21 11:48 AM, Joerg Roedel wrote: > >>> On Wed, Oct 27, 2021 at 12:44:20PM +0200, Eric Auger wrote: > Signed-o

Re: [PATCH v7 2/9] ACPI/IORT: Add support for RMR node parsing

2021-12-08 Thread Lorenzo Pieralisi
On Tue, Oct 12, 2021 at 10:00:24AM +0200, Jon Nettleton wrote: > On Mon, Oct 11, 2021 at 4:04 PM Robin Murphy wrote: > > > > On 2021-10-09 08:06, Jon Nettleton wrote: > > [...] > > >>> + if (rmr->flags & IOMMU_RMR_REMAP_PERMITTED) { > > >>> + type = IOMMU_RESV_DIREC

[PATCH v2 4/5] iommu/mediatek: Add tlb_lock in tlb_flush_all

2021-12-08 Thread Dafna Hirschfeld
From: Yong Wu The tlb_flush_all touches the registers controlling tlb operations. Protect it with the tlb_lock spinlock. This also require the range_sync func to release that spinlock before calling tlb_flush_all. Signed-off-by: Yong Wu [refactor commit log] Signed-off-by: Dafna Hirschfeld ---

[PATCH v2 0/5] iommu/mediatek: Fix tlb flush logic

2021-12-08 Thread Dafna Hirschfeld
Often devices allocate DMA buffers before they do runtime pm resume. This is the case for example with v4l2 devices where buffers are allocated during 'VIDIOC_REQBUFS` and runtime resume happens later usually during 'VIDIOC_STREAMON'. In such cases the partial tlb flush when allocating will fail si

[PATCH v2 5/5] iommu/mediatek: Always tlb_flush_all when each PM resume

2021-12-08 Thread Dafna Hirschfeld
From: Yong Wu Prepare for 2 HWs that sharing pgtable in different power-domains. When there are 2 M4U HWs, it may has problem in the flush_range in which we get the pm_status via the m4u dev, BUT that function don't reflect the real power-domain status of the HW since there may be other HW also

[PATCH v2 1/5] iommu/mediatek: Remove for_each_m4u in tlb_sync_all

2021-12-08 Thread Dafna Hirschfeld
From: Yong Wu The tlb_sync_all is called from these three functions: a) flush_iotlb_all: it will be called for each a iommu HW. b) tlb_flush_range_sync: it already has for_each_m4u. c) in irq: When IOMMU HW translation fault, Only need flush itself. Thus, No need for_each_m4u in this tlb_sync_al

[PATCH v2 3/5] iommu/mediatek: Remove the power status checking in tlb flush all

2021-12-08 Thread Dafna Hirschfeld
From: Yong Wu To simplify the code, Remove the power status checking in the tlb_flush_all, remove this: if (pm_runtime_get_if_in_use(data->dev) <= 0) continue; The mtk_iommu_tlb_flush_all is called from a) isr b) tlb flush range fail case c) iommu_create_device_direct_mappings In

[PATCH v2 2/5] iommu/mediatek: Always check runtime PM status in tlb flush range callback

2021-12-08 Thread Dafna Hirschfeld
From: Sebastian Reichel In case of v4l2_reqbufs() it is possible, that a TLB flush is done without runtime PM being enabled. In that case the "Partial TLB flush timed out, falling back to full flush" warning is printed. Commit c0b57581b73b ("iommu/mediatek: Add power-domain operation") introduce

Re: [PATCH 1/2] iommu/mediatek: Always tlb_flush_all when each PM resume

2021-12-08 Thread Dafna Hirschfeld
On 08.12.21 11:50, Dafna Hirschfeld wrote: On 07.12.21 10:31, Dafna Hirschfeld wrote: On 27.11.21 04:46, Yong Wu wrote: Hi Dafna, Sorry for reply late. On Mon, 2021-11-22 at 12:43 +0200, Dafna Hirschfeld wrote: From: Yong Wu Prepare for 2 HWs that sharing pgtable in different power-d

Re: [PATCH 1/2] iommu/mediatek: Always tlb_flush_all when each PM resume

2021-12-08 Thread Dafna Hirschfeld
On 07.12.21 10:31, Dafna Hirschfeld wrote: On 27.11.21 04:46, Yong Wu wrote: Hi Dafna, Sorry for reply late. On Mon, 2021-11-22 at 12:43 +0200, Dafna Hirschfeld wrote: From: Yong Wu Prepare for 2 HWs that sharing pgtable in different power-domains. When there are 2 M4U HWs, it may has

Re: [PATCH v3 00/26] KVM: x86: Halt and APICv overhaul

2021-12-08 Thread Paolo Bonzini
On 12/8/21 02:52, Sean Christopherson wrote: Overhaul and cleanup APIC virtualization (Posted Interrupts on Intel VMX, AVIC on AMD SVM) to streamline things as much as possible, remove a bunch of cruft, and document the lurking gotchas along the way. Patch 01 is a fix from Paolo that's already b

[PATCH v7 0/6] iommu/tegra-smmu: Add pagetable mappings to debugfs

2021-12-08 Thread Nicolin Chen via iommu
This series of patches adds a new mappings node to debugfs for tegra-smmu driver. The first five patches are all preparational changes for PATCH-6, based on Thierry's review feedback against v5. Changelog v7: * Added "Acked-by" from Thierry to PATCH1,4,5 * No other changes for PATCH1,3,4,5 * PA

[PATCH v7 1/6] iommu/tegra-smmu: Rename struct iommu_group *group to *grp

2021-12-08 Thread Nicolin Chen via iommu
There are a few structs using "group" for their pointer instances. This gets confusing sometimes. The instance of struct iommu_group is used in local function with an alias "grp", which can separate it from others. So this patch simply renames "group" to "grp" as a cleanup. Acked-by: Thierry Redi

[PATCH v7 6/6] iommu/tegra-smmu: Add pagetable mappings to debugfs

2021-12-08 Thread Nicolin Chen via iommu
This patch dumps all active mapping entries from pagetable to a debugfs directory named "mappings". Attaching an example: [SWGROUP: xusb_host] [as: (id: 5), (attr: R|W|-), (pd_dma: 0x80005000)] { [index: 1023] 0xf0080040 (count: 52) { PTE RANGE | ATTR

[PATCH v7 3/6] iommu/tegra-smmu: Rename struct tegra_smmu_swgroup *group to *swgrp

2021-12-08 Thread Nicolin Chen via iommu
There are both tegra_smmu_swgroup and tegra_smmu_group structs using "group" for their pointer instances. This gets confusing to read the driver sometimes. So this patch renames "group" of struct tegra_smmu_swgroup to "swgrp" as a cleanup. Also renames its "find" function. Note that we already ha

[PATCH v7 4/6] iommu/tegra-smmu: Use swgrp pointer instead of swgroup id

2021-12-08 Thread Nicolin Chen via iommu
This patch changes in struct tegra_smmu_group to use swgrp pointer instead of swgroup, as a preparational change for the "mappings" debugfs feature. Acked-by: Thierry Reding Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 12 1 file changed, 8 insertions(+), 4 deletion

[PATCH v7 2/6] iommu/tegra-smmu: Rename tegra_smmu_find_group to tegra_smmu_find_group_soc

2021-12-08 Thread Nicolin Chen via iommu
The existing function tegra_smmu_find_group really finds group->soc pointer, so naming it "find_group" might not be clear by looking at it alone. This patch renames it to tegra_smmu_group_soc in order to disambiguate the use of "group" in this driver. Signed-off-by: Nicolin Chen --- drivers/iomm

[PATCH v7 5/6] iommu/tegra-smmu: Attach as pointer to tegra_smmu_group

2021-12-08 Thread Nicolin Chen via iommu
This could ease driver to access corresponding as pointer when having tegra_smmu_group pointer only, which can help new mappings debugfs nodes. Also moving tegra_smmu_find_group_soc() upward, for using it in new tegra_smmu_attach_as(); and it's better to have all tegra_smmu_find_* functions togeth