From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Thomas Huth <thuth@linux.vnet.ibm.com>,
Alexander Graf <agraf@suse.de>,
Stefan Hajnoczi <stefanha@redhat.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
"Chen, Tiejun" <tiejun.chen@intel.com>,
Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v3 17/17] s390: use standard headers
Date: Mon, 16 Feb 2015 22:36:59 +0100 [thread overview]
Message-ID: <1424122283-12521-18-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1424122283-12521-1-git-send-email-mst@redhat.com>
Drop duplicated macros in favor of values from
standard headers.
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/s390x/s390-virtio-bus.h | 36 +++++++++++++++++++-----------------
hw/s390x/s390-virtio.h | 7 ++-----
2 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/hw/s390x/s390-virtio-bus.h b/hw/s390x/s390-virtio-bus.h
index ffd0df7..92aa9d0 100644
--- a/hw/s390x/s390-virtio-bus.h
+++ b/hw/s390x/s390-virtio-bus.h
@@ -19,6 +19,10 @@
#ifndef HW_S390_VIRTIO_BUS_H
#define HW_S390_VIRTIO_BUS_H 1
+#include <stddef.h>
+
+#include "standard-headers/asm-s390/kvm_virtio.h"
+#include "standard-headers/linux/virtio_ring.h"
#include "hw/virtio/virtio-blk.h"
#include "hw/virtio/virtio-net.h"
#include "hw/virtio/virtio-rng.h"
@@ -29,28 +33,26 @@
#include "hw/virtio/vhost-scsi.h"
#endif
-#define VIRTIO_DEV_OFFS_TYPE 0 /* 8 bits */
-#define VIRTIO_DEV_OFFS_NUM_VQ 1 /* 8 bits */
-#define VIRTIO_DEV_OFFS_FEATURE_LEN 2 /* 8 bits */
-#define VIRTIO_DEV_OFFS_CONFIG_LEN 3 /* 8 bits */
-#define VIRTIO_DEV_OFFS_STATUS 4 /* 8 bits */
-#define VIRTIO_DEV_OFFS_CONFIG 5 /* dynamic */
+typedef struct kvm_device_desc KvmDeviceDesc;
+
+#define VIRTIO_DEV_OFFS_TYPE offsetof(KvmDeviceDesc, type)
+#define VIRTIO_DEV_OFFS_NUM_VQ offsetof(KvmDeviceDesc, num_vq)
+#define VIRTIO_DEV_OFFS_FEATURE_LEN offsetof(KvmDeviceDesc, feature_len)
+#define VIRTIO_DEV_OFFS_CONFIG_LEN offsetof(KvmDeviceDesc, config_len)
+#define VIRTIO_DEV_OFFS_STATUS offsetof(KvmDeviceDesc, status)
+#define VIRTIO_DEV_OFFS_CONFIG offsetof(KvmDeviceDesc, config)
-#define VIRTIO_VQCONFIG_OFFS_TOKEN 0 /* 64 bits */
-#define VIRTIO_VQCONFIG_OFFS_ADDRESS 8 /* 64 bits */
-#define VIRTIO_VQCONFIG_OFFS_NUM 16 /* 16 bits */
-#define VIRTIO_VQCONFIG_LEN 24
+typedef struct kvm_vqconfig KvmVqConfig;
+#define VIRTIO_VQCONFIG_OFFS_TOKEN offsetof(KvmVqConfig,token) /* 64 bit */
+#define VIRTIO_VQCONFIG_OFFS_ADDRESS offsetof(KvmVqConfig, address) /* 64 bit */
+#define VIRTIO_VQCONFIG_OFFS_NUM offsetof(KvmVqConfig, num) /* 16 bit */
+#define VIRTIO_VQCONFIG_LEN sizeof(KvmVqConfig)
#define VIRTIO_RING_LEN (TARGET_PAGE_SIZE * 3)
-#define VIRTIO_VRING_AVAIL_IDX_OFFS 2
-#define VIRTIO_VRING_USED_IDX_OFFS 2
+#define VIRTIO_VRING_AVAIL_IDX_OFFS offsetof(struct vring_avail, idx)
+#define VIRTIO_VRING_USED_IDX_OFFS offsetof(struct vring_used, idx)
#define S390_DEVICE_PAGES 512
-#define VIRTIO_PARAM_MASK 0xff
-#define VIRTIO_PARAM_VRING_INTERRUPT 0x0
-#define VIRTIO_PARAM_CONFIG_CHANGED 0x1
-#define VIRTIO_PARAM_DEV_ADD 0x2
-
#define TYPE_VIRTIO_S390_DEVICE "virtio-s390-device"
#define VIRTIO_S390_DEVICE(obj) \
OBJECT_CHECK(VirtIOS390Device, (obj), TYPE_VIRTIO_S390_DEVICE)
diff --git a/hw/s390x/s390-virtio.h b/hw/s390x/s390-virtio.h
index 33847ae..f9d67a8 100644
--- a/hw/s390x/s390-virtio.h
+++ b/hw/s390x/s390-virtio.h
@@ -13,11 +13,8 @@
#define HW_S390_VIRTIO_H 1
#include "hw/nmi.h"
-
-#define KVM_S390_VIRTIO_NOTIFY 0
-#define KVM_S390_VIRTIO_RESET 1
-#define KVM_S390_VIRTIO_SET_STATUS 2
-#define KVM_S390_VIRTIO_CCW_NOTIFY 3
+#include "standard-headers/asm-s390/kvm_virtio.h"
+#include "standard-headers/asm-s390/virtio-ccw.h"
typedef int (*s390_virtio_fn)(const uint64_t *args);
void s390_register_virtio_hypercall(uint64_t code, s390_virtio_fn fn);
--
MST
prev parent reply other threads:[~2015-02-16 21:37 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-16 21:35 [Qemu-devel] [PATCH v3 00/17] virtio: pull headers from linux Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 01/17] scripts/update-linux-headers.sh: pull virtio hdrs Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 02/17] include: import virtio headers from linux 4.0 Michael S. Tsirkin
2015-02-17 12:45 ` Thomas Huth
2015-02-18 15:01 ` Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 03/17] virtio: use standard virtio_ring.h Michael S. Tsirkin
2015-02-17 12:44 ` Thomas Huth
2015-02-18 14:59 ` Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 04/17] virtio: use standard-headers Michael S. Tsirkin
2015-02-17 13:16 ` Thomas Huth
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 05/17] virtio-balloon: use standard headers Michael S. Tsirkin
2015-02-17 13:25 ` Thomas Huth
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 06/17] virtio-9p: " Michael S. Tsirkin
2015-02-17 13:42 ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 07/17] virtio-blk: switch to standard-headers Michael S. Tsirkin
2015-02-18 9:19 ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 08/17] virtio-net, tap: use standard-headers Michael S. Tsirkin
2015-02-18 9:30 ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 09/17] virtio-rng: " Michael S. Tsirkin
2015-02-18 9:32 ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 10/17] virtio-scsi: " Michael S. Tsirkin
2015-02-17 14:13 ` Paolo Bonzini
2015-03-11 10:54 ` Nikunj A Dadhania
2015-03-11 12:03 ` Michael S. Tsirkin
2015-03-11 13:06 ` Nikunj A Dadhania
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 11/17] virtio-serial: switch to standard-headers Michael S. Tsirkin
2015-02-18 14:34 ` Thomas Huth
2015-02-18 14:55 ` Michael S. Tsirkin
2015-02-18 15:36 ` Thomas Huth
2015-02-18 15:41 ` Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 12/17] update-linux-headers: use standard-headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 13/17] linux-headers: " Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 14/17] virtio-pci: use standard headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 15/17] scripts: add arch specific standard-headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 16/17] standard-headers: add s390 virtio headers Michael S. Tsirkin
2015-02-16 21:36 ` 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=1424122283-12521-18-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=agraf@suse.de \
--cc=cornelia.huck@de.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
--cc=thuth@linux.vnet.ibm.com \
--cc=tiejun.chen@intel.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).