This is more readable, maintainable, and livepatchable.
This involves declaring check_for_unexpected_msi(), untrusted_msi and
pv_hypercall() suitably for use by C. While making these changes,
untrusted_msi is switched over to being a C99 bool.
No behavioural change.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
obj-y += hypercall.o
+obj-y += traps.o
+
obj-bin-y += dom0_build.init.o
--- /dev/null
+/******************************************************************************
+ * arch/x86/pv/traps.c
+ *
+ * PV low level entry points.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (c) 2017 Citrix Systems Ltd.
+ */
+
+#include <xen/hypercall.h>
+
+#include <asm/apic.h>
+
+void do_entry_int82(struct cpu_user_regs *regs)
+{
+ if ( unlikely(untrusted_msi) )
+ check_for_unexpected_msi((uint8_t)regs->entry_vector);
+
+ pv_hypercall(regs);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
SAVE_VOLATILE type=HYPERCALL_VECTOR compat=1
CR4_PV32_RESTORE
- cmpb $0,untrusted_msi(%rip)
-UNLIKELY_START(ne, msi_check)
- movl $HYPERCALL_VECTOR,%edi
- call check_for_unexpected_msi
- LOAD_C_CLOBBERED compat=1 ax=0
-UNLIKELY_END(msi_check)
-
GET_CURRENT(bx)
mov %rsp, %rdi
- call pv_hypercall
+ call do_entry_int82
/* %rbx: struct vcpu */
ENTRY(compat_test_all_events)
};
/* Possible unfiltered LAPIC/MSI messages from untrusted sources? */
-bool_t __read_mostly untrusted_msi;
+bool __read_mostly untrusted_msi;
int nr_iommus;
* by the root complex unless interrupt remapping is enabled.
*/
if ( (target != hardware_domain) && !iommu_intremap )
- untrusted_msi = 1;
+ untrusted_msi = true;
/*
* If the device belongs to the hardware domain, and it has RMRR, don't
extern int lapic_resume(void);
extern void record_boot_APIC_mode(void);
extern enum apic_mode current_local_apic_mode(void);
+extern void check_for_unexpected_msi(unsigned int vector);
extern int check_nmi_watchdog (void);
extern const hypercall_args_t hypercall_args_table[NR_hypercalls];
+void pv_hypercall(struct cpu_user_regs *regs);
+
/*
* Both do_mmuext_op() and do_mmu_update():
* We steal the m.s.b. of the @count parameter to indicate whether this
int iommu_enable_x2apic_IR(void);
void iommu_disable_x2apic_IR(void);
+extern bool untrusted_msi;
+
int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
const uint8_t gvec);