[PATCH v2 2/2] iommu/vt-d: Fix unmap_pages support

2021-11-26 Thread Lu Baolu
From: Alex Williamson When supporting only the .map and .unmap callbacks of iommu_ops, the IOMMU driver can make assumptions about the size and alignment used for mappings based on the driver provided pgsize_bitmap. VT-d previously used essentially PAGE_MASK for this bitmap as any power of two

[PATCH v2 1/2] iommu/vt-d: Fix an unbalanced rcu_read_lock/rcu_read_unlock()

2021-11-26 Thread Lu Baolu
From: Christophe JAILLET If we return -EOPNOTSUPP, the rcu lock remains lock. This is spurious. Go through the end of the function instead. This way, the missing 'rcu_read_unlock()' is called. Fixes: 7afd7f6aa21a ("iommu/vt-d: Check FL and SL capability sanity in scalable mode") Signed-off-by:

[PATCH v2 0/2] iommu/vt-d: Fixes for v5.16-rc3

2021-11-26 Thread Lu Baolu
Hi Joerg, Update this series with a fix for an issue reported by Intel 0-day robot. Sorry for the inconvenience. Best regards, baolu change log: v1: https://lore.kernel.org/all/20211122032458.2549761-1-baolu...@linux.intel.com/ v2: For the patch titled "iommu/vt-d: Fix unmap_pages support",

Re: [PATCH 3/5] hyperv/IOMMU: Enable swiotlb bounce buffer for Isolation VM

2021-11-26 Thread Tianyu Lan
On 11/26/2021 3:40 PM, Christoph Hellwig wrote: On Wed, Nov 17, 2021 at 10:00:08PM +0800, Tianyu Lan wrote: On 11/17/2021 6:01 PM, Christoph Hellwig wrote: This doesn't really have much to do with normal DMA mapping, so why does this direct through the dma ops? According to the previous

Re: [PATCH 2/2] iommu/vt-d: Fix unmap_pages support

2021-11-26 Thread Lu Baolu
On 2021/11/22 11:24, Lu Baolu wrote: From: Alex Williamson When supporting only the .map and .unmap callbacks of iommu_ops, the IOMMU driver can make assumptions about the size and alignment used for mappings based on the driver provided pgsize_bitmap. VT-d previously used essentially

[PATCH] mm: kmemleak: Ignore kmemleak scanning on CMA regions

2021-11-26 Thread Calvin Zhang
Just like this: commit 620951e27457 ("mm/cma: make kmemleak ignore CMA regions"). Add kmemleak_ignore_phys() for CMA created from of reserved node. Signed-off-by: Calvin Zhang --- kernel/dma/contiguous.c | 4 1 file changed, 4 insertions(+) diff --git a/kernel/dma/contiguous.c

Re: [PATCH v2 2/6] hwtracing: Add trace function support for HiSilicon PCIe Tune and Trace device

2021-11-26 Thread Mathieu Poirier
[...] > > > >> + > > >> +#define HISI_PTT_TRACE_DMA_IRQ 0 > > >> +#define HISI_PTT_TRACE_BUFLETS_CNT 4 > > >> +#define HISI_PTT_TRACE_BUFLET_SIZE SZ_4M > > >> +#define HISI_PTT_TRACE_BUFFER_SIZE > > >> (HISI_PTT_TRACE_BUFLET_SIZE * \ > >

[patch 14/37] genirq/msi: Consolidate MSI descriptor data

2021-11-26 Thread Thomas Gleixner
All non PCI/MSI usage variants have data structures in struct msi_desc with only one member: xxx_index. PCI/MSI has a entry_nr member. Add a common msi_index member to struct msi_desc so all implementations can share it which allows further consolidation. Signed-off-by: Thomas Gleixner ---

[patch 16/37] bus: fsl-mc-msi: Use msi_desc::msi_index

2021-11-26 Thread Thomas Gleixner
Use the common msi_index member and get rid of the pointless wrapper struct. Signed-off-by: Thomas Gleixner --- drivers/bus/fsl-mc/fsl-mc-allocator.c |2 +- drivers/bus/fsl-mc/fsl-mc-msi.c |6 +++--- include/linux/msi.h | 10 -- 3 files changed, 4

[patch 15/37] platform-msi: Use msi_desc::msi_index

2021-11-26 Thread Thomas Gleixner
Use the common msi_index member and get rid of the pointless wrapper struct. Signed-off-by: Thomas Gleixner Cc: linux-arm-ker...@lists.infradead.org Cc: iommu@lists.linux-foundation.org Cc: dmaeng...@vger.kernel.org --- drivers/base/platform-msi.c | 10 +-

[patch 17/37] soc: ti: ti_sci_inta_msi: Use msi_desc::msi_index

2021-11-26 Thread Thomas Gleixner
Use the common msi_index member and get rid of the pointless wrapper struct. Signed-off-by: Thomas Gleixner --- drivers/irqchip/irq-ti-sci-inta.c |2 +- drivers/soc/ti/ti_sci_inta_msi.c |6 +++--- include/linux/msi.h | 16 ++-- 3 files changed, 6

[patch 18/37] PCI/MSI: Use msi_desc::msi_index

2021-11-26 Thread Thomas Gleixner
The usage of msi_desc::pci::entry_nr is confusing at best. It's the index into the MSI[X] descriptor table. Use msi_desc::msi_index which is shared between all MSI incarnations instead of having a PCI specific storage for no value. Signed-off-by: Thomas Gleixner ---

[patch 19/37] genirq/msi: Add msi_device_data::properties

2021-11-26 Thread Thomas Gleixner
Add a properties field which allows core code to store information for easy retrieval in order to replace MSI descriptor fiddling. Signed-off-by: Thomas Gleixner --- include/linux/msi.h | 17 + kernel/irq/msi.c| 12 2 files changed, 29 insertions(+) ---

[patch 11/37] genirq/msi: Remove the original sysfs interfaces

2021-11-26 Thread Thomas Gleixner
No more users. Refactor the core code accordingly. Signed-off-by: Thomas Gleixner --- include/linux/msi.h | 12 --- kernel/irq/msi.c| 53 +++- 2 files changed, 20 insertions(+), 45 deletions(-) --- a/include/linux/msi.h +++

[patch 12/37] platform-msi: Rename functions and clarify comments

2021-11-26 Thread Thomas Gleixner
It's hard to distinguish what platform_msi_domain_alloc() and platform_msi_domain_alloc_irqs() are about. Make the distinction more explicit and add comments which explain the use cases properly. Signed-off-by: Thomas Gleixner --- drivers/base/platform-msi.c | 36

[patch 13/37] platform-msi: Store platform private data pointer in msi_device_data

2021-11-26 Thread Thomas Gleixner
Storing the platform private data in a MSI descriptor is sloppy at best. The data belongs to the device and not to the descriptor. Add a pointer to struct msi_device_data and store the pointer there. Signed-off-by: Thomas Gleixner --- drivers/base/platform-msi.c | 79

[patch 26/37] PCI/MSI: Provide MSI_FLAG_MSIX_CONTIGUOUS

2021-11-26 Thread Thomas Gleixner
Provide a domain info flag which makes the core code check for a contiguous MSI-X index on allocation. That's simpler than checking it at some other domain callback in architecture code. Signed-off-by: Thomas Gleixner --- drivers/pci/msi/irqdomain.c | 16 ++-- include/linux/msi.h

[patch 27/37] powerpc/pseries/msi: Let core code check for contiguous entries

2021-11-26 Thread Thomas Gleixner
Set the domain info flag and remove the check. Signed-off-by: Thomas Gleixner --- arch/powerpc/platforms/pseries/msi.c | 32 +--- 1 file changed, 9 insertions(+), 23 deletions(-) --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c

[patch 28/37] genirq/msi: Provide interface to retrieve Linux interrupt number

2021-11-26 Thread Thomas Gleixner
This allows drivers to retrieve the Linux interrupt number instead of fiddling with MSI descriptors. msi_get_virq() returns the Linux interrupt number or 0, __msi_get_virq() has more detailed return codes so pci_irq_vector() can use it as well. Signed-off-by: Thomas Gleixner ---

[patch 29/37] PCI/MSI: Use __msi_get_virq() in pci_get_vector()

2021-11-26 Thread Thomas Gleixner
Use __msi_get_vector() and handle the return values to be compatible. No functional change intended. Signed-off-by: Thomas Gleixner --- drivers/pci/msi/msi.c | 25 + 1 file changed, 5 insertions(+), 20 deletions(-) --- a/drivers/pci/msi/msi.c +++

[patch 30/37] PCI/MSI: Simplify pci_irq_get_affinity()

2021-11-26 Thread Thomas Gleixner
Replace open coded MSI descriptor chasing and use the proper accessor functions instead. Signed-off-by: Thomas Gleixner --- drivers/pci/msi/msi.c | 26 ++ 1 file changed, 10 insertions(+), 16 deletions(-) --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@

[patch 05/37] platform-msi: Allocate MSI device data on first use

2021-11-26 Thread Thomas Gleixner
Allocate the MSI device data on first invocation of the allocation function for platform MSI private data. Signed-off-by: Thomas Gleixner --- drivers/base/platform-msi.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/base/platform-msi.c +++

[patch 00/37] genirq/msi, PCI/MSI: Spring cleaning - Part 2

2021-11-26 Thread Thomas Gleixner
This is the second part of [PCI]MSI refactoring which aims to provide the ability of expanding MSI-X vectors after enabling MSI-X. The first part of this work can be found here: https://lore.kernel.org/r/20211126222700.862407...@linutronix.de This second part has the following important

[patch 04/37] PCI/MSI: Use lock from msi_device_data

2021-11-26 Thread Thomas Gleixner
Remove the register lock from struct device and use the one in struct msi_device_data. Signed-off-by: Thomas Gleixner --- drivers/base/core.c|1 - drivers/pci/msi/msi.c |2 +- include/linux/device.h |2 -- 3 files changed, 1 insertion(+), 4 deletions(-) ---

[patch 06/37] bus: fsl-mc-msi: Allocate MSI device data on first use

2021-11-26 Thread Thomas Gleixner
Allocate the MSI device data on first invocation of the allocation function. Signed-off-by: Thomas Gleixner Cc: Stuart Yoder Cc: Laurentiu Tudor --- drivers/bus/fsl-mc/fsl-mc-msi.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) --- a/drivers/bus/fsl-mc/fsl-mc-msi.c

[patch 07/37] soc: ti: ti_sci_inta_msi: Allocate MSI device data on first use

2021-11-26 Thread Thomas Gleixner
Allocate the MSI device data on first invocation of the allocation function. Signed-off-by: Thomas Gleixner Cc: Nishanth Menon Cc: Tero Kristo Cc: Santosh Shilimkar Cc: linux-arm-ker...@lists.infradead.org --- drivers/soc/ti/ti_sci_inta_msi.c |4 1 file changed, 4 insertions(+) ---

[patch 02/37] device: Add device::msi_data pointer and struct msi_device_data

2021-11-26 Thread Thomas Gleixner
Create struct msi_device_data and add a pointer of that type to struct dev_msi_info, which is part of struct device. Provide an allocator function which can be invoked from the MSI interrupt allocation code pathes. Signed-off-by: Thomas Gleixner --- include/linux/device.h |5 +

[patch 01/37] device: Move MSI related data into a struct

2021-11-26 Thread Thomas Gleixner
The only unconditional part of MSI data in struct device is the irqdomain pointer. Everything else can be allocated on demand. Create a data structure and move the irqdomain pointer into it. The other MSI specific parts are going to be removed from struct device in later steps. Signed-off-by:

[patch 03/37] PCI/MSI: Allocate MSI device data on first use

2021-11-26 Thread Thomas Gleixner
Allocate MSI device data on first use, i.e. when a PCI driver invokes one of the PCI/MSI enablement functions. Signed-off-by: Thomas Gleixner --- drivers/pci/msi/msi.c | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) --- a/drivers/pci/msi/msi.c +++

[patch 20/37] PCI/MSI: Store properties in device::msi::data

2021-11-26 Thread Thomas Gleixner
Store the properties which are interesting for various places so the MSI descriptor fiddling can be removed. Signed-off-by: Thomas Gleixner --- drivers/pci/msi/msi.c |6 ++ 1 file changed, 6 insertions(+) --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -244,6 +244,8 @@

[patch 21/37] x86/pci/XEN: Use device MSI properties

2021-11-26 Thread Thomas Gleixner
instead of fiddling with MSI descriptors. Signed-off-by: Thomas Gleixner --- arch/x86/pci/xen.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) --- a/arch/x86/pci/xen.c +++ b/arch/x86/pci/xen.c @@ -399,9 +399,7 @@ static void xen_teardown_msi_irqs(struct static void

[patch 22/37] x86/apic/msi: Use device MSI properties

2021-11-26 Thread Thomas Gleixner
instead of fiddling with MSI descriptors. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/apic/msi.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c @@ -160,11 +160,8 @@ static struct irq_chip pci_msi_controlle

[patch 23/37] genirq/msi: Use device MSI properties

2021-11-26 Thread Thomas Gleixner
instead of fiddling with MSI descriptors. Signed-off-by: Thomas Gleixner Cc: x...@kernel.org --- kernel/irq/msi.c | 17 ++--- 1 file changed, 2 insertions(+), 15 deletions(-) --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -114,21 +114,8 @@ int msi_setup_device_data(struct

[patch 08/37] genirq/msi: Provide msi_device_populate/destroy_sysfs()

2021-11-26 Thread Thomas Gleixner
Add new allocation functions which can be activated by domain info flags. They store the groups pointer in struct msi_device_data. Signed-off-by: Thomas Gleixner --- include/linux/msi.h | 12 +++- kernel/irq/msi.c| 42 -- 2 files changed,

[patch 09/37] PCI/MSI: Let the irq code handle sysfs groups

2021-11-26 Thread Thomas Gleixner
Set the domain info flag which makes the core code handle sysfs groups and put an explicit invocation into the legacy code. Signed-off-by: Thomas Gleixner --- drivers/pci/msi/irqdomain.c |2 +- drivers/pci/msi/legacy.c|6 +- drivers/pci/msi/msi.c | 23

[patch 10/37] platform-msi: Let the core code handle sysfs groups

2021-11-26 Thread Thomas Gleixner
Set the domain info flag and remove the local sysfs code. Signed-off-by: Thomas Gleixner --- drivers/base/platform-msi.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) --- a/drivers/base/platform-msi.c +++ b/drivers/base/platform-msi.c @@ -23,7 +23,6 @@ struct

[patch 32/37] perf/smmuv3: Use msi_get_virq()

2021-11-26 Thread Thomas Gleixner
Let the core code fiddle with the MSI descriptor retrieval. Signed-off-by: Thomas Gleixner Cc: Mark Rutland Cc: Will Deacon Cc: linux-arm-ker...@lists.infradead.org --- drivers/perf/arm_smmuv3_pmu.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) ---

[patch 33/37] iommu/arm-smmu-v3: Use msi_get_virq()

2021-11-26 Thread Thomas Gleixner
Let the core code fiddle with the MSI descriptor retrieval. Signed-off-by: Thomas Gleixner --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++

[patch 31/37] dmaengine: mv_xor_v2: Get rid of msi_desc abuse

2021-11-26 Thread Thomas Gleixner
Storing a pointer to the MSI descriptor just to keep track of the Linux interrupt number is daft. Use msi_get_virq() instead. Signed-off-by: Thomas Gleixner Cc: dmaeng...@vger.kernel.org Cc: Vinod Koul --- drivers/dma/mv_xor_v2.c | 16 +--- 1 file changed, 5 insertions(+), 11

[patch 34/37] mailbox: bcm-flexrm-mailbox: Rework MSI interrupt handling

2021-11-26 Thread Thomas Gleixner
No point in retrieving the MSI descriptors. Just query the Linux interrupt number. Signed-off-by: Thomas Gleixner --- drivers/mailbox/bcm-flexrm-mailbox.c |7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++

[patch 24/37] powerpc/cell/axon_msi: Use MSI device properties

2021-11-26 Thread Thomas Gleixner
instead of fiddling with MSI descriptors. Signed-off-by: Thomas Gleixner --- arch/powerpc/platforms/cell/axon_msi.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c @@ -199,7 +199,7 @@

[patch 25/37] powerpc/pseries/msi: Use MSI device properties

2021-11-26 Thread Thomas Gleixner
instead of fiddling with MSI descriptors. Signed-off-by: Thomas Gleixner --- arch/powerpc/platforms/pseries/msi.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c @@ -447,9 +447,9 @@ static int

Re: [PATCH v2 0/2] iommu/vt-d: Fixes for v5.16-rc3

2021-11-26 Thread Joerg Roedel
On Fri, Nov 26, 2021 at 09:55:54PM +0800, Lu Baolu wrote: > Update this series with a fix for an issue reported by Intel 0-day > robot. Sorry for the inconvenience. Replaced those with the previous fixes, thanks. Please just send a fix on-top next time. This was already in the published fixes

[patch 36/37] soc: ti: ti_sci_inta_msi: Get rid of ti_sci_inta_msi_get_virq()

2021-11-26 Thread Thomas Gleixner
Just use the core function msi_get_virq(). Signed-off-by: Thomas Gleixner --- drivers/dma/ti/k3-udma-private.c |6 ++ drivers/dma/ti/k3-udma.c | 10 -- drivers/soc/ti/k3-ringacc.c|2 +- drivers/soc/ti/ti_sci_inta_msi.c | 12

[patch 35/37] bus: fsl-mc: fsl-mc-allocator: Rework MSI handling

2021-11-26 Thread Thomas Gleixner
Storing a pointer to the MSI descriptor just to track the Linux interrupt number is daft. Just store the interrupt number and be done with it. Signed-off-by: Thomas Gleixner Cc: Stuart Yoder --- drivers/bus/fsl-mc/dprc-driver.c|8

[patch 37/37] dmaengine: qcom_hidma: Cleanup MSI handling

2021-11-26 Thread Thomas Gleixner
There is no reason to walk the MSI descriptors to retrieve the interrupt number for a device. Use msi_get_virq() instead. Signed-off-by: Thomas Gleixner Cc: Sinan Kaya Cc: dmaeng...@vger.kernel.org --- drivers/dma/qcom/hidma.c | 42 ++ 1 file changed,

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

2021-11-26 Thread Yong Wu
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 problem in the flush_range in > which > we get the pm_status via the m4u

Re: [PATCH 2/2] iommu/mediatek: always check runtime PM status in tlb flush range callback

2021-11-26 Thread Yong Wu
On Mon, 2021-11-22 at 12:44 +0200, Dafna Hirschfeld wrote: > 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. > >

Re: [PATCH v2 0/2] iommu/vt-d: Fixes for v5.16-rc3

2021-11-26 Thread Lu Baolu
On 11/27/21 5:57 AM, Joerg Roedel wrote: On Fri, Nov 26, 2021 at 09:55:54PM +0800, Lu Baolu wrote: Update this series with a fix for an issue reported by Intel 0-day robot. Sorry for the inconvenience. Replaced those with the previous fixes, thanks. Please just send a fix on-top next time.

Re: [PATCH v2 1/5] iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG

2021-11-26 Thread Eric Auger
Hi Jean, On 11/23/21 4:52 PM, Jean-Philippe Brucker wrote: > Add definitions for the VIRTIO_IOMMU_F_BYPASS_CONFIG, which supersedes > VIRTIO_IOMMU_F_BYPASS. > > Reviewed-by: Kevin Tian > Signed-off-by: Jean-Philippe Brucker > --- > include/uapi/linux/virtio_iommu.h | 8 +++- > 1 file