aboutsummaryrefslogtreecommitdiffstats
path: root/unmodified_drivers
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-10-14 10:45:29 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-10-14 10:45:29 +0100
commit39f97ffa298bba63e727ecce0117db95f0bb17f7 (patch)
treecde5f544991c3de8f56384cf12ce139fe8c87ee5 /unmodified_drivers
parentb525c05cf95fa9528cfb83ecc120087881013980 (diff)
downloadxen-39f97ffa298bba63e727ecce0117db95f0bb17f7.tar.gz
xen-39f97ffa298bba63e727ecce0117db95f0bb17f7.tar.bz2
xen-39f97ffa298bba63e727ecce0117db95f0bb17f7.zip
x86, hvm: Hyper-V guest interface support with small set of enlightenments
A minimal implementation of the Viridian (Hyper-V) guest interface. The only enlightenments advertised and supported are vAPIC MSRs and long-spin-wait notifications. The set of enlightenments can easily be extended in future, as they are found to provide a performance win, and configured via an extended HVM_PARAM_VIRIDIAN hvm parameter. Signed-off-by: Peter Johnston <peter.johnston@citrix.com> Signed-off-by: Tim Deegan <tim.deegan@citrix.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'unmodified_drivers')
-rw-r--r--unmodified_drivers/linux-2.6/platform-pci/platform-pci.c51
1 files changed, 28 insertions, 23 deletions
diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
index 3d3a4c79a1..a1c17dd7db 100644
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
@@ -111,26 +111,37 @@ unsigned long alloc_xen_mmio(unsigned long len)
#ifndef __ia64__
-static int init_hypercall_stubs(void)
+static uint32_t xen_cpuid_base(void)
{
- uint32_t eax, ebx, ecx, edx, pages, msr, i;
+ uint32_t base, eax, ebx, ecx, edx;
char signature[13];
- cpuid(0x40000000, &eax, &ebx, &ecx, &edx);
- *(uint32_t*)(signature + 0) = ebx;
- *(uint32_t*)(signature + 4) = ecx;
- *(uint32_t*)(signature + 8) = edx;
- signature[12] = 0;
+ for (base = 0x40000000; base < 0x40001000; base += 0x100) {
+ cpuid(base, &eax, &ebx, &ecx, &edx);
+ *(uint32_t*)(signature + 0) = ebx;
+ *(uint32_t*)(signature + 4) = ecx;
+ *(uint32_t*)(signature + 8) = edx;
+ signature[12] = 0;
+
+ if (!strcmp("XenVMMXenVMM", signature) && ((eax - base) >= 2))
+ return base;
+ }
+
+ return 0;
+}
- if (strcmp("XenVMMXenVMM", signature) || (eax < 0x40000002)) {
+static int init_hypercall_stubs(void)
+{
+ uint32_t eax, ebx, ecx, edx, pages, msr, i, base;
+
+ base = xen_cpuid_base();
+ if (base == 0) {
printk(KERN_WARNING
- "Detected Xen platform device but not Xen VMM?"
- " (sig %s, eax %x)\n",
- signature, eax);
+ "Detected Xen platform device but not Xen VMM?\n");
return -EINVAL;
}
- cpuid(0x40000001, &eax, &ebx, &ecx, &edx);
+ cpuid(base + 1, &eax, &ebx, &ecx, &edx);
printk(KERN_INFO "Xen version %d.%d.\n", eax >> 16, eax & 0xffff);
@@ -138,7 +149,7 @@ static int init_hypercall_stubs(void)
* Find largest supported number of hypercall pages.
* We'll create as many as possible up to this number.
*/
- cpuid(0x40000002, &pages, &msr, &ecx, &edx);
+ cpuid(base + 2, &pages, &msr, &ecx, &edx);
/*
* Use __vmalloc() because vmalloc_exec() is not an exported symbol.
@@ -174,18 +185,12 @@ static int init_hypercall_stubs(void)
static void resume_hypercall_stubs(void)
{
- uint32_t eax, ebx, ecx, edx, pages, msr, i;
- char signature[13];
-
- cpuid(0x40000000, &eax, &ebx, &ecx, &edx);
- *(uint32_t*)(signature + 0) = ebx;
- *(uint32_t*)(signature + 4) = ecx;
- *(uint32_t*)(signature + 8) = edx;
- signature[12] = 0;
+ uint32_t base, ecx, edx, pages, msr, i;
- BUG_ON(strcmp("XenVMMXenVMM", signature) || (eax < 0x40000002));
+ base = xen_cpuid_base();
+ BUG_ON(base == 0);
- cpuid(0x40000002, &pages, &msr, &ecx, &edx);
+ cpuid(base + 2, &pages, &msr, &ecx, &edx);
if (pages > max_hypercall_stub_pages)
pages = max_hypercall_stub_pages;