Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1452121

Re: [PATCH v4] virtio: new feature to detect IOMMU device quirk

From "Michael S. Tsirkin" <mst@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4] virtio: new feature to detect IOMMU device quirk
Date 2016-07-28 23:30 +0200
Message-ID <s012q-3rN-35@gated-at.bofh.it> (permalink)
References <rZFXX-5J0-9@gated-at.bofh.it> <rZNst-2yr-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

and later

            return vdev->features & BIT_ULL(fbit);

I'll add a comment clarifying that in the next version.

-- 
MST

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v4] virtio: new feature to detect IOMMU device quirk "Michael S. Tsirkin" <mst@redhat.com> - 2016-07-28 01:00 +0200
  Re: [PATCH v4] virtio: new feature to detect IOMMU device quirk Christoph Hellwig <hch@infradead.org> - 2016-07-28 09:00 +0200
    Re: [PATCH v4] virtio: new feature to detect IOMMU device quirk "Michael S. Tsirkin" <mst@redhat.com> - 2016-07-28 23:30 +0200

csiph-web