[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 46/62] hw/xen: Implement GNTTABOP_query_size
From: |
Paolo Bonzini |
Subject: |
[PULL 46/62] hw/xen: Implement GNTTABOP_query_size |
Date: |
Thu, 2 Mar 2023 13:30:13 +0100 |
From: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
---
hw/i386/kvm/xen_gnttab.c | 19 +++++++++++++++++++
hw/i386/kvm/xen_gnttab.h | 2 ++
target/i386/kvm/xen-emu.c | 16 +++++++++++++++-
3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/hw/i386/kvm/xen_gnttab.c b/hw/i386/kvm/xen_gnttab.c
index b54a94e2bd54..1e691ded326f 100644
--- a/hw/i386/kvm/xen_gnttab.c
+++ b/hw/i386/kvm/xen_gnttab.c
@@ -211,3 +211,22 @@ int xen_gnttab_get_version_op(struct gnttab_get_version
*get)
get->version = 1;
return 0;
}
+
+int xen_gnttab_query_size_op(struct gnttab_query_size *size)
+{
+ XenGnttabState *s = xen_gnttab_singleton;
+
+ if (!s) {
+ return -ENOTSUP;
+ }
+
+ if (size->dom != DOMID_SELF && size->dom != xen_domid) {
+ size->status = GNTST_bad_domain;
+ return 0;
+ }
+
+ size->status = GNTST_okay;
+ size->nr_frames = s->nr_frames;
+ size->max_nr_frames = s->max_frames;
+ return 0;
+}
diff --git a/hw/i386/kvm/xen_gnttab.h b/hw/i386/kvm/xen_gnttab.h
index 79579677ba96..3bdbe9619147 100644
--- a/hw/i386/kvm/xen_gnttab.h
+++ b/hw/i386/kvm/xen_gnttab.h
@@ -17,7 +17,9 @@ int xen_gnttab_map_page(uint64_t idx, uint64_t gfn);
struct gnttab_set_version;
struct gnttab_get_version;
+struct gnttab_query_size;
int xen_gnttab_set_version_op(struct gnttab_set_version *set);
int xen_gnttab_get_version_op(struct gnttab_get_version *get);
+int xen_gnttab_query_size_op(struct gnttab_query_size *size);
#endif /* QEMU_XEN_GNTTAB_H */
diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c
index d49b6117f1d2..3b46cab1dae0 100644
--- a/target/i386/kvm/xen-emu.c
+++ b/target/i386/kvm/xen-emu.c
@@ -1207,7 +1207,21 @@ static bool kvm_xen_hcall_gnttab_op(struct kvm_xen_exit
*exit, X86CPU *cpu,
}
break;
}
- case GNTTABOP_query_size:
+ case GNTTABOP_query_size: {
+ struct gnttab_query_size size;
+
+ qemu_build_assert(sizeof(size) == 16);
+ if (kvm_copy_from_gva(cs, arg, &size, sizeof(size))) {
+ err = -EFAULT;
+ break;
+ }
+
+ err = xen_gnttab_query_size_op(&size);
+ if (!err && kvm_copy_to_gva(cs, arg, &size, sizeof(size))) {
+ err = -EFAULT;
+ }
+ break;
+ }
case GNTTABOP_setup_table:
case GNTTABOP_copy:
case GNTTABOP_map_grant_ref:
--
2.39.1
- [PULL 33/62] hw/xen: Implement EVTCHNOP_bind_ipi, (continued)
- [PULL 33/62] hw/xen: Implement EVTCHNOP_bind_ipi, Paolo Bonzini, 2023/03/02
- [PULL 30/62] hw/xen: Implement EVTCHNOP_close, Paolo Bonzini, 2023/03/02
- [PULL 35/62] hw/xen: Implement EVTCHNOP_alloc_unbound, Paolo Bonzini, 2023/03/02
- [PULL 37/62] hw/xen: Implement EVTCHNOP_bind_vcpu, Paolo Bonzini, 2023/03/02
- [PULL 40/62] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback, Paolo Bonzini, 2023/03/02
- [PULL 44/62] hw/xen: Support mapping grant frames, Paolo Bonzini, 2023/03/02
- [PULL 51/62] hw/xen: Add xen_xenstore device for xenstore emulation, Paolo Bonzini, 2023/03/02
- [PULL 47/62] i386/xen: handle PV timer hypercalls, Paolo Bonzini, 2023/03/02
- [PULL 48/62] i386/xen: Reserve Xen special pages for console, xenstore rings, Paolo Bonzini, 2023/03/02
- [PULL 50/62] hw/xen: Add backend implementation of interdomain event channel support, Paolo Bonzini, 2023/03/02
- [PULL 46/62] hw/xen: Implement GNTTABOP_query_size,
Paolo Bonzini <=
- [PULL 43/62] hw/xen: Add xen_gnttab device for grant table emulation, Paolo Bonzini, 2023/03/02
- [PULL 56/62] hw/xen: Support GSI mapping to PIRQ, Paolo Bonzini, 2023/03/02
- [PULL 55/62] hw/xen: Implement emulated PIRQ hypercall support, Paolo Bonzini, 2023/03/02
- [PULL 54/62] i386/xen: Implement HYPERVISOR_physdev_op, Paolo Bonzini, 2023/03/02
- [PULL 57/62] hw/xen: Support MSI mapping to PIRQ, Paolo Bonzini, 2023/03/02
- [PULL 53/62] hw/xen: Automatically add xen-platform PCI device for emulated Xen guests, Paolo Bonzini, 2023/03/02
- [PULL 61/62] qapi: Add 'acpi' field to 'query-machines' output, Paolo Bonzini, 2023/03/02
- [PULL 59/62] i386/xen: Document Xen HVM emulation, Paolo Bonzini, 2023/03/02
- [PULL 60/62] hw/xen: Subsume xen_be_register_common() into xen_be_init(), Paolo Bonzini, 2023/03/02
- [PULL 34/62] hw/xen: Implement EVTCHNOP_send, Paolo Bonzini, 2023/03/02