[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 29/40] xenner: libxc emu: grant tables
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PATCH 29/40] xenner: libxc emu: grant tables |
Date: |
Mon, 1 Nov 2010 16:01:42 +0100 |
Xenner emulates parts of libxc, so we can not use the real xen infrastructure
when running xen pv guests without xen.
This patch adds support for grant tables.
Signed-off-by: Alexander Graf <address@hidden>
---
hw/xenner_libxc_gnttab.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 91 insertions(+), 0 deletions(-)
create mode 100644 hw/xenner_libxc_gnttab.c
diff --git a/hw/xenner_libxc_gnttab.c b/hw/xenner_libxc_gnttab.c
new file mode 100644
index 0000000..c9f4ce2
--- /dev/null
+++ b/hw/xenner_libxc_gnttab.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) Red Hat 2007
+ * Copyright (C) Novell Inc. 2010
+ *
+ * Author(s): Gerd Hoffmann <address@hidden>
+ * Alexander Graf <address@hidden>
+ *
+ * Xenner Emulation -- grant tables
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; under version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <xenctrl.h>
+#include <xen/grant_table.h>
+
+#include "hw.h"
+#include "xen_interfaces.h"
+#include "xenner.h"
+
+/* ------------------------------------------------------------- */
+
+static grant_entry_v1_t *get_grant(uint32_t ref)
+{
+ grant_entry_v1_t *e;
+ int page, index;
+
+ page = ref / (PAGE_SIZE / sizeof(grant_entry_v1_t));
+ index = ref % (PAGE_SIZE / sizeof(grant_entry_v1_t));
+
+ e = xenner_get_grant_table(page);
+ if (!e) {
+ return NULL;
+ }
+ return e + index;
+}
+
+/* ------------------------------------------------------------- */
+
+static int _qemu_open(void)
+{
+ return 42;
+}
+
+static int qemu_close(int xcg_handle)
+{
+ return 0;
+}
+
+static void *qemu_map_grant_ref(int xcg_handle, uint32_t domid,
+ uint32_t ref, int prot)
+{
+ grant_entry_v1_t *e;
+
+ e = get_grant(ref);
+ if (!e) {
+ return NULL;
+ }
+
+ return xenner_mfn_to_ptr(e->frame);
+}
+
+static void *qemu_map_grant_refs(int xcg_handle, uint32_t count,
+ uint32_t *domids, uint32_t *refs, int prot)
+{
+ /* Hmm, not so easy ... */
+ return NULL;
+}
+
+static int qemu_munmap(int xcg_handle, void *start_address, uint32_t count)
+{
+ /* nothing as we didn't actually map anything ... */
+ return 0;
+}
+
+struct XenGnttabOps xc_gnttab_xenner = {
+ .open = _qemu_open,
+ .close = qemu_close,
+ .map_grant_ref = qemu_map_grant_ref,
+ .map_grant_refs = qemu_map_grant_refs,
+ .munmap = qemu_munmap,
+};
--
1.6.0.2
- [Qemu-devel] Re: [PATCH 28/40] xenner: libxc emu: evtchn, (continued)
- Re: [Qemu-devel] Re: [PATCH 28/40] xenner: libxc emu: evtchn, Stefano Stabellini, 2010/11/02
- Re: [Qemu-devel] Re: [PATCH 28/40] xenner: libxc emu: evtchn, Paolo Bonzini, 2010/11/02
- Re: [Qemu-devel] Re: [PATCH 28/40] xenner: libxc emu: evtchn, Gerd Hoffmann, 2010/11/02
- Re: [Qemu-devel] Re: [PATCH 28/40] xenner: libxc emu: evtchn, Paolo Bonzini, 2010/11/02
- Re: [Qemu-devel] Re: [PATCH 28/40] xenner: libxc emu: evtchn, Stefano Stabellini, 2010/11/02
- Re: [Qemu-devel] Re: [PATCH 28/40] xenner: libxc emu: evtchn, Alexander Graf, 2010/11/02
- Re: [Qemu-devel] Re: [PATCH 28/40] xenner: libxc emu: evtchn, Stefano Stabellini, 2010/11/02
[Qemu-devel] [PATCH 29/40] xenner: libxc emu: grant tables,
Alexander Graf <=
[Qemu-devel] [PATCH 17/40] xenner: kernel: Main (x86_64), Alexander Graf, 2010/11/01
[Qemu-devel] [PATCH 01/40] elf: Move translate_fn to helper struct, Alexander Graf, 2010/11/01
[Qemu-devel] [PATCH 13/40] xenner: kernel: Headers, Alexander Graf, 2010/11/01
[Qemu-devel] [PATCH 12/40] xenner: kernel: Hypercall handler (generic), Alexander Graf, 2010/11/01
[Qemu-devel] [PATCH 20/40] xenner: kernel: mmu support for 32-bit PAE, Alexander Graf, 2010/11/01
[Qemu-devel] [PATCH 22/40] xenner: kernel: mmu support for 64-bit, Alexander Graf, 2010/11/01
[Qemu-devel] [PATCH 15/40] xenner: kernel: lapic code, Alexander Graf, 2010/11/01
[Qemu-devel] [PATCH 27/40] xenner: add xc_dom.h, Alexander Graf, 2010/11/01
[Qemu-devel] [PATCH 34/40] xenner: PV machine, Alexander Graf, 2010/11/01
[Qemu-devel] [PATCH 32/40] xenner: emudev, Alexander Graf, 2010/11/01