mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
This changeset contains all differences between xen-unstable.hg and xen-unstable-hvm.hg. All information and comments for changesets unique to xen-unstable-hvm.hg are included below. Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> Signed-off-by: Keir Fraser <keir@xensource.com> > user: leendert@eserver2.watson.ibm.com > date: Tue Jan 31 04:29:51 2006 -0400 > files: xen/include/asm-ia64/mm.h > description: > Fix ia64 compile. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Tue Jan 31 02:21:49 2006 -0400 > files: xen/include/xen/domain_page.h > description: > Eliminate unused fields (pfn,va) warnings. > > Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Fri Jan 27 04:31:44 2006 -0400 > files: tools/python/xen/xend/image.py > description: > Name cleanup. vmx refers to VT-x specific code, HVM is used for all others. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: root@xen-trw1.amd.com > date: Sun Jan 22 18:39:58 2006 -0500 > files: xen/arch/x86/hvm/platform.c > description: > support prefix 0x67 in hvm decode logic, gfxboot patch causes 0x67 prefix. > > > user: twoller@xen-trw1.amd.com > date: Sun Jan 22 18:35:59 2006 -0500 > files: xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c xen/include/asm-x86/hvm/svm/svm.h > description: > check for valid shared_page_va/vmcb before deallocating in SVM. > > > user: leendert@eserver2.watson.ibm.com > date: Sun Jan 22 02:56:20 2006 -0400 > files: xen/include/asm-x86/hvm/svm/svm.h xen/include/asm-x86/hvm/svm/vmmcall.h > description: > Some SVM header file cleanups. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Fri Jan 20 11:50:23 2006 -0400 > files: xen/arch/x86/domain.c > description: > Need to be more diligent about when to call into the HVM abstraction layer > and when not. > > Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Wed Jan 18 15:14:56 2006 -0400 > files: xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/x86_32/exits.S xen/arch/x86/hvm/svm/x86_64/exits.S xen/arch/x86/hvm/vmx/x86_32/exits.S xen/arch/x86/hvm/vmx/x86_64/exits.S > description: > Added missing copyright statements and updated svm.c's copyright to properly > reflect that it was derived from vmx.c. > > Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Tue Jan 17 09:42:11 2006 -0400 > files: xen/arch/ia64/Makefile xen/arch/ia64/vmx/vlsapic.c xen/arch/ia64/vmx/vmx_init.c xen/include/asm-ia64/vmx_platform.h > description: > Make sure ia64 builds again with the new directory structure. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@localhost.localdomain > date: Tue Jan 17 08:28:51 2006 -0400 > files: xen/arch/x86/Makefile xen/arch/x86/hvm/i8259.c xen/arch/x86/hvm/vioapic.c > description: > The device models now belong in hvm. > > Signed-ff-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Sun Jan 15 16:40:58 2006 -0400 > files: xen/arch/x86/Makefile xen/arch/x86/cpu/amd.c xen/arch/x86/cpu/intel.c xen/arch/x86/dm/hvm_vioapic.c xen/arch/x86/dm/i8259.c xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/intercept.c xen/arch/x86/hvm/io.c xen/arch/x86/hvm/platform.c xen/arch/x86/hvm/svm/emulate.c xen/arch/x86/hvm/svm/instrlen.c xen/arch/x86/hvm/svm/intr.c xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/svm/vmcb.c xen/arch/x86/hvm/svm/x86_32/exits.S xen/arch/x86/hvm/svm/x86_64/exits.S xen/arch/x86/hvm/vlapic.c xen/arch/x86/hvm/vmx/io.c xen/arch/x86/hvm/vmx/vmcs.c xen/arch/x86/hvm/vmx/vmx.c xen/arch/x86/hvm/vmx/x86_32/exits.S xen/arch/x86/hvm/vmx/x86_64/exits.S xen/arch/x86/i387.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/entry.S xen/arch/x86/x86_64/traps.c xen/include/asm-x86/domain.h xen/include/asm-x86/hvm/domain.h xen/include/asm-x86/hvm/hvm.h xen/include/asm-x86/hvm/io.h xen/include/asm-x86/hvm/support.h xen/include/asm-x86/hvm/svm/emulate.h xen/include/asm-x86/hvm/svm/intr.h xen/include/asm-x86/hvm/svm/svm.h xen/include/asm-x86/hvm/svm/vmcb.h xen/include/asm-x86/hvm/svm/vmmcall.h xen/include/asm-x86/hvm/vcpu.h xen/include/asm-x86/hvm/vioapic.h xen/include/asm-x86/hvm/vlapic.h xen/include/asm-x86/hvm/vmx/cpu.h xen/include/asm-x86/hvm/vmx/vmcs.h xen/include/asm-x86/hvm/vmx/vmx.h xen/include/asm-x86/hvm/vpic.h xen/include/asm-x86/hvm/vpit.h xen/include/asm-x86/shadow.h > description: > As suggested by Keir, I restructured the hvm/vmx/svm tree. The new > directory structure looks like: > > xen/arch/hvm/ > xen/arch/hvm/vmx > xen/arch/hvm/vmx/x86_32 > xen/arch/hvm/vmx/x86_64 > xen/arch/hvm/svm > xen/arch/hvm/svm/x86_32 > xen/arch/hvm/svm/x86_64 > > xen/include/hvm/ > xen/include/hvm/vmx > xen/include/hvm/svm > > Many files have been renamed and had their hvm_/vmx_/svm_ suffix removed > because this is now clear from the directory where the file resides. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Sat Jan 14 17:03:28 2006 -0400 > files: xen/arch/ia64/vmx/vlsapic.c xen/include/asm-ia64/vmx_platform.h > description: > Name change fix for ia64. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Sat Jan 14 15:12:59 2006 -0400 > files: xen/arch/x86/dm/hvm_vioapic.c xen/arch/x86/dm/i8259.c xen/arch/x86/hvm.c xen/arch/x86/hvm_intercept.c xen/arch/x86/svm.c xen/arch/x86/svm_intr.c xen/arch/x86/svm_vmcb.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_vmcs.c xen/include/asm-x86/hvm_domain.h xen/include/asm-x86/hvm_vcpu.h > description: > Move VMX/SVM print buffer to hvm_domain. > > Cleanup variable names. The suffix hvm_ is redundant in hvm_domain. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: twoller@xen-trw1.site > date: Fri Jan 13 17:03:18 2006 -0500 > files: xen/arch/x86/svm.c > description: > remove unnecessary spin_unlock in asid_fetch code for svm. > > > user: twoller@xen-trw1.site > date: Wed Jan 11 20:00:36 2006 -0500 > files: xen/arch/x86/svm.c > description: > remove unneeded update_pagetables() during svm PF handling (resolved with ASID code rework). > > > user: leendert@eserver2.watson.ibm.com > date: Tue Jan 10 02:45:32 2006 -0400 > files: xen/arch/x86/hvm.c xen/arch/x86/vmx_io.c > description: > Factor out cpu_get_interrupt(). It is used by VMX and SVM. > > Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Mon Jan 9 00:03:30 2006 -0400 > files: xen/arch/x86/hvm.c xen/arch/x86/svm.c xen/arch/x86/vmx.c xen/include/asm-x86/hvm_support.h xen/include/asm-x86/hvm_vcpu.h > description: > Introduce small print buffer per domain rather than a single global one. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Sun Jan 8 23:07:12 2006 -0400 > files: xen/arch/x86/dom0_ops.c xen/include/asm-x86/hvm_support.h xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h > description: > More cleanup. There is no point in distinguishing between SVM and VMX, > a single HVM flag bit suffices. > > Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Sun Jan 8 12:05:59 2006 -0400 > files: xen/arch/x86/svm.c xen/arch/x86/vmx.c > description: > Both VMX & SVM now print writes to the debug port (0xE9) on the console. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Sat Jan 7 13:55:27 2006 -0400 > files: xen/arch/x86/svm.c xen/arch/x86/svm_intr.c xen/arch/x86/svm_vmcb.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_vmcs.c xen/arch/x86/x86_32/asm-offsets.c xen/arch/x86/x86_64/asm-offsets.c xen/include/asm-x86/domain.h xen/include/asm-x86/vmx.h > description: > Introduce shorthands to improve code legibility. > > Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Wed Jan 4 06:12:10 2006 -0400 > files: tools/examples/xmexample.hvm > description: > Minor spelling mistakes. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Wed Jan 4 03:37:55 2006 -0400 > files: xen/include/public/hvm/hvm_info_table.h xen/include/public/hvm/ioreq.h xen/include/public/hvm/vmx_assist.h > description: > Missed adding new files. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Mon Jan 2 01:23:54 2006 -0400 > files: tools/debugger/libxendebug/xendebug.c tools/libxc/xc_hvm_build.c > description: > Finalize Xin Li's patch: vmx/svm_identify is no longer necessary. > Xen debug should test for HVM instead of VMX. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: twoller@xen-trw1.site > date: Sun Jan 1 03:22:39 2006 -0500 > files: tools/ioemu/vl.c > description: > change hardcoded VTXEN to HVMXEN. > > > user: leendert@eserver2.watson.ibm.com > date: Sun Jan 1 02:22:47 2006 -0400 > files: tools/libxc/xc_hvm_build.c tools/python/xen/xend/image.py xen/arch/x86/domain.c > description: > Avoid xen crash if there is no VMX support. If a platform > doesn't support VMX, creating VMX domain will crash xen > HV. > > Signed-off-by: Xin Li <xin.b.li@intel.com> > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > [ vmx/svm_identify are still needed in hvm builder, but this may not > really be necessary. I need to check this. - lvd ] > > > user: twoller@xen-trw1.site > date: Fri Dec 30 21:38:56 2005 -0500 > files: xen/arch/x86/svm.c xen/arch/x86/svm_vmcb.c xen/arch/x86/x86_32/entry.S xen/include/asm-x86/svm.h xen/include/asm-x86/svm_vmcb.h > description: > add multi-core support for guest ASIDs for SVM partitions. > > > user: leendert@eserver2.watson.ibm.com > date: Sun Dec 25 20:44:43 2005 -0400 > files: tools/firmware/vmxassist/head.S > description: > Make sure vmxassist still works in its debug environment. > > Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Fri Dec 23 18:27:57 2005 -0400 > files: tools/libxc/xc_ia64_stubs.c > description: > Fixed libxc ia64, xend uses xc_hvm_build instead of xc_vmx_build. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: twoller@xen-trw1.site > date: Wed Dec 21 21:39:17 2005 -0500 > files: xen/arch/x86/svm_intr.c xen/arch/x86/svm_vmcb.c > description: > cleanup of svm specific code. > > > user: leendert@eserver2.watson.ibm.com > date: Wed Dec 21 17:18:25 2005 -0400 > files: tools/python/xen/xm/tests/test_create.py tools/xm-test/README > description: > Minor name cleanups. xm-test isn't VMX specific. Instead use HVM. > > > user: twoller@xen-trw1.site > date: Tue Dec 20 20:01:38 2005 -0500 > files: xen/arch/x86/svm_vmcb.c > description: > reword comments. > > > user: twoller@xen-trw1.site > date: Tue Dec 20 20:01:07 2005 -0500 > files: xen/arch/x86/svm_intr.c > description: > add additional VLAPIC delivery modes. > > > user: twoller@xen-trw1.site > date: Tue Dec 20 20:00:22 2005 -0500 > files: xen/arch/x86/svm.c > description: > reformat misaligned code. > > > user: twoller@xen-trw1.site > date: Tue Dec 20 19:59:37 2005 -0500 > files: xen/arch/x86/svm.c > description: > Add additional AMD SVM specific CPUID logic. > > > user: leendert@eserver2.watson.ibm.com > date: Thu Dec 15 03:06:15 2005 -0400 > files: tools/xm-test/tests/block-create/01_block_attach_device_pos.py tools/xm-test/tests/block-create/02_block_attach_file_device_pos.py tools/xm-test/tests/block-create/04_block_attach_device_repeatedly_pos.py tools/xm-test/tests/block-create/05_block_attach_and_dettach_device_repeatedly_pos.py tools/xm-test/tests/block-create/06_block_attach_baddomain_neg.py tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py tools/xm-test/tests/block-create/09_block_attach_and_dettach_device_check_data_pos.py tools/xm-test/tests/block-create/10_block_attach_dettach_multiple_devices.py tools/xm-test/tests/block-create/11_block_attach_shared_dom0.py tools/xm-test/tests/block-create/12_block_attach_shared_domU.py tools/xm-test/tests/block-destroy/01_block-destroy_btblock_pos.py tools/xm-test/tests/block-destroy/02_block-destroy_rtblock_pos.py tools/xm-test/tests/block-destroy/04_block-destroy_nonattached_neg.py tools/xm-test/tests/block-destroy/05_block-destroy_byname_pos.py tools/xm-test/tests/block-destroy/06_block-destroy_check_list_pos.py tools/xm-test/tests/block-list/01_block-list_pos.py tools/xm-test/tests/block-list/02_block-list_attachbd_pos.py tools/xm-test/tests/block-list/03_block-list_anotherbd_pos.py tools/xm-test/tests/block-list/04_block-list_nodb_pos.py tools/xm-test/tests/block-list/06_block-list_checkremove_pos.py tools/xm-test/tests/memmax/01_memmax_badparm_neg.py tools/xm-test/tests/memset/01_memset_basic_pos.py tools/xm-test/tests/memset/02_memset_badparm_neg.py tools/xm-test/tests/memset/03_memset_random_pos.py tools/xm-test/tests/memset/04_memset_smallmem_pos.py tools/xm-test/tests/migrate/01_migrate_localhost_pos.py tools/xm-test/tests/network-attach/01_network_attach_pos.py tools/xm-test/tests/network-attach/02_network_attach_detach_pos.py tools/xm-test/tests/network-attach/03_network_attach_detach_multiple_pos.py tools/xm-test/tests/restore/01_restore_basic_pos.py tools/xm-test/tests/restore/02_restore_badparm_neg.py tools/xm-test/tests/restore/03_restore_badfilename_neg.py tools/xm-test/tests/restore/04_restore_withdevices_pos.py tools/xm-test/tests/save/01_save_basic_pos.py tools/xm-test/tests/save/02_save_badparm_neg.py tools/xm-test/tests/save/03_save_bogusfile_neg.py tools/xm-test/tests/sysrq/01_sysrq_basic_neg.py tools/xm-test/tests/sysrq/02_sysrq_sync_pos.py tools/xm-test/tests/sysrq/03_sysrq_withreboot_pos.py > description: > Adding SKIP() to tests that aren't supported for VMX domains. > > Signed-off-by: Dan Stekloff <dsteklof@us.ibm.com> > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Tue Dec 13 22:43:47 2005 -0400 > files: xen/arch/x86/svm.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/include/asm-x86/hvm_vpit.h xen/include/asm-x86/msr.h > description: > Support VMX guest accesses to IA32_TIME_STAMP_COUNTER MSR. > > Signed-off-by: Haifeng Xue <haifeng.xue@intel.com> > Signed-off-by: Leendert van Doorn <leendert@us.ibm.com> > > > user: twoller@xen-trw1.site > date: Tue Dec 13 19:49:53 2005 -0500 > files: xen/arch/x86/svm.c xen/arch/x86/svm_emulate.c xen/arch/x86/svm_instrlen.c xen/arch/x86/svm_intr.c xen/arch/x86/svm_vmcb.c xen/include/asm-x86/svm.h xen/include/asm-x86/svm_emulate.h xen/include/asm-x86/svm_intr.h xen/include/asm-x86/svm_vmcb.h xen/include/asm-x86/svm_vmmcall.h > description: > Add SVM base files to repository. > > > user: twoller@xen-trw1.site > date: Tue Dec 13 19:49:02 2005 -0500 > files: xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_64/entry.S > description: > Add SVM entry points for launch/resume. > > > user: twoller@xen-trw1.site > date: Tue Dec 13 19:47:38 2005 -0500 > files: .hgignore > description: > Add hvmloader files to ignore list. > > > user: leendert@eserver2.watson.ibm.com > date: Mon Dec 12 22:58:54 2005 -0400 > files: docs/src/user.tex tools/firmware/README xen/include/asm-x86/hvm.h > description: > Removed dirty words (by request). > > > user: leendert@eserver2.watson.ibm.com > date: Mon Dec 12 05:48:22 2005 -0400 > files: tools/firmware/hvmloader/mkhex > description: > Fix file mode. > > Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com> > > > user: leendert@eserver2.watson.ibm.com > date: Mon Dec 12 04:50:42 2005 -0400 > files: xen/Rules.mk xen/arch/x86/cpu/amd.c xen/arch/x86/cpu/intel.c xen/arch/x86/dm/hvm_vioapic.c xen/arch/x86/dm/i8259.c xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/hvm.c xen/arch/x86/hvm_intercept.c xen/arch/x86/hvm_io.c xen/arch/x86/hvm_platform.c xen/arch/x86/hvm_vlapic.c xen/arch/x86/mpparse.c xen/arch/x86/shadow.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_vmcs.c xen/arch/x86/x86_32/asm-offsets.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_64/asm-offsets.c xen/arch/x86/x86_64/entry.S xen/arch/x86/x86_64/mm.c xen/include/asm-x86/config.h xen/include/asm-x86/cpufeature.h xen/include/asm-x86/domain.h xen/include/asm-x86/hvm_domain.h xen/include/asm-x86/hvm_io.h xen/include/asm-x86/hvm_support.h xen/include/asm-x86/hvm_vcpu.h xen/include/asm-x86/hvm_vioapic.h xen/include/asm-x86/hvm_vlapic.h xen/include/asm-x86/hvm_vpic.h xen/include/asm-x86/hvm_vpit.h xen/include/asm-x86/mpspec.h xen/include/asm-x86/msr.h xen/include/asm-x86/processor.h xen/include/asm-x86/vmx.h xen/include/asm-x86/vmx_cpu.h xen/include/asm-x86/vmx_vmcs.h > description: > Phase 3 of HVM integration: This patchset introduces the refactoring of > virtualization architecture independent functions from specific ones. > > > user: leendert@eserver2.watson.ibm.com > date: Sun Dec 11 07:02:51 2005 -0400 > files: xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/i387.c xen/arch/x86/shadow.c xen/arch/x86/vmx.c xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/traps.c xen/include/asm-x86/hvm.h xen/include/asm-x86/hvm_support.h xen/include/asm-x86/regs.h xen/include/asm-x86/shadow.h xen/include/asm-x86/vmx_vmcs.h > description: > Phase 2 of HVM integration: This patchset introduces the hvm interface > to the hypervisor and modifies all the non-vmx specific files to use it. > > > user: leendert@eserver2.watson.ibm.com > date: Sun Dec 11 01:10:00 2005 -0400 > files: tools/examples/Makefile tools/examples/README tools/examples/xmexample.hvm tools/ioemu/exec-all.h tools/ioemu/hw/i8254.c tools/ioemu/hw/i8259.c tools/ioemu/monitor.c tools/ioemu/target-i386-dm/helper2.c tools/ioemu/vl.c tools/libxc/Makefile tools/libxc/xc_hvm_build.c tools/libxc/xc_ptrace.c tools/libxc/xc_ptrace_core.c tools/libxc/xenguest.h tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/image.py tools/python/xen/xm/create.py tools/xm-test/configure.ac tools/xm-test/lib/XmTestLib/XenDomain.py tools/xm-test/lib/XmTestLib/config.py.in tools/xm-test/ramdisk/Makefile.am tools/xm-test/ramdisk/bin/create_disk_image tools/xm-test/tests/block-list/04_block-list_nodb_pos.py xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h > description: > Phase 1 of HVM integration: This patchset updates the tools. Most of the > tools are machine independent except for some detection code in the hvm > domain builder.
706 lines
20 KiB
C
706 lines
20 KiB
C
#include "xg_private.h"
|
|
#include "xenguest.h"
|
|
#include "xc_private.h"
|
|
#include "xc_elf.h"
|
|
#include <stdlib.h>
|
|
#include <zlib.h>
|
|
#include "xen/arch-ia64.h"
|
|
#include <xen/hvm/ioreq.h>
|
|
|
|
/* this is a very ugly way of getting FPSR_DEFAULT. struct ia64_fpreg is
|
|
* mysteriously declared in two places: /usr/include/asm/fpu.h and
|
|
* /usr/include/bits/sigcontext.h. The former also defines FPSR_DEFAULT,
|
|
* the latter doesn't but is included (indirectly) by xg_private.h */
|
|
#define __ASSEMBLY__
|
|
#include <asm/fpu.h>
|
|
#undef __IA64_UL
|
|
#define __IA64_UL(x) ((unsigned long)(x))
|
|
#undef __ASSEMBLY__
|
|
|
|
unsigned long xc_ia64_fpsr_default(void)
|
|
{
|
|
return FPSR_DEFAULT;
|
|
}
|
|
|
|
int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
|
|
uint32_t max_factor, uint32_t flags /* XCFLAGS_xxx */,
|
|
int (*suspend)(int domid))
|
|
{
|
|
PERROR("xc_linux_save not implemented\n");
|
|
return -1;
|
|
}
|
|
|
|
int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom, unsigned long nr_pfns,
|
|
unsigned int store_evtchn, unsigned long *store_mfn,
|
|
unsigned int console_evtchn, unsigned long *console_mfn)
|
|
{
|
|
PERROR("xc_linux_restore not implemented\n");
|
|
return -1;
|
|
}
|
|
|
|
int
|
|
xc_plan9_build(int xc_handle,
|
|
uint32_t domid,
|
|
const char *image_name,
|
|
const char *cmdline,
|
|
unsigned int control_evtchn, unsigned long flags)
|
|
{
|
|
PERROR("xc_plan9_build not implemented\n");
|
|
return -1;
|
|
}
|
|
|
|
int xc_ia64_get_pfn_list(int xc_handle,
|
|
uint32_t domid,
|
|
unsigned long *pfn_buf,
|
|
unsigned int start_page,
|
|
unsigned int nr_pages)
|
|
{
|
|
dom0_op_t op;
|
|
int ret;
|
|
unsigned long max_pfns = ((unsigned long)start_page << 32) | nr_pages;
|
|
|
|
op.cmd = DOM0_GETMEMLIST;
|
|
op.u.getmemlist.domain = (domid_t)domid;
|
|
op.u.getmemlist.max_pfns = max_pfns;
|
|
op.u.getmemlist.buffer = pfn_buf;
|
|
|
|
if ( (max_pfns != -1UL)
|
|
&& mlock(pfn_buf, nr_pages * sizeof(unsigned long)) != 0 )
|
|
{
|
|
PERROR("Could not lock pfn list buffer");
|
|
return -1;
|
|
}
|
|
|
|
ret = do_dom0_op(xc_handle, &op);
|
|
|
|
if (max_pfns != -1UL)
|
|
(void)munlock(pfn_buf, nr_pages * sizeof(unsigned long));
|
|
|
|
return (ret < 0) ? -1 : op.u.getmemlist.num_pfns;
|
|
}
|
|
|
|
long xc_get_max_pages(int xc_handle, uint32_t domid)
|
|
{
|
|
dom0_op_t op;
|
|
op.cmd = DOM0_GETDOMAININFO;
|
|
op.u.getdomaininfo.domain = (domid_t)domid;
|
|
return (do_dom0_op(xc_handle, &op) < 0) ?
|
|
-1 : op.u.getdomaininfo.max_pages;
|
|
}
|
|
|
|
int xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid,
|
|
void* src_page, unsigned long dst_pfn, int nr_pages)
|
|
{
|
|
// N.B. gva should be page aligned
|
|
|
|
unsigned long *page_array = NULL;
|
|
int i;
|
|
|
|
if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL ){
|
|
PERROR("Could not allocate memory");
|
|
goto error_out;
|
|
}
|
|
if ( xc_ia64_get_pfn_list(xc_handle, domid, page_array,
|
|
dst_pfn>>PAGE_SHIFT, nr_pages) != nr_pages ){
|
|
PERROR("Could not get the page frame list");
|
|
goto error_out;
|
|
}
|
|
|
|
for ( i=0; i< nr_pages; i++ ){
|
|
if (xc_copy_to_domain_page(xc_handle, domid, page_array[i],
|
|
src_page + (i << PAGE_SHIFT)))
|
|
goto error_out;
|
|
}
|
|
free(page_array);
|
|
return 0;
|
|
|
|
error_out:
|
|
free(page_array);
|
|
return -1;
|
|
}
|
|
|
|
|
|
#define HOB_SIGNATURE 0x3436474953424f48 // "HOBSIG64"
|
|
#define GFW_HOB_START ((4UL<<30)-(14UL<<20)) //4G -14M
|
|
#define GFW_HOB_SIZE (1UL<<20) //1M
|
|
#define MEM_G (1UL << 30)
|
|
#define MEM_M (1UL << 20)
|
|
|
|
typedef struct {
|
|
unsigned long signature;
|
|
unsigned int type;
|
|
unsigned int length;
|
|
} HOB_GENERIC_HEADER;
|
|
|
|
/*
|
|
* INFO HOB is the first data data in one HOB list
|
|
* it contains the control information of the HOB list
|
|
*/
|
|
typedef struct {
|
|
HOB_GENERIC_HEADER header;
|
|
unsigned long length; // current length of hob
|
|
unsigned long cur_pos; // current poisiton of hob
|
|
unsigned long buf_size; // size of hob buffer
|
|
}HOB_INFO;
|
|
|
|
typedef struct{
|
|
unsigned long start;
|
|
unsigned long size;
|
|
}hob_mem_t;
|
|
|
|
typedef enum {
|
|
HOB_TYPE_INFO=0,
|
|
HOB_TYPE_TERMINAL,
|
|
HOB_TYPE_MEM,
|
|
HOB_TYPE_PAL_BUS_GET_FEATURES_DATA,
|
|
HOB_TYPE_PAL_CACHE_SUMMARY,
|
|
HOB_TYPE_PAL_MEM_ATTRIB,
|
|
HOB_TYPE_PAL_CACHE_INFO,
|
|
HOB_TYPE_PAL_CACHE_PROT_INFO,
|
|
HOB_TYPE_PAL_DEBUG_INFO,
|
|
HOB_TYPE_PAL_FIXED_ADDR,
|
|
HOB_TYPE_PAL_FREQ_BASE,
|
|
HOB_TYPE_PAL_FREQ_RATIOS,
|
|
HOB_TYPE_PAL_HALT_INFO,
|
|
HOB_TYPE_PAL_PERF_MON_INFO,
|
|
HOB_TYPE_PAL_PROC_GET_FEATURES,
|
|
HOB_TYPE_PAL_PTCE_INFO,
|
|
HOB_TYPE_PAL_REGISTER_INFO,
|
|
HOB_TYPE_PAL_RSE_INFO,
|
|
HOB_TYPE_PAL_TEST_INFO,
|
|
HOB_TYPE_PAL_VM_SUMMARY,
|
|
HOB_TYPE_PAL_VM_INFO,
|
|
HOB_TYPE_PAL_VM_PAGE_SIZE,
|
|
HOB_TYPE_MAX
|
|
}hob_type_t;
|
|
|
|
static int hob_init( void *buffer ,unsigned long buf_size);
|
|
static int add_pal_hob(void* hob_buf);
|
|
static int add_mem_hob(void* hob_buf, unsigned long dom_mem_size);
|
|
static int build_hob (void* hob_buf, unsigned long hob_buf_size,
|
|
unsigned long dom_mem_size);
|
|
static int load_hob(int xc_handle,uint32_t dom, void *hob_buf);
|
|
|
|
int xc_ia64_build_hob(int xc_handle, uint32_t dom, unsigned long memsize){
|
|
|
|
char *hob_buf;
|
|
|
|
hob_buf = malloc (GFW_HOB_SIZE);
|
|
if (hob_buf == NULL) {
|
|
PERROR("Could not allocate hob");
|
|
return -1;
|
|
}
|
|
|
|
if ( build_hob( hob_buf, GFW_HOB_SIZE, memsize<<20) < 0){
|
|
free (hob_buf);
|
|
PERROR("Could not build hob");
|
|
return -1;
|
|
}
|
|
|
|
if ( load_hob( xc_handle, dom, hob_buf) <0){
|
|
free (hob_buf);
|
|
PERROR("Could not load hob");
|
|
return -1;
|
|
}
|
|
free (hob_buf);
|
|
return 0;
|
|
|
|
}
|
|
static int
|
|
hob_init( void *buffer ,unsigned long buf_size)
|
|
{
|
|
HOB_INFO *phit;
|
|
HOB_GENERIC_HEADER *terminal;
|
|
|
|
if (sizeof(HOB_INFO) + sizeof(HOB_GENERIC_HEADER) > buf_size){
|
|
// buffer too small
|
|
return -1;
|
|
}
|
|
|
|
phit = (HOB_INFO*)buffer;
|
|
phit->header.signature = HOB_SIGNATURE;
|
|
phit->header.type = HOB_TYPE_INFO;
|
|
phit->header.length = sizeof(HOB_INFO);
|
|
phit->length = sizeof(HOB_INFO) + sizeof(HOB_GENERIC_HEADER);
|
|
phit->cur_pos = 0;
|
|
phit->buf_size = buf_size;
|
|
|
|
terminal = (HOB_GENERIC_HEADER*) (buffer + sizeof(HOB_INFO));
|
|
terminal->signature= HOB_SIGNATURE;
|
|
terminal->type = HOB_TYPE_TERMINAL;
|
|
terminal->length = sizeof(HOB_GENERIC_HEADER);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Add a new HOB to the HOB List.
|
|
*
|
|
* hob_start - start address of hob buffer
|
|
* type - type of the hob to be added
|
|
* data - data of the hob to be added
|
|
* data_size - size of the data
|
|
*/
|
|
static int
|
|
hob_add(
|
|
void* hob_start,
|
|
int type,
|
|
void* data,
|
|
int data_size
|
|
)
|
|
{
|
|
HOB_INFO *phit;
|
|
HOB_GENERIC_HEADER *newhob,*tail;
|
|
|
|
phit = (HOB_INFO*)hob_start;
|
|
|
|
if (phit->length + data_size > phit->buf_size){
|
|
// no space for new hob
|
|
return -1;
|
|
}
|
|
|
|
//append new HOB
|
|
newhob = (HOB_GENERIC_HEADER*)
|
|
(hob_start + phit->length - sizeof(HOB_GENERIC_HEADER));
|
|
newhob->signature = HOB_SIGNATURE;
|
|
newhob->type = type;
|
|
newhob->length = data_size + sizeof(HOB_GENERIC_HEADER);
|
|
memcpy((void*)newhob + sizeof(HOB_GENERIC_HEADER), data, data_size);
|
|
|
|
// append terminal HOB
|
|
tail = (HOB_GENERIC_HEADER*) ( hob_start + phit->length + data_size);
|
|
tail->signature = HOB_SIGNATURE;
|
|
tail->type = HOB_TYPE_TERMINAL;
|
|
tail->length = sizeof(HOB_GENERIC_HEADER);
|
|
|
|
// adjust HOB list length
|
|
phit->length += sizeof(HOB_GENERIC_HEADER)+ data_size;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int get_hob_size(void* hob_buf){
|
|
|
|
HOB_INFO *phit = (HOB_INFO*)hob_buf;
|
|
|
|
if (phit->header.signature != HOB_SIGNATURE){
|
|
PERROR("xc_get_hob_size:Incorrect signature");
|
|
return -1;
|
|
}
|
|
return phit->length;
|
|
}
|
|
|
|
int build_hob (void* hob_buf, unsigned long hob_buf_size,
|
|
unsigned long dom_mem_size)
|
|
{
|
|
//Init HOB List
|
|
if (hob_init (hob_buf, hob_buf_size)<0){
|
|
PERROR("buffer too small");
|
|
goto err_out;
|
|
}
|
|
|
|
if ( add_mem_hob( hob_buf,dom_mem_size) < 0){
|
|
PERROR("Add memory hob failed, buffer too small");
|
|
goto err_out;
|
|
}
|
|
|
|
if ( add_pal_hob( hob_buf ) < 0 ){
|
|
PERROR("Add PAL hob failed, buffer too small");
|
|
goto err_out;
|
|
}
|
|
|
|
return 0;
|
|
|
|
err_out:
|
|
return -1;
|
|
}
|
|
|
|
static int
|
|
load_hob(int xc_handle, uint32_t dom, void *hob_buf)
|
|
{
|
|
// hob_buf should be page aligned
|
|
int hob_size;
|
|
int nr_pages;
|
|
|
|
if ((hob_size = get_hob_size(hob_buf)) < 0){
|
|
PERROR("Invalid hob data");
|
|
return -1;
|
|
}
|
|
|
|
if (hob_size > GFW_HOB_SIZE){
|
|
PERROR("No enough memory for hob data");
|
|
return -1;
|
|
}
|
|
|
|
nr_pages = (hob_size + PAGE_SIZE -1) >> PAGE_SHIFT;
|
|
|
|
return xc_ia64_copy_to_domain_pages(xc_handle, dom,
|
|
hob_buf, GFW_HOB_START, nr_pages );
|
|
}
|
|
|
|
#define MIN(x, y) ((x) < (y)) ? (x) : (y)
|
|
static int
|
|
add_mem_hob(void* hob_buf, unsigned long dom_mem_size){
|
|
hob_mem_t memhob;
|
|
|
|
// less than 3G
|
|
memhob.start = 0;
|
|
memhob.size = MIN(dom_mem_size, 0xC0000000);
|
|
|
|
if (hob_add(hob_buf, HOB_TYPE_MEM, &memhob, sizeof(memhob)) < 0){
|
|
return -1;
|
|
}
|
|
|
|
if (dom_mem_size > 0xC0000000) {
|
|
// 4G ~ 4G+remain
|
|
memhob.start = 0x100000000; //4G
|
|
memhob.size = dom_mem_size - 0xC0000000;
|
|
if (hob_add(hob_buf, HOB_TYPE_MEM, &memhob, sizeof(memhob)) < 0)
|
|
return -1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
unsigned char config_pal_bus_get_features_data[24] = {
|
|
0, 0, 0, 32, 0, 0, 240, 189, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_cache_summary[16] = {
|
|
3, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0};
|
|
unsigned char config_pal_mem_attrib[8] = {
|
|
241, 0, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_cache_info[152] = {
|
|
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
6, 4, 6, 7, 255, 1, 0, 1, 0, 64, 0, 0, 12, 12,
|
|
49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 7, 0, 1,
|
|
0, 1, 0, 64, 0, 0, 12, 12, 49, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 6, 8, 7, 7, 255, 7, 0, 11, 0, 0, 16, 0,
|
|
12, 17, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 7,
|
|
7, 7, 5, 9, 11, 0, 0, 4, 0, 12, 15, 49, 0, 254, 255,
|
|
255, 255, 255, 255, 255, 255, 2, 8, 7, 7, 7, 5, 9,
|
|
11, 0, 0, 4, 0, 12, 15, 49, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 3, 12, 7, 7, 7, 14, 1, 3, 0, 0, 192, 0, 12, 20, 49, 0
|
|
};
|
|
unsigned char config_pal_cache_prot_info[200] = {
|
|
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
45, 0, 16, 8, 0, 76, 12, 64, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
8, 0, 16, 4, 0, 76, 44, 68, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32,
|
|
0, 16, 8, 0, 81, 44, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0,
|
|
112, 12, 0, 79, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 254, 255, 255, 255, 255, 255, 255, 255,
|
|
32, 0, 112, 12, 0, 79, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 160,
|
|
12, 0, 84, 124, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0
|
|
};
|
|
unsigned char config_pal_debug_info[16] = {
|
|
2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_fixed_addr[8] = {
|
|
0, 0, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_freq_base[8] = {
|
|
109, 219, 182, 13, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_freq_ratios[24] = {
|
|
11, 1, 0, 0, 77, 7, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 4,
|
|
0, 0, 0, 7, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_halt_info[64] = {
|
|
0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_perf_mon_info[136] = {
|
|
12, 47, 18, 8, 0, 0, 0, 0, 241, 255, 0, 0, 255, 7, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 241, 255, 0, 0, 223, 0, 255, 255,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 240, 255, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_proc_get_features[104] = {
|
|
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 64, 6, 64, 49, 0, 0, 0, 0, 64, 6, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,
|
|
231, 0, 0, 0, 0, 0, 0, 0, 228, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0,
|
|
63, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_ptce_info[24] = {
|
|
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_register_info[64] = {
|
|
255, 0, 47, 127, 17, 17, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
255, 208, 128, 238, 238, 0, 0, 248, 255, 255, 255, 255, 255, 0, 0, 7, 3,
|
|
251, 3, 0, 0, 0, 0, 255, 7, 3, 0, 0, 0, 0, 0, 248, 252, 4,
|
|
252, 255, 255, 255, 255, 2, 248, 252, 255, 255, 255, 255, 255
|
|
};
|
|
unsigned char config_pal_rse_info[16] = {
|
|
96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_test_info[48] = {
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_vm_summary[16] = {
|
|
101, 18, 15, 2, 7, 7, 4, 2, 59, 18, 0, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_vm_info[104] = {
|
|
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
|
|
32, 32, 0, 0, 0, 0, 0, 0, 112, 85, 21, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 1, 32, 32, 0, 0, 0, 0, 0, 0, 112, 85,
|
|
21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 128, 128, 0,
|
|
4, 0, 0, 0, 0, 112, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 1, 128, 128, 0, 4, 0, 0, 0, 0, 112, 85, 0, 0, 0, 0, 0
|
|
};
|
|
unsigned char config_pal_vm_page_size[16] = {
|
|
0, 112, 85, 21, 0, 0, 0, 0, 0, 112, 85, 21, 0, 0, 0, 0
|
|
};
|
|
|
|
typedef struct{
|
|
hob_type_t type;
|
|
void* data;
|
|
unsigned long size;
|
|
}hob_batch_t;
|
|
|
|
hob_batch_t hob_batch[]={
|
|
{ HOB_TYPE_PAL_BUS_GET_FEATURES_DATA,
|
|
&config_pal_bus_get_features_data,
|
|
sizeof(config_pal_bus_get_features_data)
|
|
},
|
|
{ HOB_TYPE_PAL_CACHE_SUMMARY,
|
|
&config_pal_cache_summary,
|
|
sizeof(config_pal_cache_summary)
|
|
},
|
|
{ HOB_TYPE_PAL_MEM_ATTRIB,
|
|
&config_pal_mem_attrib,
|
|
sizeof(config_pal_mem_attrib)
|
|
},
|
|
{ HOB_TYPE_PAL_CACHE_INFO,
|
|
&config_pal_cache_info,
|
|
sizeof(config_pal_cache_info)
|
|
},
|
|
{ HOB_TYPE_PAL_CACHE_PROT_INFO,
|
|
&config_pal_cache_prot_info,
|
|
sizeof(config_pal_cache_prot_info)
|
|
},
|
|
{ HOB_TYPE_PAL_DEBUG_INFO,
|
|
&config_pal_debug_info,
|
|
sizeof(config_pal_debug_info)
|
|
},
|
|
{ HOB_TYPE_PAL_FIXED_ADDR,
|
|
&config_pal_fixed_addr,
|
|
sizeof(config_pal_fixed_addr)
|
|
},
|
|
{ HOB_TYPE_PAL_FREQ_BASE,
|
|
&config_pal_freq_base,
|
|
sizeof(config_pal_freq_base)
|
|
},
|
|
{ HOB_TYPE_PAL_FREQ_RATIOS,
|
|
&config_pal_freq_ratios,
|
|
sizeof(config_pal_freq_ratios)
|
|
},
|
|
{ HOB_TYPE_PAL_HALT_INFO,
|
|
&config_pal_halt_info,
|
|
sizeof(config_pal_halt_info)
|
|
},
|
|
{ HOB_TYPE_PAL_PERF_MON_INFO,
|
|
&config_pal_perf_mon_info,
|
|
sizeof(config_pal_perf_mon_info)
|
|
},
|
|
{ HOB_TYPE_PAL_PROC_GET_FEATURES,
|
|
&config_pal_proc_get_features,
|
|
sizeof(config_pal_proc_get_features)
|
|
},
|
|
{ HOB_TYPE_PAL_PTCE_INFO,
|
|
&config_pal_ptce_info,
|
|
sizeof(config_pal_ptce_info)
|
|
},
|
|
{ HOB_TYPE_PAL_REGISTER_INFO,
|
|
&config_pal_register_info,
|
|
sizeof(config_pal_register_info)
|
|
},
|
|
{ HOB_TYPE_PAL_RSE_INFO,
|
|
&config_pal_rse_info,
|
|
sizeof(config_pal_rse_info)
|
|
},
|
|
{ HOB_TYPE_PAL_TEST_INFO,
|
|
&config_pal_test_info,
|
|
sizeof(config_pal_test_info)
|
|
},
|
|
{ HOB_TYPE_PAL_VM_SUMMARY,
|
|
&config_pal_vm_summary,
|
|
sizeof(config_pal_vm_summary)
|
|
},
|
|
{ HOB_TYPE_PAL_VM_INFO,
|
|
&config_pal_vm_info,
|
|
sizeof(config_pal_vm_info)
|
|
},
|
|
{ HOB_TYPE_PAL_VM_PAGE_SIZE,
|
|
&config_pal_vm_page_size,
|
|
sizeof(config_pal_vm_page_size)
|
|
},
|
|
};
|
|
|
|
static int add_pal_hob(void* hob_buf){
|
|
int i;
|
|
for (i=0; i<sizeof(hob_batch)/sizeof(hob_batch_t); i++){
|
|
if (hob_add(hob_buf, hob_batch[i].type,
|
|
hob_batch[i].data,
|
|
hob_batch[i].size)<0)
|
|
return -1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static int setup_guest( int xc_handle,
|
|
uint32_t dom, unsigned long memsize,
|
|
char *image, unsigned long image_size,
|
|
unsigned int control_evtchn,
|
|
unsigned int store_evtchn,
|
|
unsigned long *store_mfn)
|
|
{
|
|
unsigned long page_array[2];
|
|
shared_iopage_t *sp;
|
|
// FIXME: initialize pfn list for a temp hack
|
|
if (xc_ia64_get_pfn_list(xc_handle, dom, NULL, -1, -1) == -1) {
|
|
PERROR("Could not allocate continuous memory");
|
|
goto error_out;
|
|
}
|
|
|
|
if ((image_size > 12 * MEM_M) || (image_size & (PAGE_SIZE - 1))) {
|
|
PERROR("Guest firmware size is incorrect [%ld]?", image_size);
|
|
return -1;
|
|
}
|
|
|
|
/* Load guest firmware */
|
|
if( xc_ia64_copy_to_domain_pages( xc_handle, dom,
|
|
image, 4*MEM_G-image_size, image_size>>PAGE_SHIFT)) {
|
|
PERROR("Could not load guest firmware into domain");
|
|
goto error_out;
|
|
}
|
|
|
|
/* Hand-off state passed to guest firmware */
|
|
if (xc_ia64_build_hob(xc_handle, dom, memsize) < 0){
|
|
PERROR("Could not build hob\n");
|
|
goto error_out;
|
|
}
|
|
|
|
/* Retrieve special pages like io, xenstore, etc. */
|
|
if ( xc_ia64_get_pfn_list(xc_handle, dom, page_array, IO_PAGE_START>>PAGE_SHIFT, 2) != 2 )
|
|
{
|
|
PERROR("Could not get the page frame list");
|
|
goto error_out;
|
|
}
|
|
|
|
*store_mfn = page_array[1];
|
|
if ((sp = (shared_iopage_t *) xc_map_foreign_range(
|
|
xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE,
|
|
page_array[0])) == 0)
|
|
goto error_out;
|
|
memset(sp, 0, PAGE_SIZE);
|
|
sp->sp_global.eport = control_evtchn;
|
|
munmap(sp, PAGE_SIZE);
|
|
|
|
return 0;
|
|
|
|
error_out:
|
|
return -1;
|
|
}
|
|
|
|
int xc_hvm_build(int xc_handle,
|
|
uint32_t domid,
|
|
int memsize,
|
|
const char *image_name,
|
|
unsigned int control_evtchn,
|
|
unsigned int lapic,
|
|
unsigned int vcpus,
|
|
unsigned int acpi,
|
|
unsigned int store_evtchn,
|
|
unsigned long *store_mfn)
|
|
{
|
|
dom0_op_t launch_op, op;
|
|
int rc ;
|
|
vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
|
|
char *image = NULL;
|
|
unsigned long image_size;
|
|
unsigned long nr_pages;
|
|
|
|
if ( (nr_pages = xc_get_max_pages(xc_handle, domid)) < 0 )
|
|
{
|
|
PERROR("Could not find total pages for domain");
|
|
goto error_out;
|
|
}
|
|
|
|
if ( (image = xc_read_kernel_image(image_name, &image_size)) == NULL ){
|
|
PERROR("Could not read guest firmware image %s",image_name);
|
|
goto error_out;
|
|
}
|
|
|
|
image_size = (image_size + PAGE_SIZE - 1) & PAGE_MASK;
|
|
|
|
if ( mlock(&st_ctxt, sizeof(st_ctxt) ) ){
|
|
PERROR("Unable to mlock ctxt");
|
|
return 1;
|
|
}
|
|
|
|
op.cmd = DOM0_GETDOMAININFO;
|
|
op.u.getdomaininfo.domain = (domid_t)domid;
|
|
if ( (do_dom0_op(xc_handle, &op) < 0) ||
|
|
((uint16_t)op.u.getdomaininfo.domain != domid) ) {
|
|
PERROR("Could not get info on domain");
|
|
goto error_out;
|
|
}
|
|
|
|
memset(ctxt, 0, sizeof(*ctxt));
|
|
|
|
if ( setup_guest(xc_handle, domid, (unsigned long)memsize, image, image_size,
|
|
control_evtchn, store_evtchn, store_mfn ) < 0 ){
|
|
ERROR("Error constructing guest OS");
|
|
goto error_out;
|
|
}
|
|
|
|
free(image);
|
|
|
|
ctxt->flags = VGCF_VMX_GUEST;
|
|
ctxt->regs.cr_iip = 0x80000000ffffffb0UL;
|
|
ctxt->vcpu.privregs = 0;
|
|
|
|
memset( &launch_op, 0, sizeof(launch_op) );
|
|
|
|
launch_op.u.setvcpucontext.domain = (domid_t)domid;
|
|
launch_op.u.setvcpucontext.vcpu = 0;
|
|
launch_op.u.setvcpucontext.ctxt = ctxt;
|
|
|
|
launch_op.cmd = DOM0_SETVCPUCONTEXT;
|
|
rc = do_dom0_op(xc_handle, &launch_op);
|
|
return rc;
|
|
|
|
error_out:
|
|
free(image);
|
|
return -1;
|
|
}
|
|
|
|
/*
|
|
* Local variables:
|
|
* mode: C
|
|
* c-set-style: "BSD"
|
|
* c-basic-offset: 4
|
|
* tab-width: 4
|
|
* indent-tabs-mode: nil
|
|
* End:
|
|
*/
|