virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v4] virtio: new feature to detect IOMMU device quirk
Date: Fri, 29 Jul 2016 00:28:23 +0300	[thread overview]
Message-ID: <20160729001244-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20160728065918.GA22392@infradead.org>

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

      reply	other threads:[~2016-07-28 21:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 22:50 [PATCH v4] virtio: new feature to detect IOMMU device quirk Michael S. Tsirkin
2016-07-28  6:59 ` Christoph Hellwig
2016-07-28 21:28   ` Michael S. Tsirkin [this message]

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=20160729001244-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).