mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-28 08:02:54 +00:00
2f9ec994bc
xen/hypervisor.h: - Remove unused helpers: MULTI_update_va_mapping, is_initial_xendomain, is_running_on_xen - Remove unused define CONFIG_X86_PAE - Remove unused variable xen_start_info: note that it's used inpcifront which is not built at all - Remove forward declaration of HYPERVISOR_crash xen/xen-os.h: - Remove unused define CONFIG_X86_PAE - Drop unused helpers: test_and_clear_bit, clear_bit, force_evtchn_callback - Implement a generic version (based on ofed/include/linux/bitops.h) of set_bit and test_bit and prefix them by xen_ to avoid any use by other code than Xen. Note that It would be worth to investigate a generic implementation in FreeBSD. - Replace barrier() by __compiler_membar() - Replace cpu_relax() by cpu_spinwait(): it's exactly the same as rep;nop = pause xen/xen_intr.h: - Move the prototype of xen_intr_handle_upcall in it: Use by all the platform x86/xen/xen_intr.c: - Use BITSET* for the enabledbits: Avoid to use custom helpers - test_bit/set_bit has been renamed to xen_test_bit/xen_set_bit - Don't export the variable xen_intr_pcpu dev/xen/blkback/blkback.c: - Fix the string format when XBB_DEBUG is enabled: host_addr is typed uint64_t dev/xen/balloon/balloon.c: - Remove set but not used variable - Use the correct type for frame_list: xen_pfn_t represents the frame number on any architecture dev/xen/control/control.c: - Return BUS_PROBE_WILDCARD in xs_probe: Returning 0 in a probe callback means the driver can handle this device. If by any chance xenstore is the first driver, every new device with the driver is unset will use xenstore. dev/xen/grant-table/grant_table.c: - Remove unused cmpxchg - Drop unused include opt_pmap.h: Doesn't exist on ARM64 and it doesn't contain anything required for the code on x86 dev/xen/netfront/netfront.c: - Use the correct type for rx_pfn_array: xen_pfn_t represents the frame number on any architecture dev/xen/netback/netback.c: - Use the correct type for gmfn: xen_pfn_t represents the frame number on any architecture dev/xen/xenstore/xenstore.c: - Return BUS_PROBE_WILDCARD in xctrl_probe: Returning 0 in a probe callback means the driver can handle this device. If by any chance xenstore is the first driver, every new device with the driver is unset will use xenstore. Note that with the changes, x86/include/xen/xen-os.h doesn't contain anymore arch-specific code. Although, a new series will add some helpers that differ between x86 and ARM64, so I've kept the headers for now. Submitted by: Julien Grall <julien.grall@citrix.com> Reviewed by: royger Differential Revision: https://reviews.freebsd.org/D3921 Sponsored by: Citrix Systems R&D
102 lines
2.3 KiB
C
102 lines
2.3 KiB
C
/******************************************************************************
|
|
* hypervisor.h
|
|
*
|
|
* Linux-specific hypervisor handling.
|
|
*
|
|
* Copyright (c) 2002, K A Fraser
|
|
*
|
|
* $FreeBSD$
|
|
*/
|
|
|
|
#ifndef __XEN_HYPERVISOR_H__
|
|
#define __XEN_HYPERVISOR_H__
|
|
|
|
#include <sys/cdefs.h>
|
|
#include <sys/systm.h>
|
|
#include <xen/interface/xen.h>
|
|
#include <xen/interface/platform.h>
|
|
#include <xen/interface/event_channel.h>
|
|
#include <xen/interface/physdev.h>
|
|
#include <xen/interface/sched.h>
|
|
#include <xen/interface/callback.h>
|
|
#include <xen/interface/memory.h>
|
|
#include <machine/xen/hypercall.h>
|
|
|
|
extern uint64_t get_system_time(int ticks);
|
|
|
|
static inline int
|
|
HYPERVISOR_console_write(const char *str, int count)
|
|
{
|
|
return HYPERVISOR_console_io(CONSOLEIO_write, count, str);
|
|
}
|
|
|
|
static inline int
|
|
HYPERVISOR_yield(void)
|
|
{
|
|
int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
|
|
|
|
#if CONFIG_XEN_COMPAT <= 0x030002
|
|
if (rc == -ENOXENSYS)
|
|
rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
|
|
#endif
|
|
return (rc);
|
|
}
|
|
|
|
static inline int
|
|
HYPERVISOR_block(
|
|
void)
|
|
{
|
|
int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
|
|
|
|
#if CONFIG_XEN_COMPAT <= 0x030002
|
|
if (rc == -ENOXENSYS)
|
|
rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
|
|
#endif
|
|
return (rc);
|
|
}
|
|
|
|
|
|
static inline void
|
|
HYPERVISOR_shutdown(unsigned int reason)
|
|
{
|
|
struct sched_shutdown sched_shutdown = {
|
|
.reason = reason
|
|
};
|
|
|
|
HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
|
|
#if CONFIG_XEN_COMPAT <= 0x030002
|
|
HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
|
|
#endif
|
|
}
|
|
|
|
static inline void
|
|
HYPERVISOR_crash(void)
|
|
{
|
|
HYPERVISOR_shutdown(SHUTDOWN_crash);
|
|
/* NEVER REACHED */
|
|
for (;;) ; /* eliminate noreturn error */
|
|
}
|
|
|
|
/* Transfer control to hypervisor until an event is detected on one */
|
|
/* of the specified ports or the specified number of ticks elapse */
|
|
static inline int
|
|
HYPERVISOR_poll(
|
|
evtchn_port_t *ports, unsigned int nr_ports, int ticks)
|
|
{
|
|
int rc;
|
|
struct sched_poll sched_poll = {
|
|
.nr_ports = nr_ports,
|
|
.timeout = get_system_time(ticks)
|
|
};
|
|
set_xen_guest_handle(sched_poll.ports, ports);
|
|
|
|
rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
|
|
#if CONFIG_XEN_COMPAT <= 0x030002
|
|
if (rc == -ENOXENSYS)
|
|
rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
|
|
#endif
|
|
return (rc);
|
|
}
|
|
|
|
#endif /* __XEN_HYPERVISOR_H__ */
|