Mailing List Archive

[PATCH 4/5] x86: hypercall vector is unused when !PV32
This vector can be used as an ordinary interrupt handling one in this
case. To be sure no references are left, make the #define itself
conditional.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -436,8 +436,12 @@ int __init init_irq_data(void)
irq_to_desc(irq)->irq = irq;

#ifdef CONFIG_PV
- /* Never allocate the hypercall vector or Linux/BSD fast-trap vector. */
+ /* Never allocate the Linux/BSD fast-trap vector. */
set_bit(LEGACY_SYSCALL_VECTOR, used_vectors);
+#endif
+
+#ifdef CONFIG_PV32
+ /* Never allocate the hypercall vector. */
set_bit(HYPERCALL_VECTOR, used_vectors);
#endif

--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -30,6 +30,7 @@
#include <asm/traps.h>
#include <irq_vectors.h>

+#ifdef CONFIG_PV32
void do_entry_int82(struct cpu_user_regs *regs)
{
if ( unlikely(untrusted_msi) )
@@ -37,6 +38,7 @@ void do_entry_int82(struct cpu_user_regs

pv_hypercall(regs);
}
+#endif

void pv_inject_event(const struct x86_event *event)
{
@@ -155,9 +157,11 @@ static void nmi_softirq(void)

void __init pv_trap_init(void)
{
+#ifdef CONFIG_PV32
/* The 32-on-64 hypercall vector is only accessible from ring 1. */
_set_gate(idt_table + HYPERCALL_VECTOR,
SYS_DESC_trap_gate, 1, entry_int82);
+#endif

/* Fast trap for int80 (faster than taking the #GP-fixup path). */
_set_gate(idt_table + LEGACY_SYSCALL_VECTOR, SYS_DESC_trap_gate, 3,
--- a/xen/arch/x86/x86_64/compat/entry.S
+++ b/xen/arch/x86/x86_64/compat/entry.S
@@ -11,6 +11,8 @@
#include <public/xen.h>
#include <irq_vectors.h>

+#ifdef CONFIG_PV32
+
ENTRY(entry_int82)
ASM_CLAC
pushq $0
@@ -27,6 +29,8 @@ ENTRY(entry_int82)
mov %rsp, %rdi
call do_entry_int82

+#endif /* CONFIG_PV32 */
+
/* %rbx: struct vcpu */
ENTRY(compat_test_all_events)
ASSERT_NOT_IN_ATOMIC
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -982,8 +982,10 @@ autogen_stubs: /* Automatically generate
.rept X86_NR_VECTORS

/* Common interrupts, heading towards do_IRQ(). */
-#ifdef CONFIG_PV
+#if defined(CONFIG_PV32)
.if vec >= FIRST_IRQ_VECTOR && vec != HYPERCALL_VECTOR && vec != LEGACY_SYSCALL_VECTOR
+#elif defined(CONFIG_PV)
+ .if vec >= FIRST_IRQ_VECTOR && vec != LEGACY_SYSCALL_VECTOR
#else
.if vec >= FIRST_IRQ_VECTOR
#endif
--- a/xen/include/asm-x86/mach-default/irq_vectors.h
+++ b/xen/include/asm-x86/mach-default/irq_vectors.h
@@ -22,7 +22,10 @@
#define FIRST_LEGACY_VECTOR FIRST_DYNAMIC_VECTOR
#define LAST_LEGACY_VECTOR (FIRST_LEGACY_VECTOR + 0xf)

-#define HYPERCALL_VECTOR 0x82
+#ifdef CONFIG_PV32
+#define HYPERCALL_VECTOR 0x82
+#endif
+
#define LEGACY_SYSCALL_VECTOR 0x80

/*
Re: [PATCH 4/5] x86: hypercall vector is unused when !PV32 [ In reply to ]
On Wed, Nov 25, 2020 at 09:50:51AM +0100, Jan Beulich wrote:
> This vector can be used as an ordinary interrupt handling one in this
> case. To be sure no references are left, make the #define itself
> conditional.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.