qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: <qemu-devel@nongnu.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
	xen-devel@lists.xenproject.org,
	Stefano Stabellini <sstabellini@kernel.org>,
	Paul Durrant <paul.durrant@citrix.com>
Subject: [Qemu-devel] [PATCH 3/4] xen: Import Xen public headers used by xen-hvm.c
Date: Mon, 17 Jun 2019 16:41:04 +0100	[thread overview]
Message-ID: <20190617154105.32323-4-anthony.perard@citrix.com> (raw)
In-Reply-To: <20190617154105.32323-1-anthony.perard@citrix.com>

Following "xen: Fix build with public headers", import other Xen
public headers that are describing interfaces.

The headers are cleaned up a bit while importing them. The header
guard symbols are changed to match QEMU's coding style, some other
part of the files that QEMU doesn't use are removed.

xen-mapcache.c doesn't needs params.h, so remove the include.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 hw/i386/xen/xen-hvm.c                 |   6 +-
 hw/i386/xen/xen-mapcache.c            |   2 -
 include/hw/xen/interface/hvm/e820.h   |  28 +++++++
 include/hw/xen/interface/hvm/ioreq.h  | 101 ++++++++++++++++++++++++++
 include/hw/xen/interface/hvm/params.h |  33 +++++++++
 5 files changed, 165 insertions(+), 5 deletions(-)
 create mode 100644 include/hw/xen/interface/hvm/e820.h
 create mode 100644 include/hw/xen/interface/hvm/ioreq.h
 create mode 100644 include/hw/xen/interface/hvm/params.h

diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 2939122e7c..725f9c2278 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -26,9 +26,9 @@
 #include "trace.h"
 #include "exec/address-spaces.h"
 
-#include <xen/hvm/ioreq.h>
-#include <xen/hvm/params.h>
-#include <xen/hvm/e820.h>
+#include "hw/xen/interface/hvm/ioreq.h"
+#include "hw/xen/interface/hvm/params.h"
+#include "hw/xen/interface/hvm/e820.h"
 
 //#define DEBUG_XEN_HVM
 
diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c
index 254759f776..dc73c86c61 100644
--- a/hw/i386/xen/xen-mapcache.c
+++ b/hw/i386/xen/xen-mapcache.c
@@ -17,8 +17,6 @@
 #include "hw/xen/xen-legacy-backend.h"
 #include "qemu/bitmap.h"
 
-#include <xen/hvm/params.h>
-
 #include "sysemu/xen-mapcache.h"
 #include "trace.h"
 
diff --git a/include/hw/xen/interface/hvm/e820.h b/include/hw/xen/interface/hvm/e820.h
new file mode 100644
index 0000000000..9cb141e3c4
--- /dev/null
+++ b/include/hw/xen/interface/hvm/e820.h
@@ -0,0 +1,28 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (c) 2006, Keir Fraser
+ */
+
+#ifndef XEN_PUBLIC_HVM_E820_H
+#define XEN_PUBLIC_HVM_E820_H
+
+#define HVM_BELOW_4G_RAM_END        0xF0000000
+
+#endif /* XEN_PUBLIC_HVM_E820_H */
diff --git a/include/hw/xen/interface/hvm/ioreq.h b/include/hw/xen/interface/hvm/ioreq.h
new file mode 100644
index 0000000000..453f320c28
--- /dev/null
+++ b/include/hw/xen/interface/hvm/ioreq.h
@@ -0,0 +1,101 @@
+/*
+ * ioreq.h: I/O request definitions for device models
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef XEN_PUBLIC_HVM_IOREQ_H
+#define XEN_PUBLIC_HVM_IOREQ_H
+
+#define IOREQ_READ      1
+#define IOREQ_WRITE     0
+
+#define STATE_IOREQ_NONE        0
+#define STATE_IOREQ_READY       1
+#define STATE_IOREQ_INPROCESS   2
+#define STATE_IORESP_READY      3
+
+#define IOREQ_TYPE_PIO          0 /* pio */
+#define IOREQ_TYPE_COPY         1 /* mmio ops */
+#define IOREQ_TYPE_PCI_CONFIG   2
+#define IOREQ_TYPE_TIMEOFFSET   7
+#define IOREQ_TYPE_INVALIDATE   8 /* mapcache */
+
+/*
+ * VMExit dispatcher should cooperate with instruction decoder to
+ * prepare this structure and notify service OS and DM by sending
+ * virq.
+ *
+ * For I/O type IOREQ_TYPE_PCI_CONFIG, the physical address is formatted
+ * as follows:
+ *
+ * 63....48|47..40|39..35|34..32|31........0
+ * SEGMENT |BUS   |DEV   |FN    |OFFSET
+ */
+struct ioreq {
+    uint64_t addr;          /* physical address */
+    uint64_t data;          /* data (or paddr of data) */
+    uint32_t count;         /* for rep prefixes */
+    uint32_t size;          /* size in bytes */
+    uint32_t vp_eport;      /* evtchn for notifications to/from device model */
+    uint16_t _pad0;
+    uint8_t state:4;
+    uint8_t data_is_ptr:1;  /* if 1, data above is the guest paddr
+                             * of the real data to use. */
+    uint8_t dir:1;          /* 1=read, 0=write */
+    uint8_t df:1;
+    uint8_t _pad1:1;
+    uint8_t type;           /* I/O type */
+};
+typedef struct ioreq ioreq_t;
+
+struct shared_iopage {
+    struct ioreq vcpu_ioreq[1];
+};
+typedef struct shared_iopage shared_iopage_t;
+
+struct buf_ioreq {
+    uint8_t  type;   /* I/O type                    */
+    uint8_t  pad:1;
+    uint8_t  dir:1;  /* 1=read, 0=write             */
+    uint8_t  size:2; /* 0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */
+    uint32_t addr:20;/* physical address            */
+    uint32_t data;   /* data                        */
+};
+typedef struct buf_ioreq buf_ioreq_t;
+
+#define IOREQ_BUFFER_SLOT_NUM     511 /* 8 bytes each, plus 2 4-byte indexes */
+struct buffered_iopage {
+#ifdef __XEN__
+    union bufioreq_pointers {
+        struct {
+#endif
+            uint32_t read_pointer;
+            uint32_t write_pointer;
+#ifdef __XEN__
+        };
+        uint64_t full;
+    } ptrs;
+#endif
+    buf_ioreq_t buf_ioreq[IOREQ_BUFFER_SLOT_NUM];
+}; /* NB. Size of this structure must be no greater than one page. */
+typedef struct buffered_iopage buffered_iopage_t;
+
+#endif /* XEN_PUBLIC_HVM_IOREQ_H */
diff --git a/include/hw/xen/interface/hvm/params.h b/include/hw/xen/interface/hvm/params.h
new file mode 100644
index 0000000000..a4b6ff3853
--- /dev/null
+++ b/include/hw/xen/interface/hvm/params.h
@@ -0,0 +1,33 @@
+/*
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Copyright (c) 2007, Keir Fraser
+ */
+
+#ifndef XEN_PUBLIC_HVM_PARAMS_H
+#define XEN_PUBLIC_HVM_PARAMS_H
+
+/*
+ * Parameter space for HVMOP_{set,get}_param.
+ */
+
+/* ACPI S state: currently support S0 and S3 on x86. */
+#define HVM_PARAM_ACPI_S_STATE 14
+
+#endif /* XEN_PUBLIC_HVM_PARAMS_H */
-- 
Anthony PERARD



  parent reply	other threads:[~2019-06-17 16:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 15:41 [Qemu-devel] [PATCH 0/4] Fix build of Xen support + cleanup Anthony PERARD
2019-06-17 15:41 ` [Qemu-devel] [PATCH 1/4] xen: Fix build with public headers Anthony PERARD
2019-06-17 16:05   ` Paul Durrant
2019-06-17 15:41 ` [Qemu-devel] [PATCH 2/4] xen: Import other xen/io/*.h Anthony PERARD
2019-06-17 16:09   ` Paul Durrant
2019-06-17 15:41 ` Anthony PERARD [this message]
2019-06-17 16:15   ` [Qemu-devel] [PATCH 3/4] xen: Import Xen public headers used by xen-hvm.c Paul Durrant
2019-06-17 16:45     ` Anthony PERARD
2019-06-17 16:54       ` Paul Durrant
2019-06-17 17:19       ` [Qemu-devel] [Xen-devel] " Anthony PERARD
2019-06-18  7:55         ` Paul Durrant
2019-06-18 11:05           ` Anthony PERARD
2019-06-17 15:41 ` [Qemu-devel] [PATCH 4/4] xen: Avoid VLA Anthony PERARD
2019-06-17 16:39   ` Paul Durrant
2019-06-17 17:36     ` Anthony PERARD
2019-06-18  7:50       ` Paul Durrant
2019-06-17 18:09 ` [Qemu-devel] [Xen-devel] [PATCH 0/4] Fix build of Xen support + cleanup no-reply

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=20190617154105.32323-4-anthony.perard@citrix.com \
    --to=anthony.perard@citrix.com \
    --cc=paul.durrant@citrix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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).