Hi Alex, Wing,
I revised my patch(return to SAL). What do you think?
This is still dirty since it uses the rest area of HOB.
Is there any other good place for SAL_RETURN_STUB_PADDR?
Thanks,
Kouya
Alex Williamson writes:
> Can this be combined with Tristan's approach for HVM vCPU hotplug
> that he's implemented in his GFW? Tristan allows hotplugged vCPUs to
> return online, which it appears this one does not. It might take
> changes to both the Intel GFW and to Xen to make this work. Thanks,
>
> Alex
>
> --
> Alex Williamson HP Open Source & Linux Org.
diff -r fc9e2f7920c9 tools/libxc/ia64/xc_ia64_hvm_build.c
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c Fri Mar 30 17:18:42 2007 -0600
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c Wed Apr 04 21:17:34 2007 +0900
@@ -73,8 +73,6 @@ xc_get_hvm_param(int handle, domid_t dom
}
#define HOB_SIGNATURE 0x3436474953424f48 // "HOBSIG64"
-#define GFW_HOB_START ((4UL<<30)-(14UL<<20)) // 4G - 14M
-#define GFW_HOB_SIZE (1UL<<20) // 1M
typedef struct {
unsigned long signature;
@@ -280,6 +278,7 @@ load_hob(int xc_handle, uint32_t dom, vo
// hob_buf should be page aligned
int hob_size;
int nr_pages;
+ unsigned long *code;
hob_size = get_hob_size(hob_buf);
if (hob_size < 0) {
@@ -287,12 +286,31 @@ load_hob(int xc_handle, uint32_t dom, vo
return -1;
}
- if (hob_size > GFW_HOB_SIZE) {
+ if (hob_size > GFW_HOB_SIZE - 0x10) {
PERROR("No enough memory for hob data");
return -1;
}
+ /*
+ * inject a emulation code for SAL Return state from OS_BOOT_RENDEZ
+ *
+ * 1: mov r28=0x28 // PAL_HALT
+ * break 0x110000 // DOMN_PAL_REQUEST
+ * br.many.sptk.few 1
+ */
+ code = hob_buf + GFW_HOB_SIZE - 0x10;
+ code[0] = 0x000024000070e011;
+ code[1] = 0x4000000000040010;
+
nr_pages = (hob_size + PAGE_SIZE -1) >> PAGE_SHIFT;
+
+ if (nr_pages < (GFW_HOB_SIZE >> PAGE_SHIFT)) {
+ // copy the emulation code
+ if (xc_ia64_copy_to_domain_pages(xc_handle, dom,
+ hob_buf + GFW_HOB_SIZE - PAGE_SIZE,
+ (GFW_HOB_START + GFW_HOB_SIZE - PAGE_SIZE) >> PAGE_SHIFT, 1))
+ return -1;
+ }
return xc_ia64_copy_to_domain_pages(xc_handle, dom, hob_buf,
GFW_HOB_START >> PAGE_SHIFT, nr_pages);
diff -r fc9e2f7920c9 xen/arch/ia64/vmx/vlsapic.c
--- a/xen/arch/ia64/vmx/vlsapic.c Fri Mar 30 17:18:42 2007 -0600
+++ b/xen/arch/ia64/vmx/vlsapic.c Wed Apr 04 21:17:34 2007 +0900
@@ -708,6 +708,7 @@ static void vlsapic_write_ipi(VCPU *vcpu
vcpu_init_regs(targ);
targ_regs->cr_iip = d->arch.sal_data->boot_rdv_ip;
targ_regs->r1 = d->arch.sal_data->boot_rdv_r1;
+ targ_regs->b0 = SAL_RETURN_STUB_PADDR;
if (test_and_clear_bit(_VPF_down,&targ->pause_flags)) {
vcpu_wake(targ);
diff -r fc9e2f7920c9 xen/arch/ia64/xen/fw_emul.c
--- a/xen/arch/ia64/xen/fw_emul.c Fri Mar 30 17:18:42 2007 -0600
+++ b/xen/arch/ia64/xen/fw_emul.c Wed Apr 04 21:17:34 2007 +0900
@@ -725,6 +725,8 @@ xen_pal_emulator(unsigned long index, u6
console_start_sync();
(*efi.reset_system)(EFI_RESET_SHUTDOWN,0,0,NULL);
} else {
+ printk (XENLOG_DEBUG "dom%d/vcpu%d: going offline\n",
+ current->domain->domain_id, current->vcpu_id);
set_bit(_VPF_down, ¤t->pause_flags);
vcpu_sleep_nosync(current);
status = PAL_STATUS_SUCCESS;
diff -r fc9e2f7920c9 xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c Fri Mar 30 17:18:42 2007 -0600
+++ b/xen/arch/ia64/xen/vcpu.c Wed Apr 04 21:17:34 2007 +0900
@@ -174,6 +174,9 @@ void vcpu_init_regs(struct vcpu *v)
INT_ENABLE_OFFSET(v);
VCPU(v, itv) = (1 << 16); /* timer vector masked */
}
+
+ /* to prevent a Reserved Field fault */
+ VCPU(v, pta) = 0x3c;
v->arch.domain_itm_last = -1L;
}
diff -r fc9e2f7920c9 xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h Fri Mar 30 17:18:42 2007 -0600
+++ b/xen/include/public/arch-ia64.h Wed Apr 04 21:17:34 2007 +0900
@@ -107,6 +107,11 @@ typedef unsigned long xen_ulong_t;
#define GFW_START (4*MEM_G -16*MEM_M)
#define GFW_SIZE (16*MEM_M)
+
+#define GFW_HOB_START (4*MEM_G-14*MEM_M)
+#define GFW_HOB_SIZE (1*MEM_M)
+
+#define SAL_RETURN_STUB_PADDR (GFW_HOB_START+GFW_HOB_SIZE-0x10)
struct pt_fpreg {
union {
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|