[GIT PULL] dma-mapping fixes for 5.19

2022-06-05 Thread Christoph Hellwig
[I really wanted to send these before -rc1, but the fact that today is a public holiday here really confused me and messed up my schedule] The following changes since commit 4a37f3dd9a83186cb88d44808ab35b78375082c9: dma-direct: don't over-decrypt memory (2022-05-23 15:25:40 +0200) are availab

[PATCH 4/5] vfio/iommu_type1: Clean up update_dirty_scope in detach_group()

2022-06-05 Thread Nicolin Chen via iommu
All devices in emulated_iommu_groups have pinned_page_dirty_scope set, so the update_dirty_scope in the first list_for_each_entry is always false. Clean it up, and move the "if update_dirty_scope" part from the detach_group_done routine to the domain_list part. Rename the "detach_group_done" goto

[PATCH 5/5] vfio/iommu_type1: Simplify group attachment

2022-06-05 Thread Nicolin Chen via iommu
Un-inline the domain specific logic from the attach/detach_group ops into two paired functions vfio_iommu_alloc_attach_domain() and vfio_iommu_detach_destroy_domain() that strictly deal with creating and destroying struct vfio_domains. Add the logic to check for EMEDIUMTYPE return code of iommu_at

[PATCH 3/5] vfio/iommu_type1: Prefer to reuse domains vs match enforced cache coherency

2022-06-05 Thread Nicolin Chen via iommu
From: Jason Gunthorpe The KVM mechanism for controlling wbinvd is only triggered during kvm_vfio_group_add(), meaning it is a one-shot test done once the devices are setup. So, there is no value in trying to push a device that could do enforced cache coherency to a dedicated domain vs re-using a

[PATCH 2/5] iommu: Ensure device has the same iommu_ops as the domain

2022-06-05 Thread Nicolin Chen via iommu
The core code should not call an iommu driver op with a struct device parameter unless it knows that the dev_iommu_priv_get() for that struct device was setup by the same driver. Otherwise in a mixed driver system the iommu_priv could be casted to the wrong type. Store the iommu_ops pointer in the

[PATCH 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

2022-06-05 Thread Nicolin Chen via iommu
Cases like VFIO wish to attach a device to an existing domain that was not allocated specifically from the device. This raises a condition where the IOMMU driver can fail the domain attach because the domain and device are incompatible with each other. This is a soft failure that can be resolved b

[PATCH 0/5] Simplify vfio_iommu_type1 attach/detach routine

2022-06-05 Thread Nicolin Chen via iommu
This is a preparatory series for IOMMUFD v2 patches. It enforces error code -EMEDIUMTYPE in iommu_attach_device() and iommu_attach_group() when an IOMMU domain and a device/group are incompatible. It also moves the domain->ops check into __iommu_attach_device(). These allow VFIO iommu code to simpl

Re: [PATCH 09/12] iommu/vt-d: Check device list of domain in domain free path

2022-06-05 Thread Baolu Lu
On 2022/6/2 14:29, Tian, Kevin wrote: From: Baolu Lu Sent: Wednesday, June 1, 2022 7:02 PM On 2022/6/1 17:28, Tian, Kevin wrote: From: Lu Baolu Sent: Friday, May 27, 2022 2:30 PM When the IOMMU domain is about to be freed, it should not be set on any device. Instead of silently dealing wit

Re: [PATCH v2 0/9] Add dynamic iommu backed bounce buffers

2022-06-05 Thread David Stevens
On Fri, Jun 3, 2022 at 11:53 PM Niklas Schnelle wrote: > > On Fri, 2022-05-27 at 10:25 +0900, David Stevens wrote: > > On Tue, May 24, 2022 at 9:27 PM Niklas Schnelle > > wrote: > > > On Fri, 2021-08-06 at 19:34 +0900, David Stevens wrote: > > > > From: David Stevens > > > > > > > > This patch

Re: [PATCH 2/6] iommu/qcom: Write TCR before TTBRs to fix ASID access behavior

2022-06-05 Thread Marijn Suijten
On 2022-05-31 16:55:59, Will Deacon wrote: > On Fri, May 27, 2022 at 11:28:57PM +0200, Konrad Dybcio wrote: > > From: AngeloGioacchino Del Regno > > > > As also stated in the arm-smmu driver, we must write the TCR before > > writing the TTBRs, since the TCR determines the access behavior of > > s

Re: [PATCH V4 5/8] dt-bindings: Add xen,grant-dma IOMMU description for xen-grant DMA ops

2022-06-05 Thread Rob Herring
On Thu, 02 Jun 2022 22:23:50 +0300, Oleksandr Tyshchenko wrote: > From: Oleksandr Tyshchenko > > The main purpose of this binding is to communicate Xen specific > information using generic IOMMU device tree bindings (which is > a good fit here) rather than introducing a custom property. > > Intr

Re: [PATCH 1/3] dt-bindings: iommu: mediatek: add binding documentation for MT8365 SoC

2022-06-05 Thread Rob Herring
On Mon, May 30, 2022 at 08:03:26PM +0200, Fabien Parent wrote: > Add IOMMU binding documentation for the MT8365 SoC. > > Signed-off-by: Fabien Parent > --- > .../bindings/iommu/mediatek,iommu.yaml| 2 + > include/dt-bindings/memory/mt8365-larb-port.h | 96 +++ > 2 files