24 #include <asm/sn/addrs.h>
39 #define INIT_PAL_STATUS_UNIMPLEMENTED(x) \
41 x.status = PAL_STATUS_UNIMPLEMENTED; \
47 #define INIT_PAL_STATUS_SUCCESS(x) \
49 x.status = PAL_STATUS_SUCCESS; \
55 static void kvm_get_pal_call_data(
struct kvm_vcpu *vcpu,
60 p = &vcpu->
arch.exit_data;
72 static void set_pal_result(
struct kvm_vcpu *vcpu,
77 p = kvm_get_exit_data(vcpu);
85 static void set_sal_result(
struct kvm_vcpu *vcpu,
89 p = kvm_get_exit_data(vcpu);
106 static void remote_pal_cache_flush(
void *
data)
125 gr28 = gr29 = gr30 = gr31 = 0;
126 kvm_get_pal_call_data(vcpu, &gr28, &gr29, &gr30, &gr31);
139 "status:0x%lx\n", args.
status);
145 result.
status = ia64_pal_cache_flush(gr29, gr30, &result.
v1,
151 vcpu, result.
status, gr29, gr30);
154 if (gr29 == PAL_CACHE_TYPE_COHERENT) {
184 if (result.
v0 == 0) {
202 unsigned long sal_freq, sal_drift, factor;
205 &sal_freq, &sal_drift);
220 if (vcpu->
kvm->arch.is_sn2)
221 sn2_patch_itc_freq_ratios(&result);
249 kvm_get_pal_call_data(vcpu, &in0, &in1, &in2, &in3);
250 result.
status = ia64_pal_proc_get_features(&result.
v0, &result.
v1,
262 kvm_get_pal_call_data(vcpu, &in0, &in1, &in2, &in3);
263 result.
status = ia64_pal_register_info(in1, &result.
v1, &result.
v2);
275 kvm_get_pal_call_data(vcpu, &in0, &in1, &in2, &in3);
276 status = ia64_pal_cache_config_info(in1, in2, &ci);
282 #define GUEST_IMPL_VA_MSB 59
283 #define GUEST_RID_BITS 18
309 unsigned long in0,
in1,
in2, in3;
311 kvm_get_pal_call_data(vcpu, &in0, &in1, &in2, &in3);
313 result.
status = ia64_pal_vm_info(in1, in2,
319 static u64 kvm_get_pal_call_index(
struct kvm_vcpu *vcpu)
324 p = kvm_get_exit_data(vcpu);
331 static void prepare_for_halt(
struct kvm_vcpu *vcpu)
333 vcpu->
arch.timer_pending = 1;
334 vcpu->
arch.timer_fired = 0;
340 unsigned long in0,
in1,
in2, in3,
r9;
341 unsigned long pm_buffer[16];
343 kvm_get_pal_call_data(vcpu, &in0, &in1, &in2, &in3);
344 status = ia64_pal_perf_mon_info(pm_buffer,
350 memcpy((
void *)in1, pm_buffer,
sizeof(pm_buffer));
354 "for PAL call:0x%lx!\n", in0);
362 unsigned long in0,
in1,
in2, in3;
364 unsigned long res = 1000
UL | (1000
UL << 16) | (10
UL << 32)
365 | (1
UL << 61) | (1
UL << 60);
367 kvm_get_pal_call_data(vcpu, &in0, &in1, &in2, &in3);
369 memcpy((
void *)in1, &res,
sizeof(res));
374 "for PAL call:0x%lx!\n", in0);
385 status = ia64_pal_mem_attrib(&r9);
390 static void remote_pal_prefetch_visibility(
void *
v)
393 ia64_pal_prefetch_visibility(trans_type);
399 unsigned long in0,
in1,
in2, in3;
400 kvm_get_pal_call_data(vcpu, &in0, &in1, &in2, &in3);
401 result.
status = ia64_pal_prefetch_visibility(in1);
413 static void remote_pal_mc_drain(
void *
v)
421 unsigned long in0,
in1,
in2, in3;
423 kvm_get_pal_call_data(vcpu, &in0, &in1, &in2, &in3);
425 if (in1 == 0 && in2) {
426 char brand_info[128];
427 result.
status = ia64_pal_get_brand_info(brand_info);
429 memcpy((
void *)in2, brand_info, 128);
433 "PAL call:0x%lx!\n", in0);
446 gr28 = kvm_get_pal_call_index(vcpu);
449 result = pal_cache_flush(vcpu);
452 result = pal_mem_attrib(vcpu);
458 result = pal_perf_mon_info(vcpu);
461 result = pal_halt_info(vcpu);
466 prepare_for_halt(vcpu);
473 result = pal_prefetch_visibility(vcpu);
476 result.
status = ia64_pal_mc_drain();
483 result = pal_freq_ratios(vcpu);
487 result = pal_freq_base(vcpu);
491 result = pal_logical_to_physica(vcpu);
495 result = pal_vm_summary(vcpu);
499 result = pal_vm_info(vcpu);
502 result = pal_platform_addr(vcpu);
505 result = pal_cache_info(vcpu);
509 result.
v1 = (1
L << 32) | 1
L;
512 result = pal_register_info(vcpu);
515 result.
status = ia64_pal_vm_page_size(&result.
v0,
519 result.
status = ia64_pal_rse_info(&result.
v0,
523 result = pal_proc_get_features(vcpu);
526 result.
status = ia64_pal_debug_info(&result.
v0,
530 result.
status = ia64_pal_version(
539 result = pal_get_brand_info(vcpu);
548 " index:0x%lx\n", gr28);
550 set_pal_result(vcpu, result);
556 unsigned long in2,
unsigned long in3,
557 unsigned long in4,
unsigned long in5,
558 unsigned long in6,
unsigned long in7)
560 unsigned long r9 = 0;
561 unsigned long r10 = 0;
572 " SAL_PCI_CONFIG_READ\n");
576 " SAL_PCI_CONFIG_WRITE\n");
580 if (in4 != 0 || in5 != 0 || in6 != 0 || in7 != 0) {
583 kvm->arch.rdv_sal_data.boot_ip =
in2;
584 kvm->arch.rdv_sal_data.boot_gp = in3;
586 printk(
"Rendvous called! iip:%lx\n\n", in2);
589 "ignored...\n", in1);
606 "kvm: called SAL_MC_RENDEZ. ignored...\n");
610 "kvm: called SAL_MC_SET_PARAMS.ignored!\n");
627 "kvm: called SAL_CACHE_INIT. ignored...\n");
631 "kvm: CALLED SAL_UPDATE_PAL. ignored...\n");
635 " index:%ld\n", index);
642 static void kvm_get_sal_call_data(
struct kvm_vcpu *vcpu,
u64 *in0,
u64 *in1,
647 p = kvm_get_exit_data(vcpu);
669 kvm_get_sal_call_data(vcpu, &index, &in1, &in2,
670 &in3, &in4, &in5, &in6, &in7);
671 result = sal_emulator(vcpu->
kvm, index, in1, in2, in3,
673 set_sal_result(vcpu, result);