public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Baolu Lu <baolu.lu@linux.intel.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] iommu/vt-d: Introduce dev_to_iommu()
Date: Fri, 17 Nov 2023 09:07:56 -0400	[thread overview]
Message-ID: <20231117130756.GA6501@ziepe.ca> (raw)
In-Reply-To: <053e89dd-8de9-43f3-8530-1f65181efd46@linux.intel.com>

On Thu, Nov 16, 2023 at 11:23:56AM +0800, Baolu Lu wrote:
> On 11/16/23 11:19 AM, Tian, Kevin wrote:
> > > From: Lu Baolu <baolu.lu@linux.intel.com>
> > > Sent: Thursday, November 16, 2023 9:51 AM
> > > 
> > > +static inline struct intel_iommu *dev_to_iommu(struct device *dev)
> > > +{
> > > +	/*
> > > +	 * Assume that valid per-device iommu structure must be installed
> > > +	 * if iommu_probe_device() has succeeded. This helper could only
> > > +	 * be used after device is probed.
> > > +	 */
> > > +	return ((struct device_domain_info *)dev_iommu_priv_get(dev))-
> > > > iommu;
> > > +}
> > 
> > Not sure whether this helper is useful. This is only used by 2 out of 5
> > post-probe users. Probably just open-coding in all 5 places is clearer.
> 
> I thought it should get more users in the future development.

The pattern in the SMMUv2 driver is like

  struct device_domain_info *info = dev_iommu_priv_get(dev);
  struct intel_iommu *iommu = info->iommu;

Which really isn't worth the helper, unless you have lots of caes
where info isn't needed at all?

Jason

  reply	other threads:[~2023-11-17 13:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-16  1:50 [PATCH 0/4] iommu/vt-d: Miscellaneous cleanups Lu Baolu
2023-11-16  1:50 ` [PATCH 1/4] iommu/vt-d: Introduce dev_to_iommu() Lu Baolu
2023-11-16  3:19   ` Tian, Kevin
2023-11-16  3:23     ` Baolu Lu
2023-11-17 13:07       ` Jason Gunthorpe [this message]
2023-11-18  2:26         ` Baolu Lu
2023-11-16  1:50 ` [PATCH 2/4] iommu/vt-d: Remove unused parameter of intel_pasid_setup_pass_through() Lu Baolu
2023-11-16  3:19   ` Tian, Kevin
2023-11-16  1:50 ` [PATCH 3/4] iommu/vt-d: Remove unused vcmd interfaces Lu Baolu
2023-11-16  3:21   ` Tian, Kevin
2023-11-16  3:25     ` Baolu Lu
2023-11-16  1:50 ` [PATCH 4/4] iommu/vt-d: Move inline helpers to header files Lu Baolu
2023-11-16  3:21   ` Tian, Kevin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231117130756.GA6501@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox