Re: [PATCH v7 0/5] Add Intel IOMMU debugfs support

2018-02-21 Thread Yves-Alexis Perez
On Tue, 2018-02-20 at 14:25 -0800, Jacob Pan wrote: > I didn't know about chipsec but reading the code seems to rely on an > out-of-tree kernel module. I don't think it matches what we need here. Yes good indeed, I had forgot about that. Maybe the userland part is still useful, but there's definit

Re: [PATCH 3/4] iommu/virtio: Add event queue

2018-02-21 Thread kbuild test robot
Hi Jean-Philippe, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.16-rc2 next-20180221] [cannot apply to iommu/next] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url

[PATCH 12/14] drm/msm: Add support for per-instance address spaces

2018-02-21 Thread Jordan Crouse
Add a function to allocate a new pasid from a existing MMU domain and create a per-instance address space. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/msm/msm_drv.h | 3 +++ drivers/gpu/drm/msm/msm_gem_vma.c | 36 +++- 2 files changed, 34 insertions(+),

[PATCH 14/14] drm/msm/a5xx: Support per-instance pagetables

2018-02-21 Thread Jordan Crouse
Add support for per-instance pagetables for 5XX targets. Create a support buffer for preemption to hold the SMMU pagetable information for a preempted ring, enable TTBR1 to support split pagetables and add the necessary PM4 commands to trigger a pagetable switch at the beginning of a user command.

[PATCH 13/14] drm/msm: Support per-instance address spaces

2018-02-21 Thread Jordan Crouse
Create a per-instance address spaces when a new DRM file instance is opened assuming the target supports it and the underlying infrastructure exists. If the operation is unsupported fall back quietly to use the global pagetable. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/msm/msm_drv.c | 31

[PATCH 07/14] drm/msm: Enable 64 bit mode by default

2018-02-21 Thread Jordan Crouse
A5XX GPUs can be run in either 32 or 64 bit mode. The GPU registers and the microcode use 64 bit virtual addressing in either case but the upper 32 bits are ignored if the GPU is in 32 bit mode. There is no performance disadvantage to remaining in 64 bit mode even if we are only generating 32 bit a

[PATCH 09/14] drm/msm/gpu: Support using TTBR1 for kernel buffer objects

2018-02-21 Thread Jordan Crouse
arm-smmu based targets can support split pagetables (TTBR0/TTBR1). This is most useful for implementing per-instance pagetables so that the "user" pagetable can be swapped out while the "kernel" or "global" pagetable remains entact. if the target specifies a global virtual memory range then try to

[PATCH 11/14] drm/msm: Add support for iommu-sva PASIDs

2018-02-21 Thread Jordan Crouse
The IOMMU core can support creating multiple pagetables for a specific domai and making them available to a client driver that has the means to manage the pagetable itself. PASIDs are unique indexes to a software created pagetable with the same format and characteristics as the parent IOMMU device

[PATCH 04/14] iommu: sva: Add support for pasid allocation

2018-02-21 Thread Jordan Crouse
Some older SMMU implementations that do not have a fully featured PASID model have alternate workarounds for using multiple pagetables. For example, MSM GPUs have logic to automatically switch the user pagetable from hardware by writing the context bank directly. Instead of binding and sharing CPU

[PATCH 10/14] drm/msm: Add msm_mmu features

2018-02-21 Thread Jordan Crouse
Add a few simple support functions to support a bitmask of features that a specific MMU implementation supports. The first feature will be per-instance pagetables coming in the following patch. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/msm/msm_mmu.h | 13 + 1 file changed, 13

[PATCH 06/14] iommu: arm-smmu: Add side-band function to specific pasid callbacks

2018-02-21 Thread Jordan Crouse
Just allowing a client driver to create and manage a a software pasid isn't interesting if the client driver doesn't have enough information about the pagetable to be able to use it. Add a side band function for arm-smmu that lets the client device register pasid operations to pass the relevant pag

[PATCH 08/14] drm/msm: Pass the MMU domain index in struct msm_file_private

2018-02-21 Thread Jordan Crouse
Pass the index of the MMU domain in struct msm_file_private instead of assuming gpu->id throughout the submit path. This clears the way to change ctx->aspace to a per-instance pagetable. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/msm/msm_drv.c| 16 drivers/gpu/drm/

[PATCH 05/14] iommu: arm-smmu: Add pasid implementation

2018-02-21 Thread Jordan Crouse
Add support for allocating and populating pagetables indexed by pasid. Each new pasid is allocated a pagetable with the same parameters and format as the parent domain. Signed-off-by: Jordan Crouse --- drivers/iommu/arm-smmu.c | 148 +-- 1 file changed

[PATCH 02/14] iommu/arm-smmu: Add support for TTBR1

2018-02-21 Thread Jordan Crouse
Allow a SMMU device to opt into allocating a TTBR1 pagetable. The size of the TTBR1 region will be the same as the TTBR0 size with the sign extension bit set on the highest bit in the region unless the upstream size is 49 bits and then the sign-extension bit will be set on the 49th bit. The map/u

[PATCH 03/14] iommu: Create a base struct for io_mm

2018-02-21 Thread Jordan Crouse
In order to support both shared mm sva pagetables as well as io-pgtable backed tables add a base structure to io_mm so that the two styles can share the same idr. Signed-off-by: Jordan Crouse --- drivers/iommu/arm-smmu-v3.c | 8 drivers/iommu/iommu-sva.c | 50

[RFC 00/14] Per-instance pagetables for MSM GPUs

2018-02-21 Thread Jordan Crouse
This is a request for comment for support in the iommu, arm-smmu and MSM GPU driver to support per (GPU) instance pagetables. The general idea behind per-instance pagetables is that each GPU client can have its own pagetable and virtual memory space which prevents malicious or accidental corruptio

[PATCH 01/14] iommu: Add DOMAIN_ATTR_ENABLE_TTBR1

2018-02-21 Thread Jordan Crouse
Add a new domain attribute to enable the TTBR1 pagetable for drivers and devices that support it. This will enabled using a TTBR1 (otherwise known as a "global" or "system" pagetable for devices that support a split pagetable scheme for switching pagetables quickly and safely. Signed-off-by: Jord

Re: [PATCH 1/4] iommu: Add virtio-iommu driver

2018-02-21 Thread kbuild test robot
Hi Jean-Philippe, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.16-rc2 next-20180221] [cannot apply to iommu/next] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url

Re: [PATCH 1/4] iommu: Add virtio-iommu driver

2018-02-21 Thread kbuild test robot
Hi Jean-Philippe, I love your patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v4.16-rc2 next-20180221] [cannot apply to iommu/next] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url

Re: [PATCH] iommu/rockchip: Perform a reset on shutdown

2018-02-21 Thread Robin Murphy
Hi Marc, On 20/02/18 20:25, Marc Zyngier wrote: Trying to do a kexec whilst the iommus are still on is proving to be a challenging exercise. It is terribly unsafe, as we're reusing the memory allocated for the page tables, leading to a likely crash. Let's implement a shutdown method that will a

Re: [PATCH 09/37] iommu/fault: Let handler return a fault response

2018-02-21 Thread Jean-Philippe Brucker
On 20/02/18 23:19, Jacob Pan wrote: > On Mon, 12 Feb 2018 18:33:24 + > Jean-Philippe Brucker wrote: > >> >> +/** >> + * enum page_response_code - Return status of fault handlers, >> telling the IOMMU >> + * driver how to proceed with the fault. >> + * >> + * @IOMMU_FAULT_STATUS_HANDLED: Sto