From: Stefan Hajnoczi <stefanha@gmail.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH v5 1/4] virtio-pci: Rename bugs field to flags
Date: Sun, 12 Dec 2010 15:02:05 +0000 [thread overview]
Message-ID: <1292166128-10874-2-git-send-email-stefanha@linux.vnet.ibm.com> (raw)
In-Reply-To: <1292166128-10874-1-git-send-email-stefanha@linux.vnet.ibm.com>
The VirtIOPCIProxy bugs field is currently used to enable workarounds
for older guests. Rename it to flags so that other per-device behavior
can be tracked.
A later patch uses the flags field to remember whether ioeventfd should
be used for virtqueue host notification.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
hw/virtio-pci.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 6186142..13dd391 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -80,9 +80,8 @@
* 12 is historical, and due to x86 page size. */
#define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12
-/* We can catch some guest bugs inside here so we continue supporting older
- guests. */
-#define VIRTIO_PCI_BUG_BUS_MASTER (1 << 0)
+/* Flags track per-device state like workarounds for quirks in older guests. */
+#define VIRTIO_PCI_FLAG_BUS_MASTER_BUG (1 << 0)
/* QEMU doesn't strictly need write barriers since everything runs in
* lock-step. We'll leave the calls to wmb() in though to make it obvious for
@@ -95,7 +94,7 @@
typedef struct {
PCIDevice pci_dev;
VirtIODevice *vdev;
- uint32_t bugs;
+ uint32_t flags;
uint32_t addr;
uint32_t class_code;
uint32_t nvectors;
@@ -159,7 +158,7 @@ static int virtio_pci_load_config(void * opaque, QEMUFile *f)
in ready state. Then we have a buggy guest OS. */
if ((proxy->vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) &&
!(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {
- proxy->bugs |= VIRTIO_PCI_BUG_BUS_MASTER;
+ proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
}
return 0;
}
@@ -185,7 +184,7 @@ static void virtio_pci_reset(DeviceState *d)
VirtIOPCIProxy *proxy = container_of(d, VirtIOPCIProxy, pci_dev.qdev);
virtio_reset(proxy->vdev);
msix_reset(&proxy->pci_dev);
- proxy->bugs = 0;
+ proxy->flags = 0;
}
static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
@@ -235,7 +234,7 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
some safety checks. */
if ((val & VIRTIO_CONFIG_S_DRIVER_OK) &&
!(proxy->pci_dev.config[PCI_COMMAND] & PCI_COMMAND_MASTER)) {
- proxy->bugs |= VIRTIO_PCI_BUG_BUS_MASTER;
+ proxy->flags |= VIRTIO_PCI_FLAG_BUS_MASTER_BUG;
}
break;
case VIRTIO_MSI_CONFIG_VECTOR:
@@ -403,7 +402,7 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
if (PCI_COMMAND == address) {
if (!(val & PCI_COMMAND_MASTER)) {
- if (!(proxy->bugs & VIRTIO_PCI_BUG_BUS_MASTER)) {
+ if (!(proxy->flags & VIRTIO_PCI_FLAG_BUS_MASTER_BUG)) {
virtio_set_status(proxy->vdev,
proxy->vdev->status & ~VIRTIO_CONFIG_S_DRIVER_OK);
}
--
1.7.2.3
next prev parent reply other threads:[~2010-12-12 15:02 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-12 15:02 [Qemu-devel] [PATCH v5 0/4] virtio: Use ioeventfd for virtqueue notify Stefan Hajnoczi
2010-12-12 15:02 ` Stefan Hajnoczi [this message]
2010-12-12 15:02 ` [Qemu-devel] [PATCH v5 2/4] virtio-pci: " Stefan Hajnoczi
2011-01-24 18:54 ` Kevin Wolf
2011-01-24 19:36 ` Michael S. Tsirkin
2011-01-24 19:48 ` Kevin Wolf
2011-01-24 19:47 ` Michael S. Tsirkin
2011-01-24 20:05 ` Kevin Wolf
2011-01-25 7:12 ` Stefan Hajnoczi
2011-01-25 9:49 ` Stefan Hajnoczi
2011-01-25 9:54 ` Stefan Hajnoczi
2011-01-25 11:27 ` Michael S. Tsirkin
2011-01-25 13:20 ` Stefan Hajnoczi
2011-01-25 14:07 ` Stefan Hajnoczi
2011-01-25 19:18 ` Anthony Liguori
2011-01-25 19:45 ` Stefan Hajnoczi
2011-01-25 19:51 ` Anthony Liguori
2011-01-25 19:59 ` Stefan Hajnoczi
2011-01-26 0:18 ` Anthony Liguori
2010-12-12 15:02 ` [Qemu-devel] [PATCH v5 3/4] virtio-pci: Don't use ioeventfd on old kernels Stefan Hajnoczi
2010-12-12 15:02 ` [Qemu-devel] [PATCH v5 4/4] docs: Document virtio PCI -device ioeventfd=on|off Stefan Hajnoczi
2010-12-12 15:14 ` [Qemu-devel] Re: [PATCH v5 0/4] virtio: Use ioeventfd for virtqueue notify Stefan Hajnoczi
2010-12-12 20:41 ` Michael S. Tsirkin
2010-12-12 20:42 ` Michael S. Tsirkin
2010-12-12 20:56 ` Michael S. Tsirkin
2010-12-12 21:09 ` Michael S. Tsirkin
2010-12-13 10:24 ` Stefan Hajnoczi
2010-12-13 10:38 ` Michael S. Tsirkin
2010-12-13 13:11 ` Stefan Hajnoczi
2010-12-13 13:35 ` Michael S. Tsirkin
2010-12-13 13:36 ` Michael S. Tsirkin
2010-12-13 14:06 ` Stefan Hajnoczi
2010-12-13 15:27 ` Stefan Hajnoczi
2010-12-13 16:00 ` Michael S. Tsirkin
2010-12-13 16:29 ` Stefan Hajnoczi
2010-12-13 16:30 ` Michael S. Tsirkin
2010-12-13 16:12 ` Michael S. Tsirkin
2010-12-13 16:28 ` Stefan Hajnoczi
2010-12-13 17:57 ` Stefan Hajnoczi
2010-12-13 18:52 ` Michael S. Tsirkin
2010-12-15 11:42 ` Stefan Hajnoczi
2010-12-15 11:48 ` Stefan Hajnoczi
2010-12-15 12:00 ` Michael S. Tsirkin
2010-12-15 12:14 ` Michael S. Tsirkin
2010-12-15 12:59 ` Stefan Hajnoczi
2010-12-16 16:40 ` Stefan Hajnoczi
2010-12-16 23:39 ` Michael S. Tsirkin
2010-12-19 14:49 ` Michael S. Tsirkin
2011-01-06 16:41 ` Stefan Hajnoczi
2011-01-06 17:04 ` Michael S. Tsirkin
2011-01-06 18:00 ` Michael S. Tsirkin
2011-01-07 8:56 ` Stefan Hajnoczi
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=1292166128-10874-2-git-send-email-stefanha@linux.vnet.ibm.com \
--to=stefanha@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/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).