All of lore.kernel.org
 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,
	Pawel Moll <pawel.moll@arm.com>
Subject: Re: [PATCH] virtio_mmio: generation support
Date: Thu, 12 Mar 2015 12:37:49 +1030	[thread overview]
Message-ID: <87y4n3vuh6.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1425593244-18869-1-git-send-email-mst@redhat.com>

"Michael S. Tsirkin" <mst@redhat.com> writes:
> virtio_mmio currently lacks generation support which
> makes multi-byte field access racy.
> Fix by getting the value at offset 0xfc for version 2
> devices. Nothing we can do for version 1, so return
> generation id 0.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> Pawel, you mentioned you have a working virtio 1.0
> hypervisor, can you pls confirm this works correctly?

I've applied this one, but fixed it to compile:

>  drivers/virtio/virtio_mmio.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 0375456..69b2e4d 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -237,6 +237,16 @@ static void vm_set(struct virtio_device *vdev, unsigned offset,
>  	}
>  }
>  
> +static u32 vm_generation(struct virtio_device *vdev)
> +{
> +	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
> +
> +	if (vm_dev->version == 1)
> +		return 0;
> +	else
> +		return readl(vm_dev->base + VIRTIO_MMIO_CONFIG_GENERATION);
> +}
> +
>  static u8 vm_get_status(struct virtio_device *vdev)
>  {
>  	struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
> @@ -503,6 +513,8 @@ static const char *vm_bus_name(struct virtio_device *vdev)
>  static const struct virtio_config_ops virtio_mmio_config_ops = {
>  	.get		= vm_get,
>  	.set		= vm_set,
> +	.generation	= vm_generation,
> +	.get_status	= vm_get_status,
>  	.get_status	= vm_get_status,

See the double-assingment of get_status?

Thanks,
Rusty.
PS.  Sorry, that *does* actually compile.  I wish it didn't though...

  parent reply	other threads:[~2015-03-12  3:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 22:09 [PATCH] virtio_mmio: generation support Michael S. Tsirkin
2015-03-09  8:40 ` Michael S. Tsirkin
2015-03-09  8:40   ` Michael S. Tsirkin
2015-03-12  2:07 ` Rusty Russell [this message]
2015-03-23 11:50   ` Pawel Moll
2015-03-23 11:50     ` Pawel Moll
2015-03-12  2:07 ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2015-03-05 22:09 Michael S. Tsirkin

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=87y4n3vuh6.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pawel.moll@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.