Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/bouyer-xenpvh]: src/sys/arch Include ci_isources[] for XenPV too.
details: https://anonhg.NetBSD.org/src/rev/249b33d5ca64
branches: bouyer-xenpvh
changeset: 1024951:249b33d5ca64
user: bouyer <bouyer%NetBSD.org@localhost>
date: Sat Apr 11 10:11:30 2020 +0000
description:
Include ci_isources[] for XenPV too.
Adjust spllower() to XenPV needs, and switch XenPV to the native spllower().
Remove xen_spllower().
diffstat:
sys/arch/amd64/amd64/genassym.cf | 4 +---
sys/arch/amd64/amd64/spl.S | 18 +++++++++++++-----
sys/arch/amd64/include/frameasm.h | 14 +++++++++++++-
sys/arch/i386/i386/genassym.cf | 4 +---
sys/arch/i386/i386/spl.S | 21 ++++++++++++++-------
sys/arch/i386/include/frameasm.h | 9 ++++++++-
sys/arch/x86/include/cpu.h | 4 +---
sys/arch/xen/x86/xen_intr.c | 36 ++----------------------------------
8 files changed, 53 insertions(+), 57 deletions(-)
diffs (truncated from 304 to 300 lines):
diff -r c3c565aa7d99 -r 249b33d5ca64 sys/arch/amd64/amd64/genassym.cf
--- a/sys/arch/amd64/amd64/genassym.cf Sat Apr 11 08:06:16 2020 +0000
+++ b/sys/arch/amd64/amd64/genassym.cf Sat Apr 11 10:11:30 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.82.4.1 2020/04/08 17:59:16 bouyer Exp $
+# $NetBSD: genassym.cf,v 1.82.4.2 2020/04/11 10:11:30 bouyer Exp $
#
# Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -246,13 +246,11 @@
define CPU_INFO_GDT offsetof(struct cpu_info, ci_gdt)
define CPU_INFO_ILEVEL offsetof(struct cpu_info, ci_ilevel)
define CPU_INFO_IDEPTH offsetof(struct cpu_info, ci_idepth)
-if !defined(XENPV)
define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_ipending)
define CPU_INFO_IMASKED offsetof(struct cpu_info, ci_imasked)
define CPU_INFO_IMASK offsetof(struct cpu_info, ci_imask)
define CPU_INFO_IUNMASK offsetof(struct cpu_info, ci_iunmask)
define CPU_INFO_ISOURCES offsetof(struct cpu_info, ci_isources)
-endif
define CPU_INFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
define CPU_INFO_MTX_OLDSPL offsetof(struct cpu_info, ci_mtx_oldspl)
define CPU_INFO_CPUID offsetof(struct cpu_info, ci_cpuid)
diff -r c3c565aa7d99 -r 249b33d5ca64 sys/arch/amd64/amd64/spl.S
--- a/sys/arch/amd64/amd64/spl.S Sat Apr 11 08:06:16 2020 +0000
+++ b/sys/arch/amd64/amd64/spl.S Sat Apr 11 10:11:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spl.S,v 1.43.4.3 2020/04/10 14:41:59 bouyer Exp $ */
+/* $NetBSD: spl.S,v 1.43.4.4 2020/04/11 10:11:30 bouyer Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -226,7 +226,6 @@
IDTVEC_END(resume_preempt)
#endif /* XEN */
-#ifndef XENPV
/*
* void spllower(int s);
*
@@ -238,8 +237,8 @@
cmpl CPUVAR(ILEVEL),%edi
jae 1f
movl CPUVAR(IUNMASK)(,%rdi,4),%edx
- pushf
- cli
+ PUSHF(ax)
+ CLI(ax)
testl CPUVAR(IPENDING),%edx
jnz 2f
#if defined(XEN)
@@ -248,12 +247,20 @@
jnz 2f
#endif
movl %edi,CPUVAR(ILEVEL)
- popf
+ POPF /* clobbers %rdi */
1:
ret
ret
2:
+#ifdef XENPV
+ /*
+ * no need to call stipending, we're going to CLI again
+ * just drop the saved value on stack
+ */
+ addq $8,%rsp
+#else
popf
+#endif
jmp _C_LABEL(Xspllower)
3:
.space 16
@@ -261,6 +268,7 @@
END(spllower)
LABEL(spllower_end)
+#ifndef XENPV
/*
* void cx8_spllower(int s);
*
diff -r c3c565aa7d99 -r 249b33d5ca64 sys/arch/amd64/include/frameasm.h
--- a/sys/arch/amd64/include/frameasm.h Sat Apr 11 08:06:16 2020 +0000
+++ b/sys/arch/amd64/include/frameasm.h Sat Apr 11 10:11:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: frameasm.h,v 1.47 2019/11/17 14:07:00 maxv Exp $ */
+/* $NetBSD: frameasm.h,v 1.47.6.1 2020/04/11 10:11:30 bouyer Exp $ */
#ifndef _AMD64_MACHINE_FRAMEASM_H
#define _AMD64_MACHINE_FRAMEASM_H
@@ -31,11 +31,23 @@
movq CPUVAR(VCPU),%r ## temp_reg ; \
movb $0,EVTCHN_UPCALL_MASK(%r ## temp_reg);
+#define PUSHF(temp_reg) \
+ movq CPUVAR(VCPU),%r ## temp_reg ; \
+ movzbl EVTCHN_UPCALL_MASK(%r ## temp_reg), %e ## temp_reg; \
+ pushq %r ## temp_reg
+
+#define POPF \
+ popq %rdi; \
+ call _C_LABEL(xen_write_psl)
+
+
#else /* XENPV */
#define XEN_ONLY2(x,y)
#define NOT_XEN(x) x
#define CLI(temp_reg) cli
#define STI(temp_reg) sti
+#define PUSHF(temp_reg) pushf
+#define POPL popl
#endif /* XEN */
#define HP_NAME_CLAC 1
diff -r c3c565aa7d99 -r 249b33d5ca64 sys/arch/i386/i386/genassym.cf
--- a/sys/arch/i386/i386/genassym.cf Sat Apr 11 08:06:16 2020 +0000
+++ b/sys/arch/i386/i386/genassym.cf Sat Apr 11 10:11:30 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.119.4.1 2020/04/08 17:59:16 bouyer Exp $
+# $NetBSD: genassym.cf,v 1.119.4.2 2020/04/11 10:11:31 bouyer Exp $
#
# Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -268,13 +268,11 @@
define CPU_INFO_SIGNATURE offsetof(struct cpu_info, ci_signature)
define CPU_INFO_GDT offsetof(struct cpu_info, ci_gdt)
-if !defined(XENPV)
define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_ipending)
define CPU_INFO_IMASKED offsetof(struct cpu_info, ci_imasked)
define CPU_INFO_IMASK offsetof(struct cpu_info, ci_imask)
define CPU_INFO_ISOURCES offsetof(struct cpu_info, ci_isources)
define CPU_INFO_IUNMASK offsetof(struct cpu_info, ci_iunmask)
-endif
define CPU_INFO_ILEVEL offsetof(struct cpu_info, ci_ilevel)
define CPU_INFO_IDEPTH offsetof(struct cpu_info, ci_idepth)
define CPU_INFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
diff -r c3c565aa7d99 -r 249b33d5ca64 sys/arch/i386/i386/spl.S
--- a/sys/arch/i386/i386/spl.S Sat Apr 11 08:06:16 2020 +0000
+++ b/sys/arch/i386/i386/spl.S Sat Apr 11 10:11:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spl.S,v 1.50.4.1 2020/04/10 14:42:00 bouyer Exp $ */
+/* $NetBSD: spl.S,v 1.50.4.2 2020/04/11 10:11:31 bouyer Exp $ */
/*
* Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.50.4.1 2020/04/10 14:42:00 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.50.4.2 2020/04/11 10:11:31 bouyer Exp $");
#include "opt_ddb.h"
#include "opt_spldebug.h"
@@ -67,8 +67,6 @@
ret
END(splraise)
-#ifndef XENPV
-
/*
* void spllower(int s);
*
@@ -90,8 +88,8 @@
cmpl CPUVAR(ILEVEL),%ecx
jae 1f
movl CPUVAR(IUNMASK)(,%ecx,4),%edx
- pushf
- cli
+ PUSHF(%eax)
+ CLI(%eax)
testl CPUVAR(IPENDING),%edx
jnz 2f
#if defined(XEN)
@@ -100,16 +98,25 @@
jnz 2f
#endif
movl %ecx,CPUVAR(ILEVEL)
- popf
+ POPF(%eax)
1:
ret
2:
+#ifdef XENPV
+ /*
+ * no need to call stipending, we're going to CLI again
+ * just drop the saved value on stack
+ */
+ addl $4,%esp
+#else
popf
+#endif
jmp _C_LABEL(Xspllower)
.align 32
LABEL(spllower_end)
END(spllower)
+#ifndef XENPV
/*
* void cx8_spllower(int s);
*
diff -r c3c565aa7d99 -r 249b33d5ca64 sys/arch/i386/include/frameasm.h
--- a/sys/arch/i386/include/frameasm.h Sat Apr 11 08:06:16 2020 +0000
+++ b/sys/arch/i386/include/frameasm.h Sat Apr 11 10:11:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: frameasm.h,v 1.29 2019/10/12 06:31:03 maxv Exp $ */
+/* $NetBSD: frameasm.h,v 1.29.6.1 2020/04/11 10:11:31 bouyer Exp $ */
#ifndef _I386_FRAMEASM_H_
#define _I386_FRAMEASM_H_
@@ -25,9 +25,16 @@
#define STIC(reg) movl CPUVAR(VCPU),reg ; \
XEN_UNBLOCK_EVENTS(reg) ; \
testb $0xff,EVTCHN_UPCALL_PENDING(reg)
+#define PUSHF(reg) movl CPUVAR(VCPU),reg ; \
+ movzbl EVTCHN_UPCALL_MASK(reg), reg; \
+ pushl reg
+#define POPF(reg) call _C_LABEL(xen_write_psl); \
+ addl $4,%esp
#else
#define CLI(reg) cli
#define STI(reg) sti
+#define PUSHF(reg) pushf
+#define POPF(reg) popf
#ifdef XENPVHVM
#define STIC(reg) sti ; \
movl CPUVAR(VCPU),reg ; \
diff -r c3c565aa7d99 -r 249b33d5ca64 sys/arch/x86/include/cpu.h
--- a/sys/arch/x86/include/cpu.h Sat Apr 11 08:06:16 2020 +0000
+++ b/sys/arch/x86/include/cpu.h Sat Apr 11 10:11:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.117.4.2 2020/04/10 14:37:54 bouyer Exp $ */
+/* $NetBSD: cpu.h,v 1.117.4.3 2020/04/11 10:11:31 bouyer Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -132,9 +132,7 @@
int ci_kfpu_spl;
-#ifndef XENPV
struct intrsource *ci_isources[MAX_INTR_SOURCES];
-#endif
#if defined(XEN)
struct intrsource *ci_xsources[NIPL];
uint32_t ci_xmask[NIPL];
diff -r c3c565aa7d99 -r 249b33d5ca64 sys/arch/xen/x86/xen_intr.c
--- a/sys/arch/xen/x86/xen_intr.c Sat Apr 11 08:06:16 2020 +0000
+++ b/sys/arch/xen/x86/xen_intr.c Sat Apr 11 10:11:30 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_intr.c,v 1.21 2020/04/06 19:26:00 jdolecek Exp $ */
+/* $NetBSD: xen_intr.c,v 1.21.2.1 2020/04/11 10:11:31 bouyer Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21 2020/04/06 19:26:00 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.1 2020/04/11 10:11:31 bouyer Exp $");
#include "opt_multiprocessor.h"
@@ -73,38 +73,6 @@
static const char *xen_ipi_names[XEN_NIPIS] = XEN_IPI_NAMES;
#endif
-/*
- * Restore a value to cpl (unmasking interrupts). If any unmasked
- * interrupts are pending, call Xspllower() to process them.
- */
-void xen_spllower(int nlevel);
-
-void
-xen_spllower(int nlevel)
-{
- struct cpu_info *ci = curcpu();
- uint32_t xmask;
- u_long psl;
-
- if (ci->ci_ilevel <= nlevel)
- return;
-
- __insn_barrier();
-
- xmask = XUNMASK(ci, nlevel);
- psl = xen_read_psl();
- x86_disable_intr();
- if (ci->ci_xpending & xmask) {
- KASSERT(psl == 0);
- Xspllower(nlevel);
- /* Xspllower does enable_intr() */
- } else {
- ci->ci_ilevel = nlevel;
- xen_write_psl(psl);
- }
-}
-
Home |
Main Index |
Thread Index |
Old Index