xref: /openbmc/qemu/include/sysemu/whpx.h (revision faf20793b5af15ed4bea9c40dd8e6ae46d51be23)
129b22c79SJustin Terry (VM) /*
229b22c79SJustin Terry (VM)  * QEMU Windows Hypervisor Platform accelerator (WHPX) support
329b22c79SJustin Terry (VM)  *
429b22c79SJustin Terry (VM)  * Copyright Microsoft, Corp. 2017
529b22c79SJustin Terry (VM)  *
629b22c79SJustin Terry (VM)  * Authors:
729b22c79SJustin Terry (VM)  *
829b22c79SJustin Terry (VM)  * This work is licensed under the terms of the GNU GPL, version 2 or later.
929b22c79SJustin Terry (VM)  * See the COPYING file in the top-level directory.
1029b22c79SJustin Terry (VM)  *
1129b22c79SJustin Terry (VM)  */
1229b22c79SJustin Terry (VM) 
1329b22c79SJustin Terry (VM) #ifndef QEMU_WHPX_H
1429b22c79SJustin Terry (VM) #define QEMU_WHPX_H
1529b22c79SJustin Terry (VM) 
1629b22c79SJustin Terry (VM) #ifdef CONFIG_WHPX
1729b22c79SJustin Terry (VM) 
18*faf20793SSunil Muthuswamy #include "whp-dispatch.h"
19*faf20793SSunil Muthuswamy 
20*faf20793SSunil Muthuswamy struct whpx_state {
21*faf20793SSunil Muthuswamy     uint64_t mem_quota;
22*faf20793SSunil Muthuswamy     WHV_PARTITION_HANDLE partition;
23*faf20793SSunil Muthuswamy     bool kernel_irqchip_allowed;
24*faf20793SSunil Muthuswamy     bool kernel_irqchip_required;
25*faf20793SSunil Muthuswamy     bool apic_in_platform;
26*faf20793SSunil Muthuswamy };
27*faf20793SSunil Muthuswamy 
28*faf20793SSunil Muthuswamy struct whpx_lapic_state {
29*faf20793SSunil Muthuswamy     struct {
30*faf20793SSunil Muthuswamy         uint32_t data;
31*faf20793SSunil Muthuswamy         uint32_t padding[3];
32*faf20793SSunil Muthuswamy     } fields[256];
33*faf20793SSunil Muthuswamy };
34*faf20793SSunil Muthuswamy 
35*faf20793SSunil Muthuswamy extern struct whpx_state whpx_global;
3629b22c79SJustin Terry (VM) int whpx_enabled(void);
3729b22c79SJustin Terry (VM) 
38*faf20793SSunil Muthuswamy void whpx_apic_get(DeviceState *s);
39*faf20793SSunil Muthuswamy #define whpx_apic_in_platform() (whpx_global.apic_in_platform)
40*faf20793SSunil Muthuswamy 
4129b22c79SJustin Terry (VM) #else /* CONFIG_WHPX */
4229b22c79SJustin Terry (VM) 
4329b22c79SJustin Terry (VM) #define whpx_enabled() (0)
44*faf20793SSunil Muthuswamy #define whpx_apic_in_platform() (0)
4529b22c79SJustin Terry (VM) 
4629b22c79SJustin Terry (VM) #endif /* CONFIG_WHPX */
4729b22c79SJustin Terry (VM) 
4829b22c79SJustin Terry (VM) #endif /* QEMU_WHPX_H */
49