All of lore.kernel.org
 help / color / mirror / Atom feed
* Xen HVM Support
@ 2011-06-01  9:59 Ian Campbell
  2011-06-01 10:00 ` [PATCH 1/2] Move support for copying out BIOS tables into its own file Ian Campbell
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Ian Campbell @ 2011-06-01  9:59 UTC (permalink / raw)
  To: seabios, xen-devel

The following enables support for running SeaBIOS as the virtual BIOS
in a Xen HVM (fully-virtualised) guest.

In this series SeaBIOS is loaded by hvmloader (the Xen early firmware)
rather than directly as was previously tried. This approach turned out
to be far less intrusive on the SeaBIOS side and leaves knowledge of
the virtual hardware setup encapsulated within hvmloader which is
updated in lock step with the hypervisor and associated tools.

BIOS tables are built by hvmloader and passed to SeaBIOS via a simple
in memory data structure. The tables are identified by scanning for
their signatures which is hopefully extensible enough but the core
structure can also be extended as necessary.

The associated hvmloader series was only posted on xen-devel can be
found at:
http://marc.info/?l=xen-devel&m=130692187111154
the most interesting patch is probably:
http://marc.info/?l=xen-devel&m=130692182011054

Ian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] Move support for copying out BIOS tables into its own file.
  2011-06-01  9:59 Xen HVM Support Ian Campbell
@ 2011-06-01 10:00 ` Ian Campbell
  2011-06-01 10:00 ` [PATCH 2/2] Add support for use as Xen HVM BIOS Ian Campbell
  2011-06-06  1:20 ` [SeaBIOS] Xen HVM Support Kevin O'Connor
  2 siblings, 0 replies; 10+ messages in thread
From: Ian Campbell @ 2011-06-01 10:00 UTC (permalink / raw)
  To: xen-devel, seabios; +Cc: Ian Campbell

I'd like to use it for Xen support.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Makefile         |    2 +-
 src/biostables.c |   83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/coreboot.c   |   75 ------------------------------------------------
 src/util.h       |    5 +++
 4 files changed, 89 insertions(+), 76 deletions(-)
 create mode 100644 src/biostables.c

diff --git a/Makefile b/Makefile
index d17f85a..07ba2d0 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ SRC16=$(SRCBOTH) system.c disk.c font.c
 SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c coreboot.c boot.c \
       acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c \
       lzmadecode.c bootsplash.c jpeg.c usb-hub.c paravirt.c dev-i440fx.c \
-      pci_region.c
+      pci_region.c biostables.c
 SRC32SEG=util.c output.c pci.c pcibios.c apm.c stacks.c
 
 cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
diff --git a/src/biostables.c b/src/biostables.c
new file mode 100644
index 0000000..21b8573
--- /dev/null
+++ b/src/biostables.c
@@ -0,0 +1,83 @@
+// Coreboot interface support.
+//
+// Copyright (C) 2008,2009  Kevin O'Connor <kevin@koconnor.net>
+//
+// This file may be distributed under the terms of the GNU LGPLv3 license.
+
+#include "config.h" // CONFIG_*
+#include "util.h" // dprintf
+#include "pci.h" // struct pir_header
+#include "acpi.h" // struct rsdp_descriptor
+#include "mptable.h" // MPTABLE_SIGNATURE
+
+void
+copy_pir(void *pos)
+{
+    struct pir_header *p = pos;
+    if (p->signature != PIR_SIGNATURE)
+        return;
+    if (PirOffset)
+        return;
+    if (p->size < sizeof(*p))
+        return;
+    if (checksum(pos, p->size) != 0)
+        return;
+    void *newpos = malloc_fseg(p->size);
+    if (!newpos) {
+        warn_noalloc();
+        return;
+    }
+    dprintf(1, "Copying PIR from %p to %p\n", pos, newpos);
+    memcpy(newpos, pos, p->size);
+    PirOffset = (u32)newpos - BUILD_BIOS_ADDR;
+}
+
+void
+copy_mptable(void *pos)
+{
+    struct mptable_floating_s *p = pos;
+    if (p->signature != MPTABLE_SIGNATURE)
+        return;
+    if (!p->physaddr)
+        return;
+    if (checksum(pos, sizeof(*p)) != 0)
+        return;
+    u32 length = p->length * 16;
+    u16 mpclength = ((struct mptable_config_s *)p->physaddr)->length;
+    struct mptable_floating_s *newpos = malloc_fseg(length + mpclength);
+    if (!newpos) {
+        warn_noalloc();
+        return;
+    }
+    dprintf(1, "Copying MPTABLE from %p/%x to %p\n", pos, p->physaddr, newpos);
+    memcpy(newpos, pos, length);
+    newpos->physaddr = (u32)newpos + length;
+    newpos->checksum -= checksum(newpos, sizeof(*newpos));
+    memcpy((void*)newpos + length, (void*)p->physaddr, mpclength);
+}
+
+void
+copy_acpi_rsdp(void *pos)
+{
+    if (RsdpAddr)
+        return;
+    struct rsdp_descriptor *p = pos;
+    if (p->signature != RSDP_SIGNATURE)
+        return;
+    u32 length = 20;
+    if (checksum(pos, length) != 0)
+        return;
+    if (p->revision > 1) {
+        length = p->length;
+        if (checksum(pos, length) != 0)
+            return;
+    }
+    void *newpos = malloc_fseg(length);
+    if (!newpos) {
+        warn_noalloc();
+        return;
+    }
+    dprintf(1, "Copying ACPI RSDP from %p to %p\n", pos, newpos);
+    memcpy(newpos, pos, length);
+    RsdpAddr = newpos;
+}
diff --git a/src/coreboot.c b/src/coreboot.c
index f627531..6e22919 100644
--- a/src/coreboot.c
+++ b/src/coreboot.c
@@ -6,9 +6,6 @@
 
 #include "memmap.h" // add_e820
 #include "util.h" // dprintf
-#include "pci.h" // struct pir_header
-#include "acpi.h" // struct rsdp_descriptor
-#include "mptable.h" // MPTABLE_SIGNATURE
 #include "biosvar.h" // GET_EBDA
 #include "lzmadecode.h" // LzmaDecode
 #include "smbios.h" // smbios_init
@@ -194,78 +191,6 @@ fail:
  * BIOS table copying
  ****************************************************************/
 
-static void
-copy_pir(void *pos)
-{
-    struct pir_header *p = pos;
-    if (p->signature != PIR_SIGNATURE)
-        return;
-    if (PirOffset)
-        return;
-    if (p->size < sizeof(*p))
-        return;
-    if (checksum(pos, p->size) != 0)
-        return;
-    void *newpos = malloc_fseg(p->size);
-    if (!newpos) {
-        warn_noalloc();
-        return;
-    }
-    dprintf(1, "Copying PIR from %p to %p\n", pos, newpos);
-    memcpy(newpos, pos, p->size);
-    PirOffset = (u32)newpos - BUILD_BIOS_ADDR;
-}
-
-static void
-copy_mptable(void *pos)
-{
-    struct mptable_floating_s *p = pos;
-    if (p->signature != MPTABLE_SIGNATURE)
-        return;
-    if (!p->physaddr)
-        return;
-    if (checksum(pos, sizeof(*p)) != 0)
-        return;
-    u32 length = p->length * 16;
-    u16 mpclength = ((struct mptable_config_s *)p->physaddr)->length;
-    struct mptable_floating_s *newpos = malloc_fseg(length + mpclength);
-    if (!newpos) {
-        warn_noalloc();
-        return;
-    }
-    dprintf(1, "Copying MPTABLE from %p/%x to %p\n", pos, p->physaddr, newpos);
-    memcpy(newpos, pos, length);
-    newpos->physaddr = (u32)newpos + length;
-    newpos->checksum -= checksum(newpos, sizeof(*newpos));
-    memcpy((void*)newpos + length, (void*)p->physaddr, mpclength);
-}
-
-static void
-copy_acpi_rsdp(void *pos)
-{
-    if (RsdpAddr)
-        return;
-    struct rsdp_descriptor *p = pos;
-    if (p->signature != RSDP_SIGNATURE)
-        return;
-    u32 length = 20;
-    if (checksum(pos, length) != 0)
-        return;
-    if (p->revision > 1) {
-        length = p->length;
-        if (checksum(pos, length) != 0)
-            return;
-    }
-    void *newpos = malloc_fseg(length);
-    if (!newpos) {
-        warn_noalloc();
-        return;
-    }
-    dprintf(1, "Copying ACPI RSDP from %p to %p\n", pos, newpos);
-    memcpy(newpos, pos, length);
-    RsdpAddr = newpos;
-}
-
 // Attempt to find (and relocate) any standard bios tables found in a
 // given address range.
 static void
diff --git a/src/util.h b/src/util.h
index 2160b37..cb54432 100644
--- a/src/util.h
+++ b/src/util.h
@@ -405,6 +405,11 @@ void coreboot_copy_biostable(void);
 void cbfs_payload_setup(void);
 void coreboot_setup(void);
 
+// biostable.c
+void copy_pir(void *pos);
+void copy_mptable(void *pos);
+void copy_acpi_rsdp(void *pos);
+
 // vgahooks.c
 extern int VGAbdf;
 void handle_155f(struct bregs *regs);
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] Add support for use as Xen HVM BIOS.
  2011-06-01  9:59 Xen HVM Support Ian Campbell
  2011-06-01 10:00 ` [PATCH 1/2] Move support for copying out BIOS tables into its own file Ian Campbell
@ 2011-06-01 10:00 ` Ian Campbell
  2011-06-06  1:20 ` [SeaBIOS] Xen HVM Support Kevin O'Connor
  2 siblings, 0 replies; 10+ messages in thread
From: Ian Campbell @ 2011-06-01 10:00 UTC (permalink / raw)
  To: xen-devel, seabios; +Cc: Ian Campbell

SeaBIOS is called by Xen's hvmloader which does the basic platform
setup (PCI, APIC, etc) and provides the various BIOS tables. Therefore
avoid re-doing that setup and copy out the tables as necessary. A
simple data structure is defined to pass the addresses of these
tables.

This patch also establishes the basic infrastructure to make
hypercalls, although it currently only uses it to query the hypervisor
version.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Makefile         |    2 +-
 src/Kconfig      |    6 ++
 src/biostables.c |   22 ++++++++
 src/mtrr.c       |    3 +-
 src/pciinit.c    |    5 +-
 src/post.c       |   10 ++++
 src/shadow.c     |    5 +-
 src/util.h       |    1 +
 src/xen.c        |  149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/xen.h        |  135 ++++++++++++++++++++++++++++++++++++++++++++++++
 10 files changed, 332 insertions(+), 6 deletions(-)
 create mode 100644 src/xen.c
 create mode 100644 src/xen.h

diff --git a/Makefile b/Makefile
index 07ba2d0..05bcee3 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ SRC16=$(SRCBOTH) system.c disk.c font.c
 SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c coreboot.c boot.c \
       acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c \
       lzmadecode.c bootsplash.c jpeg.c usb-hub.c paravirt.c dev-i440fx.c \
-      pci_region.c biostables.c
+      pci_region.c biostables.c xen.c
 SRC32SEG=util.c output.c pci.c pcibios.c apm.c stacks.c
 
 cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
diff --git a/src/Kconfig b/src/Kconfig
index 123db01..c2fe086 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -10,6 +10,12 @@ menu "General Features"
         help
             Configure as a coreboot payload.
 
+    config XEN
+        bool "Build for Xen HVM"
+        default n
+        help
+            Configure to be used by xen hvmloader, for a HVM guest.
+
     config THREADS
         bool "Parallelize hardware init"
         default y
diff --git a/src/biostables.c b/src/biostables.c
index 21b8573..761b260 100644
--- a/src/biostables.c
+++ b/src/biostables.c
@@ -9,6 +9,7 @@
 #include "pci.h" // struct pir_header
 #include "acpi.h" // struct rsdp_descriptor
 #include "mptable.h" // MPTABLE_SIGNATURE
+#include "smbios.h" // struct smbios_entry_point
 
 void
 copy_pir(void *pos)
@@ -81,3 +82,24 @@ copy_acpi_rsdp(void *pos)
     memcpy(newpos, pos, length);
     RsdpAddr = newpos;
 }
+
+void
+copy_smbios(void *pos)
+{
+    struct smbios_entry_point *p = pos;
+    if (memcmp(p->anchor_string, "_SM_", 4))
+        return;
+    if (checksum(pos, 0x10) != 0)
+        return;
+    if (memcmp(p->intermediate_anchor_string, "_DMI_", 5))
+        return;
+    if (checksum(pos+0x10, p->length-0x10) != 0)
+        return;
+    struct smbios_entry_point *newpos = malloc_fseg(sizeof(p->length));
+    if (!newpos) {
+        warn_noalloc();
+        return;
+    }
+    dprintf(1, "Copying SMBIOS entry point from %p to %p\n", pos, newpos);
+    memcpy(newpos, pos, p->length);
+}
diff --git a/src/mtrr.c b/src/mtrr.c
index 0502c18..0548043 100644
--- a/src/mtrr.c
+++ b/src/mtrr.c
@@ -6,6 +6,7 @@
 
 #include "util.h" // dprintf
 #include "biosvar.h" // GET_EBDA
+#include "xen.h" // usingXen
 
 #define MSR_MTRRcap                    0x000000fe
 #define MSR_MTRRfix64K_00000           0x00000250
@@ -32,7 +33,7 @@
 
 void mtrr_setup(void)
 {
-    if (!CONFIG_MTRR_INIT || CONFIG_COREBOOT)
+    if (!CONFIG_MTRR_INIT || CONFIG_COREBOOT || usingXen())
         return;
 
     u32 eax, ebx, ecx, edx, cpuid_features;
diff --git a/src/pciinit.c b/src/pciinit.c
index ee2e72d..0bd9b72 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -11,6 +11,7 @@
 #include "pci_ids.h" // PCI_VENDOR_ID_INTEL
 #include "pci_regs.h" // PCI_COMMAND
 #include "dev-i440fx.h"
+#include "xen.h" // usingXen
 
 #define PCI_ROM_SLOT 6
 #define PCI_NUM_REGIONS 7
@@ -396,8 +397,8 @@ pci_bios_init_bus(void)
 void
 pci_setup(void)
 {
-    if (CONFIG_COREBOOT)
-        // Already done by coreboot.
+    if (CONFIG_COREBOOT || usingXen())
+        // Already done by coreboot or Xen.
         return;
 
     dprintf(3, "pci setup\n");
diff --git a/src/post.c b/src/post.c
index 7d2b5f2..70d98a6 100644
--- a/src/post.c
+++ b/src/post.c
@@ -23,6 +23,7 @@
 #include "usb.h" // usb_setup
 #include "smbios.h" // smbios_init
 #include "paravirt.h" // qemu_cfg_port_probe
+#include "xen.h" // xen_probe_hvm_info
 #include "ps2port.h" // ps2port_setup
 #include "virtio-blk.h" // virtio_blk_setup
 
@@ -101,6 +102,8 @@ ram_probe(void)
     dprintf(3, "Find memory size\n");
     if (CONFIG_COREBOOT) {
         coreboot_setup();
+    } else if (usingXen()) {
+	xen_setup();
     } else {
         // On emulators, get memory size from nvram.
         u32 rs = ((inb_cmos(CMOS_MEM_EXTMEM2_LOW) << 16)
@@ -158,6 +161,10 @@ init_bios_tables(void)
         coreboot_copy_biostable();
         return;
     }
+    if (usingXen()) {
+	xen_copy_biostables();
+	return;
+    }
 
     create_pirtable();
 
@@ -380,6 +387,9 @@ _start(void)
         // This is a soft reboot - invoke a hard reboot.
         tryReboot();
 
+    // Check if we are running under Xen.
+    xen_probe();
+
     // Allow writes to modify bios area (0xf0000)
     make_bios_writable();
     HaveRunPost = 1;
diff --git a/src/shadow.c b/src/shadow.c
index ed530e0..cb39ddf 100644
--- a/src/shadow.c
+++ b/src/shadow.c
@@ -10,6 +10,7 @@
 #include "config.h" // CONFIG_*
 #include "pci_ids.h" // PCI_VENDOR_ID_INTEL
 #include "dev-i440fx.h"
+#include "xen.h" // usingXen
 
 // On the emulators, the bios at 0xf0000 is also at 0xffff0000
 #define BIOS_SRC_OFFSET 0xfff00000
@@ -102,7 +103,7 @@ static const struct pci_device_id dram_controller_make_writable_tbl[] = {
 void
 make_bios_writable(void)
 {
-    if (CONFIG_COREBOOT)
+    if (CONFIG_COREBOOT || usingXen())
         return;
 
     dprintf(3, "enabling shadow ram\n");
@@ -127,7 +128,7 @@ static const struct pci_device_id dram_controller_make_readonly_tbl[] = {
 void
 make_bios_readonly(void)
 {
-    if (CONFIG_COREBOOT)
+    if (CONFIG_COREBOOT || usingXen())
         return;
 
     dprintf(3, "locking shadow ram\n");
diff --git a/src/util.h b/src/util.h
index cb54432..00433e2 100644
--- a/src/util.h
+++ b/src/util.h
@@ -409,6 +409,7 @@ void coreboot_setup(void);
 void copy_pir(void *pos);
 void copy_mptable(void *pos);
 void copy_acpi_rsdp(void *pos);
+void copy_smbios(void *pos);
 
 // vgahooks.c
 extern int VGAbdf;
diff --git a/src/xen.c b/src/xen.c
new file mode 100644
index 0000000..4072793
--- /dev/null
+++ b/src/xen.c
@@ -0,0 +1,149 @@
+// Xen HVM support
+//
+// Copyright (C) 2011 Citrix Systems.
+//
+// This file may be distributed under the terms of the GNU LGPLv3 license.
+
+#include "config.h"
+#include "xen.h"
+
+#include "memmap.h" // add_e820
+#include "types.h" // ASM32FLAT
+#include "util.h" // copy_acpi_rsdp
+
+#define INFO_PHYSICAL_ADDRESS 0x00001000
+
+u32 xen_cpuid_base = 0;
+
+struct xen_seabios_info {
+    char signature[14]; /* XenHVMSeaBIOS\0 */
+    u8 length;     /* Length of this struct */
+    u8 checksum;   /* Set such that the sum over bytes 0..length == 0 */
+    /*
+     * Physical address of an array of tables_nr elements.
+     *
+     * Each element is a 32 bit value contianing the physical address
+     * of a BIOS table.
+     */
+    u32 tables;
+    u32 tables_nr;
+    /*
+     * Physical address of the e820 table, contains e820_nr entries.
+     */
+    u32 e820;
+    u32 e820_nr;
+} PACKED;
+
+static void validate_info(struct xen_seabios_info *t)
+{
+    if ( memcmp(t->signature, "XenHVMSeaBIOS", 14) )
+        panic("Bad Xen info signature\n");
+
+    if ( t->length < sizeof(struct xen_seabios_info) )
+        panic("Bad Xen info length\n");
+
+    if (checksum(t, t->length) != 0)
+        panic("Bad Xen info checksum\n");
+}
+
+void xen_probe(void)
+{
+    u32 base, eax, ebx, ecx, edx;
+    char signature[13];
+
+    if (!CONFIG_XEN)
+        return;
+
+    for (base = 0x40000000; base < 0x40010000; base += 0x100) {
+        cpuid(base, &eax, &ebx, &ecx, &edx);
+        memcpy(signature + 0, &ebx, 4);
+        memcpy(signature + 4, &ecx, 4);
+        memcpy(signature + 8, &edx, 4);
+        signature[12] = 0;
+
+        dprintf(1, "Found hypervisor signature \"%s\" at %x\n",
+                signature, base);
+        if (strcmp(signature, "XenVMMXenVMM") == 0) {
+            if ((eax - base) < 2)
+                panic("Insufficient Xen cpuid leaves. eax=%x at base %x\n",
+                      eax, base);
+            xen_cpuid_base = base;
+            break;
+        }
+    }
+}
+
+static int hypercall_xen_version( int cmd, void *arg)
+{
+    return _hypercall2(int, xen_version, cmd, arg);
+}
+
+/* Fill in hypercall transfer pages. */
+void xen_init_hypercalls(void)
+{
+    u32 eax, ebx, ecx, edx;
+    xen_extraversion_t extraversion;
+    unsigned long i;
+
+    if (!usingXen())
+        return;
+
+    cpuid(xen_cpuid_base + 2, &eax, &ebx, &ecx, &edx);
+
+    xen_hypercall_page = (unsigned long)memalign_high(PAGE_SIZE, eax*PAGE_SIZE);
+    if (!xen_hypercall_page)
+        panic("unable to allocate Xen hypercall page\n");
+
+    dprintf(1, "Allocated Xen hypercall page at %lx\n", xen_hypercall_page);
+    for ( i = 0; i < eax; i++ )
+        wrmsr(ebx, xen_hypercall_page + (i << 12) + i);
+
+    /* Print version information. */
+    cpuid(xen_cpuid_base + 1, &eax, &ebx, &ecx, &edx);
+    hypercall_xen_version(XENVER_extraversion, extraversion);
+    dprintf(1, "Detected Xen v%u.%u%s\n", eax >> 16, eax & 0xffff, extraversion);
+}
+
+void xen_copy_biostables(void)
+{
+    struct xen_seabios_info *info = (void *)INFO_PHYSICAL_ADDRESS;
+    u32 *tables = (u32 *)info->tables;
+    int i;
+
+    dprintf(1, "xen: copy BIOS tables...\n");
+    for (i=0; i<info->tables_nr; i++) {
+        void *table = (void *)tables[i];
+        copy_acpi_rsdp(table);
+        copy_mptable(table);
+        copy_pir(table);
+        copy_smbios(table);
+    }
+}
+
+void xen_setup(void)
+{
+    u64 maxram = 0, maxram_over4G = 0;
+    int i;
+    struct xen_seabios_info *info = (void *)INFO_PHYSICAL_ADDRESS;
+    struct e820entry *e820 = (struct e820entry *)info->e820;
+    validate_info(info);
+
+    dprintf(1, "xen: copy e820...\n");
+
+    for (i = 0; i < info->e820_nr; i++) {
+        struct e820entry *e = &e820[i];
+        if (e->type == E820_ACPI || e->type == E820_RAM) {
+            u64 end = e->start + e->size;
+            if (end > 0x100000000ull) {
+                end -= 0x100000000ull;
+                if (end > maxram_over4G)
+                    maxram_over4G = end;
+            } else if (end > maxram)
+                maxram = end;
+        }
+        add_e820(e->start, e->size, e->type);
+    }
+
+    RamSize = maxram;
+    RamSizeOver4G = maxram_over4G;
+}
diff --git a/src/xen.h b/src/xen.h
new file mode 100644
index 0000000..0ed1e9f
--- /dev/null
+++ b/src/xen.h
@@ -0,0 +1,135 @@
+#ifndef __XEN_H
+#define __XEN_H
+
+#include "util.h"
+
+extern u32 xen_cpuid_base;
+
+void xen_probe(void);
+void xen_setup(void);
+void xen_init_hypercalls(void);
+void xen_copy_biostables(void);
+
+static inline int usingXen(void) {
+    if (!CONFIG_XEN)
+	return 0;
+    return (xen_cpuid_base != 0);
+}
+
+unsigned long xen_hypercall_page;
+
+#define _hypercall0(type, name)                                         \
+({                                                                      \
+    unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
+    long __res;                                                         \
+    asm volatile (                                                      \
+        "call *%%eax"                                                   \
+        : "=a" (__res)                                                  \
+        : "0" (__hentry)                                                \
+        : "memory" );                                                   \
+    (type)__res;                                                        \
+})
+
+#define _hypercall1(type, name, a1)                                     \
+({                                                                      \
+    unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
+    long __res, __ign1;                                                 \
+    asm volatile (                                                      \
+        "call *%%eax"                                                   \
+        : "=a" (__res), "=b" (__ign1)                                   \
+        : "0" (__hentry), "1" ((long)(a1))                              \
+        : "memory" );                                                   \
+    (type)__res;                                                        \
+})
+
+#define _hypercall2(type, name, a1, a2)                                 \
+({                                                                      \
+    unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
+    long __res, __ign1, __ign2;                                         \
+    asm volatile (                                                      \
+        "call *%%eax"                                                   \
+        : "=a" (__res), "=b" (__ign1), "=c" (__ign2)                    \
+        : "0" (__hentry), "1" ((long)(a1)), "2" ((long)(a2))            \
+        : "memory" );                                                   \
+    (type)__res;                                                        \
+})
+
+#define _hypercall3(type, name, a1, a2, a3)                             \
+({                                                                      \
+    unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
+    long __res, __ign1, __ign2, __ign3;                                 \
+    asm volatile (                                                      \
+        "call *%%eax"                                                   \
+        : "=a" (__res), "=b" (__ign1), "=c" (__ign2),                   \
+          "=d" (__ign3)                                                 \
+        : "0" (__hentry), "1" ((long)(a1)), "2" ((long)(a2)),           \
+          "3" ((long)(a3))                                              \
+        : "memory" );                                                   \
+    (type)__res;                                                        \
+})
+
+#define _hypercall4(type, name, a1, a2, a3, a4)                         \
+({                                                                      \
+    unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
+    long __res, __ign1, __ign2, __ign3, __ign4;                         \
+    asm volatile (                                                      \
+        "call *%%eax"                                                   \
+        : "=a" (__res), "=b" (__ign1), "=c" (__ign2),                   \
+          "=d" (__ign3), "=S" (__ign4)                                  \
+        : "0" (__hentry), "1" ((long)(a1)), "2" ((long)(a2)),           \
+          "3" ((long)(a3)), "4" ((long)(a4))                            \
+        : "memory" );                                                   \
+    (type)__res;                                                        \
+})
+
+#define _hypercall5(type, name, a1, a2, a3, a4, a5)                     \
+({                                                                      \
+    unsigned long __hentry = xen_hypercall_page+__HYPERVISOR_##name*32; \
+    long __res, __ign1, __ign2, __ign3, __ign4, __ign5;                 \
+    asm volatile (                                                      \
+        "call *%%eax"                                                   \
+        : "=a" (__res), "=b" (__ign1), "=c" (__ign2),                   \
+          "=d" (__ign3), "=S" (__ign4), "=D" (__ign5)                   \
+        : "0" (__hentry), "1" ((long)(a1)), "2" ((long)(a2)),           \
+          "3" ((long)(a3)), "4" ((long)(a4)),                           \
+          "5" ((long)(a5))                                              \
+        : "memory" );                                                   \
+    (type)__res;                                                        \
+})
+
+/******************************************************************************
+ *
+ * The following interface definitions are taken from Xen and have the
+ * following license:
+ *
+ * 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.
+ */
+
+/* xen.h */
+
+#define __HYPERVISOR_xen_version          17
+
+/* version.h */
+
+/* arg == xen_extraversion_t. */
+#define XENVER_extraversion 1
+typedef char xen_extraversion_t[16];
+#define XEN_EXTRAVERSION_LEN (sizeof(xen_extraversion_t))
+
+#endif
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [SeaBIOS] Xen HVM Support
  2011-06-01  9:59 Xen HVM Support Ian Campbell
  2011-06-01 10:00 ` [PATCH 1/2] Move support for copying out BIOS tables into its own file Ian Campbell
  2011-06-01 10:00 ` [PATCH 2/2] Add support for use as Xen HVM BIOS Ian Campbell
@ 2011-06-06  1:20 ` Kevin O'Connor
  2011-06-06  8:54   ` Ian Campbell
  2 siblings, 1 reply; 10+ messages in thread
From: Kevin O'Connor @ 2011-06-06  1:20 UTC (permalink / raw)
  To: Ian Campbell; +Cc: seabios, xen-devel

On Wed, Jun 01, 2011 at 10:59:10AM +0100, Ian Campbell wrote:
> The following enables support for running SeaBIOS as the virtual BIOS
> in a Xen HVM (fully-virtualised) guest.
> 
> In this series SeaBIOS is loaded by hvmloader (the Xen early firmware)
> rather than directly as was previously tried. This approach turned out
> to be far less intrusive on the SeaBIOS side and leaves knowledge of
> the virtual hardware setup encapsulated within hvmloader which is
> updated in lock step with the hypervisor and associated tools.
> 
> BIOS tables are built by hvmloader and passed to SeaBIOS via a simple
> in memory data structure. The tables are identified by scanning for
> their signatures which is hopefully extensible enough but the core
> structure can also be extended as necessary.

It looks okay to me.

Thanks,
-Kevin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Xen HVM Support
  2011-06-06  1:20 ` [SeaBIOS] Xen HVM Support Kevin O'Connor
@ 2011-06-06  8:54   ` Ian Campbell
  2011-06-13 12:00     ` [SeaBIOS] " Kevin O'Connor
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Campbell @ 2011-06-06  8:54 UTC (permalink / raw)
  To: Kevin O'Connor; +Cc: seabios, xen-devel

On Mon, 2011-06-06 at 02:20 +0100, Kevin O'Connor wrote:
> On Wed, Jun 01, 2011 at 10:59:10AM +0100, Ian Campbell wrote:
> > The following enables support for running SeaBIOS as the virtual BIOS
> > in a Xen HVM (fully-virtualised) guest.
> > 
> > In this series SeaBIOS is loaded by hvmloader (the Xen early firmware)
> > rather than directly as was previously tried. This approach turned out
> > to be far less intrusive on the SeaBIOS side and leaves knowledge of
> > the virtual hardware setup encapsulated within hvmloader which is
> > updated in lock step with the hypervisor and associated tools.
> > 
> > BIOS tables are built by hvmloader and passed to SeaBIOS via a simple
> > in memory data structure. The tables are identified by scanning for
> > their signatures which is hopefully extensible enough but the core
> > structure can also be extended as necessary.
> 
> It looks okay to me.

Thanks.

All the Xen side pieces are in place already (although not set in stone
if you find something you would like done different).

Ian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [SeaBIOS] Xen HVM Support
  2011-06-06  8:54   ` Ian Campbell
@ 2011-06-13 12:00     ` Kevin O'Connor
  2011-06-14  8:19       ` Ian Campbell
  0 siblings, 1 reply; 10+ messages in thread
From: Kevin O'Connor @ 2011-06-13 12:00 UTC (permalink / raw)
  To: Ian Campbell; +Cc: seabios, xen-devel

On Mon, Jun 06, 2011 at 09:54:54AM +0100, Ian Campbell wrote:
> On Mon, 2011-06-06 at 02:20 +0100, Kevin O'Connor wrote:
> > On Wed, Jun 01, 2011 at 10:59:10AM +0100, Ian Campbell wrote:
> > > The following enables support for running SeaBIOS as the virtual BIOS
> > > in a Xen HVM (fully-virtualised) guest.
> > > 
> > > In this series SeaBIOS is loaded by hvmloader (the Xen early firmware)
> > > rather than directly as was previously tried. This approach turned out
> > > to be far less intrusive on the SeaBIOS side and leaves knowledge of
> > > the virtual hardware setup encapsulated within hvmloader which is
> > > updated in lock step with the hypervisor and associated tools.
> > > 
> > > BIOS tables are built by hvmloader and passed to SeaBIOS via a simple
> > > in memory data structure. The tables are identified by scanning for
> > > their signatures which is hopefully extensible enough but the core
> > > structure can also be extended as necessary.
> > 
> > It looks okay to me.
> 
> Thanks.
> 
> All the Xen side pieces are in place already (although not set in stone
> if you find something you would like done different).

I've committed this.

Thanks,
-Kevin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [SeaBIOS] Xen HVM Support
  2011-06-13 12:00     ` [SeaBIOS] " Kevin O'Connor
@ 2011-06-14  8:19       ` Ian Campbell
  2011-07-22  9:27         ` Tobias Geiger
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Campbell @ 2011-06-14  8:19 UTC (permalink / raw)
  To: Kevin O'Connor; +Cc: seabios, xen-devel

On Mon, 2011-06-13 at 08:00 -0400, Kevin O'Connor wrote:
> On Mon, Jun 06, 2011 at 09:54:54AM +0100, Ian Campbell wrote:
> > On Mon, 2011-06-06 at 02:20 +0100, Kevin O'Connor wrote:
> > > On Wed, Jun 01, 2011 at 10:59:10AM +0100, Ian Campbell wrote:
> > > > The following enables support for running SeaBIOS as the virtual BIOS
> > > > in a Xen HVM (fully-virtualised) guest.
> > > > 
> > > > In this series SeaBIOS is loaded by hvmloader (the Xen early firmware)
> > > > rather than directly as was previously tried. This approach turned out
> > > > to be far less intrusive on the SeaBIOS side and leaves knowledge of
> > > > the virtual hardware setup encapsulated within hvmloader which is
> > > > updated in lock step with the hypervisor and associated tools.
> > > > 
> > > > BIOS tables are built by hvmloader and passed to SeaBIOS via a simple
> > > > in memory data structure. The tables are identified by scanning for
> > > > their signatures which is hopefully extensible enough but the core
> > > > structure can also be extended as necessary.
> > > 
> > > It looks okay to me.
> > 
> > Thanks.
> > 
> > All the Xen side pieces are in place already (although not set in stone
> > if you find something you would like done different).
> 
> I've committed this.

Thanks Kevin!

Ian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [SeaBIOS] Xen HVM Support
  2011-06-14  8:19       ` Ian Campbell
@ 2011-07-22  9:27         ` Tobias Geiger
  2011-07-22  9:32           ` Ian Campbell
  0 siblings, 1 reply; 10+ messages in thread
From: Tobias Geiger @ 2011-07-22  9:27 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell, Kevin O'Connor, seabios

Hi,

yesterday i tried to boot Windows7 64bit with the new "Upstream Qemu with 
Seabios" HVM loader under xen unstable (yesterdays hg pull)

The Windows Installer booted fine from the ISO (after enabling El-Torrito 
Emulation in Seabios menuconfig), but the Windows Installer soon gave up with a 
BSOD (STOP 0xA5), much like stated here http://www.coreboot.org/SeaBIOS under 
"Windows".
I have a Screenshot from the BSOD in case the adresses are of any interest.

Any hints, or is this supposed to not work (yet) ?

Greetings
Tobias



Am Dienstag, 14. Juni 2011, 10:19:26 schrieb Ian Campbell:
> On Mon, 2011-06-13 at 08:00 -0400, Kevin O'Connor wrote:
> > On Mon, Jun 06, 2011 at 09:54:54AM +0100, Ian Campbell wrote:
> > > On Mon, 2011-06-06 at 02:20 +0100, Kevin O'Connor wrote:
> > > > On Wed, Jun 01, 2011 at 10:59:10AM +0100, Ian Campbell wrote:
> > > > > The following enables support for running SeaBIOS as the virtual
> > > > > BIOS in a Xen HVM (fully-virtualised) guest.
> > > > > 
> > > > > In this series SeaBIOS is loaded by hvmloader (the Xen early
> > > > > firmware) rather than directly as was previously tried. This
> > > > > approach turned out to be far less intrusive on the SeaBIOS side
> > > > > and leaves knowledge of the virtual hardware setup encapsulated
> > > > > within hvmloader which is updated in lock step with the hypervisor
> > > > > and associated tools.
> > > > > 
> > > > > BIOS tables are built by hvmloader and passed to SeaBIOS via a
> > > > > simple in memory data structure. The tables are identified by
> > > > > scanning for their signatures which is hopefully extensible enough
> > > > > but the core structure can also be extended as necessary.
> > > > 
> > > > It looks okay to me.
> > > 
> > > Thanks.
> > > 
> > > All the Xen side pieces are in place already (although not set in stone
> > > if you find something you would like done different).
> > 
> > I've committed this.
> 
> Thanks Kevin!
> 
> Ian.
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [SeaBIOS] Xen HVM Support
  2011-07-22  9:27         ` Tobias Geiger
@ 2011-07-22  9:32           ` Ian Campbell
  2011-07-22 10:34             ` Tobias Geiger
  0 siblings, 1 reply; 10+ messages in thread
From: Ian Campbell @ 2011-07-22  9:32 UTC (permalink / raw)
  To: Tobias Geiger; +Cc: Kevin O'Connor, xen-devel, seabios

On Fri, 2011-07-22 at 10:27 +0100, Tobias Geiger wrote:
> Hi,
> 
> yesterday i tried to boot Windows7 64bit with the new "Upstream Qemu with 
> Seabios" HVM loader under xen unstable (yesterdays hg pull)
> 
> The Windows Installer booted fine from the ISO (after enabling El-Torrito 
> Emulation in Seabios menuconfig), but the Windows Installer soon gave up with a 
> BSOD (STOP 0xA5), much like stated here http://www.coreboot.org/SeaBIOS under 
> "Windows".
> I have a Screenshot from the BSOD in case the adresses are of any interest.
> 
> Any hints, or is this supposed to not work (yet) ?

We haven't yet tested the whole range of possible guests and I haven't
personally tried Windows 7 with new qemu+SeaBIOS.

The Wikipage suggests that the issue is related to the ACPI tables and
under Xen these are the same as those used by old qemu+ROMBIOS so it may
not be the exact same issue. Have you tried the same OS under old qemu?
(although I'm sure we would know already if Windows 7 support was broken
in xen-unstable...)

The screenshot would probably be useful to see.

Ian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: [SeaBIOS] Xen HVM Support
  2011-07-22  9:32           ` Ian Campbell
@ 2011-07-22 10:34             ` Tobias Geiger
  0 siblings, 0 replies; 10+ messages in thread
From: Tobias Geiger @ 2011-07-22 10:34 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell

Hello Ian,

The BSOD was a ACPI related one, yes.
unfortunatly the Screenshot is @home - i will upload it when back there again.

with "standard" qemu (i.e. the one shipped with xen) win7-64 installs and 
works fine, yes.

Greetings!
Tobias


Am Freitag, 22. Juli 2011, 11:32:34 schrieb Ian Campbell:
> On Fri, 2011-07-22 at 10:27 +0100, Tobias Geiger wrote:
> > Hi,
> > 
> > yesterday i tried to boot Windows7 64bit with the new "Upstream Qemu with
> > Seabios" HVM loader under xen unstable (yesterdays hg pull)
> > 
> > The Windows Installer booted fine from the ISO (after enabling El-Torrito
> > Emulation in Seabios menuconfig), but the Windows Installer soon gave up
> > with a BSOD (STOP 0xA5), much like stated here
> > http://www.coreboot.org/SeaBIOS under "Windows".
> > I have a Screenshot from the BSOD in case the adresses are of any
> > interest.
> > 
> > Any hints, or is this supposed to not work (yet) ?
> 
> We haven't yet tested the whole range of possible guests and I haven't
> personally tried Windows 7 with new qemu+SeaBIOS.
> 
> The Wikipage suggests that the issue is related to the ACPI tables and
> under Xen these are the same as those used by old qemu+ROMBIOS so it may
> not be the exact same issue. Have you tried the same OS under old qemu?
> (although I'm sure we would know already if Windows 7 support was broken
> in xen-unstable...)
> 
> The screenshot would probably be useful to see.
> 
> Ian.
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-07-22 10:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-01  9:59 Xen HVM Support Ian Campbell
2011-06-01 10:00 ` [PATCH 1/2] Move support for copying out BIOS tables into its own file Ian Campbell
2011-06-01 10:00 ` [PATCH 2/2] Add support for use as Xen HVM BIOS Ian Campbell
2011-06-06  1:20 ` [SeaBIOS] Xen HVM Support Kevin O'Connor
2011-06-06  8:54   ` Ian Campbell
2011-06-13 12:00     ` [SeaBIOS] " Kevin O'Connor
2011-06-14  8:19       ` Ian Campbell
2011-07-22  9:27         ` Tobias Geiger
2011-07-22  9:32           ` Ian Campbell
2011-07-22 10:34             ` Tobias Geiger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.