From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>,
David Hildenbrand <david@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Richard Henderson <richard.henderson@linaro.org>,
Marcelo Tosatti <mtosatti@redhat.com>
Cc: "Markus Armbruster" <armbru@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Xu" <peterx@redhat.com>,
"Chao Peng" <chao.p.peng@linux.intel.com>,
"Michael Roth" <michael.roth@amd.com>,
isaku.yamahata@gmail.com, xiaoyao.li@intel.com,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: [RFC PATCH 02/19] *** HACK *** linux-headers: Update headers to pull in gmem APIs
Date: Mon, 31 Jul 2023 12:21:44 -0400 [thread overview]
Message-ID: <20230731162201.271114-3-xiaoyao.li@intel.com> (raw)
In-Reply-To: <20230731162201.271114-1-xiaoyao.li@intel.com>
This patch needs to be updated by script
scripts/update-linux-headers.sh
once gmem fd support is upstreamed in Linux kernel.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
| 3 +++
| 50 +++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
--git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
index 2b3a8f7bd2c0..003fb745347c 100644
--- a/linux-headers/asm-x86/kvm.h
+++ b/linux-headers/asm-x86/kvm.h
@@ -560,4 +560,7 @@ struct kvm_pmu_event_filter {
/* x86-specific KVM_EXIT_HYPERCALL flags. */
#define KVM_EXIT_HYPERCALL_LONG_MODE BIT(0)
+#define KVM_X86_DEFAULT_VM 0
+#define KVM_X86_SW_PROTECTED_VM 1
+
#endif /* _ASM_X86_KVM_H */
--git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 1f3f3333a4d8..278bed78f98e 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -95,6 +95,19 @@ struct kvm_userspace_memory_region {
__u64 userspace_addr; /* start of the userspace allocated memory */
};
+/* for KVM_SET_USER_MEMORY_REGION2 */
+struct kvm_userspace_memory_region2 {
+ __u32 slot;
+ __u32 flags;
+ __u64 guest_phys_addr;
+ __u64 memory_size;
+ __u64 userspace_addr;
+ __u64 gmem_offset;
+ __u32 gmem_fd;
+ __u32 pad1;
+ __u64 pad2[14];
+};
+
/*
* The bit 0 ~ bit 15 of kvm_userspace_memory_region::flags are visible for
* userspace, other bits are reserved for kvm internal use which are defined
@@ -102,6 +115,7 @@ struct kvm_userspace_memory_region {
*/
#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
#define KVM_MEM_READONLY (1UL << 1)
+#define KVM_MEM_PRIVATE (1UL << 2)
/* for KVM_IRQ_LINE */
struct kvm_irq_level {
@@ -264,6 +278,7 @@ struct kvm_xen_exit {
#define KVM_EXIT_RISCV_SBI 35
#define KVM_EXIT_RISCV_CSR 36
#define KVM_EXIT_NOTIFY 37
+#define KVM_EXIT_MEMORY_FAULT 38
/* For KVM_EXIT_INTERNAL_ERROR */
/* Emulate instruction failed. */
@@ -506,6 +521,13 @@ struct kvm_run {
#define KVM_NOTIFY_CONTEXT_INVALID (1 << 0)
__u32 flags;
} notify;
+ /* KVM_EXIT_MEMORY_FAULT */
+ struct {
+#define KVM_MEMORY_EXIT_FLAG_PRIVATE (1ULL << 3)
+ __u64 flags;
+ __u64 gpa;
+ __u64 size;
+ } memory;
/* Fix the size of the union. */
char padding[256];
};
@@ -1188,6 +1210,9 @@ struct kvm_ppc_resize_hpt {
#define KVM_CAP_COUNTER_OFFSET 227
#define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE 228
#define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES 229
+#define KVM_CAP_USER_MEMORY2 230
+#define KVM_CAP_MEMORY_ATTRIBUTES 231
+#define KVM_CAP_VM_TYPES 232
#ifdef KVM_CAP_IRQ_ROUTING
@@ -1462,6 +1487,8 @@ struct kvm_vfio_spapr_tce {
struct kvm_userspace_memory_region)
#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
+#define KVM_SET_USER_MEMORY_REGION2 _IOW(KVMIO, 0x49, \
+ struct kvm_userspace_memory_region2)
/* enable ucontrol for s390 */
struct kvm_s390_ucas_mapping {
@@ -2245,4 +2272,27 @@ struct kvm_s390_zpci_op {
/* flags for kvm_s390_zpci_op->u.reg_aen.flags */
#define KVM_S390_ZPCIOP_REGAEN_HOST (1 << 0)
+/* Available with KVM_CAP_MEMORY_ATTRIBUTES */
+#define KVM_GET_SUPPORTED_MEMORY_ATTRIBUTES _IOR(KVMIO, 0xd2, __u64)
+#define KVM_SET_MEMORY_ATTRIBUTES _IOW(KVMIO, 0xd3, struct kvm_memory_attributes)
+
+struct kvm_memory_attributes {
+ __u64 address;
+ __u64 size;
+ __u64 attributes;
+ __u64 flags;
+};
+
+#define KVM_MEMORY_ATTRIBUTE_PRIVATE (1ULL << 3)
+
+#define KVM_CREATE_GUEST_MEMFD _IOWR(KVMIO, 0xd4, struct kvm_create_guest_memfd)
+
+#define KVM_GUEST_MEMFD_ALLOW_HUGEPAGE (1ULL << 0)
+
+struct kvm_create_guest_memfd {
+ __u64 size;
+ __u64 flags;
+ __u64 reserved[6];
+};
+
#endif /* __LINUX_KVM_H */
--
2.34.1
next prev parent reply other threads:[~2023-07-31 16:29 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 16:21 [RFC PATCH 00/19] QEMU gmem implemention Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 01/19] trace/kvm: Split address space and slot id in trace_kvm_set_user_memory() Xiaoyao Li
2023-07-31 16:21 ` Xiaoyao Li [this message]
2023-07-31 16:21 ` [RFC PATCH 03/19] RAMBlock: Support KVM gmemory Xiaoyao Li
2023-08-01 16:33 ` David Hildenbrand
2023-07-31 16:21 ` [RFC PATCH 04/19] memory: Introduce memory_region_can_be_private() Xiaoyao Li
2023-07-31 21:23 ` Peter Xu
2023-07-31 21:33 ` Michael S. Tsirkin
2023-07-31 21:34 ` Sean Christopherson
2023-07-31 21:36 ` Michael S. Tsirkin
2023-08-01 0:21 ` Peter Xu
2023-08-01 16:23 ` Sean Christopherson
2023-08-01 16:48 ` Claudio Fontana
2023-08-01 16:52 ` Claudio Fontana
2023-08-02 8:05 ` Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 05/19] kvm: Enable KVM_SET_USER_MEMORY_REGION2 for memslot Xiaoyao Li
2023-08-01 17:10 ` Claudio Fontana
2023-08-03 8:43 ` Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 06/19] i386/pc: Drop pc_machine_kvm_type() Xiaoyao Li
2023-08-02 23:00 ` Isaku Yamahata
2023-07-31 16:21 ` [RFC PATCH 07/19] target/i386: Implement mc->kvm_type() to get VM type Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 08/19] HostMem: Add private property to indicate to use kvm gmem Xiaoyao Li
2023-07-31 17:22 ` Markus Armbruster
2023-08-01 14:54 ` Xiaoyao Li
2023-08-01 14:57 ` Daniel P. Berrangé
2023-08-02 8:04 ` Xiaoyao Li
2023-08-01 17:21 ` David Hildenbrand
2023-08-02 8:03 ` Xiaoyao Li
2023-08-02 14:14 ` David Hildenbrand
2023-08-02 22:53 ` Isaku Yamahata
2023-08-03 13:05 ` David Hildenbrand
2023-07-31 16:21 ` [RFC PATCH 09/19] i386/kvm: Create gmem fd for KVM_X86_SW_PROTECTED_VM Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 10/19] kvm: Introduce support for memory_attributes Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 11/19] kvm/memory: Introduce the infrastructure to set the default shared/private value Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 12/19] i386/kvm: Set memory to default private for KVM_X86_SW_PROTECTED_VM Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 13/19] physmem: replace function name with __func__ in ram_block_discard_range() Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 14/19] physmem: Add ram_block_convert_range Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 15/19] kvm: handle KVM_EXIT_MEMORY_FAULT Xiaoyao Li
2023-08-02 22:25 ` Isaku Yamahata
2023-09-13 6:59 ` Xiaoyao Li
2023-08-09 15:02 ` Xu Yilun
2023-09-13 7:00 ` Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 16/19] trace/kvm: Add trace for page convertion between shared and private Xiaoyao Li
2023-07-31 16:21 ` [RFC PATCH 17/19] pci-host/q35: Move PAM initialization above SMRAM initialization Xiaoyao Li
2023-07-31 16:22 ` [RFC PATCH 18/19] q35: Introduce smm_ranges property for q35-pci-host Xiaoyao Li
2023-07-31 16:22 ` [RFC PATCH 19/19] i386: Disable SMM mode for X86_SW_PROTECTED_VM Xiaoyao Li
2023-08-02 22:27 ` Isaku Yamahata
2023-07-31 16:51 ` [RFC PATCH 00/19] QEMU gmem implemention Daniel P. Berrangé
2023-08-01 1:45 ` Xiaoyao Li
2023-08-10 15:58 ` Michael Roth via
2023-08-14 21:45 ` Isaku Yamahata
2023-07-31 17:10 ` Isaku Yamahata
2023-08-01 1:55 ` Xiaoyao Li
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=20230731162201.271114-3-xiaoyao.li@intel.com \
--to=xiaoyao.li@intel.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=chao.p.peng@linux.intel.com \
--cc=david@redhat.com \
--cc=eblake@redhat.com \
--cc=imammedo@redhat.com \
--cc=isaku.yamahata@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=michael.roth@amd.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=seanjc@google.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;
as well as URLs for NNTP newsgroup(s).