[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b96994da-b3bd-1321-b45f-4c9c1fc4b0c4@linux.intel.com>
Date: Thu, 24 Jan 2019 14:47:39 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Joerg Roedel <joro@...tes.org>
Cc: baolu.lu@...ux.intel.com, David Woodhouse <dwmw2@...radead.org>,
Alex Williamson <alex.williamson@...hat.com>,
Kirti Wankhede <kwankhede@...dia.com>, ashok.raj@...el.com,
sanjay.k.kumar@...el.com, jacob.jun.pan@...el.com,
kevin.tian@...el.com,
Jean-Philippe Brucker <jean-philippe.brucker@....com>,
yi.l.liu@...el.com, yi.y.sun@...el.com, peterx@...hat.com,
tiwei.bie@...el.com, Zeng@...tes.org, Xin <xin.zeng@...el.com>,
iommu@...ts.linux-foundation.org, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jacob Pan <jacob.jun.pan@...ux.intel.com>
Subject: Re: [PATCH v5 2/8] iommu/vt-d: Add per-device IOMMU feature ops
entries
Hi Joerg,
On 1/11/19 7:16 PM, Joerg Roedel wrote:
>> +
>> +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.
Yes, as the API name implies, it should return the device capability
instead of enable/disable status. I misused this API in the IOMMU
driver.
Since we already have iommu_dev_enable/disable_feature() to enable and
disable an iommu specific feature, is it possible to add another API to
query whether a specific feature has been enabled?
How about
bool iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX)?
This is necessary for the third party drivers (like vfio) to determine
which domain attach interface it should use:
if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX))
iommmu_aux_attach_device(domain, dev)
else
iommu_attach_device(domain, dev)
Best regards,
Lu Baolu
Powered by blists - more mailing lists