blob: 754ec2e6cb694a4d82bc50094b25ede843551f1e [file] [log] [blame]
Philippe Mathieu-Daudéda278d52020-05-08 12:02:22 +02001/*
2 * QEMU Xen support
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7
Philippe Mathieu-Daudé69700302023-04-03 14:53:17 +02008/* header to be included in non-Xen-specific code */
9
Philippe Mathieu-Daudéda278d52020-05-08 12:02:22 +020010#ifndef SYSEMU_XEN_H
11#define SYSEMU_XEN_H
12
Philippe Mathieu-Daudé261bbc32023-11-10 22:04:53 +000013#ifdef CONFIG_USER_ONLY
14#error Cannot include sysemu/xen.h from user emulation
15#endif
16
Philippe Mathieu-Daudéce6936b2020-09-08 17:55:27 +020017#include "exec/cpu-common.h"
18
Philippe Mathieu-Daudé7d7a21b2023-06-13 16:29:11 +020019#ifdef COMPILING_PER_TARGET
Philippe Mathieu-Daudé8e0ef062020-08-04 09:49:30 +020020# ifdef CONFIG_XEN
21# define CONFIG_XEN_IS_POSSIBLE
22# endif
23#else
24# define CONFIG_XEN_IS_POSSIBLE
Philippe Mathieu-Daudé7d7a21b2023-06-13 16:29:11 +020025#endif /* COMPILING_PER_TARGET */
Philippe Mathieu-Daudéda278d52020-05-08 12:02:22 +020026
Philippe Mathieu-Daudé8e0ef062020-08-04 09:49:30 +020027#ifdef CONFIG_XEN_IS_POSSIBLE
28
29extern bool xen_allowed;
30
31#define xen_enabled() (xen_allowed)
Philippe Mathieu-Daudéda278d52020-05-08 12:02:22 +020032
Philippe Mathieu-Daudéda278d52020-05-08 12:02:22 +020033void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length);
34void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
35 struct MemoryRegion *mr, Error **errp);
Philippe Mathieu-Daudéda278d52020-05-08 12:02:22 +020036
Philippe Mathieu-Daudé8e0ef062020-08-04 09:49:30 +020037#else /* !CONFIG_XEN_IS_POSSIBLE */
Philippe Mathieu-Daudéda278d52020-05-08 12:02:22 +020038
39#define xen_enabled() 0
Philippe Mathieu-Daudéda278d52020-05-08 12:02:22 +020040static inline void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
41{
42 /* nothing */
43}
44static inline void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
45 MemoryRegion *mr, Error **errp)
46{
47 g_assert_not_reached();
48}
Philippe Mathieu-Daudéda278d52020-05-08 12:02:22 +020049
Philippe Mathieu-Daudé8e0ef062020-08-04 09:49:30 +020050#endif /* CONFIG_XEN_IS_POSSIBLE */
Philippe Mathieu-Daudéda278d52020-05-08 12:02:22 +020051
52#endif