From 3c790178c589358099085e42b6f45d3b26461666 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 6 Aug 2015 17:07:21 +0000 Subject: [PATCH] Remove some more vestiges of the Xen PV domu support. Specifically, use vtophys() directly instead of vtomach() and retire the no-longer-used headers and . Reported by: bde (stale bits in ) Reviewed by: royger (earlier version) Differential Revision: https://reviews.freebsd.org/D3266 --- sys/amd64/include/xen/xenfunc.h | 73 ----------------------------- sys/amd64/include/xen/xenvar.h | 59 ------------------------ sys/dev/xen/balloon/balloon.c | 2 - sys/dev/xen/blkfront/blkfront.c | 5 +- sys/dev/xen/control/control.c | 3 -- sys/dev/xen/netback/netback.c | 4 +- sys/dev/xen/netfront/netfront.c | 6 +-- sys/dev/xen/pcifront/pcifront.c | 2 +- sys/i386/include/xen/xenfunc.h | 81 --------------------------------- sys/i386/include/xen/xenvar.h | 36 --------------- sys/x86/xen/xen_intr.c | 1 - 11 files changed, 6 insertions(+), 266 deletions(-) delete mode 100644 sys/amd64/include/xen/xenfunc.h delete mode 100644 sys/amd64/include/xen/xenvar.h delete mode 100644 sys/i386/include/xen/xenfunc.h delete mode 100644 sys/i386/include/xen/xenvar.h diff --git a/sys/amd64/include/xen/xenfunc.h b/sys/amd64/include/xen/xenfunc.h deleted file mode 100644 index d8a6b5c5c99b..000000000000 --- a/sys/amd64/include/xen/xenfunc.h +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * Copyright (c) 2004, 2005 Kip Macy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _XEN_XENFUNC_H_ -#define _XEN_XENFUNC_H_ - -#include - -#define BKPT __asm__("int3"); -#define XPQ_CALL_DEPTH 5 -#define XPQ_CALL_COUNT 2 -#define PG_PRIV PG_AVAIL3 -typedef struct { - unsigned long pt_ref; - unsigned long pt_eip[XPQ_CALL_COUNT][XPQ_CALL_DEPTH]; -} pteinfo_t; - -extern pteinfo_t *pteinfo_list; -#ifdef XENDEBUG_LOW -#define __PRINTK(x) printk x -#else -#define __PRINTK(x) -#endif - -char *xen_setbootenv(char *cmd_line); - -int xen_boothowto(char *envp); - -void _xen_machphys_update(vm_paddr_t, vm_paddr_t, char *file, int line); - -#ifdef INVARIANTS -#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), __FILE__, __LINE__) -#else -#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), NULL, 0) -#endif - -extern struct mtx balloon_lock; -#if 0 -#define balloon_lock(__flags) mtx_lock_irqsave(&balloon_lock, __flags) -#define balloon_unlock(__flags) mtx_unlock_irqrestore(&balloon_lock, __flags) -#else -#define balloon_lock(__flags) __flags = 1 -#define balloon_unlock(__flags) __flags = 0 -#endif - - - -#endif /* _XEN_XENFUNC_H_ */ diff --git a/sys/amd64/include/xen/xenvar.h b/sys/amd64/include/xen/xenvar.h deleted file mode 100644 index 110a351bac62..000000000000 --- a/sys/amd64/include/xen/xenvar.h +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * Copyright (c) 2008 Kip Macy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -#ifndef XENVAR_H_ -#define XENVAR_H_ -#define XBOOTUP 0x1 -#define XPMAP 0x2 -extern int xendebug_flags; -#ifndef NOXENDEBUG -#define XENPRINTF printk -#else -#define XENPRINTF printf -#endif -#include - -#if 0 -#define TRACE_ENTER XENPRINTF("(file=%s, line=%d) entered %s\n", __FILE__, __LINE__, __FUNCTION__) -#define TRACE_EXIT XENPRINTF("(file=%s, line=%d) exiting %s\n", __FILE__, __LINE__, __FUNCTION__) -#define TRACE_DEBUG(argflags, _f, _a...) \ -if (xendebug_flags & argflags) XENPRINTF("(file=%s, line=%d) " _f "\n", __FILE__, __LINE__, ## _a); -#else -#define TRACE_ENTER -#define TRACE_EXIT -#define TRACE_DEBUG(argflags, _f, _a...) -#endif - -#define vtomach(va) pmap_kextract((vm_offset_t) (va)) - -void xpq_init(void); - -int xen_create_contiguous_region(vm_page_t pages, int npages); - -void xen_destroy_contiguous_region(void * addr, int npages); - -#endif diff --git a/sys/dev/xen/balloon/balloon.c b/sys/dev/xen/balloon/balloon.c index a6036d84961a..773644fda27c 100644 --- a/sys/dev/xen/balloon/balloon.c +++ b/sys/dev/xen/balloon/balloon.c @@ -49,8 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - static MALLOC_DEFINE(M_BALLOON, "Balloon", "Xen Balloon Driver"); /* Convert from KB (as fetched from xenstore) to number of PAGES */ diff --git a/sys/dev/xen/blkfront/blkfront.c b/sys/dev/xen/blkfront/blkfront.c index 312a0771a9e4..5ff9d38a68dc 100644 --- a/sys/dev/xen/blkfront/blkfront.c +++ b/sys/dev/xen/blkfront/blkfront.c @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -762,7 +761,7 @@ xbd_alloc_ring(struct xbd_softc *sc) i++, sring_page_addr += PAGE_SIZE) { error = xenbus_grant_ring(sc->xbd_dev, - (vtomach(sring_page_addr) >> PAGE_SHIFT), + (vtophys(sring_page_addr) >> PAGE_SHIFT), &sc->xbd_ring_ref[i]); if (error) { xenbus_dev_fatal(sc->xbd_dev, error, @@ -1305,7 +1304,7 @@ xbd_connect(struct xbd_softc *sc) for (j = 0; j < sc->xbd_max_request_indirectpages; j++) { if (gnttab_grant_foreign_access( xenbus_get_otherend_id(sc->xbd_dev), - (vtomach(indirectpages) >> PAGE_SHIFT) + j, + (vtophys(indirectpages) >> PAGE_SHIFT) + j, 1 /* grant read-only access */, &cm->cm_indirectionrefs[j])) break; diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index 2a0d459ee621..219a3953a24e 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -145,9 +145,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include - /*--------------------------- Forward Declarations --------------------------*/ /** Function signature for shutdown event handlers. */ typedef void (xctrl_shutdown_handler_t)(void); diff --git a/sys/dev/xen/netback/netback.c b/sys/dev/xen/netback/netback.c index 2233084edb42..c58b324abbfb 100644 --- a/sys/dev/xen/netback/netback.c +++ b/sys/dev/xen/netback/netback.c @@ -87,8 +87,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - /*--------------------------- Compile-time Tunables --------------------------*/ /*---------------------------------- Macros ----------------------------------*/ @@ -132,7 +130,7 @@ static MALLOC_DEFINE(M_XENNETBACK, "xnb", "Xen Net Back Driver Data"); req < rsp ? req : rsp; \ }) -#define virt_to_mfn(x) (vtomach(x) >> PAGE_SHIFT) +#define virt_to_mfn(x) (vtophys(x) >> PAGE_SHIFT) #define virt_to_offset(x) ((x) & (PAGE_SIZE - 1)) /** diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index 3eac25dccd35..2f972b847e39 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -86,8 +86,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - #include "xenbus_if.h" /* Features supported by all backends. TSO and LRO can be negotiated */ @@ -190,7 +188,7 @@ static int xennet_get_responses(struct netfront_info *np, struct netfront_rx_info *rinfo, RING_IDX rp, RING_IDX *cons, struct mbuf **list, int *pages_flipped_p); -#define virt_to_mfn(x) (vtomach(x) >> PAGE_SHIFT) +#define virt_to_mfn(x) (vtophys(x) >> PAGE_SHIFT) #define INVALID_P2M_ENTRY (~0UL) @@ -901,7 +899,7 @@ refill: req->gref = ref; sc->rx_pfn_array[i] = - vtomach(mtod(m_new,vm_offset_t)) >> PAGE_SHIFT; + vtophys(mtod(m_new,vm_offset_t)) >> PAGE_SHIFT; } KASSERT(i, ("no mbufs processed")); /* should have returned earlier */ diff --git a/sys/dev/xen/pcifront/pcifront.c b/sys/dev/xen/pcifront/pcifront.c index 1613e0ae0ca0..1730bf8fc09f 100644 --- a/sys/dev/xen/pcifront/pcifront.c +++ b/sys/dev/xen/pcifront/pcifront.c @@ -78,7 +78,7 @@ __FBSDID("$FreeBSD$"); #define INVALID_GRANT_REF (0) #define INVALID_EVTCHN (-1) -#define virt_to_mfn(x) (vtomach(x) >> PAGE_SHIFT) +#define virt_to_mfn(x) (vtophys(x) >> PAGE_SHIFT) struct pcifront_device { STAILQ_ENTRY(pcifront_device) next; diff --git a/sys/i386/include/xen/xenfunc.h b/sys/i386/include/xen/xenfunc.h deleted file mode 100644 index f48b1f14719d..000000000000 --- a/sys/i386/include/xen/xenfunc.h +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * Copyright (c) 2004, 2005 Kip Macy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _XEN_XENFUNC_H_ -#define _XEN_XENFUNC_H_ - -#include -#include - -#include - -#include - -#include -#define BKPT __asm__("int3"); -#define XPQ_CALL_DEPTH 5 -#define XPQ_CALL_COUNT 2 -#define PG_PRIV PG_AVAIL3 -typedef struct { - unsigned long pt_ref; - unsigned long pt_eip[XPQ_CALL_COUNT][XPQ_CALL_DEPTH]; -} pteinfo_t; - -extern pteinfo_t *pteinfo_list; -#ifdef XENDEBUG_LOW -#define __PRINTK(x) printk x -#else -#define __PRINTK(x) -#endif - -char *xen_setbootenv(char *cmd_line); - -int xen_boothowto(char *envp); - -void _xen_machphys_update(vm_paddr_t, vm_paddr_t, char *file, int line); - -#ifdef INVARIANTS -#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), __FILE__, __LINE__) -#else -#define xen_machphys_update(a, b) _xen_machphys_update((a), (b), NULL, 0) -#endif - -void xen_update_descriptor(union descriptor *, union descriptor *); - -extern struct mtx balloon_lock; -#if 0 -#define balloon_lock(__flags) mtx_lock_irqsave(&balloon_lock, __flags) -#define balloon_unlock(__flags) mtx_unlock_irqrestore(&balloon_lock, __flags) -#else -#define balloon_lock(__flags) __flags = 1 -#define balloon_unlock(__flags) __flags = 0 -#endif - - - -#endif /* _XEN_XENFUNC_H_ */ diff --git a/sys/i386/include/xen/xenvar.h b/sys/i386/include/xen/xenvar.h deleted file mode 100644 index 484c279c0ff1..000000000000 --- a/sys/i386/include/xen/xenvar.h +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * Copyright (c) 2008 Kip Macy - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef XENVAR_H_ -#define XENVAR_H_ - -#include - -#define vtomach(va) pmap_kextract((vm_offset_t) (va)) - -#endif diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c index 3bc4b4399f5c..a728ddb22e62 100644 --- a/sys/x86/xen/xen_intr.c +++ b/sys/x86/xen/xen_intr.c @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include