[PATCH] iommu/iova: Replace cmpxchg with xchg in queue_iova

2020-08-27 Thread Shaokun Zhang
From: Yuqi Jin The performance of the atomic_xchg is better than atomic_cmpxchg because no comparison is required. While the value of @fq_timer_on can only be 0 or 1. Let's use atomic_xchg instead of atomic_cmpxchg here because we only need to check that the value changes from 0 to 1 or from 1

Re: [RESEND PATCH v4] iommu/mediatek: check 4GB mode by reading infracfg

2020-08-27 Thread Matthias Brugger
On 26/08/2020 10:56, Miles Chen wrote: In previous discussion [1] and [2], we found that it is risky to use max_pfn or totalram_pages to tell if 4GB mode is enabled. Check 4GB mode by reading infracfg register, remove the usage of the un-exported symbol max_pfn. This is a step towards

[PATCH v5 1/3] iommu/arm-smmu-v3: replace symbolic permissions by octal permissions for module parameter

2020-08-27 Thread Barry Song
This fixed the below checkpatch issue: WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. 417: FILE: drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:417: module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO); Reviewed-by: Robin Murphy

[PATCH v5 0/3] iommu/arm-smmu-v3: permit users to disable msi polling

2020-08-27 Thread Barry Song
patch 1/3 and patch 2/3 are the preparation of patch 3/3 which permits users to disable MSI-based polling by cmd line. -v5: add Robin's reviewed-by -v4: with respect to Robin's comments * cleanup the code of the existing module parameter disable_bypass * add ARM_SMMU_OPT_MSIPOLL flag. on

[PATCH v5 3/3] iommu/arm-smmu-v3: permit users to disable msi polling

2020-08-27 Thread Barry Song
Polling by MSI isn't necessarily faster than polling by SEV. Tests on hi1620 show hns3 100G NIC network throughput can improve from 25G to 27G if we disable MSI polling while running 16 netperf threads sending UDP packets in size 32KB. TX throughput can improve from 7G to 7.7G for single thread.

[PATCH v5 2/3] iommu/arm-smmu-v3: replace module_param_named by module_param for disable_bypass

2020-08-27 Thread Barry Song
Just use module_param() - going out of the way to specify a "different" name that's identical to the variable name is silly. Reviewed-by: Robin Murphy Signed-off-by: Barry Song --- -v5: add Robin's reviewed-by drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- 1 file changed, 1

Re: [PATCH 8/9] dt-bindings: net: renesas,ravb: Add support for r8a774e1 SoC

2020-08-27 Thread Lad, Prabhakar
Hi David, On Mon, Jul 13, 2020 at 10:36 PM Lad Prabhakar wrote: > > From: Marian-Cristian Rotariu > > Document RZ/G2H (R8A774E1) SoC bindings. > > Signed-off-by: Marian-Cristian Rotariu > > Signed-off-by: Lad Prabhakar > --- > Documentation/devicetree/bindings/net/renesas,ravb.txt | 1 + >

Re: [patch V2 43/46] genirq/msi: Provide and use msi_domain_set_default_info_flags()

2020-08-27 Thread Marc Zyngier
On 2020-08-26 12:17, Thomas Gleixner wrote: MSI interrupts have some common flags which should be set not only for PCI/MSI interrupts. Move the PCI/MSI flag setting into a common function so it can be reused. Signed-off-by: Thomas Gleixner --- V2: New patch --- drivers/pci/msi.c |7

[PATCH] iommu/arm-smmu-v3: add tracepoints for cmdq_issue_cmdlist

2020-08-27 Thread Barry Song
cmdq_issue_cmdlist() is the hotspot that uses a lot of time. This patch adds tracepoints for it to help debug. Signed-off-by: Barry Song --- * can furthermore develop an eBPF program to benchmark using this trace cmdlistlat.c: #include BPF_HASH(start, u32); BPF_HISTOGRAM(dist);

[PATCH v3 1/2] iommu/vt-d:Add support for detecting ACPI device in RMRR

2020-08-27 Thread FelixCuioc
Some ACPI devices need to issue dma requests to access the reserved memory area.BIOS uses the device scope type ACPI_NAMESPACE_DEVICE in RMRR to report these ACPI devices. This patch add support for detecting ACPI devices in RMRR. Signed-off-by: FelixCuioc --- drivers/iommu/intel/dmar.c | 76

[PATCH v3 0/2] Add support for ACPI device in RMRR

2020-08-27 Thread FelixCuioc
BIOS allocate reserved memory ranges that may be DMA targets. BIOS may report each such reserved memory region through the RMRR structures,along with the devices that requires access to the specified reserved memory region. The purpose of this series is to achieve ACPI device in RMRR access

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

2020-08-27 Thread FelixCuioc
After acpi device in RMRR is detected,it is necessary to establish a mapping for these devices. In acpi_device_create_direct_mappings(),create a mapping for the acpi device in RMRR. Add a helper to achieve the acpi namespace device can access the RMRR region. Signed-off-by: FelixCuioc ---

Re: Aw: [PATCH 00/18] Convert arch/arm to use iommu-dma

2020-08-27 Thread Matthias Brugger
On 27/08/2020 14:31, Frank Wunderlich wrote: Tested full series on bananapi r2 (mt7623/mt2701, 5.9-rc1 + hdmi-patches), works so far fbcon+x without issues Tested-by: Frank Wunderlich Thanks for testing. Robin this is especially relevant for: [PATCH 09/18] iommu/mediatek-v1: Add

Aw: [PATCH 00/18] Convert arch/arm to use iommu-dma

2020-08-27 Thread Frank Wunderlich
Tested full series on bananapi r2 (mt7623/mt2701, 5.9-rc1 + hdmi-patches), works so far fbcon+x without issues Tested-by: Frank Wunderlich regards Frank ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH v11 00/11] PCI: brcmstb: enable PCIe for STB chips

2020-08-27 Thread Jim Quinlan via iommu
On Thu, Aug 27, 2020 at 2:35 AM Christoph Hellwig wrote: > > On Tue, Aug 25, 2020 at 10:40:27AM -0700, Florian Fainelli wrote: > > Hi, > > > > On 8/24/2020 12:30 PM, Jim Quinlan wrote: > >> > >> Patchset Summary: > >>Enhance a PCIe host controller driver. Because of its unusual design > >>

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

2020-08-27 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 also benefits the vIOMMU use case where only a single vIOMMU is exposed, hence no RHSA will be present but device numa domain can be correct. Cc: Jacob Pan

Re: [PATCH v11 00/11] PCI: brcmstb: enable PCIe for STB chips

2020-08-27 Thread Christoph Hellwig
On Tue, Aug 25, 2020 at 10:40:27AM -0700, Florian Fainelli wrote: > Hi, > > On 8/24/2020 12:30 PM, Jim Quinlan wrote: >> >> Patchset Summary: >>Enhance a PCIe host controller driver. Because of its unusual design >>we are foced to change dev->dma_pfn_offset into a more general role >>

Re: [patch V2 27/46] x86/xen: Rework MSI teardown

2020-08-27 Thread Jürgen Groß
On 26.08.20 13:16, Thomas Gleixner wrote: From: Thomas Gleixner X86 cannot store the irq domain pointer in struct device without breaking XEN because the irq domain pointer takes precedence over arch_*_msi_irqs() fallbacks. XENs MSI teardown relies on default_teardown_msi_irqs() which invokes

[PATCH] dma-pool: turn the end variable in cma_in_zone into a u64

2020-08-27 Thread Christoph Hellwig
phys_addr_t can be 32-bit, in which case smatch will complain: kernel/dma/pool.c:79 cma_in_zone() warn: always true condition '(end <= 32) == 64)) ?~0:((1 << (32)) - 1))) => (0-u32max <= u32max)' Just turn the variable into a u64 to make the range check valid. Fixes: d7e673ec2c8e

Re: [PATCH 16/18] staging/media/tegra-vde: Clean up IOMMU workaround

2020-08-27 Thread Dmitry Osipenko
24.08.2020 17:01, Robin Murphy пишет: ... >> Robin, thank you very much for the clarifications! >> >> In accordance to yours comments, this patch can't be applied until Tegra >> SMMU will support IOMMU_DOMAIN_IDENTITY and implement def_domain_type() >> callback that returns IOMMU_DOMAIN_IDENTITY

Re: [PATCH v3 0/6] Add virtio-iommu built-in topology

2020-08-27 Thread Jean-Philippe Brucker
On Wed, Aug 26, 2020 at 09:26:02AM -0400, Michael S. Tsirkin wrote: > On Fri, Aug 21, 2020 at 03:15:34PM +0200, Jean-Philippe Brucker wrote: > > Add a topology description to the virtio-iommu driver and enable x86 > > platforms. > > > > Since [v2] we have made some progress on adding ACPI support

Re: [PATCH] dma-pool: Fix an uninitialized variable bug in atomic_pool_expand()

2020-08-27 Thread Christoph Hellwig
Thanks, applied to the dma-mapping for-linux tree. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [patch V2 28/46] x86/xen: Consolidate XEN-MSI init

2020-08-27 Thread Jürgen Groß
On 26.08.20 13:16, Thomas Gleixner wrote: From: Thomas Gleixner X86 cannot store the irq domain pointer in struct device without breaking XEN because the irq domain pointer takes precedence over arch_*_msi_irqs() fallbacks. To achieve this XEN MSI interrupt management needs to be wrapped into

Re: [PATCH 13/18] iommu/tegra: Add IOMMU_DOMAIN_DMA support

2020-08-27 Thread Thierry Reding
On Thu, Aug 20, 2020 at 04:08:32PM +0100, Robin Murphy wrote: > Now that arch/arm is wired up for default domains and iommu-dma, > implement the corresponding driver-side support for DMA domains. > > Signed-off-by: Robin Murphy > --- > drivers/iommu/tegra-smmu.c | 37

Re: [PATCH 16/18] staging/media/tegra-vde: Clean up IOMMU workaround

2020-08-27 Thread Thierry Reding
On Thu, Aug 27, 2020 at 10:05:14AM +0300, Dmitry Osipenko wrote: > 24.08.2020 17:01, Robin Murphy пишет: > ... > >> Robin, thank you very much for the clarifications! > >> > >> In accordance to yours comments, this patch can't be applied until Tegra > >> SMMU will support IOMMU_DOMAIN_IDENTITY and

Re: [PATCH v2 1/9] docs: Document IO Address Space ID (IOASID) APIs

2020-08-27 Thread Auger Eric
Hi Jacob, On 8/24/20 12:32 PM, Jean-Philippe Brucker wrote: > On Fri, Aug 21, 2020 at 09:35:10PM -0700, Jacob Pan wrote: >> IOASID is used to identify address spaces that can be targeted by device >> DMA. It is a system-wide resource that is essential to its many users. >> This document is an

[PATCH v7 3/9] docs: x86: Add documentation for SVA (Shared Virtual Addressing)

2020-08-27 Thread Fenghua Yu
From: Ashok Raj ENQCMD and Data Streaming Accelerator (DSA) and all of their associated features are a complicated stack with lots of interconnected pieces. This documentation provides a big picture overview for all of the features. Signed-off-by: Ashok Raj Co-developed-by: Fenghua Yu

[PATCH v7 0/9] x86: tag application address space for devices

2020-08-27 Thread Fenghua Yu
Typical hardware devices require a driver stack to translate application buffers to hardware addresses, and a kernel-user transition to notify the hardware of new work. What if both the translation and transition overhead could be eliminated? This is what Shared Virtual Address (SVA) and ENQCMD

[PATCH v7 6/9] x86/msr-index: Define IA32_PASID MSR

2020-08-27 Thread Fenghua Yu
The IA32_PASID MSR (0xd93) contains the Process Address Space Identifier (PASID), a 20-bit value. Bit 31 must be set to indicate the value programmed in the MSR is valid. Hardware uses PASID to identify process address space and direct responses to the right address space. Signed-off-by: Fenghua

[PATCH v7 7/9] mm: Define pasid in mm

2020-08-27 Thread Fenghua Yu
PASID is shared by all threads in a process. So the logical place to keep track of it is in the "mm". Both ARM and X86 need to use the PASID in the "mm". Suggested-by: Christoph Hellwig Signed-off-by: Fenghua Yu Reviewed-by: Tony Luck --- v4: - Change PASID type to u32 (Christoph) v3: -

[PATCH v7 5/9] x86/fpu/xstate: Add supervisor PASID state for ENQCMD feature

2020-08-27 Thread Fenghua Yu
From: Yu-cheng Yu ENQCMD instruction reads PASID from IA32_PASID MSR. The MSR is stored in the task's supervisor FPU PASID state and is context switched by XSAVES/XRSTORS. Signed-off-by: Yu-cheng Yu Co-developed-by: Fenghua Yu Signed-off-by: Fenghua Yu Reviewed-by: Tony Luck --- v2: -

[PATCH v7 8/9] x86/cpufeatures: Mark ENQCMD as disabled when configured out

2020-08-27 Thread Fenghua Yu
Currently the ENQCMD feature cannot be used if CONFIG_INTEL_IOMMU_SVM is not set. Add X86_FEATURE_ENQCMD to the disabled features mask. Signed-off-by: Fenghua Yu Reviewed-by: Tony Luck --- v7: - Split this patch from a previous patch. arch/x86/include/asm/disabled-features.h | 9 - 1

[PATCH v7 4/9] x86/cpufeatures: Enumerate ENQCMD and ENQCMDS instructions

2020-08-27 Thread Fenghua Yu
Work submission instruction comes in two flavors. ENQCMD can be called both in ring 3 and ring 0 and always uses the contents of PASID MSR when shipping the command to the device. ENQCMDS allows a kernel driver to submit commands on behalf of a user process. The driver supplies the PASID value in

Re: [PATCH 6/9] dt-bindings: gpio: renesas, rcar-gpio: Add r8a774e1 support

2020-08-27 Thread Lad, Prabhakar
Hi Linus and Bartosz, On Mon, Jul 13, 2020 at 10:35 PM Lad Prabhakar wrote: > > Document Renesas RZ/G2H (R8A774E1) GPIO blocks compatibility within the > relevant dt-bindings. > > Signed-off-by: Lad Prabhakar > --- > Documentation/devicetree/bindings/gpio/renesas,rcar-gpio.yaml | 1 + > 1 file

Re: [patch V2 01/46] iommu/amd: Prevent NULL pointer dereference

2020-08-27 Thread Joerg Roedel
On Wed, Aug 26, 2020 at 01:16:29PM +0200, Thomas Gleixner wrote: > From: Thomas Gleixner > > Dereferencing irq_data before checking it for NULL is suboptimal. > > Signed-off-by: Thomas Gleixner Acked-by: Joerg Roedel Reviewed-by: Joerg Roedel ___

[PATCH v7 2/9] iommu/vt-d: Change flags type to unsigned int in binding mm

2020-08-27 Thread Fenghua Yu
"flags" passed to intel_svm_bind_mm() is a bit mask and should be defined as "unsigned int" instead of "int". Change its type to "unsigned int". Suggested-by: Thomas Gleixner Signed-off-by: Fenghua Yu Reviewed-by: Tony Luck Reviewed-by: Lu Baolu --- v5: - Reviewed by Lu Baolu v2: - Add this

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

2020-08-27 Thread Fenghua Yu
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 PASID values in different binding/unbinding SVM cycles. The mm's PASID (non-zero for valid

[PATCH v7 1/9] iommu: Change type of pasid to u32

2020-08-27 Thread Fenghua Yu
PASID is defined as a few different types in iommu including "int", "u32", and "unsigned int". To be consistent and to match with uapi definitions, define PASID and its variations (e.g. max PASID) as "u32". "u32" is also shorter and a little more explicit than "unsigned int". No PASID type change

Re: [RESEND PATCH v4] iommu/mediatek: check 4GB mode by reading infracfg

2020-08-27 Thread Robin Murphy
On 2020-08-27 06:31, Yong Wu wrote: On Wed, 2020-08-26 at 16:56 +0800, Miles Chen wrote: In previous discussion [1] and [2], we found that it is risky to use max_pfn or totalram_pages to tell if 4GB mode is enabled. Check 4GB mode by reading infracfg register, remove the usage of the

Re: [PATCH] iommu/iova: Replace cmpxchg with xchg in queue_iova

2020-08-27 Thread Robin Murphy
On 2020-08-27 09:43, Shaokun Zhang wrote: From: Yuqi Jin The performance of the atomic_xchg is better than atomic_cmpxchg because no comparison is required. While the value of @fq_timer_on can only be 0 or 1. Let's use atomic_xchg instead of atomic_cmpxchg here because we only need to check

Re: [PATCH 13/18] iommu/tegra: Add IOMMU_DOMAIN_DMA support

2020-08-27 Thread Robin Murphy
On 2020-08-27 16:45, Thierry Reding wrote: On Thu, Aug 20, 2020 at 04:08:32PM +0100, Robin Murphy wrote: Now that arch/arm is wired up for default domains and iommu-dma, implement the corresponding driver-side support for DMA domains. Signed-off-by: Robin Murphy ---

Re: [patch V2 34/46] PCI/MSI: Make arch_.*_msi_irq[s] fallbacks selectable

2020-08-27 Thread Bjorn Helgaas
[+cc Rob, cover https://lore.kernel.org/r/20200826111628.794979...@linutronix.de/ this https://lore.kernel.org/r/20200826112333.992429...@linutronix.de/] On Wed, Aug 26, 2020 at 01:17:02PM +0200, Thomas Gleixner wrote: > From: Thomas Gleixner > > The arch_.*_msi_irq[s] fallbacks are compiled

Re: [PATCH v2 1/1] iommu/vt-d: Serialize IOMMU GCMD register modifications

2020-08-27 Thread Lu Baolu
Hi, On 8/27/20 1:39 PM, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, August 27, 2020 12:25 PM The VT-d spec requires (10.4.4 Global Command Register, GCMD_REG General Description) that: If multiple control fields in this register need to be modified, software must serialize the

[PATCH v3 1/1] iommu/vt-d: Serialize IOMMU GCMD register modifications

2020-08-27 Thread Lu Baolu
The VT-d spec requires (10.4.4 Global Command Register, GCMD_REG General Description) that: If multiple control fields in this register need to be modified, software must serialize the modifications through multiple writes to this register. However, in irq_remapping.c, modifications of IRE and

Re: [patch V2 15/46] x86/irq: Consolidate DMAR irq allocation

2020-08-27 Thread Dey, Megha
Hi Thomas, On 8/26/2020 1:50 PM, Thomas Gleixner wrote: On Wed, Aug 26 2020 at 20:32, Thomas Gleixner wrote: On Wed, Aug 26 2020 at 09:50, Megha Dey wrote: @@ -329,15 +329,15 @@ static struct irq_chip dmar_msi_controll static irq_hw_number_t dmar_msi_get_hwirq(struct msi_domain_info *info,

Re: [patch V2 29/46] irqdomain/msi: Allow to override msi_domain_alloc/free_irqs()

2020-08-27 Thread Dey, Megha
Hi Thomas, On 8/26/2020 4:16 AM, Thomas Gleixner wrote: From: Thomas Gleixner To support MSI irq domains which do not fit at all into the regular MSI irqdomain scheme, like the XEN MSI interrupt management for PV/HVM/DOM0, it's necessary to allow to override the alloc/free implementation.

RE: [PATCH v3 1/1] iommu/vt-d: Serialize IOMMU GCMD register modifications

2020-08-27 Thread Tian, Kevin
> From: Lu Baolu > Sent: Friday, August 28, 2020 8:06 AM > > The VT-d spec requires (10.4.4 Global Command Register, GCMD_REG > General > Description) that: > > If multiple control fields in this register need to be modified, software > must serialize the modifications through multiple writes

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

2020-08-27 Thread Yoshihiro Shimoda
Hi Lad-san, > From: Lad Prabhakar, Sent: Tuesday, August 25, 2020 11:18 PM > > 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 > --- Thank you

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

2020-08-27 Thread Tom Murphy
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) { > > struct sgt_iter s = { .sgp = sgl }; > > > > + if (sgl &&

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

2020-08-27 Thread Logan Gunthorpe
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) { > struct sgt_iter s = { .sgp = sgl }; > > + if (sgl && sg_dma_len(sgl) == 0) > + s.sgp = NULL; > > if (s.sgp)

Re: [PATCH 6/9] dt-bindings: gpio: renesas, rcar-gpio: Add r8a774e1 support

2020-08-27 Thread Bartosz Golaszewski
On Thu, Aug 27, 2020 at 6:40 PM Lad, Prabhakar wrote: > > Hi Linus and Bartosz, > > On Mon, Jul 13, 2020 at 10:35 PM Lad Prabhakar > wrote: > > > > Document Renesas RZ/G2H (R8A774E1) GPIO blocks compatibility within the > > relevant dt-bindings. > > > > Signed-off-by: Lad Prabhakar > > --- > >

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

2020-08-27 Thread Tian, Kevin
> From: Lu Baolu > Sent: Thursday, August 27, 2020 1:57 PM > > 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 also > benefits the vIOMMU use case where only a single vIOMMU is exposed, > hence > no