| 1 | /* |
| 2 | * Xen HVM emulation support in KVM |
| 3 | * |
| 4 | * Copyright © 2019 Oracle and/or its affiliates. All rights reserved. |
| 5 | * Copyright © 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 6 | * |
| 7 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 8 | * See the COPYING file in the top-level directory. |
| 9 | * |
| 10 | */ |
| 11 | |
| 12 | #ifndef QEMU_SYSTEM_KVM_XEN_H |
| 13 | #define QEMU_SYSTEM_KVM_XEN_H |
| 14 | |
| 15 | #include "exec/target_page.h" |
| 16 | |
| 17 | /* The KVM API uses these to indicate "no GPA" or "no GFN" */ |
| 18 | #define INVALID_GPA UINT64_MAX |
| 19 | #define INVALID_GFN UINT64_MAX |
| 20 | |
| 21 | /* QEMU plays the rôle of dom0 for "interdomain" communication. */ |
| 22 | #define DOMID_QEMU 0 |
| 23 | |
| 24 | int kvm_xen_soft_reset(void); |
| 25 | uint32_t kvm_xen_get_caps(void); |
| 26 | void *kvm_xen_get_vcpu_info_hva(uint32_t vcpu_id); |
| 27 | bool kvm_xen_has_vcpu_callback_vector(void); |
| 28 | void kvm_xen_inject_vcpu_callback_vector(uint32_t vcpu_id, int type); |
| 29 | void kvm_xen_set_callback_asserted(void); |
| 30 | int kvm_xen_set_vcpu_virq(uint32_t vcpu_id, uint16_t virq, uint16_t port); |
| 31 | uint16_t kvm_xen_get_gnttab_max_frames(void); |
| 32 | uint16_t kvm_xen_get_evtchn_max_pirq(void); |
| 33 | |
| 34 | #define kvm_xen_has_cap(cap) (!!(kvm_xen_get_caps() & \ |
| 35 | KVM_XEN_HVM_CONFIG_ ## cap)) |
| 36 | |
| 37 | #define XEN_SPECIAL_AREA_ADDR 0xfeff8000UL |
| 38 | #define XEN_SPECIAL_AREA_SIZE 0x4000UL |
| 39 | |
| 40 | #define XEN_SPECIALPAGE_CONSOLE 0 |
| 41 | #define XEN_SPECIALPAGE_XENSTORE 1 |
| 42 | |
| 43 | #define XEN_SPECIAL_PFN(x) ((XEN_SPECIAL_AREA_ADDR >> TARGET_PAGE_BITS) + \ |
| 44 | XEN_SPECIALPAGE_##x) |
| 45 | |
| 46 | #endif /* QEMU_SYSTEM_KVM_XEN_H */ |