Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2748279ybh; Mon, 16 Mar 2020 08:59:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtjkm8u4fgij353Im47aDrierueBwFZKnhfCzl6krzO9ancSyrO49h+ZBdCVO8AH7R8chKQ X-Received: by 2002:a05:6830:1447:: with SMTP id w7mr23391131otp.267.1584374360078; Mon, 16 Mar 2020 08:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584374360; cv=none; d=google.com; s=arc-20160816; b=MKU5bmuM3NlhOnIbx/mZqQ+kjtZRUWFD1opLaAZ3mam/bqO1yQE/MfN6cywdbbjLx5 wf7yNC3HsNzU42/kybTWF+CpnKrxBY15IPSfbQzhMmNSOkOhFnovdV4un0oKgjxGO2/v iRsSxDXoIeluMF24mIJ88yzqIlDwyYyHZtG8IFztkpK3BD5Z4ZylNTACNLCzu89v8p3+ hhO+A8AzYUdBFZwdlsLygrYIFvgBvohouUO6lGm+IS/0ZkB4/BFQDIpzW1B/ONs6bqHT 0O+1KQgFFxJJJlmARbcpznN/h4jxBmRvglc3cYeA+7Yg/Kaub4szCjY6x5LsWov7iYnH 0yww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=xMvs0/HoidPNJcKREH4cxPQfySQhzOIJtF8I7+UM558=; b=mpLx8toUo5/lQpSLA+BDmdAUI6u6nSm/DPZiLrqEbERokJ80K6Nb4ub5Nx4IaoEkQr kOIDYcCgs7IR0ktr2hJManeUt2xxCrrznIVr7D4QjVMi1Fhah6RecpAhZUG6K8+Cxc51 QSf/OoMDePOVK3dXvl61wQljEEzz/yFzN1xrAIiR34RAVR6ex7QiGaZ/xGZ047cK6hOR x34M84ulxak3JdaVCTLMaT0srQVWo6dEp/GhcIO3YVQWfW8A63tyZqx+C6RYPFIcP265 OvjwiAQ8XfWMkCPxSg//zUZtOp82tqvHeyx65+GlzuWHK7rI8aEYjNGlnU/2IEfzDoqK f8zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uq3aC7rP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 38si149296otu.250.2020.03.16.08.59.07; Mon, 16 Mar 2020 08:59:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uq3aC7rP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731965AbgCPP4x (ORCPT + 99 others); Mon, 16 Mar 2020 11:56:53 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55882 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731687AbgCPP4x (ORCPT ); Mon, 16 Mar 2020 11:56:53 -0400 Received: by mail-wm1-f68.google.com with SMTP id 6so18260800wmi.5 for ; Mon, 16 Mar 2020 08:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xMvs0/HoidPNJcKREH4cxPQfySQhzOIJtF8I7+UM558=; b=uq3aC7rP8Gi0hWD2k9GTvb304Urdg7HWJq+1GajWwKZFGsN2rAJMGURBxedQKUW4jd asGhdTqUUsTBsHFqdt9E3rUbuOPH9LnplZyIROCXZts0Altk+BtOGfxVnQG2zCkEVKBq NAuI2JAjicGhKKjGeoT4CC5ZB2QqLarkq2Zu2k9kjsXdW+uN+BMXxoUU5u4N96yU44fx tCZDJoxX8PkOf/gkX0aCFzGDyygT+xsCtaCtEDXLQvT6XUdDgAn69Z6zXz1IbnDjfIOR mq+n2Ab7QrOC31UPcgX0gGxqUx4OOFYTI0TN6BbHpW3S45c2GIHm7KEYESWZoQ3DPMJV MY7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xMvs0/HoidPNJcKREH4cxPQfySQhzOIJtF8I7+UM558=; b=bA4Sjgs0C9KSLPbSAMwnUeOfqit+GM8egqWMXWtIu1gjgzRfYUahoF/nY8j5PlF63o gSaqmA/MG9SYCaZSeifen8XDtatM6wsYZ06QD1fTb+IdEMCEXERy5kQOVBifJcNsmcvB V5zqHEln3Gk2oDrBAkaQ/4+LDhGClYujs5Ok/226HgbDZvSayOEfp1kpjqO2MXNseBff I38lB4moyk80a4wReZuNCBeaU16+CTpj1QOjkm5zlQs81DZD/OPTsxj1WuLDQjyyHHA0 YMXjYK+LLMqw0IlpdhsYVG6hIBNjg6L19YNSEKCrGl2lnUJ52yc2+w/9xN10kt81m3i0 ZKsQ== X-Gm-Message-State: ANhLgQ0HWSyHWZ8dmc5C5nOvVBHLpGIdNPq7QowJz/tgLNKM5YY9hJTT va8Uo31AkHQPVnrRW6BJSdyzqQ== X-Received: by 2002:a1c:4d13:: with SMTP id o19mr28587408wmh.186.1584374209825; Mon, 16 Mar 2020 08:56:49 -0700 (PDT) Received: from myrica ([2001:171b:226b:54a0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id w16sm531971wrp.8.2020.03.16.08.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 08:56:49 -0700 (PDT) Date: Mon, 16 Mar 2020 16:56:41 +0100 From: Jean-Philippe Brucker To: Joerg Roedel Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, virtualization@lists.linux-foundation.org, Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Rob Clark , Sean Paul , Will Deacon , Robin Murphy , Matthias Brugger , Thierry Reding , Andy Gross , Bjorn Andersson , Joerg Roedel Subject: Re: [PATCH 14/15] iommu/virtio: Use accessor functions for iommu private data Message-ID: <20200316155641.GN304669@myrica> References: <20200310091229.29830-1-joro@8bytes.org> <20200310091229.29830-15-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200310091229.29830-15-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 10, 2020 at 10:12:28AM +0100, Joerg Roedel wrote: > From: Joerg Roedel > > Make use of dev_iommu_priv_set/get() functions. > > Signed-off-by: Joerg Roedel Reviewed-by: Jean-Philippe Brucker 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 >