[PATCH] memory: mtk-smi: Fix a null dereference for the ostd

2021-10-27 Thread Yong Wu
We add the ostd setting for mt8195. It introduces a abort for the previous SoC which doesn't have ostd setting. This is the log: Unable to handle kernel NULL pointer dereference at virtual address 0080 ... pc : mtk_smi_larb_config_port_gen2_general+0x64/0x130 lr :

RE: [RFC 10/20] iommu/iommufd: Add IOMMU_DEVICE_GET_INFO

2021-10-27 Thread Tian, Kevin
> From: Jason Gunthorpe > Sent: Tuesday, October 26, 2021 7:35 AM > > On Fri, Oct 22, 2021 at 03:08:06AM +, Tian, Kevin wrote: > > > > I have no idea what security model makes sense for wbinvd, that is the > > > major question you have to answer. > > > > wbinvd flushes the entire cache in

RE: [RFC] /dev/ioasid uAPI proposal

2021-10-27 Thread Tian, Kevin
> From: Paolo Bonzini > Sent: Wednesday, October 27, 2021 6:32 PM > > On 27/10/21 08:18, Tian, Kevin wrote: > >> I absolutely do *not* want an API that tells KVM to enable WBINVD. This > >> is not up for discussion. > >> > >> But really, let's stop calling the file descriptor a security proof

[PATCH] iommu/dma: fix incorrect error return on iommu deferred attach

2021-10-27 Thread Logan Gunthorpe
scsi_dma_map() was reporting a failure during boot on an AMD machine with the IOMMU enabled. scsi_dma_map failed: request for 36 bytes! The issue was tracked down to a mistake in logic: should not return an error if iommu_deferred_attach() returns zero. Reported-by: Marshall Midden Fixes:

Re: I got an IOMMU IO page fault. What to do now?

2021-10-27 Thread Alex Deucher
On Wed, Oct 27, 2021 at 1:24 PM Alex Deucher wrote: > > On Wed, Oct 27, 2021 at 1:20 PM Robin Murphy wrote: > > > > On 27/10/2021 5:45 pm, Paul Menzel wrote: > > > Dear Robin, > > > > > > > > > On 25.10.21 18:01, Robin Murphy wrote: > > >> On 2021-10-25 12:23, Christian König wrote: > > > > >

Re: I got an IOMMU IO page fault. What to do now?

2021-10-27 Thread Alex Deucher
On Wed, Oct 27, 2021 at 1:20 PM Robin Murphy wrote: > > On 27/10/2021 5:45 pm, Paul Menzel wrote: > > Dear Robin, > > > > > > On 25.10.21 18:01, Robin Murphy wrote: > >> On 2021-10-25 12:23, Christian König wrote: > > > >>> not sure how the IOMMU gives out addresses, but the printed ones look >

Re: I got an IOMMU IO page fault. What to do now?

2021-10-27 Thread Robin Murphy
On 27/10/2021 5:45 pm, Paul Menzel wrote: Dear Robin, On 25.10.21 18:01, Robin Murphy wrote: On 2021-10-25 12:23, Christian König wrote: not sure how the IOMMU gives out addresses, but the printed ones look suspicious to me. Something like we are using an invalid address like -1 or

Re: I got an IOMMU IO page fault. What to do now?

2021-10-27 Thread Paul Menzel
Dear Robin, On 25.10.21 18:01, Robin Murphy wrote: On 2021-10-25 12:23, Christian König wrote: not sure how the IOMMU gives out addresses, but the printed ones look suspicious to me. Something like we are using an invalid address like -1 or similar. FWIW those look like believable DMA

[RFC v16 9/9] iommu/smmuv3: Disallow nested mode in presence of HW MSI regions

2021-10-27 Thread Eric Auger
Nested mode currently is not compatible with HW MSI reserved regions. Indeed MSI transactions targeting those MSI doorbells bypass the SMMU. This would require the guest to also bypass those ranges but the guest has no information about them. Let's check nested mode is not attempted in such

[RFC v16 8/9] iommu/smmuv3: report additional recoverable faults

2021-10-27 Thread Eric Auger
Up to now we have only reported translation faults. Now that the guest can induce some configuration faults, let's report them too. Add propagation for BAD_SUBSTREAMID, CD_FETCH, BAD_CD, WALK_EABT. We also fix the transcoding for some existing translation faults. Signed-off-by: Eric Auger ---

[RFC v16 7/9] iommu/smmuv3: Implement cache_invalidate

2021-10-27 Thread Eric Auger
Implement domain-selective, pasid selective and page-selective IOTLB invalidations. Signed-off-by: Eric Auger --- v15 -> v16: - make sure the range is set (RIL guest) and check the granule size is supported by the physical IOMMU - use cmd_with_sync v14 -> v15: - remove the redundant

[RFC v16 6/9] iommu/smmuv3: Allow stage 1 invalidation with unmanaged ASIDs

2021-10-27 Thread Eric Auger
With nested stage support, soon we will need to invalidate S1 contexts and ranges tagged with an unmanaged asid, this latter being managed by the guest. So let's introduce 2 helpers that allow to invalidate with externally managed ASIDs Signed-off-by: Eric Auger --- v15 -> v16: - Use

[RFC v16 5/9] iommu/smmuv3: Implement attach/detach_pasid_table

2021-10-27 Thread Eric Auger
On attach_pasid_table() we program STE S1 related info set by the guest into the actual physical STEs. At minimum we need to program the context descriptor GPA and compute whether the stage1 is translated/bypassed or aborted. On detach, the stage 1 config is unset and the abort flag is unset.

[RFC v16 4/9] iommu/smmuv3: Get prepared for nested stage support

2021-10-27 Thread Eric Auger
When nested stage translation is setup, both s1_cfg and s2_cfg are set. We introduce a new smmu_domain abort field that will be set upon guest stage1 configuration passing. If no guest stage1 config has been attached, it is ignored when writing the STE. arm_smmu_write_strtab_ent() is modified to

[RFC v16 3/9] iommu/smmuv3: Allow s1 and s2 configs to coexist

2021-10-27 Thread Eric Auger
In true nested mode, both s1_cfg and s2_cfg will coexist. Let's remove the union and add a "set" field in each config structure telling whether the config is set and needs to be applied when writing the STE. In legacy nested mode, only the second stage is used. In true nested mode, both stages are

[RFC v16 2/9] iommu: Introduce iommu_get_nesting

2021-10-27 Thread Eric Auger
Add iommu_get_nesting() which allow to retrieve whether a domain uses nested stages. Signed-off-by: Eric Auger --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 8 drivers/iommu/arm/arm-smmu/arm-smmu.c | 8 drivers/iommu/intel/iommu.c | 13 +

[RFC v16 1/9] iommu: Introduce attach/detach_pasid_table API

2021-10-27 Thread Eric Auger
In virtualization use case, when a guest is assigned a PCI host device, protected by a virtual IOMMU on the guest, the physical IOMMU must be programmed to be consistent with the guest mappings. If the physical IOMMU supports two translation stages it makes sense to program guest mappings onto the

[RFC v16 0/9] SMMUv3 Nested Stage Setup (IOMMU part)

2021-10-27 Thread Eric Auger
This series brings the IOMMU part of HW nested paging support in the SMMUv3. The SMMUv3 driver is adapted to support 2 nested stages. The IOMMU API is extended to convey the guest stage 1 configuration and the hook is implemented in the SMMUv3 driver. This allows the guest to own the stage 1

Re: [RFC] /dev/ioasid uAPI proposal

2021-10-27 Thread Paolo Bonzini
On 27/10/21 08:18, Tian, Kevin wrote: I absolutely do *not* want an API that tells KVM to enable WBINVD. This is not up for discussion. But really, let's stop calling the file descriptor a security proof or a capability. It's overkill; all that we are doing here is kernel acceleration of the

Re: [PATCH 1/5] iova: Move fast alloc size roundup into alloc_iova_fast()

2021-10-27 Thread John Garry
On 11/10/2021 03:06, Jason Wang wrote: On Fri, Sep 24, 2021 at 6:07 PM John Garry wrote: It really is a property of the IOVA rcache code that we need to alloc a power-of-2 size, so relocate the functionality to resize into alloc_iova_fast(), rather than the callsites. Signed-off-by: John

Re: [PATCH] iommu/dart: Initialize DART_STREAMS_ENABLE

2021-10-27 Thread Joerg Roedel
On Tue, Oct 19, 2021 at 06:22:53PM +0200, Sven Peter wrote: > DART has an additional global register to control which streams are > isolated. This register is a bit redundant since DART_TCR can already > be used to control isolation and is usually initialized to DART_STREAM_ALL > by the time we

Re: [GIT PULL] iommu/arm-smmu: Updates for 5.16

2021-10-27 Thread Joerg Roedel
On Tue, Oct 19, 2021 at 01:54:34PM +0100, Will Deacon wrote: > git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git > tags/arm-smmu-updates Pulled, thanks Will. ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH][next] iommu/dma: Use kvcalloc() instead of kvzalloc()

2021-10-27 Thread Joerg Roedel
On Tue, Sep 28, 2021 at 05:22:29PM -0500, Gustavo A. R. Silva wrote: > Use 2-factor argument form kvcalloc() instead of kvzalloc(). > > Link: https://github.com/KSPP/linux/issues/162 > Signed-off-by: Gustavo A. R. Silva > --- > drivers/iommu/dma-iommu.c | 2 +- > 1 file changed, 1 insertion(+),

Re: [PATCH] dma-mapping: Use 'bitmap_zalloc()' when applicable

2021-10-27 Thread Christoph Hellwig
Thanks, applied. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

RE: [RFC] /dev/ioasid uAPI proposal

2021-10-27 Thread Tian, Kevin
Hi, Paolo, > From: Paolo Bonzini > Sent: Wednesday, June 9, 2021 11:21 PM > > On 09/06/21 16:45, Jason Gunthorpe wrote: > > On Wed, Jun 09, 2021 at 08:31:34AM -0600, Alex Williamson wrote: > > > >> If we go back to the wbinvd ioctl mechanism, if I call that ioctl with > >> an ioasidfd that