aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/kvm
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw@amazon.co.uk>2022-12-16 23:40:57 +0000
committerDavid Woodhouse <dwmw@amazon.co.uk>2023-03-01 09:07:52 +0000
commit28b7ae94a21d37f38f7b68a9f40fa521144898a6 (patch)
tree26ed653f30b423f86ece11398895a3a6ec0c3c1d /hw/i386/kvm
parente33cb789afd3aedbe181b78fd75d04a5c48f7cba (diff)
downloadqemu-28b7ae94a21d37f38f7b68a9f40fa521144898a6.zip
qemu-28b7ae94a21d37f38f7b68a9f40fa521144898a6.tar.gz
qemu-28b7ae94a21d37f38f7b68a9f40fa521144898a6.tar.bz2
i386/xen: Implement HYPERVISOR_grant_table_op and GNTTABOP_[gs]et_verson
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org>
Diffstat (limited to 'hw/i386/kvm')
-rw-r--r--hw/i386/kvm/xen_gnttab.c31
-rw-r--r--hw/i386/kvm/xen_gnttab.h5
2 files changed, 36 insertions, 0 deletions
diff --git a/hw/i386/kvm/xen_gnttab.c b/hw/i386/kvm/xen_gnttab.c
index 72e87ae..b54a94e 100644
--- a/hw/i386/kvm/xen_gnttab.c
+++ b/hw/i386/kvm/xen_gnttab.c
@@ -180,3 +180,34 @@ int xen_gnttab_map_page(uint64_t idx, uint64_t gfn)
return 0;
}
+int xen_gnttab_set_version_op(struct gnttab_set_version *set)
+{
+ int ret;
+
+ switch (set->version) {
+ case 1:
+ ret = 0;
+ break;
+
+ case 2:
+ /* Behave as before set_version was introduced. */
+ ret = -ENOSYS;
+ break;
+
+ default:
+ ret = -EINVAL;
+ }
+
+ set->version = 1;
+ return ret;
+}
+
+int xen_gnttab_get_version_op(struct gnttab_get_version *get)
+{
+ if (get->dom != DOMID_SELF && get->dom != xen_domid) {
+ return -ESRCH;
+ }
+
+ get->version = 1;
+ return 0;
+}
diff --git a/hw/i386/kvm/xen_gnttab.h b/hw/i386/kvm/xen_gnttab.h
index a7caa94..7957967 100644
--- a/hw/i386/kvm/xen_gnttab.h
+++ b/hw/i386/kvm/xen_gnttab.h
@@ -15,4 +15,9 @@
void xen_gnttab_create(void);
int xen_gnttab_map_page(uint64_t idx, uint64_t gfn);
+struct gnttab_set_version;
+struct gnttab_get_version;
+int xen_gnttab_set_version_op(struct gnttab_set_version *set);
+int xen_gnttab_get_version_op(struct gnttab_get_version *get);
+
#endif /* QEMU_XEN_GNTTAB_H */