[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [IA64] merge pal emulator
# HG changeset patch # User awilliam@xxxxxxxxxxx # Node ID fffb36174ddb70ddcda84d66b6389722dc37e1bd # Parent c13c3bd7f3b51caeb4219cc65fdd67b277ee06a8 [IA64] merge pal emulator Merge VTi pal emulator with Xen pal emulator. Xen/ia64 now has only one pal and one sal emulator. Signed-off-by: Tristan Gingold <tristan.gingold@xxxxxxxx> --- xen/arch/ia64/vmx/pal_emul.c | 515 ++----------------------------------------- xen/arch/ia64/xen/fw_emul.c | 65 +++-- 2 files changed, 73 insertions(+), 507 deletions(-) diff -r c13c3bd7f3b5 -r fffb36174ddb xen/arch/ia64/vmx/pal_emul.c --- a/xen/arch/ia64/vmx/pal_emul.c Wed Oct 18 22:06:23 2006 -0600 +++ b/xen/arch/ia64/vmx/pal_emul.c Wed Oct 18 22:06:38 2006 -0600 @@ -17,509 +17,46 @@ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307 USA. */ - -#include <asm/vmx_vcpu.h> + +#include <xen/lib.h> +#include <asm/vcpu.h> +#include <asm/dom_fw.h> #include <asm/pal.h> #include <asm/sal.h> -#include <asm/dom_fw.h> -#include <asm/tlb.h> -#include <asm/vmx_mm_def.h> -#include <xen/hypercall.h> -#include <public/sched.h> -/* - * Handy macros to make sure that the PAL return values start out - * as something meaningful. - */ -#define INIT_PAL_STATUS_UNIMPLEMENTED(x) \ - { \ - x.status = PAL_STATUS_UNIMPLEMENTED; \ - x.v0 = 0; \ - x.v1 = 0; \ - x.v2 = 0; \ - } - -#define INIT_PAL_STATUS_SUCCESS(x) \ - { \ - x.status = PAL_STATUS_SUCCESS; \ - x.v0 = 0; \ - x.v1 = 0; \ - x.v2 = 0; \ - } - -static void -get_pal_parameters(VCPU *vcpu, u64 *gr29, u64 *gr30, u64 *gr31) { - - vcpu_get_gr_nat(vcpu,29,gr29); - vcpu_get_gr_nat(vcpu,30,gr30); - vcpu_get_gr_nat(vcpu,31,gr31); -} - -static void -set_pal_result(VCPU *vcpu,struct ia64_pal_retval result) { - - vcpu_set_gr(vcpu,8, result.status,0); - vcpu_set_gr(vcpu,9, result.v0,0); - vcpu_set_gr(vcpu,10, result.v1,0); - vcpu_set_gr(vcpu,11, result.v2,0); -} - -static void -set_sal_result(VCPU *vcpu,struct sal_ret_values result) { - - vcpu_set_gr(vcpu,8, result.r8,0); - vcpu_set_gr(vcpu,9, result.r9,0); - vcpu_set_gr(vcpu,10, result.r10,0); - vcpu_set_gr(vcpu,11, result.r11,0); -} - -static struct ia64_pal_retval -pal_cache_flush(VCPU *vcpu) { - u64 gr28,gr29, gr30, gr31; +void +pal_emul(struct vcpu *vcpu) +{ + u64 gr28, gr29, gr30, gr31; struct ia64_pal_retval result; - get_pal_parameters(vcpu, &gr29, &gr30, &gr31); - vcpu_get_gr_nat(vcpu, 28, &gr28); + vcpu_get_gr_nat(vcpu, 28, &gr28); //bank1 - /* Always call Host Pal in int=1 */ - gr30 = gr30 & ~0x2UL; + /* FIXME: works only for static calling convention ? */ + vcpu_get_gr_nat(vcpu, 29, &gr29); + vcpu_get_gr_nat(vcpu, 30, &gr30); + vcpu_get_gr_nat(vcpu, 31, &gr31); - /* - * Call Host PAL cache flush - * Clear psr.ic when call PAL_CACHE_FLUSH - */ - result = ia64_pal_call_static(gr28 ,gr29, gr30, gr31, 1); + perfc_incrc(vmx_pal_emul); + result = xen_pal_emulator(gr28, gr29, gr30, gr31); - /* If host PAL call is interrupted, then loop to complete it */ -// while (result.status == 1) -// ia64_pal_call_static(gr28 ,gr29, gr30, result.v1, 1LL); -// - if (result.status != 0) - panic_domain(vcpu_regs(vcpu), "PAL_CACHE_FLUSH ERROR, " - "status %ld", result.status); - - return result; -} - -static struct ia64_pal_retval -pal_vm_tr_read(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_prefetch_visibility(VCPU *vcpu) { - /* Due to current MM virtualization algorithm, - * We do not allow guest to change mapping attribute. - * Thus we will not support PAL_PREFETCH_VISIBILITY - */ - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_platform_addr(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_SUCCESS(result); - - return result; -} - -static struct ia64_pal_retval -pal_halt(VCPU *vcpu) { - //bugbug: to be implement. - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_halt_light(VCPU *vcpu) { - struct ia64_pal_retval result; - - if (!is_unmasked_irq(vcpu)) - do_sched_op_compat(SCHEDOP_block, 0); - - INIT_PAL_STATUS_SUCCESS(result); - - return result; -} - -static struct ia64_pal_retval -pal_cache_read(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_cache_write(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_bus_get_features(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_cache_summary(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_cache_init(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_SUCCESS(result); - - return result; -} - -static struct ia64_pal_retval -pal_cache_info(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_cache_prot_info(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_mem_attrib(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_debug_info(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_fixed_addr(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_freq_base(VCPU *vcpu) { - struct ia64_pal_retval result; - struct ia64_sal_retval isrv; - - PAL_CALL(result,PAL_FREQ_BASE, 0, 0, 0); - /* - * PAL_FREQ_BASE may not be implemented in some platforms, - * call SAL instead. - */ - if (result.v0 == 0) { - SAL_CALL(isrv, SAL_FREQ_BASE, - SAL_FREQ_BASE_PLATFORM, 0, 0, 0, 0, 0, 0); - result.status = isrv.status; - result.v0 = isrv.v0; - result.v1 = result.v2 = 0; - } - return result; -} - -static struct ia64_pal_retval -pal_freq_ratios(VCPU *vcpu) { - struct ia64_pal_retval result; - - PAL_CALL(result, PAL_FREQ_RATIOS, 0, 0, 0); - return result; -} - -static struct ia64_pal_retval -pal_halt_info(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_logical_to_physica(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_perf_mon_info(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_proc_get_features(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_ptce_info(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_register_info(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_rse_info(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_test_info(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_vm_summary(VCPU *vcpu) { - pal_vm_info_1_u_t vminfo1; - pal_vm_info_2_u_t vminfo2; - struct ia64_pal_retval result; - - PAL_CALL(result, PAL_VM_SUMMARY, 0, 0, 0); - if (!result.status) { - vminfo1.pvi1_val = result.v0; - vminfo1.pal_vm_info_1_s.max_itr_entry = NITRS -1; - vminfo1.pal_vm_info_1_s.max_dtr_entry = NDTRS -1; - result.v0 = vminfo1.pvi1_val; - vminfo2.pal_vm_info_2_s.impl_va_msb = GUEST_IMPL_VA_MSB; - vminfo2.pal_vm_info_2_s.rid_size = - current->domain->arch.rid_bits; - result.v1 = vminfo2.pvi2_val; - } - return result; -} - -static struct ia64_pal_retval -pal_vm_info(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; -} - -static struct ia64_pal_retval -pal_vm_page_size(VCPU *vcpu) { - struct ia64_pal_retval result; - - INIT_PAL_STATUS_UNIMPLEMENTED(result); - - return result; + vcpu_set_gr(vcpu, 8, result.status, 0); + vcpu_set_gr(vcpu, 9, result.v0, 0); + vcpu_set_gr(vcpu, 10, result.v1, 0); + vcpu_set_gr(vcpu, 11, result.v2, 0); } void -pal_emul(VCPU *vcpu) { - u64 gr28; - struct ia64_pal_retval result; - - vcpu_get_gr_nat(vcpu,28,&gr28); //bank1 - - perfc_incrc(vmx_pal_emul); - switch (gr28) { - case PAL_CACHE_FLUSH: - result = pal_cache_flush(vcpu); - break; - - case PAL_PREFETCH_VISIBILITY: - result = pal_prefetch_visibility(vcpu); - break; - - case PAL_VM_TR_READ: - result = pal_vm_tr_read(vcpu); - break; - - case PAL_HALT: - result = pal_halt(vcpu); - break; - - case PAL_HALT_LIGHT: - result = pal_halt_light(vcpu); - break; - - case PAL_CACHE_READ: - result = pal_cache_read(vcpu); - break; - - case PAL_CACHE_WRITE: - result = pal_cache_write(vcpu); - break; - - case PAL_PLATFORM_ADDR: - result = pal_platform_addr(vcpu); - break; - - case PAL_FREQ_RATIOS: - result = pal_freq_ratios(vcpu); - break; - - case PAL_FREQ_BASE: - result = pal_freq_base(vcpu); - break; - - case PAL_BUS_GET_FEATURES : - result = pal_bus_get_features(vcpu); - break; - - case PAL_CACHE_SUMMARY : - result = pal_cache_summary(vcpu); - break; - - case PAL_CACHE_INIT : - result = pal_cache_init(vcpu); - break; - - case PAL_CACHE_INFO : - result = pal_cache_info(vcpu); - break; - - case PAL_CACHE_PROT_INFO : - result = pal_cache_prot_info(vcpu); - break; - - case PAL_MEM_ATTRIB : - result = pal_mem_attrib(vcpu); - break; - - case PAL_DEBUG_INFO : - result = pal_debug_info(vcpu); - break; - - case PAL_FIXED_ADDR : - result = pal_fixed_addr(vcpu); - break; - - case PAL_HALT_INFO : - result = pal_halt_info(vcpu); - break; - - case PAL_LOGICAL_TO_PHYSICAL : - result = pal_logical_to_physica(vcpu); - break; - - case PAL_PERF_MON_INFO : - result = pal_perf_mon_info(vcpu); - break; - - case PAL_PROC_GET_FEATURES: - result = pal_proc_get_features(vcpu); - break; - - case PAL_PTCE_INFO : - result = pal_ptce_info(vcpu); - break; - - case PAL_REGISTER_INFO : - result = pal_register_info(vcpu); - break; - - case PAL_RSE_INFO : - result = pal_rse_info(vcpu); - break; - - case PAL_TEST_PROC : - result = pal_test_info(vcpu); - break; - - case PAL_VM_SUMMARY : - result = pal_vm_summary(vcpu); - break; - - case PAL_VM_INFO : - result = pal_vm_info(vcpu); - break; - - case PAL_VM_PAGE_SIZE : - result = pal_vm_page_size(vcpu); - break; - - default: - panic_domain(vcpu_regs(vcpu),"pal_emul(): guest " - "call unsupported pal" ); - } - set_pal_result(vcpu, result); -} - -void -sal_emul(VCPU *v) { +sal_emul(struct vcpu *v) +{ struct sal_ret_values result; result = sal_emulator(vcpu_get_gr(v, 32), vcpu_get_gr(v, 33), vcpu_get_gr(v, 34), vcpu_get_gr(v, 35), vcpu_get_gr(v, 36), vcpu_get_gr(v, 37), vcpu_get_gr(v, 38), vcpu_get_gr(v, 39)); - set_sal_result(v, result); + + vcpu_set_gr(v, 8, result.r8, 0); + vcpu_set_gr(v, 9, result.r9, 0); + vcpu_set_gr(v, 10, result.r10, 0); + vcpu_set_gr(v, 11, result.r11, 0); } diff -r c13c3bd7f3b5 -r fffb36174ddb xen/arch/ia64/xen/fw_emul.c --- a/xen/arch/ia64/xen/fw_emul.c Wed Oct 18 22:06:23 2006 -0600 +++ b/xen/arch/ia64/xen/fw_emul.c Wed Oct 18 22:06:38 2006 -0600 @@ -26,9 +26,11 @@ #include <public/sched.h> #include "hpsim_ssc.h" #include <asm/vcpu.h> +#include <asm/vmx_vcpu.h> #include <asm/dom_fw.h> #include <asm/uaccess.h> #include <xen/console.h> +#include <xen/hypercall.h> extern unsigned long running_on_sim; @@ -173,6 +175,10 @@ xen_pal_emulator(unsigned long index, u6 break; case PAL_FREQ_BASE: status = ia64_pal_freq_base(&r9); + if (status == PAL_STATUS_UNIMPLEMENTED) { + status = ia64_sal_freq_base(0, &r9, &r10); + r10 = 0; + } break; case PAL_PROC_GET_FEATURES: status = ia64_pal_proc_get_features(&r9,&r10,&r11); @@ -215,7 +221,7 @@ xen_pal_emulator(unsigned long index, u6 { /* Use xen-specific values. hash_tag_id is somewhat random! */ - const pal_vm_info_1_u_t v1 = + static const pal_vm_info_1_u_t v1 = {.pal_vm_info_1_s = { .vw = 1, .phys_add_size = 44, @@ -232,11 +238,12 @@ xen_pal_emulator(unsigned long index, u6 .num_tc_levels = 1 #endif }}; - const pal_vm_info_2_u_t v2 = - { .pal_vm_info_2_s = - { .impl_va_msb = 50, - .rid_size = current->domain->arch.rid_bits, - .reserved = 0 }}; + pal_vm_info_2_u_t v2; + v2.pvi2_val = 0; + v2.pal_vm_info_2_s.rid_size = + current->domain->arch.rid_bits; + v2.pal_vm_info_2_s.impl_va_msb = + VMX_DOMAIN(current) ? GUEST_IMPL_VA_MSB : 50; r9 = v1.pvi1_val; r10 = v2.pvi2_val; status = PAL_STATUS_SUCCESS; @@ -294,9 +301,20 @@ xen_pal_emulator(unsigned long index, u6 status = ia64_pal_register_info(in1, &r9, &r10); break; case PAL_CACHE_FLUSH: - /* FIXME */ - printk("PAL_CACHE_FLUSH NOT IMPLEMENTED!\n"); - BUG(); + /* Always call Host Pal in int=0 */ + in2 &= ~PAL_CACHE_FLUSH_CHK_INTRS; + + /* + * Call Host PAL cache flush + * Clear psr.ic when call PAL_CACHE_FLUSH + */ + r10 = in3; + status = ia64_pal_cache_flush(in1, in2, &r10, &r9); + + if (status != 0) + panic_domain(NULL, "PAL_CACHE_FLUSH ERROR, " + "status %lx", status); + break; case PAL_PERF_MON_INFO: { @@ -343,15 +361,26 @@ xen_pal_emulator(unsigned long index, u6 } break; case PAL_HALT: - if (current->domain == dom0) { - printf ("Domain0 halts the machine\n"); - console_start_sync(); - (*efi.reset_system)(EFI_RESET_SHUTDOWN,0,0,NULL); - } - else - domain_shutdown (current->domain, - SHUTDOWN_poweroff); - break; + if (current->domain == dom0) { + printf ("Domain0 halts the machine\n"); + console_start_sync(); + (*efi.reset_system)(EFI_RESET_SHUTDOWN,0,0,NULL); + } + else + domain_shutdown(current->domain, SHUTDOWN_poweroff); + break; + case PAL_HALT_LIGHT: + if (VMX_DOMAIN(current)) { + /* Called by VTI. */ + if (!is_unmasked_irq(current)) + do_sched_op_compat(SCHEDOP_block, 0); + status = PAL_STATUS_SUCCESS; + } + break; + case PAL_PLATFORM_ADDR: + if (VMX_DOMAIN(current)) + status = PAL_STATUS_SUCCESS; + break; default: printk("xen_pal_emulator: UNIMPLEMENTED PAL CALL %lu!!!!\n", index); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |