From: Lu Baolu <baolu.lu@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: baolu.lu@linux.intel.com, 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, 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: Mon, 14 Jan 2019 13:30:28 +0800 [thread overview]
Message-ID: <9fd40493-6140-c4e9-f6c8-fefbe4c33ccd@linux.intel.com> (raw)
In-Reply-To: <20190111111644.epawu474jdjv4a33@8bytes.org>
Hi Joerg,
Thanks for reviewing my patch.
On 1/11/19 7:16 PM, Joerg Roedel wrote:
> Hi,
>
> this looks a bit confusing to me because I can see no checking whether
> the device actually supports scalable mode.
Yes. I should put some checking there. Device scalable mode capability
is exposed in PCI extended capability list.
> 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?
Yes. My design was rough. We should prepare the device for scalable mode
instead of assuming that everything is ready.
>
>> +
>> +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?
We need an API to check whether this feature is enabled. In vfio, it
is used like below,
if (iommu_dev_has_feat(dev, FEAT_AUX_DOMAIN))
iommu_aux_attach_device(dev, domain)
else
iommu_attach_device(dev, domain)
> The function should just
> return whether the device _supports_ scalable mode, not whether it is
> enabled.
Do we want to have an API to tell whether device has aux-domain feature?
It could be included in the enable API. The enable API returns failure
if device doesn't support aux-domain.
>
> Regards,
>
> Joerg
>
Best regards,
Lu Baolu
next prev parent reply other threads:[~2019-01-14 5:30 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
2019-01-14 5:30 ` Lu Baolu [this message]
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=9fd40493-6140-c4e9-f6c8-fefbe4c33ccd@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=alex.williamson@redhat.com \
--cc=ashok.raj@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=joro@8bytes.org \
--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.