xen/hv_xen_base.patch

210 lines
6.3 KiB
Diff
Raw Normal View History

%patch
Index: xen-3.3.1-testing/xen/include/asm-x86/hvm/domain.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/asm-x86/hvm/domain.h 2009-01-05 13:27:58.000000000 -0700
+++ xen-3.3.1-testing/xen/include/asm-x86/hvm/domain.h 2009-01-22 13:23:44.000000000 -0700
@@ -82,6 +82,7 @@
struct vmx_domain vmx;
struct svm_domain svm;
};
+ void *hyperv_handle; /* will be NULL on creation*/
};
#endif /* __ASM_X86_HVM_DOMAIN_H__ */
Index: xen-3.3.1-testing/xen/arch/x86/hvm/Makefile
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/Makefile 2009-01-05 13:27:57.000000000 -0700
+++ xen-3.3.1-testing/xen/arch/x86/hvm/Makefile 2009-01-22 13:23:44.000000000 -0700
@@ -1,5 +1,6 @@
subdir-y += svm
subdir-y += vmx
+subdir-y += hyperv
obj-y += emulate.o
obj-y += hvm.o
Index: xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/hvm.c 2009-01-05 13:27:57.000000000 -0700
+++ xen-3.3.1-testing/xen/arch/x86/hvm/hvm.c 2009-01-22 13:23:44.000000000 -0700
@@ -44,6 +44,7 @@
#include <asm/mc146818rtc.h>
#include <asm/spinlock.h>
#include <asm/hvm/hvm.h>
+#include <asm/hvm/hvm_extensions.h>
#include <asm/hvm/vpt.h>
#include <asm/hvm/support.h>
#include <asm/hvm/cacheattr.h>
@@ -361,6 +362,7 @@
void hvm_domain_destroy(struct domain *d)
{
+ hyperx_intercept_domain_destroy(d);
hvm_funcs.domain_destroy(d);
rtc_deinit(d);
stdvga_deinit(d);
@@ -644,8 +646,14 @@
{
int rc;
+ if ((rc = hyperx_intercept_vcpu_initialize(v)) != 0)
+ goto fail1;
+
if ( (rc = vlapic_init(v)) != 0 )
+ {
+ hyperx_intercept_vcpu_destroy(v);
goto fail1;
+ }
if ( (rc = hvm_funcs.vcpu_initialise(v)) != 0 )
goto fail2;
@@ -692,12 +700,14 @@
hvm_funcs.vcpu_destroy(v);
fail2:
vlapic_destroy(v);
+ hyperx_intercept_vcpu_destroy(v);
fail1:
return rc;
}
void hvm_vcpu_destroy(struct vcpu *v)
{
+ hyperx_intercept_vcpu_destroy(v);
hvm_vcpu_cacheattr_destroy(v);
vlapic_destroy(v);
hvm_funcs.vcpu_destroy(v);
@@ -1645,7 +1655,7 @@
struct vcpu *v = current;
if ( cpuid_hypervisor_leaves(input, eax, ebx, ecx, edx) )
- return;
+ goto hvm_cpuid_done;
domain_cpuid(v->domain, input, *ecx, eax, ebx, ecx, edx);
@@ -1657,6 +1667,8 @@
if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
__clear_bit(X86_FEATURE_APIC & 31, edx);
}
+hvm_cpuid_done:
+ hyperx_intercept_do_cpuid(input, eax, ebx, ecx, edx);
}
void hvm_rdtsc_intercept(struct cpu_user_regs *regs)
@@ -1747,6 +1759,8 @@
break;
default:
+ if (hyperx_intercept_do_msr_read(ecx, regs))
+ return X86EMUL_OKAY;
return hvm_funcs.msr_read_intercept(regs);
}
@@ -1835,6 +1849,8 @@
break;
default:
+ if (hyperx_intercept_do_msr_write(ecx, regs))
+ return X86EMUL_OKAY;
return hvm_funcs.msr_write_intercept(regs);
}
@@ -2002,6 +2018,10 @@
case 0:
break;
}
+ if (hyperx_intercept_do_hypercall(regs))
+ {
+ return HVM_HCALL_completed;
+ }
if ( (eax >= NR_hypercalls) || !hvm_hypercall32_table[eax] )
{
@@ -2503,6 +2523,15 @@
rc = -EINVAL;
break;
+ case HVM_PARAM_EXTEND_HYPERVISOR:
+ if ((a.value == 1) && hyperv_initialize(d))
+ {
+ if (a.value != 1)
+ rc = -EINVAL;
+ else
+ rc = -ENOMEM;
+ goto param_fail;
+ }
}
if ( rc == 0 )
Index: xen-3.3.1-testing/xen/include/public/arch-x86/hvm/save.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/public/arch-x86/hvm/save.h 2009-01-05 13:27:58.000000000 -0700
+++ xen-3.3.1-testing/xen/include/public/arch-x86/hvm/save.h 2009-01-23 08:35:50.000000000 -0700
@@ -38,7 +38,7 @@
uint32_t version; /* File format version */
uint64_t changeset; /* Version of Xen that saved this file */
uint32_t cpuid; /* CPUID[0x01][%eax] on the saving machine */
- uint32_t pad0;
+ uint32_t pad0;
};
DECLARE_HVM_SAVE_TYPE(HEADER, 1, struct hvm_save_header);
@@ -421,9 +421,23 @@
DECLARE_HVM_SAVE_TYPE(MTRR, 14, struct hvm_hw_mtrr);
+struct hvm_hyperv_dom {
+ uint64_t guestid_msr;
+ uint64_t hypercall_msr;
+ uint32_t long_mode;
+ uint32_t ext_id;
+};
+DECLARE_HVM_SAVE_TYPE(HYPERV_DOM, 15, struct hvm_hyperv_dom);
+
+struct hvm_hyperv_cpu {
+ uint64_t control_msr;
+ uint64_t version_msr;
+ uint64_t pad[27]; //KYS: sles10 sp2 compatibility
+};
+DECLARE_HVM_SAVE_TYPE(HYPERV_CPU, 16, struct hvm_hyperv_cpu);
/*
* Largest type-code in use
*/
-#define HVM_SAVE_CODE_MAX 14
+#define HVM_SAVE_CODE_MAX 16
#endif /* __XEN_PUBLIC_HVM_SAVE_X86_H__ */
Index: xen-3.3.1-testing/xen/arch/x86/hvm/vlapic.c
===================================================================
--- xen-3.3.1-testing.orig/xen/arch/x86/hvm/vlapic.c 2009-01-22 13:23:43.000000000 -0700
+++ xen-3.3.1-testing/xen/arch/x86/hvm/vlapic.c 2009-01-22 13:23:44.000000000 -0700
@@ -34,6 +34,7 @@
#include <asm/hvm/hvm.h>
#include <asm/hvm/io.h>
#include <asm/hvm/support.h>
+#include <asm/hvm/hvm_extensions.h>
#include <asm/hvm/vmx/vmx.h>
#include <public/hvm/ioreq.h>
#include <public/hvm/params.h>
@@ -307,6 +308,7 @@
hvm_vcpu_reset_state(v, trampoline_vector << 8, 0);
vcpu_unpause(v);
+ hyperx_intercept_vcpu_up(v);
return X86EMUL_OKAY;
}
Index: xen-3.3.1-testing/xen/include/public/hvm/params.h
===================================================================
--- xen-3.3.1-testing.orig/xen/include/public/hvm/params.h 2009-01-05 13:27:58.000000000 -0700
+++ xen-3.3.1-testing/xen/include/public/hvm/params.h 2009-01-22 13:23:44.000000000 -0700
@@ -93,6 +93,8 @@
/* ACPI S state: currently support S0 and S3 on x86. */
#define HVM_PARAM_ACPI_S_STATE 14
-#define HVM_NR_PARAMS 15
+#define HVM_PARAM_EXTEND_HYPERVISOR 15
+
+#define HVM_NR_PARAMS 16
#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */