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.
This commit is contained in:
cherry 2019-02-12 07:58:26 +00:00
parent db4c90ad36
commit b4bf0ca2e6
2 changed files with 13 additions and 4 deletions

View File

@ -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 *);

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/systm.h>
@ -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 */