public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Wu <dan1.wu@intel.com>
To: seanjc@google.com, pbonzini@redhat.com, kvm@vger.kernel.org
Cc: xiaoyao.li@intel.com, dan1.wu@intel.com
Subject: [kvm-unit-tests PATCH v1 1/3] x86: Add a common header asyncpf.h
Date: Tue, 12 Dec 2023 14:27:06 +0800	[thread overview]
Message-ID: <20231212062708.16509-2-dan1.wu@intel.com> (raw)
In-Reply-To: <20231212062708.16509-1-dan1.wu@intel.com>

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@intel.com>
---
 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


  reply	other threads:[~2023-12-12  6:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  6:27 [kvm-unit-tests PATCH v1 0/3] x86: fix async page fault issues Dan Wu
2023-12-12  6:27 ` Dan Wu [this message]
2023-12-12  6:27 ` [kvm-unit-tests PATCH v1 2/3] x86: Add async page fault int test Dan Wu
2023-12-12  6:27 ` [kvm-unit-tests PATCH v1 3/3] x86/asyncpf: Add CPUID feature bits check to ensure feature is available Dan Wu
2023-12-12 15:17 ` [kvm-unit-tests PATCH v1 0/3] x86: fix async page fault issues Sean Christopherson
2023-12-13  1:36   ` Wu, Dan1
2023-12-13 18:20     ` Sean Christopherson
2023-12-14  2:32       ` Wu, Dan1

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231212062708.16509-2-dan1.wu@intel.com \
    --to=dan1.wu@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=xiaoyao.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox