mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 12:09:58 +00:00
libqos: drop duplicated virtio_config.h definitions
Note that VIRTIO_F_ANY_LAYOUT and VIRTIO_F_NOTIFY_ON_EMPTY are bit numbers in virtio_config.h but bit masks in qtest virtio.h. Therefore it's necessary to change users from X to (1u << X). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1462798061-30382-4-git-send-email-stefanha@redhat.com
This commit is contained in:
parent
7ad1e708e6
commit
1373a4c256
@ -10,6 +10,7 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "libqtest.h"
|
||||
#include "libqos/virtio.h"
|
||||
#include "standard-headers/linux/virtio_config.h"
|
||||
|
||||
uint8_t qvirtio_config_readb(const QVirtioBus *bus, QVirtioDevice *d,
|
||||
uint64_t addr)
|
||||
@ -54,28 +55,28 @@ QVirtQueue *qvirtqueue_setup(const QVirtioBus *bus, QVirtioDevice *d,
|
||||
|
||||
void qvirtio_reset(const QVirtioBus *bus, QVirtioDevice *d)
|
||||
{
|
||||
bus->set_status(d, QVIRTIO_RESET);
|
||||
g_assert_cmphex(bus->get_status(d), ==, QVIRTIO_RESET);
|
||||
bus->set_status(d, 0);
|
||||
g_assert_cmphex(bus->get_status(d), ==, 0);
|
||||
}
|
||||
|
||||
void qvirtio_set_acknowledge(const QVirtioBus *bus, QVirtioDevice *d)
|
||||
{
|
||||
bus->set_status(d, bus->get_status(d) | QVIRTIO_ACKNOWLEDGE);
|
||||
g_assert_cmphex(bus->get_status(d), ==, QVIRTIO_ACKNOWLEDGE);
|
||||
bus->set_status(d, bus->get_status(d) | VIRTIO_CONFIG_S_ACKNOWLEDGE);
|
||||
g_assert_cmphex(bus->get_status(d), ==, VIRTIO_CONFIG_S_ACKNOWLEDGE);
|
||||
}
|
||||
|
||||
void qvirtio_set_driver(const QVirtioBus *bus, QVirtioDevice *d)
|
||||
{
|
||||
bus->set_status(d, bus->get_status(d) | QVIRTIO_DRIVER);
|
||||
bus->set_status(d, bus->get_status(d) | VIRTIO_CONFIG_S_DRIVER);
|
||||
g_assert_cmphex(bus->get_status(d), ==,
|
||||
QVIRTIO_DRIVER | QVIRTIO_ACKNOWLEDGE);
|
||||
VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_ACKNOWLEDGE);
|
||||
}
|
||||
|
||||
void qvirtio_set_driver_ok(const QVirtioBus *bus, QVirtioDevice *d)
|
||||
{
|
||||
bus->set_status(d, bus->get_status(d) | QVIRTIO_DRIVER_OK);
|
||||
g_assert_cmphex(bus->get_status(d), ==,
|
||||
QVIRTIO_DRIVER_OK | QVIRTIO_DRIVER | QVIRTIO_ACKNOWLEDGE);
|
||||
bus->set_status(d, bus->get_status(d) | VIRTIO_CONFIG_S_DRIVER_OK);
|
||||
g_assert_cmphex(bus->get_status(d), ==, VIRTIO_CONFIG_S_DRIVER_OK |
|
||||
VIRTIO_CONFIG_S_DRIVER | VIRTIO_CONFIG_S_ACKNOWLEDGE);
|
||||
}
|
||||
|
||||
void qvirtio_wait_queue_isr(const QVirtioBus *bus, QVirtioDevice *d,
|
||||
|
@ -12,13 +12,6 @@
|
||||
|
||||
#include "libqos/malloc.h"
|
||||
|
||||
#define QVIRTIO_RESET 0x0
|
||||
#define QVIRTIO_ACKNOWLEDGE 0x1
|
||||
#define QVIRTIO_DRIVER 0x2
|
||||
#define QVIRTIO_DRIVER_OK 0x4
|
||||
|
||||
#define QVIRTIO_F_NOTIFY_ON_EMPTY 0x01000000
|
||||
#define QVIRTIO_F_ANY_LAYOUT 0x08000000
|
||||
#define QVIRTIO_F_RING_INDIRECT_DESC 0x10000000
|
||||
#define QVIRTIO_F_RING_EVENT_IDX 0x20000000
|
||||
#define QVIRTIO_F_BAD_FEATURE 0x40000000
|
||||
@ -27,8 +20,6 @@
|
||||
#define QVRING_DESC_F_WRITE 0x2
|
||||
#define QVRING_DESC_F_INDIRECT 0x4
|
||||
|
||||
#define QVIRTIO_F_NOTIFY_ON_EMPTY 0x01000000
|
||||
#define QVIRTIO_F_ANY_LAYOUT 0x08000000
|
||||
#define QVIRTIO_F_RING_INDIRECT_DESC 0x10000000
|
||||
#define QVIRTIO_F_RING_EVENT_IDX 0x20000000
|
||||
#define QVIRTIO_F_BAD_FEATURE 0x40000000
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "libqos/malloc-generic.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "standard-headers/linux/virtio_ids.h"
|
||||
#include "standard-headers/linux/virtio_config.h"
|
||||
|
||||
#define QVIRTIO_BLK_F_BARRIER 0x00000001
|
||||
#define QVIRTIO_BLK_F_SIZE_MAX 0x00000002
|
||||
@ -239,7 +240,7 @@ static void test_basic(const QVirtioBus *bus, QVirtioDevice *dev,
|
||||
|
||||
guest_free(alloc, req_addr);
|
||||
|
||||
if (features & QVIRTIO_F_ANY_LAYOUT) {
|
||||
if (features & (1u << VIRTIO_F_ANY_LAYOUT)) {
|
||||
/* Write and read with 2 descriptor layout */
|
||||
/* Write request */
|
||||
req.type = QVIRTIO_BLK_T_OUT;
|
||||
@ -606,7 +607,8 @@ static void pci_idx(void)
|
||||
features = qvirtio_get_features(&qvirtio_pci, &dev->vdev);
|
||||
features = features & ~(QVIRTIO_F_BAD_FEATURE |
|
||||
QVIRTIO_F_RING_INDIRECT_DESC |
|
||||
QVIRTIO_F_NOTIFY_ON_EMPTY | QVIRTIO_BLK_F_SCSI);
|
||||
(1u << VIRTIO_F_NOTIFY_ON_EMPTY) |
|
||||
QVIRTIO_BLK_F_SCSI);
|
||||
qvirtio_set_features(&qvirtio_pci, &dev->vdev, features);
|
||||
|
||||
vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci, &dev->vdev,
|
||||
|
Loading…
Reference in New Issue
Block a user