Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/bouyer-xenpvh]: src/sys/arch amd64: Xhypervisor_pvhvm_callback has to be...
details: https://anonhg.NetBSD.org/src/rev/f6daebdebd74
branches: bouyer-xenpvh
changeset: 1024976:f6daebdebd74
user: bouyer <bouyer%NetBSD.org@localhost>
date: Thu Apr 16 17:50:51 2020 +0000
description:
amd64: Xhypervisor_pvhvm_callback has to be in text.user for SVS.
Thanks to maxv@ for helping me with this.
Enable SVS again.
While there, increase ci_idepth before calling do_hypervisor_callback,
and don't touch ci_idepth while looping over pending events.
diffstat:
sys/arch/amd64/amd64/vector.S | 7 +++++--
sys/arch/amd64/conf/GENERIC_XENHVM | 5 ++---
sys/arch/i386/i386/vector.S | 13 +++++++------
sys/arch/xen/x86/hypervisor_machdep.c | 13 +++++++------
4 files changed, 21 insertions(+), 17 deletions(-)
diffs (141 lines):
diff -r 47b6ce406f5f -r f6daebdebd74 sys/arch/amd64/amd64/vector.S
--- a/sys/arch/amd64/amd64/vector.S Thu Apr 16 17:47:37 2020 +0000
+++ b/sys/arch/amd64/amd64/vector.S Thu Apr 16 17:50:51 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vector.S,v 1.73.6.4 2020/04/16 08:46:34 bouyer Exp $ */
+/* $NetBSD: vector.S,v 1.73.6.5 2020/04/16 17:50:51 bouyer Exp $ */
/*
* Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -761,17 +761,20 @@
movq (%rsp),%rcx
movq 8(%rsp),%r11
addq $16,%rsp
+ jmp _C_LABEL(Xhypervisor_pvhvm_callback)
+ TEXT_USER_BEGIN
IDTVEC(hypervisor_pvhvm_callback)
pushq $0 /* Dummy error code */
pushq $T_ASTFLT
INTRENTRY
movl CPUVAR(ILEVEL),%edi
pushq %rdi /* for Xdoreti */
+ incl CPUVAR(IDEPTH)
movq %rsp,%rdi
call do_hypervisor_callback
- incl CPUVAR(IDEPTH)
jmp _C_LABEL(Xdoreti)
IDTVEC_END(hypervisor_pvhvm_callback)
+ TEXT_USER_END
END(hypervisor_callback)
#endif /* XEN */
diff -r 47b6ce406f5f -r f6daebdebd74 sys/arch/amd64/conf/GENERIC_XENHVM
--- a/sys/arch/amd64/conf/GENERIC_XENHVM Thu Apr 16 17:47:37 2020 +0000
+++ b/sys/arch/amd64/conf/GENERIC_XENHVM Thu Apr 16 17:50:51 2020 +0000
@@ -1,14 +1,13 @@
-# $NetBSD: GENERIC_XENHVM,v 1.1.2.3 2020/04/16 10:42:26 bouyer Exp $
+# $NetBSD: GENERIC_XENHVM,v 1.1.2.4 2020/04/16 17:50:51 bouyer Exp $
include "arch/amd64/conf/GENERIC"
options XENPVHVM
options XEN
-no options SVS # Separate Virtual Space
options MAXPHYS=32768 #xbd doesn't handle 64k transfers
hypervisor* at mainbus? # Xen hypervisor
#vcpu* at hypervisor? # Xen virtual CPUs
xenbus* at hypervisor? # Xen virtual bus
xencons* at hypervisor? # Xen virtual console
-xennet* at xenbus? # Xen virtual network interface
+xennet* at xenbus? # Xen virtual network interface
xbd* at xenbus? # Xen virtual block device
diff -r 47b6ce406f5f -r f6daebdebd74 sys/arch/i386/i386/vector.S
--- a/sys/arch/i386/i386/vector.S Thu Apr 16 17:47:37 2020 +0000
+++ b/sys/arch/i386/i386/vector.S Thu Apr 16 17:50:51 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vector.S,v 1.85.6.5 2020/04/16 08:46:34 bouyer Exp $ */
+/* $NetBSD: vector.S,v 1.85.6.6 2020/04/16 17:50:52 bouyer Exp $ */
/*
* Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.5 2020/04/16 08:46:34 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.85.6.6 2020/04/16 17:50:52 bouyer Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -1013,11 +1013,12 @@
pushl $T_ASTFLT
INTRENTRY
pushl CPUVAR(ILEVEL)
- push %esp
+ IDEPTH_INCR
+ /* IDEPTH_INCR puts %esp on stack; we use it as argument to
+ * do_hypervisor_callback. But don't restore the stack after,
+ * Xdoreti needs it too.
+ */
call do_hypervisor_callback
- add $4,%esp
- IDEPTH_INCR
- CLI(%eax)
jmp _C_LABEL(Xdoreti)
IDTVEC_END(hypervisor_pvhvm_callback)
END(hypervisor_callback)
diff -r 47b6ce406f5f -r f6daebdebd74 sys/arch/xen/x86/hypervisor_machdep.c
--- a/sys/arch/xen/x86/hypervisor_machdep.c Thu Apr 16 17:47:37 2020 +0000
+++ b/sys/arch/xen/x86/hypervisor_machdep.c Thu Apr 16 17:50:51 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor_machdep.c,v 1.36.8.2 2020/04/16 08:46:35 bouyer Exp $ */
+/* $NetBSD: hypervisor_machdep.c,v 1.36.8.3 2020/04/16 17:50:52 bouyer Exp $ */
/*
*
@@ -54,11 +54,12 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.8.2 2020/04/16 08:46:35 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.8.3 2020/04/16 17:50:52 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kmem.h>
+#include <sys/cpu.h>
#include <uvm/uvm_extern.h>
@@ -215,7 +216,9 @@
{
KASSERT(args != NULL);
+#ifdef DOM0OPS
struct cpu_info *ci = curcpu();
+#endif
struct intrframe *regs = args;
#ifdef PORT_DEBUG
@@ -223,9 +226,8 @@
printf("do_hypervisor_callback event %d\n", port);
#endif
if (evtsource[port]) {
- ci->ci_idepth++;
+ KASSERT(cpu_intr_p());
evtchn_do_event(port, regs);
- ci->ci_idepth--;
}
#ifdef DOM0OPS
else {
@@ -233,9 +235,8 @@
/* fast path */
int oipl = ci->ci_ilevel;
ci->ci_ilevel = IPL_HIGH;
- ci->ci_idepth++;
+ KASSERT(cpu_intr_p());
xenevt_event(port);
- ci->ci_idepth--;
ci->ci_ilevel = oipl;
} else {
/* set pending event */
Home |
Main Index |
Thread Index |
Old Index