virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: "Michael S. Tsirkin" <mst@redhat.com>, linux-kernel@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 6/6] virtio: core support for config generation
Date: Fri, 19 Dec 2014 13:31:53 +1030	[thread overview]
Message-ID: <87mw6ks5pa.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1418678575-31755-7-git-send-email-mst@redhat.com>

"Michael S. Tsirkin" <mst@redhat.com> writes:
> virtio 1.0 spec says:
>
> Drivers MUST NOT assume reads from fields greater than 32 bits wide are
> atomic, nor are reads from multiple fields: drivers SHOULD read device
> configuration space fields like so:
> 	u32 before, after;
> 	do {
> 		before = get_config_generation(device);
> 		// read config entry/entries.
> 		after = get_config_generation(device);
> 	} while (after != before);
>
> Do exactly this, for transports that support it.

>  static inline void virtio_cwrite8(struct virtio_device *vdev,
> @@ -352,6 +375,7 @@ static inline u64 virtio_cread64(struct virtio_device *vdev,
>  {
>  	u64 ret;
>  	vdev->config->get(vdev, offset, &ret, sizeof(ret));
> +	__virtio_cread_many(vdev, offset, &ret, 1, sizeof(ret));
>  	return virtio64_to_cpu(vdev, (__force __virtio64)ret);
>  }

The "vdev->config->get(vdev, offset, &ret, sizeof(ret));" should
be deleted.  Harmless if not, though.

Cheers,
Rusty.

      parent reply	other threads:[~2014-12-19  3:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15 21:23 [PATCH 0/6] virtio 1.0 fixups, tweaks Michael S. Tsirkin
2014-12-15 21:23 ` [PATCH 1/6] virtio: set VIRTIO_CONFIG_S_FEATURES_OK on restore Michael S. Tsirkin
2014-12-15 21:23 ` [PATCH 2/6] virtio_config: fix virtio_cread_bytes Michael S. Tsirkin
2014-12-15 21:23 ` [PATCH 3/6] virtio_pci_common.h: drop VIRTIO_PCI_NO_LEGACY Michael S. Tsirkin
2014-12-15 21:23 ` [PATCH 4/6] virtio_pci: move probe to common file Michael S. Tsirkin
2014-12-15 21:23 ` [PATCH 5/6] virtio_pci: add VIRTIO_PCI_NO_LEGACY Michael S. Tsirkin
2014-12-15 21:23 ` [PATCH 6/6] virtio: core support for config generation Michael S. Tsirkin
2014-12-19  1:26 ` [PATCH 0/6] virtio 1.0 fixups, tweaks Rusty Russell
     [not found] ` <1418678575-31755-7-git-send-email-mst@redhat.com>
2014-12-19  3:01   ` Rusty Russell [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=87mw6ks5pa.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --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).