185 lines
7.9 KiB
Diff
185 lines
7.9 KiB
Diff
unstable c/s 13276: Support for save and restore of compatibility guests
|
|
|
|
Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
|
|
|
|
unstable c/s 13279: Initial support for HVM compat guests
|
|
|
|
Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
|
|
|
|
Index: 2007-01-31/tools/libxc/xc_linux_save.c
|
|
===================================================================
|
|
--- 2007-01-31.orig/tools/libxc/xc_linux_save.c 2007-01-31 09:19:49.000000000 +0100
|
|
+++ 2007-01-31/tools/libxc/xc_linux_save.c 2007-01-31 09:33:01.000000000 +0100
|
|
@@ -44,6 +44,7 @@ static xen_pfn_t *live_p2m = NULL;
|
|
|
|
/* Live mapping of system MFN to PFN table. */
|
|
static xen_pfn_t *live_m2p = NULL;
|
|
+static unsigned long m2p_mfn0;
|
|
|
|
/* grep fodder: machine_to_phys */
|
|
|
|
@@ -467,13 +468,23 @@ static int canonicalize_pagetable(unsign
|
|
** that this check will fail for other L2s.
|
|
*/
|
|
if (pt_levels == 3 && type == XEN_DOMCTL_PFINFO_L2TAB) {
|
|
+ int hstart;
|
|
+ unsigned long he;
|
|
|
|
-/* XXX index of the L2 entry in PAE mode which holds the guest LPT */
|
|
-#define PAE_GLPT_L2ENTRY (495)
|
|
- pte = ((const uint64_t*)spage)[PAE_GLPT_L2ENTRY];
|
|
+ hstart = (hvirt_start >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
|
|
+ he = ((const uint64_t *) spage)[hstart];
|
|
|
|
- if(((pte >> PAGE_SHIFT) & 0x0fffffff) == live_p2m[pfn])
|
|
- xen_start = (hvirt_start >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
|
|
+ if ( ((he >> PAGE_SHIFT) & 0x0fffffff) == m2p_mfn0 ) {
|
|
+ /* hvirt starts with xen stuff... */
|
|
+ xen_start = hstart;
|
|
+ } else if ( hvirt_start != 0xf5800000 ) {
|
|
+ /* old L2s from before hole was shrunk... */
|
|
+ hstart = (0xf5800000 >> L2_PAGETABLE_SHIFT_PAE) & 0x1ff;
|
|
+ he = ((const uint64_t *) spage)[hstart];
|
|
+
|
|
+ if( ((he >> PAGE_SHIFT) & 0x0fffffff) == m2p_mfn0 )
|
|
+ xen_start = hstart;
|
|
+ }
|
|
}
|
|
|
|
if (pt_levels == 4 && type == XEN_DOMCTL_PFINFO_L4TAB) {
|
|
@@ -577,6 +588,8 @@ static xen_pfn_t *xc_map_m2p(int xc_hand
|
|
return NULL;
|
|
}
|
|
|
|
+ m2p_mfn0 = entries[0].mfn;
|
|
+
|
|
free(extent_start);
|
|
free(entries);
|
|
|
|
Index: 2007-01-31/tools/libxc/xg_save_restore.h
|
|
===================================================================
|
|
--- 2007-01-31.orig/tools/libxc/xg_save_restore.h 2007-01-08 14:16:35.000000000 +0100
|
|
+++ 2007-01-31/tools/libxc/xg_save_restore.h 2007-01-31 09:33:01.000000000 +0100
|
|
@@ -53,8 +53,17 @@ static int get_platform_info(int xc_hand
|
|
|
|
*hvirt_start = xen_params.virt_start;
|
|
|
|
+ /*
|
|
+ * XXX For now, 32bit dom0's can only save/restore 32bit domUs
|
|
+ * on 64bit hypervisors, so no need to check which type of domain
|
|
+ * we're dealing with.
|
|
+ */
|
|
if (strstr(xen_caps, "xen-3.0-x86_64"))
|
|
+#if defined(__i386__)
|
|
+ *pt_levels = 3;
|
|
+#else
|
|
*pt_levels = 4;
|
|
+#endif
|
|
else if (strstr(xen_caps, "xen-3.0-x86_32p"))
|
|
*pt_levels = 3;
|
|
else if (strstr(xen_caps, "xen-3.0-x86_32"))
|
|
Index: 2007-01-31/xen/arch/x86/domain.c
|
|
===================================================================
|
|
--- 2007-01-31.orig/xen/arch/x86/domain.c 2007-01-31 09:31:01.000000000 +0100
|
|
+++ 2007-01-31/xen/arch/x86/domain.c 2007-01-31 09:34:52.000000000 +0100
|
|
@@ -1405,7 +1405,11 @@ void domain_relinquish_resources(struct
|
|
#ifdef CONFIG_COMPAT
|
|
if ( IS_COMPAT(d) )
|
|
{
|
|
- pfn = l4e_get_pfn(*(l4_pgentry_t *)__va(pagetable_get_paddr(v->arch.guest_table)));
|
|
+ if ( is_hvm_vcpu(v) )
|
|
+ pfn = pagetable_get_pfn(v->arch.guest_table);
|
|
+ else
|
|
+ pfn = l4e_get_pfn(*(l4_pgentry_t *)__va(pagetable_get_paddr(v->arch.guest_table)));
|
|
+
|
|
if ( pfn != 0 )
|
|
{
|
|
if ( shadow_mode_refcounts(d) )
|
|
Index: 2007-01-31/xen/arch/x86/domctl.c
|
|
===================================================================
|
|
--- 2007-01-31.orig/xen/arch/x86/domctl.c 2007-01-31 09:29:26.000000000 +0100
|
|
+++ 2007-01-31/xen/arch/x86/domctl.c 2007-01-31 09:33:01.000000000 +0100
|
|
@@ -356,7 +356,10 @@ void arch_get_info_guest(struct vcpu *v,
|
|
c.nat->ctrlreg[3] = xen_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table));
|
|
#ifdef CONFIG_COMPAT
|
|
else
|
|
- c.cmp->ctrlreg[3] = compat_pfn_to_cr3(pagetable_get_pfn(v->arch.guest_table));
|
|
+ {
|
|
+ l4_pgentry_t *l4e = __va(pagetable_get_paddr(v->arch.guest_table));
|
|
+ c.cmp->ctrlreg[3] = compat_pfn_to_cr3(l4e_get_pfn(*l4e));
|
|
+ }
|
|
#endif
|
|
|
|
c(vm_assist = v->domain->vm_assist);
|
|
Index: 2007-01-31/xen/arch/x86/hvm/intercept.c
|
|
===================================================================
|
|
--- 2007-01-31.orig/xen/arch/x86/hvm/intercept.c 2006-12-13 11:15:53.000000000 +0100
|
|
+++ 2007-01-31/xen/arch/x86/hvm/intercept.c 2007-01-31 09:34:52.000000000 +0100
|
|
@@ -180,7 +180,7 @@ int hvm_buffered_io_intercept(ioreq_t *p
|
|
spin_lock(buffered_io_lock);
|
|
|
|
if ( buffered_iopage->write_pointer - buffered_iopage->read_pointer ==
|
|
- (unsigned long)IOREQ_BUFFER_SLOT_NUM ) {
|
|
+ (unsigned int)IOREQ_BUFFER_SLOT_NUM ) {
|
|
/* the queue is full.
|
|
* send the iopacket through the normal path.
|
|
* NOTE: The arithimetic operation could handle the situation for
|
|
Index: 2007-01-31/xen/arch/x86/x86_64/compat/entry.S
|
|
===================================================================
|
|
--- 2007-01-31.orig/xen/arch/x86/x86_64/compat/entry.S 2007-01-31 09:29:27.000000000 +0100
|
|
+++ 2007-01-31/xen/arch/x86/x86_64/compat/entry.S 2007-01-31 09:34:52.000000000 +0100
|
|
@@ -313,7 +313,7 @@ ENTRY(compat_hypercall_table)
|
|
.quad compat_xenoprof_op
|
|
.quad do_event_channel_op
|
|
.quad compat_physdev_op
|
|
- .quad compat_ni_hypercall
|
|
+ .quad do_hvm_op
|
|
.quad compat_sysctl /* 35 */
|
|
.quad compat_domctl
|
|
.quad compat_kexec_op
|
|
@@ -356,7 +356,7 @@ ENTRY(compat_hypercall_args_table)
|
|
.byte 2 /* compat_xenoprof_op */
|
|
.byte 2 /* compat_event_channel_op */
|
|
.byte 2 /* compat_physdev_op */
|
|
- .byte 0 /* compat_ni_hypercall */
|
|
+ .byte 2 /* do_hvm_op */
|
|
.byte 1 /* compat_sysctl */ /* 35 */
|
|
.byte 1 /* compat_domctl */
|
|
.byte 2 /* compat_kexec_op */
|
|
Index: 2007-01-31/xen/include/asm-x86/x86_64/page.h
|
|
===================================================================
|
|
--- 2007-01-31.orig/xen/include/asm-x86/x86_64/page.h 2007-01-31 09:29:11.000000000 +0100
|
|
+++ 2007-01-31/xen/include/asm-x86/x86_64/page.h 2007-01-31 09:33:01.000000000 +0100
|
|
@@ -96,7 +96,7 @@ typedef l4_pgentry_t root_pgentry_t;
|
|
#define L3_DISALLOW_MASK (BASE_DISALLOW_MASK | 0x180U /* must-be-zero */)
|
|
#define L4_DISALLOW_MASK (BASE_DISALLOW_MASK | 0x180U /* must-be-zero */)
|
|
|
|
-#define COMPAT_L3_DISALLOW_MASK 0xFFFFF1E6U /* must-be-zero */
|
|
+#define COMPAT_L3_DISALLOW_MASK L3_DISALLOW_MASK
|
|
|
|
#define PAGE_HYPERVISOR (__PAGE_HYPERVISOR | _PAGE_GLOBAL)
|
|
#define PAGE_HYPERVISOR_NOCACHE (__PAGE_HYPERVISOR_NOCACHE | _PAGE_GLOBAL)
|
|
Index: 2007-01-31/xen/include/public/hvm/ioreq.h
|
|
===================================================================
|
|
--- 2007-01-31.orig/xen/include/public/hvm/ioreq.h 2006-12-13 11:15:56.000000000 +0100
|
|
+++ 2007-01-31/xen/include/public/hvm/ioreq.h 2007-01-31 09:34:52.000000000 +0100
|
|
@@ -56,6 +56,7 @@ struct ioreq {
|
|
uint8_t dir:1; /* 1=read, 0=write */
|
|
uint8_t df:1;
|
|
uint8_t type; /* I/O type */
|
|
+ uint8_t _pad0[6];
|
|
uint64_t io_count; /* How many IO done on a vcpu */
|
|
};
|
|
typedef struct ioreq ioreq_t;
|
|
@@ -74,8 +75,8 @@ typedef struct shared_iopage shared_iopa
|
|
|
|
#define IOREQ_BUFFER_SLOT_NUM 80
|
|
struct buffered_iopage {
|
|
- unsigned long read_pointer;
|
|
- unsigned long write_pointer;
|
|
+ unsigned int read_pointer;
|
|
+ unsigned int write_pointer;
|
|
ioreq_t ioreq[IOREQ_BUFFER_SLOT_NUM];
|
|
}; /* sizeof this structure must be in one page */
|
|
typedef struct buffered_iopage buffered_iopage_t;
|