All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	Kirti Wankhede <kwankhede@nvidia.com>,
	ashok.raj@intel.com, sanjay.k.kumar@intel.com,
	jacob.jun.pan@intel.com, kevin.tian@intel.com,
	Jean-Philippe Brucker <jean-philippe.brucker@arm.com>,
	yi.l.liu@intel.com, yi.y.sun@intel.com, peterx@redhat.com,
	tiwei.bie@intel.com, Zeng@8bytes.org, Xin <xin.zeng@intel.com>,
	iommu@lists.linux-foundation.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Jacob Pan <jacob.jun.pan@linux.intel.com>
Subject: Re: [PATCH v5 2/8] iommu/vt-d: Add per-device IOMMU feature ops entries
Date: Fri, 11 Jan 2019 12:16:44 +0100	[thread overview]
Message-ID: <20190111111644.epawu474jdjv4a33@8bytes.org> (raw)
In-Reply-To: <20190110030027.31447-3-baolu.lu@linux.intel.com>

Hi,

this looks a bit confusing to me because I can see no checking whether
the device actually supports scalable mode. More below:

On Thu, Jan 10, 2019 at 11:00:21AM +0800, Lu Baolu wrote:
> +static int intel_iommu_enable_auxd(struct device *dev)
> +{
> +	struct device_domain_info *info;
> +	struct dmar_domain *domain;
> +	unsigned long flags;
> +
> +	if (!scalable_mode_support())
> +		return -ENODEV;
> +
> +	domain = get_valid_domain_for_dev(dev);
> +	if (!domain)
> +		return -ENODEV;
> +
> +	spin_lock_irqsave(&device_domain_lock, flags);
> +	info = dev->archdata.iommu;
> +	info->auxd_enabled = 1;
> +	spin_unlock_irqrestore(&device_domain_lock, flags);
> +
> +	return 0;
> +}

This code sets a flag to mark scalable mode enabled. Doesn't the device
need some handling too, like enabling the PASID capability and all?

> +
> +static bool
> +intel_iommu_dev_has_feat(struct device *dev, enum iommu_dev_features feat)
> +{
> +	struct device_domain_info *info = dev->archdata.iommu;
> +
> +	if (feat == IOMMU_DEV_FEAT_AUX)
> +		return scalable_mode_support() && info && info->auxd_enabled;
> +
> +	return false;
> +}

Why is this checking the auxd_enabled flag? The function should just
return whether the device _supports_ scalable mode, not whether it is
enabled.

Regards,

	Joerg

  reply	other threads:[~2019-01-11 11:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10  3:00 [PATCH v5 0/8] vfio/mdev: IOMMU aware mediated device Lu Baolu
     [not found] ` <20190110030027.31447-1-baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2019-01-10  3:00   ` [PATCH v5 1/8] iommu: Add APIs for multiple domains per device Lu Baolu
2019-01-14 11:22     ` Jonathan Cameron
2019-01-14 11:22       ` Jonathan Cameron
2019-01-15  1:33       ` Lu Baolu
2019-01-10  3:00   ` [PATCH v5 2/8] iommu/vt-d: Add per-device IOMMU feature ops entries Lu Baolu
2019-01-11 11:16     ` Joerg Roedel [this message]
2019-01-14  5:30       ` Lu Baolu
2019-01-24  6:47       ` Lu Baolu
2019-01-24 13:20         ` Joerg Roedel
2019-01-10  3:00   ` [PATCH v5 3/8] iommu/vt-d: Move common code out of iommu_attch_device() Lu Baolu
2019-01-14 11:45     ` Jonathan Cameron
2019-01-14 11:45       ` Jonathan Cameron
2019-01-10  3:00   ` [PATCH v5 6/8] vfio/mdev: Add iommu related member in mdev_device Lu Baolu
2019-01-10  3:00   ` [PATCH v5 7/8] vfio/type1: Add domain at(de)taching group helpers Lu Baolu
2019-01-10  3:00 ` [PATCH v5 4/8] iommu/vt-d: Aux-domain specific domain attach/detach Lu Baolu
2019-01-14 12:26   ` Jonathan Cameron
2019-01-14 12:26     ` Jonathan Cameron
2019-01-15  2:10     ` Lu Baolu
2019-01-15 13:31       ` Jonathan Cameron
2019-01-15 13:31         ` Jonathan Cameron
2019-01-10  3:00 ` [PATCH v5 5/8] iommu/vt-d: Return ID associated with an auxiliary domain Lu Baolu
2019-01-10  3:00 ` [PATCH v5 8/8] vfio/type1: Handle different mdev isolation type Lu Baolu

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=20190111111644.epawu474jdjv4a33@8bytes.org \
    --to=joro@8bytes.org \
    --cc=Zeng@8bytes.org \
    --cc=alex.williamson@redhat.com \
    --cc=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@intel.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=jean-philippe.brucker@arm.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterx@redhat.com \
    --cc=sanjay.k.kumar@intel.com \
    --cc=tiwei.bie@intel.com \
    --cc=xin.zeng@intel.com \
    --cc=yi.l.liu@intel.com \
    --cc=yi.y.sun@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.