xref: /openbmc/qemu/include/hw/xen/xen-pvh-common.h (revision 258b2a40)
1 /*
2  * QEMU Xen PVH machine - common code.
3  *
4  * Copyright (c) 2024 Advanced Micro Devices, Inc.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef XEN_PVH_COMMON_H__
10 #define XEN_PVH_COMMON_H__
11 
12 #include <assert.h>
13 #include "hw/sysbus.h"
14 #include "hw/hw.h"
15 #include "hw/xen/xen-hvm-common.h"
16 #include "hw/pci-host/gpex.h"
17 
18 #define TYPE_XEN_PVH_MACHINE MACHINE_TYPE_NAME("xen-pvh-base")
19 OBJECT_DECLARE_TYPE(XenPVHMachineState, XenPVHMachineClass,
20                     XEN_PVH_MACHINE)
21 
22 struct XenPVHMachineClass {
23     MachineClass parent;
24 
25     /* PVH implementation specific init.  */
26     void (*init)(MachineState *state);
27 
28     /*
29      * Each implementation can optionally enable features that it
30      * supports and are known to work.
31      */
32     bool has_tpm;
33     bool has_virtio_mmio;
34 };
35 
36 struct XenPVHMachineState {
37     /*< private >*/
38     MachineState parent;
39 
40     XenIOState ioreq;
41 
42     struct {
43         MemoryRegion low;
44         MemoryRegion high;
45     } ram;
46 
47     struct {
48         MemMapEntry ram_low, ram_high;
49         MemMapEntry tpm;
50 
51         /* Virtio-mmio */
52         MemMapEntry virtio_mmio;
53         uint32_t virtio_mmio_num;
54         uint32_t virtio_mmio_irq_base;
55     } cfg;
56 };
57 
58 void xen_pvh_class_setup_common_props(XenPVHMachineClass *xpc);
59 #endif
60