Re: [PATCH v4] virtio: new feature to detect IOMMU device quirk
From: Michael S. Tsirkin
Date: Thu Jul 28 2016 - 17:28:32 EST
On Wed, Jul 27, 2016 at 11:59:18PM -0700, Christoph Hellwig wrote:
> Again, this is still the wrong way around. A "noiommu" feature is a
> quirk and should not be the default.
Christoph, I'm not sure what you mean by the default here.
We read a register from the device (bit 33 in the feature qword)
and act on it.
The specific register value is 0 on noiommu quirky devices
(it happened to be that way in the past),
and 1 on clean iommu devices.
static bool vring_use_dma_api(struct virtio_device *vdev)
+ if (virtio_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM))
+ return true;
+ /* Otherwise, we are left to guess. */
As a hypothesis, do you object to use of virtio_has_feature?
Yes this might be confusing but in fact that
is just testing a cached register bit: at init time we read it:
device_features = dev->config->get_features(dev);
vdev->features = device_features
return vdev->features & BIT_ULL(fbit);
I'll add a comment clarifying that in the next version.