[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v15 42/60] kvm/i386: Add xen-gnttab-max-frames property
From: |
David Woodhouse |
Subject: |
[PATCH v15 42/60] kvm/i386: Add xen-gnttab-max-frames property |
Date: |
Wed, 1 Mar 2023 13:52:05 +0000 |
From: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
---
accel/kvm/kvm-all.c | 1 +
include/sysemu/kvm_int.h | 1 +
include/sysemu/kvm_xen.h | 1 +
target/i386/kvm/kvm.c | 34 ++++++++++++++++++++++++++++++++++
target/i386/kvm/xen-emu.c | 6 ++++++
5 files changed, 43 insertions(+)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 511d3eb9a0..3d8e400bbf 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3704,6 +3704,7 @@ static void kvm_accel_instance_init(Object *obj)
s->notify_vmexit = NOTIFY_VMEXIT_OPTION_RUN;
s->notify_window = 0;
s->xen_version = 0;
+ s->xen_gnttab_max_frames = 64;
}
/**
diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h
index 7f945bc763..39ce4d36f6 100644
--- a/include/sysemu/kvm_int.h
+++ b/include/sysemu/kvm_int.h
@@ -120,6 +120,7 @@ struct KVMState
uint32_t notify_window;
uint32_t xen_version;
uint32_t xen_caps;
+ uint16_t xen_gnttab_max_frames;
};
void kvm_memory_listener_register(KVMState *s, KVMMemoryListener *kml,
diff --git a/include/sysemu/kvm_xen.h b/include/sysemu/kvm_xen.h
index 2b20030281..49afa0eb9e 100644
--- a/include/sysemu/kvm_xen.h
+++ b/include/sysemu/kvm_xen.h
@@ -25,6 +25,7 @@ void *kvm_xen_get_vcpu_info_hva(uint32_t vcpu_id);
void kvm_xen_inject_vcpu_callback_vector(uint32_t vcpu_id, int type);
void kvm_xen_set_callback_asserted(void);
int kvm_xen_set_vcpu_virq(uint32_t vcpu_id, uint16_t virq, uint16_t port);
+uint16_t kvm_xen_get_gnttab_max_frames(void);
#define kvm_xen_has_cap(cap) (!!(kvm_xen_get_caps() & \
KVM_XEN_HVM_CONFIG_ ## cap))
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 3c3795506d..a73c49aabb 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -5880,6 +5880,33 @@ static void kvm_arch_set_xen_version(Object *obj,
Visitor *v,
}
}
+static void kvm_arch_get_xen_gnttab_max_frames(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ KVMState *s = KVM_STATE(obj);
+ uint16_t value = s->xen_gnttab_max_frames;
+
+ visit_type_uint16(v, name, &value, errp);
+}
+
+static void kvm_arch_set_xen_gnttab_max_frames(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ KVMState *s = KVM_STATE(obj);
+ Error *error = NULL;
+ uint16_t value;
+
+ visit_type_uint16(v, name, &value, &error);
+ if (error) {
+ error_propagate(errp, error);
+ return;
+ }
+
+ s->xen_gnttab_max_frames = value;
+}
+
void kvm_arch_accel_class_init(ObjectClass *oc)
{
object_class_property_add_enum(oc, "notify-vmexit", "NotifyVMexitOption",
@@ -5905,6 +5932,13 @@ void kvm_arch_accel_class_init(ObjectClass *oc)
"Xen version to be emulated "
"(in XENVER_version form "
"e.g. 0x4000a for 4.10)");
+
+ object_class_property_add(oc, "xen-gnttab-max-frames", "uint16",
+ kvm_arch_get_xen_gnttab_max_frames,
+ kvm_arch_set_xen_gnttab_max_frames,
+ NULL, NULL);
+ object_class_property_set_description(oc, "xen-gnttab-max-frames",
+ "Maximum number of grant table
frames");
}
void kvm_set_max_apic_id(uint32_t max_apic_id)
diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c
index 9e22c9fa02..46be631726 100644
--- a/target/i386/kvm/xen-emu.c
+++ b/target/i386/kvm/xen-emu.c
@@ -1238,6 +1238,12 @@ int kvm_xen_handle_exit(X86CPU *cpu, struct kvm_xen_exit
*exit)
return 0;
}
+uint16_t kvm_xen_get_gnttab_max_frames(void)
+{
+ KVMState *s = KVM_STATE(current_accel());
+ return s->xen_gnttab_max_frames;
+}
+
int kvm_put_xen_state(CPUState *cs)
{
X86CPU *cpu = X86_CPU(cs);
--
2.39.0
- [PATCH v15 18/60] i386/xen: implement XENMEM_add_to_physmap_batch, (continued)
- [PATCH v15 18/60] i386/xen: implement XENMEM_add_to_physmap_batch, David Woodhouse, 2023/03/01
- [PATCH v15 53/60] hw/xen: Automatically add xen-platform PCI device for emulated Xen guests, David Woodhouse, 2023/03/01
- [PATCH v15 02/60] xen: add CONFIG_XEN_BUS and CONFIG_XEN_EMU options for Xen emulation, David Woodhouse, 2023/03/01
- [PATCH v15 44/60] hw/xen: Support mapping grant frames, David Woodhouse, 2023/03/01
- [PATCH v15 38/60] hw/xen: Implement EVTCHNOP_reset, David Woodhouse, 2023/03/01
- [PATCH v15 50/60] hw/xen: Add backend implementation of interdomain event channel support, David Woodhouse, 2023/03/01
- [PATCH v15 39/60] i386/xen: add monitor commands to test event injection, David Woodhouse, 2023/03/01
- [PATCH v15 51/60] hw/xen: Add xen_xenstore device for xenstore emulation, David Woodhouse, 2023/03/01
- [PATCH v15 45/60] i386/xen: Implement HYPERVISOR_grant_table_op and GNTTABOP_[gs]et_verson, David Woodhouse, 2023/03/01
- [PATCH v15 52/60] hw/xen: Add basic ring handling to xenstore, David Woodhouse, 2023/03/01
- [PATCH v15 42/60] kvm/i386: Add xen-gnttab-max-frames property,
David Woodhouse <=
- [PATCH v15 49/60] i386/xen: handle HVMOP_get_param, David Woodhouse, 2023/03/01
- [PATCH v15 32/60] hw/xen: Implement EVTCHNOP_bind_virq, David Woodhouse, 2023/03/01
- [PATCH v15 41/60] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback, David Woodhouse, 2023/03/01
- [PATCH v15 54/60] i386/xen: Implement HYPERVISOR_physdev_op, David Woodhouse, 2023/03/01
- [PATCH v15 16/60] i386/xen: manage and save/restore Xen guest long_mode setting, David Woodhouse, 2023/03/01
- [PATCH v15 24/60] i386/xen: implement HYPERVISOR_event_channel_op, David Woodhouse, 2023/03/01
- [PATCH v15 06/60] i386/kvm: Set Xen vCPU ID in KVM, David Woodhouse, 2023/03/01
- [PATCH v15 56/60] hw/xen: Support GSI mapping to PIRQ, David Woodhouse, 2023/03/01
- [PATCH v15 01/60] include: import Xen public headers to hw/xen/interface, David Woodhouse, 2023/03/01
- [PATCH v15 25/60] i386/xen: implement HVMOP_set_evtchn_upcall_vector, David Woodhouse, 2023/03/01