Grab the ASYNC PF related bit definitions from asyncpf.c and put them into asyncpf.h. Add some new definitions and they are going to be used by asyncpf-int test which will be added later. Signed-off-by: Dan Wu <dan1.wu@xxxxxxxxx> --- x86/asyncpf.c | 9 +-------- x86/asyncpf.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 x86/asyncpf.h diff --git a/x86/asyncpf.c b/x86/asyncpf.c index bc515be9..a0bdefcf 100644 --- a/x86/asyncpf.c +++ b/x86/asyncpf.c @@ -27,14 +27,7 @@ #include "libcflat.h" #include "vmalloc.h" #include <stdint.h> - -#define KVM_PV_REASON_PAGE_NOT_PRESENT 1 -#define KVM_PV_REASON_PAGE_READY 2 - -#define MSR_KVM_ASYNC_PF_EN 0x4b564d02 - -#define KVM_ASYNC_PF_ENABLED (1 << 0) -#define KVM_ASYNC_PF_SEND_ALWAYS (1 << 1) +#include "asyncpf.h" volatile uint32_t apf_reason __attribute__((aligned(64))); char *buf; diff --git a/x86/asyncpf.h b/x86/asyncpf.h new file mode 100644 index 00000000..8e4a133e --- /dev/null +++ b/x86/asyncpf.h @@ -0,0 +1,23 @@ +#define KVM_PV_REASON_PAGE_NOT_PRESENT 1 +#define KVM_PV_REASON_PAGE_READY 2 + +#define MSR_KVM_ASYNC_PF_EN 0x4b564d02 +#define MSR_KVM_ASYNC_PF_INT 0x4b564d06 +#define MSR_KVM_ASYNC_PF_ACK 0x4b564d07 + +#define KVM_ASYNC_PF_ENABLED (1 << 0) +#define KVM_ASYNC_PF_SEND_ALWAYS (1 << 1) +#define KVM_ASYNC_PF_DELIVERY_AS_INT (1 << 3) + +#define HYPERVISOR_CALLBACK_VECTOR 0xf3 + +struct kvm_vcpu_pv_apf_data { + /* Used for 'page not present' events delivered via #PF */ + uint32_t flags; + + /* Used for 'page ready' events delivered via interrupt notification */ + uint32_t token; + + uint8_t pad[56]; + uint32_t enabled; +} __attribute__((aligned(64))); -- 2.39.3