From b4bf0ca2e6905d402db63027d87c3f1d7a2b77ff Mon Sep 17 00:00:00 2001 From: cherry Date: Tue, 12 Feb 2019 07:58:26 +0000 Subject: [PATCH] conditionally include XENPV specific code. This explicitly excludes PV only functionality that would be wrong to attempt to use in other modes, for eg: p2m table management. --- sys/arch/xen/include/pci_machdep.h | 4 ++-- sys/arch/xen/x86/hypervisor_machdep.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/arch/xen/include/pci_machdep.h b/sys/arch/xen/include/pci_machdep.h index 69aca4d5dd6e..4f7d154e0525 100644 --- a/sys/arch/xen/include/pci_machdep.h +++ b/sys/arch/xen/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.h,v 1.19 2017/07/16 06:14:24 cherry Exp $ */ +/* $NetBSD: pci_machdep.h,v 1.20 2019/02/12 07:58:26 cherry Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -66,7 +66,7 @@ typedef intr_handle_t pci_intr_handle_t; #include "opt_xen.h" -#ifndef DOM0OPS +#if !defined(DOM0OPS) && defined(XENPV) int xpci_enumerate_bus(struct pci_softc *, const int *, int (*)(const struct pci_attach_args *), struct pci_attach_args *); diff --git a/sys/arch/xen/x86/hypervisor_machdep.c b/sys/arch/xen/x86/hypervisor_machdep.c index d8950d0f6188..4a02ff3d1a65 100644 --- a/sys/arch/xen/x86/hypervisor_machdep.c +++ b/sys/arch/xen/x86/hypervisor_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: hypervisor_machdep.c,v 1.34 2018/12/25 06:50:12 cherry Exp $ */ +/* $NetBSD: hypervisor_machdep.c,v 1.35 2019/02/12 07:58:26 cherry Exp $ */ /* * @@ -54,7 +54,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.34 2018/12/25 06:50:12 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.35 2019/02/12 07:58:26 cherry Exp $"); #include #include @@ -74,6 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.34 2018/12/25 06:50:12 cher #include "isa.h" #include "pci.h" +#ifdef XENPV /* * arch-dependent p2m frame lists list (L3 and L2) * used by Xen for save/restore mappings @@ -85,6 +86,8 @@ static int l2_p2m_page_size; /* size of L2 page, in pages */ static void build_p2m_frame_list_list(void); static void update_p2m_frame_list_list(void); +#endif + // #define PORT_DEBUG 4 // #define EARLY_DEBUG_EVENT @@ -434,21 +437,26 @@ hypervisor_set_ipending(uint32_t iplmask, int l1, int l2) void hypervisor_machdep_attach(void) { +#ifdef XENPV /* dom0 does not require the arch-dependent P2M translation table */ if (!xendomain_is_dom0()) { build_p2m_frame_list_list(); sysctl_xen_suspend_setup(); } +#endif } void hypervisor_machdep_resume(void) { +#ifdef XENPV /* dom0 does not require the arch-dependent P2M translation table */ if (!xendomain_is_dom0()) update_p2m_frame_list_list(); +#endif } +#ifdef XENPV /* * Generate the p2m_frame_list_list table, * needed for guest save/restore @@ -532,3 +540,4 @@ update_p2m_frame_list_list(void) HYPERVISOR_shared_info->arch.max_pfn = max_pfn; } +#endif /* XENPV */