Re: [PATCH 3/3] iommu/ipmmu-vmsa: Add utlb_offset_base

2019-10-09 Thread Niklas Söderlund
Hi Shimoda-san, Thanks for your patch. On 2019-10-09 17:26:49 +0900, Yoshihiro Shimoda wrote: > Since we will have changed memory mapping of the IPMMU in the future, > this patch adds a utlb_offset_base into struct ipmmu_features > for IMUCTR and IMUASID registers. > No behavior change. > >

[PATCH 1/2] iommu/vt-d: Select PCI_PRI for INTEL_IOMMU_SVM

2019-10-09 Thread Bjorn Helgaas
From: Bjorn Helgaas When CONFIG_INTEL_IOMMU_SVM=y, iommu_enable_dev_iotlb() calls PRI interfaces (pci_reset_pri() and pci_enable_pri()), but those are only implemented when CONFIG_PCI_PRI is enabled. Previously INTEL_IOMMU_SVM selected PCI_PASID but not PCI_PRI, so the state of PCI_PRI depended

[PATCH 2/2] PCI/ATS: Move pci_prg_resp_pasid_required() to CONFIG_PCI_PRI

2019-10-09 Thread Bjorn Helgaas
From: Bjorn Helgaas pci_prg_resp_pasid_required() returns the value of the "PRG Response PASID Required" bit from the PRI capability, but the interface was previously defined under #ifdef CONFIG_PCI_PASID. Move it from CONFIG_PCI_PASID to CONFIG_PCI_PRI so it's with the other PRI-related

[PATCH 0/2] iommu/vt-d: Select PCI_PRI for INTEL_IOMMU_SVM

2019-10-09 Thread Bjorn Helgaas
From: Bjorn Helgaas I think intel-iommu.c depends on CONFIG_AMD_IOMMU in an undesirable way: When CONFIG_INTEL_IOMMU_SVM=y, iommu_enable_dev_iotlb() calls PRI interfaces (pci_reset_pri() and pci_enable_pri()), but those are only implemented when CONFIG_PCI_PRI is enabled. If CONFIG_PCI_PRI is

Re: [PATCH 0/2] iommu/vt-d: Select PCI_PRI for INTEL_IOMMU_SVM

2019-10-09 Thread Jerry Snitselaar
On Wed Oct 09 19, Bjorn Helgaas wrote: From: Bjorn Helgaas I think intel-iommu.c depends on CONFIG_AMD_IOMMU in an undesirable way: When CONFIG_INTEL_IOMMU_SVM=y, iommu_enable_dev_iotlb() calls PRI interfaces (pci_reset_pri() and pci_enable_pri()), but those are only implemented when

Re: [PATCH 1/2] iommu/vt-d: Select PCI_PRI for INTEL_IOMMU_SVM

2019-10-09 Thread Kuppuswamy Sathyanarayanan
On 10/9/19 3:45 PM, Bjorn Helgaas wrote: From: Bjorn Helgaas When CONFIG_INTEL_IOMMU_SVM=y, iommu_enable_dev_iotlb() calls PRI interfaces (pci_reset_pri() and pci_enable_pri()), but those are only implemented when CONFIG_PCI_PRI is enabled. Previously INTEL_IOMMU_SVM selected PCI_PASID but

Re: [PATCH 2/2] PCI/ATS: Move pci_prg_resp_pasid_required() to CONFIG_PCI_PRI

2019-10-09 Thread Kuppuswamy Sathyanarayanan
On 10/9/19 3:45 PM, Bjorn Helgaas wrote: From: Bjorn Helgaas pci_prg_resp_pasid_required() returns the value of the "PRG Response PASID Required" bit from the PRI capability, but the interface was previously defined under #ifdef CONFIG_PCI_PASID. Move it from CONFIG_PCI_PASID to

[PATCH 2/3] PCI/ATS: Remove unnecessary EXPORT_SYMBOL_GPL()

2019-10-09 Thread Bjorn Helgaas
From: Bjorn Helgaas The following functions are only used by the PCI core or by IOMMU drivers that cannot be modular, so there's no need to export them at all: pci_enable_ats() pci_disable_ats() pci_restore_ats_state() pci_ats_queue_depth() pci_ats_page_aligned() pci_enable_pri()

[PATCH 3/3] PCI/ATS: Make pci_restore_pri_state(), pci_restore_pasid_state() private

2019-10-09 Thread Bjorn Helgaas
From: Bjorn Helgaas These interfaces: void pci_restore_pri_state(struct pci_dev *pdev); void pci_restore_pasid_state(struct pci_dev *pdev); are only used in drivers/pci and do not need to be seen by the rest of the kernel. Most them to drivers/pci/pci.h so they're private to the PCI

[PATCH 1/3] PCI/ATS: Remove unused PRI and PASID stubs

2019-10-09 Thread Bjorn Helgaas
From: Bjorn Helgaas The following functions are only used by amd_iommu.c and intel-iommu.c (when CONFIG_INTEL_IOMMU_SVM is enabled). CONFIG_PCI_PRI and CONFIG_PCI_PASID are always defined in those cases, so there's no need for the stubs. pci_enable_pri() pci_disable_pri() pci_reset_pri()

[PATCH 0/3] PCI/ATS: Clean up unnecessary stubs and exports

2019-10-09 Thread Bjorn Helgaas
From: Bjorn Helgaas Most of the ATS/PRI/PASID interfaces are only used by IOMMU drivers that can only be built statically, not as modules. A couple are only used by the PCI core and don't need to be visible outside at all. These are intended to be cleanup only, but let me know if they would

Re: [PATCH 1/3] iommu/amd: Implement dma_[un]map_resource()

2019-10-09 Thread Christoph Hellwig
On Tue, Oct 08, 2019 at 04:18:35PM -0600, Logan Gunthorpe wrote: > From: Kit Chow > > Currently the Intel IOMMU uses the default dma_[un]map_resource() s/Intel/AMD/ ? > +static dma_addr_t map_resource(struct device *dev, phys_addr_t paddr, > + size_t size, enum dma_data_direction

Re: [PATCH v2] iommu/arm-smmu: fix "hang" when games exit

2019-10-09 Thread Robin Murphy
On 2019-10-07 9:49 pm, Rob Clark wrote: From: Rob Clark When games, browser, or anything using a lot of GPU buffers exits, there can be many hundreds or thousands of buffers to unmap and free. If the GPU is otherwise suspended, this can cause arm-smmu to resume/suspend for each buffer,

Re: [PATCH] iommu/mediatek: Move the tlb_sync into tlb_flush

2019-10-09 Thread Tomasz Figa
On Tue, Oct 8, 2019 at 5:09 PM Yong Wu wrote: > > Hi Tomasz, > > Sorry for reply late. > > On Wed, 2019-10-02 at 14:18 +0900, Tomasz Figa wrote: > > Hi Yong, > > > > On Mon, Sep 30, 2019 at 2:42 PM Yong Wu wrote: > > > > > > The commit 4d689b619445 ("iommu/io-pgtable-arm-v7s: Convert to IOMMU

[PATCH 2/3] iommu/ipmmu-vmsa: Calculate context registers' offset instead of a macro

2019-10-09 Thread Yoshihiro Shimoda
Since we will have changed memory mapping of the IPMMU in the future, this patch uses ipmmu_features values instead of a macro to calculate context registers offset. No behavior change. Signed-off-by: Yoshihiro Shimoda --- drivers/iommu/ipmmu-vmsa.c | 27 +++ 1 file

[PATCH 0/3] iommu/ipmmu-vmsa: minor updates

2019-10-09 Thread Yoshihiro Shimoda
This patch series is based on the latest iommu.git / next branch to modify the driver in the future's new hardware. Yoshihiro Shimoda (3): iommu/ipmmu-vmsa: Remove some unused register declarations iommu/ipmmu-vmsa: Calculate context registers' offset instead of a macro

[PATCH 1/3] iommu/ipmmu-vmsa: Remove some unused register declarations

2019-10-09 Thread Yoshihiro Shimoda
To support different registers memory mapping hardware easily in the future, this patch removes some unused register declarations. Signed-off-by: Yoshihiro Shimoda --- drivers/iommu/ipmmu-vmsa.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c

[PATCH 3/3] iommu/ipmmu-vmsa: Add utlb_offset_base

2019-10-09 Thread Yoshihiro Shimoda
Since we will have changed memory mapping of the IPMMU in the future, this patch adds a utlb_offset_base into struct ipmmu_features for IMUCTR and IMUASID registers. No behavior change. Signed-off-by: Yoshihiro Shimoda --- drivers/iommu/ipmmu-vmsa.c | 14 +++--- 1 file changed, 11

Re: [PATCH] iommu/rockchip: don't use platform_get_irq to implicitly count irqs

2019-10-09 Thread Enric Balletbo Serra
Hi, Missatge de Heiko Stuebner del dia dc., 25 de set. 2019 a les 20:44: > > Till now the Rockchip iommu driver walked through the irq list via > platform_get_irq() until it encountered an ENXIO error. With the > recent change to add a central error message, this always results > in such an

[PATCH v2 1/4] iommu/mediatek: Correct the flush_iotlb_all callback

2019-10-09 Thread Yong Wu
Use the correct tlb_flush_all instead of the original one. Fixes: 4d689b619445 ("iommu/io-pgtable-arm-v7s: Convert to IOMMU API TLB sync") Signed-off-by: Yong Wu --- 1. rebase on v5.4-rc1 2. v1:

[PATCH] memory: mtk-smi: Add PM suspend and resume ops

2019-10-09 Thread Yong Wu
In the commit 4f0a1a1ae351 ("memory: mtk-smi: Invoke pm runtime_callback to enable clocks"), we use pm_runtime callback to enable/disable the smi larb clocks. It will cause the larb's clock may not be disabled when suspend. That is because device_prepare will call pm_runtime_get_noresume which

[PATCH v2 3/4] iommu/mediatek: Use writel for TLB range invalidation

2019-10-09 Thread Yong Wu
Use writel for the register F_MMU_INV_RANGE which is for triggering the HW work. We expect all the setting(iova_start/iova_end...) have already been finished before F_MMU_INV_RANGE. Signed-off-by: Anan.Sun Signed-off-by: Yong Wu --- This is a improvement rather than fixing a issue. ---

[PATCH v2 2/4] iommu/mediatek: Move the tlb_sync into tlb_flush

2019-10-09 Thread Yong Wu
The commit 4d689b619445 ("iommu/io-pgtable-arm-v7s: Convert to IOMMU API TLB sync") help move the tlb_sync of unmap from v7s into the iommu framework. It helps add a new function "mtk_iommu_iotlb_sync", But it lacked the dom->pgtlock, then it will cause the variable "tlb_flush_active" may be

[PATCH v2 4/4] iommu/mediatek: Reduce the tlb flush timeout value

2019-10-09 Thread Yong Wu
Reduce the tlb timeout value from 10us to 1000us. the original value is so long that affect the multimedia performance. This is only a minor improvement rather than fixing a issue. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [PATCH] iommu/mediatek: Move the tlb_sync into tlb_flush

2019-10-09 Thread Yong Wu
On Wed, 2019-10-09 at 16:56 +0900, Tomasz Figa wrote: > On Tue, Oct 8, 2019 at 5:09 PM Yong Wu wrote: > > > > Hi Tomasz, > > > > Sorry for reply late. > > > > On Wed, 2019-10-02 at 14:18 +0900, Tomasz Figa wrote: > > > Hi Yong, > > > > > > On Mon, Sep 30, 2019 at 2:42 PM Yong Wu wrote: > > > > >

Re: [PATCH] iommu/mediatek: Move the tlb_sync into tlb_flush

2019-10-09 Thread Tomasz Figa
On Wed, Oct 9, 2019 at 10:38 PM Yong Wu wrote: > > On Wed, 2019-10-09 at 16:56 +0900, Tomasz Figa wrote: > > On Tue, Oct 8, 2019 at 5:09 PM Yong Wu wrote: > > > > > > Hi Tomasz, > > > > > > Sorry for reply late. > > > > > > On Wed, 2019-10-02 at 14:18 +0900, Tomasz Figa wrote: > > > > Hi Yong, >

Re: [PATCH 1/3] iommu/amd: Implement dma_[un]map_resource()

2019-10-09 Thread Logan Gunthorpe
On 2019-10-09 12:57 a.m., Christoph Hellwig wrote: > On Tue, Oct 08, 2019 at 04:18:35PM -0600, Logan Gunthorpe wrote: >> From: Kit Chow >> >> Currently the Intel IOMMU uses the default dma_[un]map_resource() > > s/Intel/AMD/ ? Oops, yes, my mistake. >> +static dma_addr_t map_resource(struct

Re: [PATCH 1/3] iommu/ipmmu-vmsa: Remove some unused register declarations

2019-10-09 Thread Niklas Söderlund
Hi Shimoda-san, Thanks for your patch. On 2019-10-09 17:26:47 +0900, Yoshihiro Shimoda wrote: > To support different registers memory mapping hardware easily > in the future, this patch removes some unused register > declarations. > > Signed-off-by: Yoshihiro Shimoda Reviewed-by: Niklas

Re: [PATCH 2/3] iommu/ipmmu-vmsa: Calculate context registers' offset instead of a macro

2019-10-09 Thread Niklas Söderlund
Hi Shimoda-san, Thanks for your patch. On 2019-10-09 17:26:48 +0900, Yoshihiro Shimoda wrote: > Since we will have changed memory mapping of the IPMMU in the future, > this patch uses ipmmu_features values instead of a macro to > calculate context registers offset. No behavior change. > >