[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200316155641.GN304669@myrica>
Date: Mon, 16 Mar 2020 16:56:41 +0100
From: Jean-Philippe Brucker <jean-philippe@...aro.org>
To: Joerg Roedel <joro@...tes.org>
Cc: iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-mediatek@...ts.infradead.org,
virtualization@...ts.linux-foundation.org,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Hanjun Guo <guohanjun@...wei.com>,
Sudeep Holla <sudeep.holla@....com>,
Rob Clark <robdclark@...il.com>, Sean Paul <sean@...rly.run>,
Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Matthias Brugger <matthias.bgg@...il.com>,
Thierry Reding <thierry.reding@...il.com>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH 14/15] iommu/virtio: Use accessor functions for iommu
private data
On Tue, Mar 10, 2020 at 10:12:28AM +0100, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@...e.de>
>
> Make use of dev_iommu_priv_set/get() functions.
>
> Signed-off-by: Joerg Roedel <jroedel@...e.de>
Reviewed-by: Jean-Philippe Brucker <jean-philippe@...aro.org>
And tested on QEMU
> ---
> drivers/iommu/virtio-iommu.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
> index cce329d71fba..8ead57f031f5 100644
> --- a/drivers/iommu/virtio-iommu.c
> +++ b/drivers/iommu/virtio-iommu.c
> @@ -466,7 +466,7 @@ static int viommu_probe_endpoint(struct viommu_dev *viommu, struct device *dev)
> struct virtio_iommu_req_probe *probe;
> struct virtio_iommu_probe_property *prop;
> struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
> - struct viommu_endpoint *vdev = fwspec->iommu_priv;
> + struct viommu_endpoint *vdev = dev_iommu_priv_get(dev);
>
> if (!fwspec->num_ids)
> return -EINVAL;
> @@ -648,7 +648,7 @@ static int viommu_attach_dev(struct iommu_domain *domain, struct device *dev)
> int ret = 0;
> struct virtio_iommu_req_attach req;
> struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
> - struct viommu_endpoint *vdev = fwspec->iommu_priv;
> + struct viommu_endpoint *vdev = dev_iommu_priv_get(dev);
> struct viommu_domain *vdomain = to_viommu_domain(domain);
>
> mutex_lock(&vdomain->mutex);
> @@ -807,8 +807,7 @@ static void viommu_iotlb_sync(struct iommu_domain *domain,
> static void viommu_get_resv_regions(struct device *dev, struct list_head *head)
> {
> struct iommu_resv_region *entry, *new_entry, *msi = NULL;
> - struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
> - struct viommu_endpoint *vdev = fwspec->iommu_priv;
> + struct viommu_endpoint *vdev = dev_iommu_priv_get(dev);
> int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO;
>
> list_for_each_entry(entry, &vdev->resv_regions, list) {
> @@ -876,7 +875,7 @@ static int viommu_add_device(struct device *dev)
> vdev->dev = dev;
> vdev->viommu = viommu;
> INIT_LIST_HEAD(&vdev->resv_regions);
> - fwspec->iommu_priv = vdev;
> + dev_iommu_priv_set(dev, vdev);
>
> if (viommu->probe_size) {
> /* Get additional information for this endpoint */
> @@ -920,7 +919,7 @@ static void viommu_remove_device(struct device *dev)
> if (!fwspec || fwspec->ops != &viommu_ops)
> return;
>
> - vdev = fwspec->iommu_priv;
> + vdev = dev_iommu_priv_get(dev);
>
> iommu_group_remove_device(dev);
> iommu_device_unlink(&vdev->viommu->iommu, dev);
> --
> 2.17.1
>
Powered by blists - more mailing lists