Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen/xen Workarounds for amazon's Xen 4.2 version, s...
details: https://anonhg.NetBSD.org/src/rev/acd87e973b1a
branches: trunk
changeset: 954738:acd87e973b1a
user: bouyer <bouyer%NetBSD.org@localhost>
date: Wed Sep 09 16:46:06 2020 +0000
description:
Workarounds for amazon's Xen 4.2 version, still present on some instances:
- It doens't provides an xencons, so allow HVM_PARAM_CONSOLE_PFN to fail
- the xen clock is not fully functionnal, so don't try to use it if
HVM_PARAM_CONSOLE_PFN failed.
- it doesn't have XEN_HVM_CPUID_VCPU_ID_PRESENT so fall back to ci_acpiid
as ci_vcpuid in this case.
It also doesn't support the per-CPU event callback; so fix the fallback
to global vector (don't try to register more per-cpu vector)
Should fix port-amd64/55543
diffstat:
sys/arch/xen/xen/hypervisor.c | 76 +++++++++++++++++++++++++-----------------
1 files changed, 45 insertions(+), 31 deletions(-)
diffs (125 lines):
diff -r 4743c989c295 -r acd87e973b1a sys/arch/xen/xen/hypervisor.c
--- a/sys/arch/xen/xen/hypervisor.c Wed Sep 09 16:29:59 2020 +0000
+++ b/sys/arch/xen/xen/hypervisor.c Wed Sep 09 16:46:06 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.87 2020/07/14 00:45:53 yamaguchi Exp $ */
+/* $NetBSD: hypervisor.c,v 1.88 2020/09/09 16:46:06 bouyer Exp $ */
/*
* Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.87 2020/07/14 00:45:53 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.88 2020/09/09 16:46:06 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -413,32 +413,42 @@
xen_hvm_param.index = HVM_PARAM_CONSOLE_PFN;
if ( HYPERVISOR_hvm_op(HVMOP_get_param, &xen_hvm_param) < 0) {
- aprint_error(
+ aprint_debug(
"Xen HVM: Unable to obtain xencons page address\n");
- return 0;
+ xen_start_info.console.domU.mfn = 0;
+ xen_start_info.console.domU.evtchn = -1;
+ xencons_interface = 0;
+ } else {
+ /* Re-use PV field */
+ xen_start_info.console.domU.mfn = xen_hvm_param.value;
+
+ pmap_kenter_pa((vaddr_t) xencons_interface,
+ ptoa(xen_start_info.console.domU.mfn),
+ VM_PROT_READ|VM_PROT_WRITE, 0);
+
+ xen_hvm_param.domid = DOMID_SELF;
+ xen_hvm_param.index = HVM_PARAM_CONSOLE_EVTCHN;
+
+ if ( HYPERVISOR_hvm_op(HVMOP_get_param, &xen_hvm_param) < 0) {
+ aprint_error(
+ "Xen HVM: Unable to obtain xencons event channel\n");
+ return 0;
+ }
+
+ xen_start_info.console.domU.evtchn = xen_hvm_param.value;
}
- /* Re-use PV field */
- xen_start_info.console.domU.mfn = xen_hvm_param.value;
-
- pmap_kenter_pa((vaddr_t) xencons_interface, ptoa(xen_start_info.console.domU.mfn),
- VM_PROT_READ|VM_PROT_WRITE, 0);
-
- xen_hvm_param.domid = DOMID_SELF;
- xen_hvm_param.index = HVM_PARAM_CONSOLE_EVTCHN;
-
- if ( HYPERVISOR_hvm_op(HVMOP_get_param, &xen_hvm_param) < 0) {
- aprint_error(
- "Xen HVM: Unable to obtain xencons event channel\n");
- return 0;
+ /*
+ * PR port-amd64/55543
+ * workround for amazon's Xen 4.2: it looks like the Xen clock is not
+ * fully funtionnal here. This version also doesn't support
+ * HVM_PARAM_CONSOLE_PFN.
+ */
+ if (xencons_interface != 0) {
+ delay_func = x86_delay = xen_delay;
+ x86_initclock_func = xen_initclocks;
}
- xen_start_info.console.domU.evtchn = xen_hvm_param.value;
-
-
- delay_func = x86_delay = xen_delay;
- x86_initclock_func = xen_initclocks;
-
vm_guest = VM_GUEST_XENPVHVM; /* Be more specific */
return 1;
}
@@ -458,13 +468,14 @@
descs[0] = 0;
x86_cpuid(XEN_CPUID_LEAF(4), descs);
- if (!(descs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT)) {
- aprint_error_dev(ci->ci_dev, "Xen HVM: can't get VCPU id\n");
- vm_guest = VM_GUEST_XENHVM;
- return 0;
+ if (descs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT) {
+ ci->ci_vcpuid = descs[1];
+ } else {
+ aprint_debug_dev(ci->ci_dev,
+ "Xen HVM: can't get VCPU id, falling back to ci_acpiid\n");
+ ci->ci_vcpuid = ci->ci_acpiid;
}
- ci->ci_vcpuid = descs[1];
ci->ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[ci->ci_vcpuid];
/* Register event callback handler. */
@@ -491,6 +502,7 @@
panic("event upcall vector");
aprint_error_dev(ci->ci_dev,
"falling back to global vector\n");
+ xenhvm_use_percpu_callback = 0;
} else {
/*
* From FreeBSD:
@@ -664,9 +676,11 @@
config_found_ia(self, "xendevbus", &hac.hac_xenbus, hypervisor_print);
#endif
#if NXENCONS > 0
- memset(&hac, 0, sizeof(hac));
- hac.hac_xencons.xa_device = "xencons";
- config_found_ia(self, "xendevbus", &hac.hac_xencons, hypervisor_print);
+ if (xencons_interface != 0) {
+ memset(&hac, 0, sizeof(hac));
+ hac.hac_xencons.xa_device = "xencons";
+ config_found_ia(self, "xendevbus", &hac.hac_xencons, hypervisor_print);
+ }
#endif
#if defined(XENPV) && defined(DOM0OPS)
#if NPCI > 0
Home |
Main Index |
Thread Index |
Old Index