[PW_SID:1059075] Convert riscv to use the generic iommu page table#1520
[PW_SID:1059075] Convert riscv to use the generic iommu page table#1520linux-riscv-bot wants to merge 7 commits into
Conversation
The RISC-V format is a fairly simple 5 level page table not unlike the x86 one. It has optional support for a single contiguous page size of 64k (16 x 4k). The specification describes a 32-bit format, the general code can support it via a #define but the iommu side implementation has been left off until a user comes. Tested-by: Vincent Chen <vincent.chen@sifive.com> Acked-by: Paul Walmsley <pjw@kernel.org> # arch/riscv Reviewed-by: Tomasz Jeznach <tjeznach@rivosinc.com> Tested-by: Tomasz Jeznach <tjeznach@rivosinc.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
In terms of the iommu subystem the SADE/GADE feature "3.4. IOMMU updating of PTE accessed (A) and dirty (D) updates" is called dirty tracking. There is no reason to enable HW support for this, and the HW cost associated with it, unless dirty tracking is actually enabled through iommufd. It should be a dynamic feature linked to user request. Further, without implementing the read dirty ops the whole thing is pointless. Do not set DC.tc.SADE just because the HW has support for dirty tracking. Tested-by: Vincent Chen <vincent.chen@sifive.com> Acked-by: Paul Walmsley <pjw@kernel.org> # arch/riscv Reviewed-by: Tomasz Jeznach <tjeznach@rivosinc.com> Tested-by: Tomasz Jeznach <tjeznach@rivosinc.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
This is a fairly straightforward conversion of the RISC-V iommu driver to use the generic iommu page table code. Invalidation stays as it is now with the driver pretending to implement simple range based invalidation even though the HW is more like ARM SMMUv3 than AMD where the HW implements a single-PTE based invalidation. Future work to extend the generic invalidate mechanism to support more ARM-like semantics would benefit this driver as well. Delete the existing page table code. Tested-by: Vincent Chen <vincent.chen@sifive.com> Acked-by: Paul Walmsley <pjw@kernel.org> # arch/riscv Reviewed-by: Tomasz Jeznach <tjeznach@rivosinc.com> Tested-by: Tomasz Jeznach <tjeznach@rivosinc.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
This turns on a 64k page size. The "RISC-V IOMMU Architecture Specification" states: 6.4 IOMMU capabilities [..] IOMMU implementations must support the Svnapot standard extension for NAPOT Translation Contiguity. So just switch it on unconditionally. Cc: Xu Lu <luxu.kernel@bytedance.com> Tested-by: Vincent Chen <vincent.chen@sifive.com> Acked-by: Paul Walmsley <pjw@kernel.org> # arch/riscv Reviewed-by: Tomasz Jeznach <tjeznach@rivosinc.com> Tested-by: Tomasz Jeznach <tjeznach@rivosinc.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The commit below added MSI related calls to the driver that depends on GENERIC_MSI_IRQ. It is possible to build RISC-V without this selected. This is also necessary to make the driver COMPILE_TEST. Fixes: d5f88ac ("iommu/riscv: Add support for platform msi") Tested-by: Vincent Chen <vincent.chen@sifive.com> Tested-by: Tomasz Jeznach <tjeznach@rivosinc.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
This driver used to use a lot of page table constants from the architecture code which prevented COMPILE_TEST on other architectures. Now that iommupt provides all of the constants internally there are only two small bumps preventing COMPILE_TEST. - Use the generic functions for the riscv specific phys_to_pfn() and pfn_to_phys() - Use CONFIG_MMIOWB to block off the mmiowb() barrier - Require 64 bit because of writeq use failing compilation on 32 bit Tested-by: Vincent Chen <vincent.chen@sifive.com> Acked-by: Paul Walmsley <pjw@kernel.org> # arch/riscv Reviewed-by: Tomasz Jeznach <tjeznach@rivosinc.com> Tested-by: Tomasz Jeznach <tjeznach@rivosinc.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 1: "[v4,1/6] iommupt: Add the RISC-V page table format" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 2: "[v4,2/6] iommu/riscv: Disable SADE" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
|
Patch 6: "[v4,6/6] iommu/riscv: Allow RISC_VIOMMU to COMPILE_TEST" |
7e26e01 to
ba6737c
Compare
ba6737c to
abccef3
Compare
PR for series 1059075 applied to workflow
Name: Convert riscv to use the generic iommu page table
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1059075
Version: 4