[PATCH 1/1] iommu/vt-d: Update the virtual command related registers

2021-07-12 Thread Lu Baolu
The VT-d spec Revision 3.3 updated the virtual command registers, virtual command opcode B register, virtual command response register and virtual command capability register (Section 10.4.43, 10.4.44, 10.4.45, 10.4.46). This updates the virtual command interface implementation in the Intel IOMMU

Re: [PATCH 1/4] iommu/vt-d: Disable superpage for Geminilake igfx

2021-07-12 Thread Lu Baolu
On 7/12/21 11:47 PM, Ville Syrjälä wrote: On Mon, Jul 12, 2021 at 07:23:07AM +0800, Lu Baolu wrote: On 7/10/21 12:47 AM, Ville Syrjala wrote: From: Ville Syrjälä While running "gem_exec_big --r single" from igt-gpu-tools on Geminilake as soon as a 2M mapping is made I tend to get a DMAR write

RE: [RFC v2] /dev/iommu uAPI proposal

2021-07-12 Thread Tian, Kevin
> From: Alex Williamson > Sent: Tuesday, July 13, 2021 2:42 AM > > On Mon, 12 Jul 2021 01:22:11 + > "Tian, Kevin" wrote: > > > From: Alex Williamson > > > Sent: Saturday, July 10, 2021 5:51 AM > > > On Fri, 9 Jul 2021 07:48:44 + > > > "Tian, Kevin" wrote: > > > > > For mdev the

RE: [RFC v2] /dev/iommu uAPI proposal

2021-07-12 Thread Tian, Kevin
> From: Alex Williamson > Sent: Tuesday, July 13, 2021 2:42 AM > > On Mon, 12 Jul 2021 01:22:11 + > "Tian, Kevin" wrote: > > > From: Alex Williamson > > > Sent: Saturday, July 10, 2021 5:51 AM > > > On Fri, 9 Jul 2021 07:48:44 + > > > "Tian, Kevin" wrote: > > > > > For mdev the

Re: [RFC v2] /dev/iommu uAPI proposal

2021-07-12 Thread Alex Williamson
On Mon, 12 Jul 2021 01:22:11 + "Tian, Kevin" wrote: > > From: Alex Williamson > > Sent: Saturday, July 10, 2021 5:51 AM > > On Fri, 9 Jul 2021 07:48:44 + > > "Tian, Kevin" wrote: > > > For mdev the struct device should be the pointer to the parent device. > > > > I don't get how

Re: [PATCH 1/4] iommu/vt-d: Disable superpage for Geminilake igfx

2021-07-12 Thread Ville Syrjälä
On Mon, Jul 12, 2021 at 07:23:07AM +0800, Lu Baolu wrote: > On 7/10/21 12:47 AM, Ville Syrjala wrote: > > From: Ville Syrjälä > > > > While running "gem_exec_big --r single" from igt-gpu-tools on > > Geminilake as soon as a 2M mapping is made I tend to get a DMAR > > write fault. Strangely the

Re: [PATCH] dt-bindings: arm-smmu: Fix json-schema syntax

2021-07-12 Thread Rob Herring
On Tue, Jun 22, 2021 at 11:56 PM Krzysztof Kozlowski wrote: > > On Mon, 21 Jun 2021 16:00:36 +0200, Thierry Reding wrote: > > Commit 4287861dca9d ("dt-bindings: arm-smmu: Add Tegra186 compatible > > string") introduced a jsonschema syntax error as a result of a rebase > > gone wrong. Fix it. > >

Re: [PATCH v15 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing

2021-07-12 Thread Will Deacon
On Tue, Jul 06, 2021 at 12:59:57PM -0400, Konrad Rzeszutek Wilk wrote: > On Tue, Jul 06, 2021 at 05:57:21PM +0100, Will Deacon wrote: > > On Tue, Jul 06, 2021 at 10:46:07AM -0400, Konrad Rzeszutek Wilk wrote: > > > On Tue, Jul 06, 2021 at 04:05:13PM +0200, Christoph Hellwig wrote: > > > > On Tue,

Re: [PATCH v4 3/3] iommu: dart: Add DART iommu driver

2021-07-12 Thread Alyssa Rosenzweig
> > Should we be checking alignment here? Something like > > > > BUG_ON(paddr & ((1 << DART_TTBR_SHIFT) - 1)); > > > > Sure, right now paddr will always be aligned but adding that > BUG_ON doesn't hurt :) Probably should have suggested WARN_ON instead of BUG_ON but yes.

[PATCH v15 6/6] iommu: Remove mode argument from iommu_set_dma_strict()

2021-07-12 Thread John Garry
We only ever now set strict mode enabled in iommu_set_dma_strict(), so just remove the argument. Signed-off-by: John Garry Reviewed-by: Robin Murphy Reviewed-by: Lu Baolu --- drivers/iommu/amd/init.c| 2 +- drivers/iommu/intel/iommu.c | 6 +++--- drivers/iommu/iommu.c | 5 ++---

[PATCH v15 5/6] iommu/amd: Add support for IOMMU default DMA mode build options

2021-07-12 Thread John Garry
From: Zhen Lei Make IOMMU_DEFAULT_LAZY default for when AMD_IOMMU config is set, which matches current behaviour. For "fullflush" param, just call iommu_set_dma_strict(true) directly. Since we get a strict vs lazy mode print already in iommu_subsys_init(), and maintain a deprecation print when

[PATCH v15 4/6] iommu/vt-d: Add support for IOMMU default DMA mode build options

2021-07-12 Thread John Garry
From: Zhen Lei Make IOMMU_DEFAULT_LAZY default for when INTEL_IOMMU config is set, as is current behaviour. Also delete global flag intel_iommu_strict: - In intel_iommu_setup(), call iommu_set_dma_strict(true) directly. Also remove the print, as iommu_subsys_init() prints the mode and we have

[PATCH v15 3/6] iommu: Enhance IOMMU default DMA mode build options

2021-07-12 Thread John Garry
From: Zhen Lei First, add build options IOMMU_DEFAULT_{LAZY|STRICT}, so that we have the opportunity to set {lazy|strict} mode as default at build time. Then put the two config options in an choice, as they are mutually exclusive. [jpg: Make choice between strict and lazy only (and not

[PATCH v15 2/6] iommu: Print strict or lazy mode at init time

2021-07-12 Thread John Garry
As well as the default domain type, it's useful to know whether strict or lazy for DMA domains, so add this info in a separate print. The (stict/lazy) mode may be also set via iommu.strict earlyparm, but this will be processed prior to iommu_subsys_init(), so that print will be accurate for

[PATCH v15 1/6] iommu: Deprecate Intel and AMD cmdline methods to enable strict mode

2021-07-12 Thread John Garry
Now that the x86 drivers support iommu.strict, deprecate the custom methods. Signed-off-by: John Garry Acked-by: Robin Murphy Reviewed-by: Lu Baolu --- Documentation/admin-guide/kernel-parameters.txt | 9 ++--- drivers/iommu/amd/init.c| 4 +++-

[PATCH v15 0/6] iommu: Enhance IOMMU default DMA mode build options

2021-07-12 Thread John Garry
This is a reboot of Zhen Lei's series from a couple of years ago, which never made it across the line. I still think that it has some value, so taking up the mantle. Motivation: Allow lazy mode be default mode for DMA domains for all ARCHs, and not only those who hardcode it (to be lazy). For

Re: [PATCH v4 3/3] iommu: dart: Add DART iommu driver

2021-07-12 Thread Sven Peter via iommu
Hi, On Wed, Jun 30, 2021, at 15:49, Alyssa Rosenzweig wrote: > Looks really good! Just a few minor comments. With them addressed, > > Reviewed-by: Alyssa Rosenzweig Thanks! > > > + Say Y here if you are using an Apple SoC with a DART IOMMU. > > Nit: Do we need to spell out "with

[PATCH v3] iommu/rockchip: Fix physical address decoding

2021-07-12 Thread Benjamin Gaignard
Restore bits 39 to 32 at correct position. It reverses the operation done in rk_dma_addr_dte_v2(). Fixes: c55356c534aa ("iommu: rockchip: Add support for iommu v2") Reported-by: Dan Carpenter Signed-off-by: Benjamin Gaignard --- version 3: - change commit header to match with IOMMU tree

Re: [RFC PATCH V3 08/11] swiotlb: Add bounce buffer remap address setting function

2021-07-12 Thread Tianyu Lan
Hi Christoph and Robin: I introduced new interface set_memory_decrypted_map() to hide all the hypervisor code behind it in the latest version. In current generic code, only swiotlb bounce buffer needs to be decrypted and remapped in the same time and so keep set_memory_decrypted(). If there

[PATCH 5.13 677/800] iommu/amd: Fix extended features logging

2021-07-12 Thread Greg Kroah-Hartman
From: Alexander Monakov [ Upstream commit 4b21a503adf597773e4b37db05db0e9b16a81d53 ] print_iommu_info prints the EFR register and then the decoded list of features on a separate line: pci :00:00.2: AMD-Vi: Extended features (0x206d73ef22254ade): PPR X2APIC NX GT IA GA PC GA_vAPIC The

[PATCH 5.12 591/700] iommu/amd: Fix extended features logging

2021-07-12 Thread Greg Kroah-Hartman
From: Alexander Monakov [ Upstream commit 4b21a503adf597773e4b37db05db0e9b16a81d53 ] print_iommu_info prints the EFR register and then the decoded list of features on a separate line: pci :00:00.2: AMD-Vi: Extended features (0x206d73ef22254ade): PPR X2APIC NX GT IA GA PC GA_vAPIC The

[PATCH 1/1] iommu/vt-d: Fix clearing real DMA device's scalable-mode context entries

2021-07-12 Thread Lu Baolu
The commit 2b0140c69637e ("iommu/vt-d: Use pci_real_dma_dev() for mapping") fixes an issue of "sub-device is removed where the context entry is cleared for all aliases". But this commit didn't consider the PASID entry and PASID table in VT-d scalable mode. This fix increases the coverage of

[PATCH 1/1] iommu/vt-d: Global devTLB flush when present context entry changed

2021-07-12 Thread Lu Baolu
From: Sanjay Kumar This fixes a bug in context cache clear operation. The code was not following the correct invalidation flow. A global device TLB invalidation should be added after the IOTLB invalidation. At the same time, it uses the domain ID from the context entry. But in scalable mode, the

Re: [PATCH 3/9] memory: mtk-smi: Use clk_bulk instead of the clk ops

2021-07-12 Thread Krzysztof Kozlowski
On 11/07/2021 10:29, Yong Wu wrote: > On Thu, 2021-07-08 at 11:32 +0200, Krzysztof Kozlowski wrote: >> On 16/06/2021 13:43, Yong Wu wrote: >>> smi have many clocks: apb/smi/gals. >>> This patch use clk_bulk interface instead of the orginal one to simply >>> the code. >>> >>> gals is optional

[PATCH 5.10 495/593] iommu/amd: Fix extended features logging

2021-07-12 Thread Greg Kroah-Hartman
From: Alexander Monakov [ Upstream commit 4b21a503adf597773e4b37db05db0e9b16a81d53 ] print_iommu_info prints the EFR register and then the decoded list of features on a separate line: pci :00:00.2: AMD-Vi: Extended features (0x206d73ef22254ade): PPR X2APIC NX GT IA GA PC GA_vAPIC The

[PATCH 7/7] hexagon: use the generic global coherent pool

2021-07-12 Thread Christoph Hellwig
Switch hexagon to use the generic code for dma_alloc_coherent from a global pre-filled pool. Signed-off-by: Christoph Hellwig --- arch/hexagon/Kconfig | 1 + arch/hexagon/kernel/dma.c | 57 --- 2 files changed, 12 insertions(+), 46 deletions(-) diff

[PATCH 6/7] dma-mapping: make the global coherent pool conditional

2021-07-12 Thread Christoph Hellwig
Only build the code to support the global coherent pool if support for it is enabled. Signed-off-by: Christoph Hellwig Tested-by: Dillon Min --- include/linux/dma-map-ops.h | 18 +++--- kernel/dma/coherent.c | 47 - 2 files changed, 35

[PATCH 5/7] dma-mapping: add a dma_init_global_coherent helper

2021-07-12 Thread Christoph Hellwig
Add a new helper to initialize the global coherent pool. This both cleans up the existing initialization which indirects through the reserved_mem_ops that are normally only used for struct device, and also allows using the global pool for non-devicetree architectures. Signed-off-by: Christoph

[PATCH 4/7] dma-mapping: simplify dma_init_coherent_memory

2021-07-12 Thread Christoph Hellwig
Return the allocated dma_coherent_mem structure, set the use_dma_pfn_offset and print the failure warning inside of dma_init_coherent_memory instead of leaving that to the callers. Signed-off-by: Christoph Hellwig Tested-by: Dillon Min --- kernel/dma/coherent.c | 78

[PATCH 3/7] dma-mapping: allow using the global coherent pool for !ARM

2021-07-12 Thread Christoph Hellwig
Switch an ifdef so that the global coherent pool is initialized for any architecture that selects the DMA_GLOBAL_POOL symbol insted of hardcoding ARM. Signed-off-by: Christoph Hellwig Tested-by: Dillon Min --- kernel/dma/coherent.c | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH 2/7] ARM/nommu: use the generic dma-direct code for non-coherent devices

2021-07-12 Thread Christoph Hellwig
Select the right options to just use the generic dma-direct code instead of reimplementing it. Signed-off-by: Christoph Hellwig Tested-by: Dillon Min --- arch/arm/Kconfig| 5 +- arch/arm/mm/dma-mapping-nommu.c | 173 ++-- 2 files changed, 9

[PATCH 1/7] dma-direct: add support for dma_coherent_default_memory

2021-07-12 Thread Christoph Hellwig
Add an option to allocate uncached memory for dma_alloc_coherent from the global dma_coherent_default_memory. This will allow to move arm-nommu (and eventually other platforms) to use generic code for allocating uncached memory from a pre-populated pool. Note that this is a different pool from

add support for the global coherent pool to the dma core

2021-07-12 Thread Christoph Hellwig
Hi all, this series adds support for using the global coherent (aka uncached) pool to the generic dma-direct code and then switches arm-nommu and hexagon over to it, together with a bunch of cleanups. Diffstat: arch/arm/Kconfig|5 - arch/arm/mm/dma-mapping-nommu.c | 173