valgrind/valgrind.xen.patch
Dirk Mueller bbd92e39b8 - update to 3.14.0 (bsc#1114575, FATE#326355):
see http://www.valgrind.org/docs/manual/dist.news.html
  * The new option --keep-debuginfo=no|yes (default no) can be used to retain
    debug info for unloaded code.  This allows saved stack traces (e.g. for
    memory leaks) to include file/line info for code that has been dlclose'd (or
    similar).  See the user manual for more information and known limitations.
  * Ability to specify suppressions based on source file name and line number.
  * Majorly overhauled register allocator.  No end-user changes, but the JIT
    generates code a bit more quickly now.
  * Preliminary support for macOS 10.13 has been added.
  * mips: support for MIPS32/MIPS64 Revision 6 has been added.
  * mips: support for MIPS SIMD architecture (MSA) has been added.
  * mips: support for MIPS N32 ABI has been added.
  * s390: partial support for vector instructions (integer and string) has been
    added.
  * Helgrind: Addition of a flag
    --delta-stacktrace=no|yes [yes on linux amd64/x86]
    which specifies how full history stack traces should be computed.
    Setting this to =yes can speed up Helgrind by 25% when using
    --history-level=full.
  * Memcheck: reduced false positive rate for optimised code created by Clang 6
    / LLVM 6 on x86, amd64 and arm64.  In particular, Memcheck analyses code
    blocks more carefully to determine where it can avoid expensive definedness
    checks without loss of precision.  This is controlled by the flag
    --expensive-definedness-checks=no|auto|yes [auto].
  * Valgrind is now buildable with link-time optimisation (LTO).  A new
    configure option --enable-lto=yes allows building Valgrind with LTO.  If the
    toolchain supports it, this produces a smaller/faster Valgrind (up to 10%).
    Note that if you are doing Valgrind development, --enable-lto=yes massively
    slows down the build process.

OBS-URL: https://build.opensuse.org/package/show/devel:tools/valgrind?expand=0&rev=173
2018-11-21 12:11:24 +00:00

4479 lines
162 KiB
Diff

From 4424dfed6bb824d0ef506e8f3547bb2790a1233f Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:20:56 +0100
Subject: [PATCH 01/75] fix xen_sysctl_numainfo handling
The OUT value node_to_node_distance is a 2D array, not a 1D array
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 54153ab1c..8865306f7 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -1788,7 +1788,8 @@ POST(sysctl)
POST_MEM_WRITE((Addr)sysctl->u.numainfo.node_to_memfree.p,
sizeof(uint64_t) * sysctl->u.numainfo.max_node_index);
POST_MEM_WRITE((Addr)sysctl->u.numainfo.node_to_node_distance.p,
- sizeof(uint32_t) * sysctl->u.numainfo.max_node_index);
+ sizeof(uint32_t) *
+ (sysctl->u.numainfo.max_node_index * sysctl->u.numainfo.max_node_index));
break;
/* No outputs */
From f875f9c082532f30d68a5aee379ad04741fc05b3 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:20:58 +0100
Subject: [PATCH 02/75] xen-3.1: IOCTL_GNTDEV_MAP_GRANT_REF
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
coregrind/m_syswrap/syswrap-linux.c | 15 +++++++++++++++
include/vki/vki-linux.h | 16 ++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 90d4a8586..70be2e50b 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8260,6 +8260,15 @@ PRE(sys_ioctl)
case VKI_XEN_IOCTL_EVTCHN_RESET:
/* No input*/
break;
+ case VKI_XEN_IOCTL_GNTDEV_MAP_GRANT_REF: {
+ struct vki_xen_ioctl_gntdev_map_grant_ref *args =
+ (struct vki_xen_ioctl_gntdev_map_grant_ref*)(Addr)(ARG3);
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTDEV_map_grant_ref(count)",
+ (Addr)&args->count, sizeof(args->count));
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTDEV_map_grant_ref(refs)",
+ (Addr)args->refs, sizeof(*(args->refs)) * args->count);
+ }
+ break;
#endif
/* Lustre */
@@ -10735,6 +10744,12 @@ POST(sys_ioctl)
case VKI_XEN_IOCTL_EVTCHN_RESET:
/* No output */
break;
+ case VKI_XEN_IOCTL_GNTDEV_MAP_GRANT_REF: {
+ struct vki_xen_ioctl_gntdev_map_grant_ref *args =
+ (struct vki_xen_ioctl_gntdev_map_grant_ref*)(Addr)(ARG3);
+ POST_FIELD_WRITE(args->index);
+ }
+ break;
#endif
/* Lustre */
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index b4c60854a..aad7f975a 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3428,6 +3428,22 @@ struct vki_xen_ioctl_evtchn_notify {
#define VKI_XEN_IOCTL_EVTCHN_RESET \
_VKI_IOC(_VKI_IOC_NONE, 'E', 5, 0)
+//----------------------------------------------------------------------
+// Xen gnttdev IOCTL
+//----------------------------------------------------------------------
+
+#define VKI_XEN_IOCTL_GNTDEV_MAP_GRANT_REF \
+ _VKI_IOC(_VKI_IOC_NONE, 'G', 0, sizeof(struct vki_xen_ioctl_gntdev_map_grant_ref))
+struct vki_xen_ioctl_gntdev_grant_ref {
+ vki_u32 domid;
+ vki_u32 ref;
+};
+struct vki_xen_ioctl_gntdev_map_grant_ref {
+ vki_u32 count;
+ vki_u32 pad;
+ __vki_u64 index;
+ struct vki_xen_ioctl_gntdev_grant_ref refs[1];
+};
//----------------------------------------------------------------------
// From linux-3.4.0/include/linux/fs.h
From 4c8f2104755c4fbc0d290e9eae49e27b2d61eb86 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:20:59 +0100
Subject: [PATCH 03/75] xen-3.1: IOCTL_GNTDEV_UNMAP_GRANT_REF
bz#390553
---
coregrind/m_syswrap/syswrap-linux.c | 14 ++++++++++++++
include/vki/vki-linux.h | 8 ++++++++
2 files changed, 22 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 70be2e50b..9c24348ee 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8269,6 +8269,17 @@ PRE(sys_ioctl)
(Addr)args->refs, sizeof(*(args->refs)) * args->count);
}
break;
+ case VKI_XEN_IOCTL_GNTDEV_UNMAP_GRANT_REF: {
+ struct vki_xen_ioctl_gntdev_map_grant_ref *args =
+ (struct vki_xen_ioctl_gntdev_map_grant_ref*)(Addr)(ARG3);
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTDEV_map_grant_ref(index)",
+ (Addr)&args->index, sizeof(args->index));
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTDEV_map_grant_ref(count)",
+ (Addr)&args->count, sizeof(args->count));
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTDEV_map_grant_ref(pad)",
+ (Addr)&args->pad, sizeof(args->pad));
+ }
+ break;
#endif
/* Lustre */
@@ -10750,6 +10761,9 @@ POST(sys_ioctl)
POST_FIELD_WRITE(args->index);
}
break;
+ case VKI_XEN_IOCTL_GNTDEV_UNMAP_GRANT_REF:
+ /* No output */
+ break;
#endif
/* Lustre */
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index aad7f975a..9153997ea 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3445,6 +3445,14 @@ struct vki_xen_ioctl_gntdev_map_grant_ref {
struct vki_xen_ioctl_gntdev_grant_ref refs[1];
};
+#define VKI_XEN_IOCTL_GNTDEV_UNMAP_GRANT_REF \
+ _VKI_IOC(_VKI_IOC_NONE, 'G', 1, sizeof(struct vki_xen_ioctl_gntdev_unmap_grant_ref))
+struct vki_xen_ioctl_gntdev_unmap_grant_ref {
+ __vki_u64 index;
+ vki_u32 count;
+ vki_u32 pad;
+};
+
//----------------------------------------------------------------------
// From linux-3.4.0/include/linux/fs.h
//----------------------------------------------------------------------
From 61dc99a7fba4efcda3cec3b00a2143039899153e Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:00 +0100
Subject: [PATCH 04/75] xen-3.1: IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR
bz#390553
---
coregrind/m_syswrap/syswrap-linux.c | 14 ++++++++++++++
include/vki/vki-linux.h | 9 +++++++++
2 files changed, 23 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 9c24348ee..01112a2fb 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8280,6 +8280,13 @@ PRE(sys_ioctl)
(Addr)&args->pad, sizeof(args->pad));
}
break;
+ case VKI_XEN_IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR: {
+ struct vki_xen_ioctl_gntdev_get_offset_for_vaddr *args =
+ (struct vki_xen_ioctl_gntdev_get_offset_for_vaddr*)(Addr)(ARG3);
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTDEV_map_grant_ref(vaddr)",
+ (Addr)&args->vaddr, sizeof(args->vaddr));
+ }
+ break;
#endif
/* Lustre */
@@ -10764,6 +10771,13 @@ POST(sys_ioctl)
case VKI_XEN_IOCTL_GNTDEV_UNMAP_GRANT_REF:
/* No output */
break;
+ case VKI_XEN_IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR: {
+ struct vki_xen_ioctl_gntdev_get_offset_for_vaddr *args =
+ (struct vki_xen_ioctl_gntdev_get_offset_for_vaddr*)(Addr)(ARG3);
+ POST_FIELD_WRITE(args->count);
+ POST_FIELD_WRITE(args->offset);
+ }
+ break;
#endif
/* Lustre */
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 9153997ea..3878eca0d 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3453,6 +3453,15 @@ struct vki_xen_ioctl_gntdev_unmap_grant_ref {
vki_u32 pad;
};
+#define VKI_XEN_IOCTL_GNTDEV_GET_OFFSET_FOR_VADDR \
+ _VKI_IOC(_VKI_IOC_NONE, 'G', 2, sizeof(struct vki_xen_ioctl_gntdev_get_offset_for_vaddr))
+struct vki_xen_ioctl_gntdev_get_offset_for_vaddr {
+ __vki_u64 vaddr;
+ __vki_u64 offset;
+ vki_u32 count;
+ vki_u32 pad;
+};
+
//----------------------------------------------------------------------
// From linux-3.4.0/include/linux/fs.h
//----------------------------------------------------------------------
From 4a059dc428cf47962ca9f8582107de3660b7fc0d Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:01 +0100
Subject: [PATCH 05/75] xen-3.3: IOCTL_GNTDEV_SET_MAX_GRANTS
bz#390553
---
coregrind/m_syswrap/syswrap-linux.c | 10 ++++++++++
include/vki/vki-linux.h | 6 ++++++
2 files changed, 16 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 01112a2fb..16a1aae1f 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8287,6 +8287,13 @@ PRE(sys_ioctl)
(Addr)&args->vaddr, sizeof(args->vaddr));
}
break;
+ case VKI_XEN_IOCTL_GNTDEV_SET_MAX_GRANTS: {
+ struct vki_xen_ioctl_gntdev_set_max_grants *args =
+ (struct vki_xen_ioctl_gntdev_set_max_grants*)(Addr)(ARG3);
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTDEV_set_max_grants(count)",
+ (Addr)&args->count, sizeof(args->count));
+ }
+ break;
#endif
/* Lustre */
@@ -10778,6 +10785,9 @@ POST(sys_ioctl)
POST_FIELD_WRITE(args->offset);
}
break;
+ case VKI_XEN_IOCTL_GNTDEV_SET_MAX_GRANTS:
+ /* No output */
+ break;
#endif
/* Lustre */
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 3878eca0d..a743b9678 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3462,6 +3462,12 @@ struct vki_xen_ioctl_gntdev_get_offset_for_vaddr {
vki_u32 pad;
};
+#define VKI_XEN_IOCTL_GNTDEV_SET_MAX_GRANTS \
+ _VKI_IOC(_VKI_IOC_NONE, 'G', 3, sizeof(struct vki_xen_ioctl_gntdev_set_max_grants))
+struct vki_xen_ioctl_gntdev_set_max_grants {
+ vki_u32 count;
+};
+
//----------------------------------------------------------------------
// From linux-3.4.0/include/linux/fs.h
//----------------------------------------------------------------------
From 1e0cd634023ea9bf579f039194258e6c565a1ce2 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:02 +0100
Subject: [PATCH 06/75] xen-4.2: IOCTL_GNTALLOC_ALLOC_GREF
bz#390553
---
coregrind/m_syswrap/syswrap-linux.c | 20 ++++++++++++++++++++
include/vki/vki-linux.h | 10 ++++++++++
2 files changed, 30 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 16a1aae1f..433086116 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8294,6 +8294,17 @@ PRE(sys_ioctl)
(Addr)&args->count, sizeof(args->count));
}
break;
+ case VKI_XEN_IOCTL_GNTALLOC_ALLOC_GREF: {
+ struct vki_xen_ioctl_gntalloc_alloc_gref *args =
+ (struct vki_xen_ioctl_gntalloc_alloc_gref*)(Addr)(ARG3);
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTALLOC_alloc_gref(domid)",
+ (Addr)&args->domid, sizeof(args->domid));
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTALLOC_alloc_gref(flags)",
+ (Addr)&args->flags, sizeof(args->flags));
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTALLOC_alloc_gref(count)",
+ (Addr)&args->count, sizeof(args->count));
+ }
+ break;
#endif
/* Lustre */
@@ -10788,6 +10799,15 @@ POST(sys_ioctl)
case VKI_XEN_IOCTL_GNTDEV_SET_MAX_GRANTS:
/* No output */
break;
+ case VKI_XEN_IOCTL_GNTALLOC_ALLOC_GREF: {
+ struct vki_xen_ioctl_gntalloc_alloc_gref *args =
+ (struct vki_xen_ioctl_gntalloc_alloc_gref*)(Addr)(ARG3);
+ POST_FIELD_WRITE(args->index);
+ POST_FIELD_WRITE(args->count);
+ POST_MEM_WRITE((Addr)&args->gref_ids,
+ sizeof(args->gref_ids) * sizeof(args->count));
+ }
+ break;
#endif
/* Lustre */
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index a743b9678..472071a12 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3468,6 +3468,16 @@ struct vki_xen_ioctl_gntdev_set_max_grants {
vki_u32 count;
};
+#define VKI_XEN_IOCTL_GNTALLOC_ALLOC_GREF \
+ _VKI_IOC(_VKI_IOC_NONE, 'G', 5, sizeof(struct vki_xen_ioctl_gntalloc_alloc_gref))
+struct vki_xen_ioctl_gntalloc_alloc_gref {
+ vki_u16 domid;
+ vki_u16 flags;
+ vki_u32 count;
+ __vki_u64 index;
+ vki_u32 gref_ids[1];
+};
+
//----------------------------------------------------------------------
// From linux-3.4.0/include/linux/fs.h
//----------------------------------------------------------------------
From 353dc51d07ff08e24cccf32a1ae0e6b879dacdc9 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Mon, 19 Nov 2018 10:49:49 +0100
Subject: [PATCH 07/75] xen-4.2: IOCTL_GNTALLOC_DEALLOC_GREF
bz#390553
---
coregrind/m_syswrap/syswrap-linux.c | 12 ++++++++++++
include/vki/vki-linux.h | 7 +++++++
2 files changed, 19 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 433086116..774849907 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8305,6 +8305,15 @@ PRE(sys_ioctl)
(Addr)&args->count, sizeof(args->count));
}
break;
+ case VKI_XEN_IOCTL_GNTALLOC_DEALLOC_GREF: {
+ struct vki_xen_ioctl_gntalloc_dealloc_gref *args =
+ (struct vki_xen_ioctl_gntalloc_dealloc_gref*)(Addr)(ARG3);
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTALLOC_dealloc_gref(index)",
+ (Addr)&args->index, sizeof(args->index));
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTALLOC_dealloc_gref(count)",
+ (Addr)&args->count, sizeof(args->count));
+ }
+ break;
#endif
/* Lustre */
@@ -10808,6 +10817,9 @@ POST(sys_ioctl)
sizeof(args->gref_ids) * sizeof(args->count));
}
break;
+ case VKI_XEN_IOCTL_GNTALLOC_DEALLOC_GREF:
+ /* No output */
+ break;
#endif
/* Lustre */
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 472071a12..eb0b23615 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3478,6 +3478,13 @@ struct vki_xen_ioctl_gntalloc_alloc_gref {
vki_u32 gref_ids[1];
};
+#define VKI_XEN_IOCTL_GNTALLOC_DEALLOC_GREF \
+ _VKI_IOC(_VKI_IOC_NONE, 'G', 6, sizeof(struct vki_xen_ioctl_gntalloc_dealloc_gref))
+struct vki_xen_ioctl_gntalloc_dealloc_gref {
+ __vki_u64 index;
+ vki_u32 count;
+};
+
//----------------------------------------------------------------------
// From linux-3.4.0/include/linux/fs.h
//----------------------------------------------------------------------
From 180935afc7b31975db44a5172f147ca214ca3ffd Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Mon, 19 Nov 2018 10:56:08 +0100
Subject: [PATCH 08/75] xen-4.2: IOCTL_GNTALLOC_SET_UNMAP_NOTIFY
bz#390553
---
coregrind/m_syswrap/syswrap-linux.c | 12 ++++++++++++
include/vki/vki-linux.h | 8 ++++++++
2 files changed, 20 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 774849907..1b6064138 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8314,6 +8314,17 @@ PRE(sys_ioctl)
(Addr)&args->count, sizeof(args->count));
}
break;
+ case VKI_XEN_IOCTL_GNTALLOC_SET_UNMAP_NOTIFY: {
+ struct vki_xen_ioctl_gntalloc_set_unmap_notify *args =
+ (struct vki_xen_ioctl_gntalloc_set_unmap_notify*)(Addr)(ARG3);
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTALLOC_set_unmap_notify(index)",
+ (Addr)&args->index, sizeof(args->index));
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTALLOC_set_unmap_notify(action)",
+ (Addr)&args->action, sizeof(args->action));
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTALLOC_set_unmap_notify(event_channel_port)",
+ (Addr)&args->event_channel_port, sizeof(args->event_channel_port));
+ }
+ break;
#endif
/* Lustre */
@@ -10818,6 +10829,7 @@ POST(sys_ioctl)
}
break;
case VKI_XEN_IOCTL_GNTALLOC_DEALLOC_GREF:
+ case VKI_XEN_IOCTL_GNTALLOC_SET_UNMAP_NOTIFY:
/* No output */
break;
#endif
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index eb0b23615..6b079ebaf 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3485,6 +3485,14 @@ struct vki_xen_ioctl_gntalloc_dealloc_gref {
vki_u32 count;
};
+#define VKI_XEN_IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \
+ _VKI_IOC(_VKI_IOC_NONE, 'G', 7, sizeof(struct vki_xen_ioctl_gntalloc_set_unmap_notify))
+struct vki_xen_ioctl_gntalloc_set_unmap_notify {
+ __vki_u64 index;
+ vki_u32 action;
+ vki_u32 event_channel_port;
+};
+
//----------------------------------------------------------------------
// From linux-3.4.0/include/linux/fs.h
//----------------------------------------------------------------------
From 8ced0994062e3cfc53a1e396d24add017c8eb0f1 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:03 +0100
Subject: [PATCH 09/75] xen: include vki-xen-physdev.h earlier in vki-xen.h
Upcoming changes will require defines from this file.
bz#390553
---
include/vki/vki-xen.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/vki/vki-xen.h b/include/vki/vki-xen.h
index c0dfee36b..2d65bcc0e 100644
--- a/include/vki/vki-xen.h
+++ b/include/vki/vki-xen.h
@@ -104,6 +104,7 @@ struct vki_xenctl_bitmap {
vki_uint32_t nr_bits;
};
+#include <vki/vki-xen-physdev.h>
#include <vki/vki-xen-domctl.h>
#include <vki/vki-xen-sysctl.h>
#include <vki/vki-xen-mmuext.h>
@@ -115,7 +116,6 @@ struct vki_xenctl_bitmap {
#include <vki/vki-xen-hvm.h>
#include <vki/vki-xen-tmem.h>
#include <vki/vki-xen-xsm.h>
-#include <vki/vki-xen-physdev.h>
#endif // __VKI_XEN_H
From dfa5ff84112f0eb47c80a32d1707cfe74f3b5032 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:04 +0100
Subject: [PATCH 10/75] xen-4.2: add sharing_op
Add define for XENMEM_sharing_op
bz#390553
---
include/vki/vki-xen-memory.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/vki/vki-xen-memory.h b/include/vki/vki-xen-memory.h
index 3b6f9e519..4fc575d39 100644
--- a/include/vki/vki-xen-memory.h
+++ b/include/vki/vki-xen-memory.h
@@ -48,6 +48,7 @@
#define VKI_XENMEM_get_sharing_freed_pages 18
#define VKI_XENMEM_get_sharing_shared_pages 19
#define VKI_XENMEM_access_op 21
+#define VKI_XENMEM_sharing_op 22
#define VKI_XENMEM_claim_pages 24
#define VKI_XENMEM_machphys_compat_mfn_list 25
From 3536fdc85b4ad7bcb27057b14bba973a42408951 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:05 +0100
Subject: [PATCH 11/75] xen-4.4: add_to_physmap_batch
Add define for XENMEM_add_to_physmap_batch, which used to be
XENMEM_add_to_physmap_range up to xen-4.3.
bz#390553
---
include/vki/vki-xen-memory.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/vki/vki-xen-memory.h b/include/vki/vki-xen-memory.h
index 4fc575d39..0de46ff9d 100644
--- a/include/vki/vki-xen-memory.h
+++ b/include/vki/vki-xen-memory.h
@@ -49,6 +49,7 @@
#define VKI_XENMEM_get_sharing_shared_pages 19
#define VKI_XENMEM_access_op 21
#define VKI_XENMEM_sharing_op 22
+#define VKI_XENMEM_add_to_physmap_batch 23
#define VKI_XENMEM_claim_pages 24
#define VKI_XENMEM_machphys_compat_mfn_list 25
From 1044c9e04d3987b234bcc35590c9a0374a78a827 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:06 +0100
Subject: [PATCH 12/75] xen-4.5: psr_cmt_op
Add defines introduced in xen-4.5
bz#390553
---
include/vki/vki-xen-sysctl.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 8f4eac124..6fab979e0 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -38,6 +38,7 @@
#define VKI_XEN_SYSCTL_cpupool_op 18
#define VKI_XEN_SYSCTL_scheduler_op 19
#define VKI_XEN_SYSCTL_coverage_op 20
+#define VKI_XEN_SYSCTL_psr_cmt_op 21
struct vki_xen_sysctl_readconsole {
/* IN */
@@ -192,6 +193,7 @@ struct vki_xen_sysctl {
struct vki_xen_sysctl_cpupool_op cpupool_op;
//struct vki_xen_sysctl_scheduler_op scheduler_op;
//struct vki_xen_sysctl_coverage_op coverage_op;
+ //struct vki_xen_sysctl_psr_cmt_op psr_cmt_op;
vki_uint8_t pad[128];
} u;
From 8eea6fda76928c86fe45854e6905a409145edb52 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:07 +0100
Subject: [PATCH 13/75] xen-4.5: GNTTABOP_cache_flush
Add defines introduced in xen-4.5
bz#390553
---
include/vki/vki-xen-gnttab.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/vki/vki-xen-gnttab.h b/include/vki/vki-xen-gnttab.h
index 3e6c36cdb..73af94409 100644
--- a/include/vki/vki-xen-gnttab.h
+++ b/include/vki/vki-xen-gnttab.h
@@ -42,6 +42,7 @@ typedef vki_uint32_t vki_xen_grant_ref_t;
#define VKI_XEN_GNTTABOP_get_status_frames 9
#define VKI_XEN_GNTTABOP_get_version 10
#define VKI_XEN_GNTTABOP_swap_grant_ref 11
+#define VKI_XEN_GNTTABOP_cache_flush 12
struct vki_xen_gnttab_setup_table {
/* IN parameters. */
From 7cb3b6e06c157ccbc3d712bbf7d116a8305a31c4 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:09 +0100
Subject: [PATCH 14/75] xen-4.5: domctl defines
Add defines introduced in xen-4.5
bz#390553
---
include/vki/vki-xen-domctl.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 9e8b5ef1f..3963fdd97 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -119,6 +119,9 @@
#define VKI_XEN_DOMCTL_cacheflush 71
#define VKI_XEN_DOMCTL_get_vcpu_msrs 72
#define VKI_XEN_DOMCTL_set_vcpu_msrs 73
+#define VKI_XEN_DOMCTL_setvnumainfo 74
+#define VKI_XEN_DOMCTL_psr_cmt_op 75
+#define VKI_XEN_DOMCTL_arm_configure_domain 76
#define VKI_XEN_DOMCTL_monitor_op 77 /* new in 4.6 */
#define VKI_XEN_DOMCTL_gdbsx_guestmemio 1000
#define VKI_XEN_DOMCTL_gdbsx_pausevcpu 1001
@@ -582,6 +585,7 @@ struct vki_xen_domctl {
vki_xen_domid_t domain;
union {
struct vki_xen_domctl_createdomain createdomain;
+ //struct vki_xen_domctl_arm_configuredomain configuredomain;
struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007;
struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008;
struct vki_xen_domctl_getdomaininfo_00000009 getdomaininfo_00000009;
@@ -644,6 +648,8 @@ struct vki_xen_domctl {
//struct vki_xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
//struct vki_xen_domctl_gdbsx_domstatus gdbsx_domstatus;
struct vki_xen_domctl_monitor_op_0000000b monitor_op_0000000b;
+ //struct vki_xen_domctl_vnuma vnuma;
+ //struct vki_xen_domctl_psr_cmt_op psr_cmt_op;
vki_uint8_t pad[128];
} u;
};
From 7287d5c3f526fd2413cf9a20c54bc1290fec9085 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:10 +0100
Subject: [PATCH 15/75] xen-4.5: xen_domctl_createdomain
Rename createdomain to represent layout up to xen-4.5.
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 13 ++++++++++---
include/vki/vki-xen-domctl.h | 4 ++--
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 8865306f7..7eb1b2176 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -757,9 +757,16 @@ PRE(domctl)
break;
case VKI_XEN_DOMCTL_createdomain:
- PRE_XEN_DOMCTL_READ(createdomain, ssidref);
- PRE_XEN_DOMCTL_READ(createdomain, handle);
- PRE_XEN_DOMCTL_READ(createdomain, flags);
+ switch (domctl->interface_version) {
+ case 0x00000007:
+ case 0x00000008:
+ case 0x00000009:
+ case 0x0000000a:
+ PRE_XEN_DOMCTL_READ(createdomain_0000000a, ssidref);
+ PRE_XEN_DOMCTL_READ(createdomain_0000000a, handle);
+ PRE_XEN_DOMCTL_READ(createdomain_0000000a, flags);
+ break;
+ }
break;
case VKI_XEN_DOMCTL_gethvmcontext:
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 3963fdd97..36767d102 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -128,7 +128,7 @@
#define VKI_XEN_DOMCTL_gdbsx_unpausevcpu 1002
#define VKI_XEN_DOMCTL_gdbsx_domstatus 1003
-struct vki_xen_domctl_createdomain {
+struct vki_xen_domctl_createdomain_0000000a {
/* IN parameters */
vki_uint32_t ssidref;
vki_xen_domain_handle_t handle;
@@ -584,7 +584,7 @@ struct vki_xen_domctl {
vki_uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
vki_xen_domid_t domain;
union {
- struct vki_xen_domctl_createdomain createdomain;
+ struct vki_xen_domctl_createdomain_0000000a createdomain_0000000a;
//struct vki_xen_domctl_arm_configuredomain configuredomain;
struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007;
struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008;
From ea4f0af7f70b4c82d838dc6cee1d66cd8e352647 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:11 +0100
Subject: [PATCH 16/75] xen-4.5: XENMEM_get_vnumainfo
Add define for XENMEM_get_vnumainfo
bz#390553
---
include/vki/vki-xen-memory.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/vki/vki-xen-memory.h b/include/vki/vki-xen-memory.h
index 0de46ff9d..4dc233f70 100644
--- a/include/vki/vki-xen-memory.h
+++ b/include/vki/vki-xen-memory.h
@@ -52,6 +52,7 @@
#define VKI_XENMEM_add_to_physmap_batch 23
#define VKI_XENMEM_claim_pages 24
#define VKI_XENMEM_machphys_compat_mfn_list 25
+#define VKI_XENMEM_get_vnumainfo 26
struct vki_xen_memory_map {
unsigned int nr_entries;
From 5aff54d961d804d03684039d8c18e10c94ba50f1 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:12 +0100
Subject: [PATCH 17/75] xen-4.5: XEN_SYSCTL_topologyinfo
The XEN_SYSCTL_topologyinfo was available until xen-4.5.
In xen-4.6 it was replaced by XEN_SYSCTL_cputopoinfo.
Both share the same number.
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 54 +++++++++++++++++++++++--------
1 file changed, 40 insertions(+), 14 deletions(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 7eb1b2176..33e5fd626 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -681,10 +681,25 @@ PRE(sysctl) {
break;
case VKI_XEN_SYSCTL_topologyinfo:
- PRE_XEN_SYSCTL_READ(topologyinfo, max_cpu_index);
- PRE_XEN_SYSCTL_READ(topologyinfo, cpu_to_core);
- PRE_XEN_SYSCTL_READ(topologyinfo, cpu_to_socket);
- PRE_XEN_SYSCTL_READ(topologyinfo, cpu_to_node);
+ switch (sysctl->interface_version)
+ {
+ case 0x00000007:
+ case 0x00000008:
+ case 0x00000009:
+ case 0x0000000a:
+ case 0x0000000b:
+ PRE_XEN_SYSCTL_READ(topologyinfo, max_cpu_index);
+ PRE_XEN_SYSCTL_READ(topologyinfo, cpu_to_core);
+ PRE_XEN_SYSCTL_READ(topologyinfo, cpu_to_socket);
+ PRE_XEN_SYSCTL_READ(topologyinfo, cpu_to_node);
+ break;
+ default:
+ VG_(dmsg)("WARNING: XEN_SYSCTL_cputopoinfo for sysctl version "
+ "%"PRIx32" not implemented yet\n",
+ sysctl->interface_version);
+ SET_STATUS_Failure(VKI_EINVAL);
+ return;
+ }
break;
case VKI_XEN_SYSCTL_numainfo:
@@ -1776,16 +1791,27 @@ POST(sysctl)
break;
case VKI_XEN_SYSCTL_topologyinfo:
- POST_XEN_SYSCTL_WRITE(topologyinfo, max_cpu_index);
- if (sysctl->u.topologyinfo.cpu_to_core.p)
- POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_core.p,
- sizeof(uint32_t) * sysctl->u.topologyinfo.max_cpu_index);
- if (sysctl->u.topologyinfo.cpu_to_socket.p)
- POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_socket.p,
- sizeof(uint32_t) * sysctl->u.topologyinfo.max_cpu_index);
- if (sysctl->u.topologyinfo.cpu_to_node.p)
- POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_node.p,
- sizeof(uint32_t) * sysctl->u.topologyinfo.max_cpu_index);
+ switch (sysctl->interface_version)
+ {
+ case 0x00000007:
+ case 0x00000008:
+ case 0x00000009:
+ case 0x0000000a:
+ case 0x0000000b:
+ POST_XEN_SYSCTL_WRITE(topologyinfo, max_cpu_index);
+ if (sysctl->u.topologyinfo.cpu_to_core.p)
+ POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_core.p,
+ sizeof(uint32_t) * sysctl->u.topologyinfo.max_cpu_index);
+ if (sysctl->u.topologyinfo.cpu_to_socket.p)
+ POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_socket.p,
+ sizeof(uint32_t) * sysctl->u.topologyinfo.max_cpu_index);
+ if (sysctl->u.topologyinfo.cpu_to_node.p)
+ POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_node.p,
+ sizeof(uint32_t) * sysctl->u.topologyinfo.max_cpu_index);
+ break;
+ default:
+ break;
+ }
break;
case VKI_XEN_SYSCTL_numainfo:
From 234be8be627d4fdadef4fa9fe11c0dfd763db8f7 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:13 +0100
Subject: [PATCH 18/75] xen-4.5: XEN_SYSCTL_numainfo
The XEN_SYSCTL_numainfo changed layout after xen-4.5.
Rename layout and handle runtime upto xen-4.5.
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 50 +++++++++++++++++++++++--------
include/vki/vki-xen-sysctl.h | 4 +--
2 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 33e5fd626..a5942c33b 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -703,10 +703,25 @@ PRE(sysctl) {
break;
case VKI_XEN_SYSCTL_numainfo:
- PRE_XEN_SYSCTL_READ(numainfo, max_node_index);
- PRE_XEN_SYSCTL_READ(numainfo, node_to_memsize);
- PRE_XEN_SYSCTL_READ(numainfo, node_to_memfree);
- PRE_XEN_SYSCTL_READ(numainfo, node_to_node_distance);
+ switch (sysctl->interface_version)
+ {
+ case 0x00000007:
+ case 0x00000008:
+ case 0x00000009:
+ case 0x0000000a:
+ case 0x0000000b:
+ PRE_XEN_SYSCTL_READ(numainfo_0000000b, max_node_index);
+ PRE_XEN_SYSCTL_READ(numainfo_0000000b, node_to_memsize);
+ PRE_XEN_SYSCTL_READ(numainfo_0000000b, node_to_memfree);
+ PRE_XEN_SYSCTL_READ(numainfo_0000000b, node_to_node_distance);
+ break;
+ default:
+ VG_(dmsg)("WARNING: XEN_SYSCTL_numainfo for sysctl version "
+ "%"PRIx32" not implemented yet\n",
+ sysctl->interface_version);
+ SET_STATUS_Failure(VKI_EINVAL);
+ return;
+ }
break;
default:
@@ -1815,14 +1830,25 @@ POST(sysctl)
break;
case VKI_XEN_SYSCTL_numainfo:
- POST_XEN_SYSCTL_WRITE(numainfo, max_node_index);
- POST_MEM_WRITE((Addr)sysctl->u.numainfo.node_to_memsize.p,
- sizeof(uint64_t) * sysctl->u.numainfo.max_node_index);
- POST_MEM_WRITE((Addr)sysctl->u.numainfo.node_to_memfree.p,
- sizeof(uint64_t) * sysctl->u.numainfo.max_node_index);
- POST_MEM_WRITE((Addr)sysctl->u.numainfo.node_to_node_distance.p,
- sizeof(uint32_t) *
- (sysctl->u.numainfo.max_node_index * sysctl->u.numainfo.max_node_index));
+ switch (sysctl->interface_version)
+ {
+ case 0x00000007:
+ case 0x00000008:
+ case 0x00000009:
+ case 0x0000000a:
+ case 0x0000000b:
+ POST_XEN_SYSCTL_WRITE(numainfo_0000000b, max_node_index);
+ POST_MEM_WRITE((Addr)sysctl->u.numainfo_0000000b.node_to_memsize.p,
+ sizeof(uint64_t) * sysctl->u.numainfo_0000000b.max_node_index);
+ POST_MEM_WRITE((Addr)sysctl->u.numainfo_0000000b.node_to_memfree.p,
+ sizeof(uint64_t) * sysctl->u.numainfo_0000000b.max_node_index);
+ POST_MEM_WRITE((Addr)sysctl->u.numainfo_0000000b.node_to_node_distance.p,
+ sizeof(uint32_t) *
+ (sysctl->u.numainfo_0000000b.max_node_index * sysctl->u.numainfo_0000000b.max_node_index));
+ break;
+ default:
+ break;
+ }
break;
/* No outputs */
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 6fab979e0..22ac1706f 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -121,7 +121,7 @@ struct vki_xen_sysctl_topologyinfo {
VKI_XEN_GUEST_HANDLE_64(vki_uint32) cpu_to_node;
};
-struct vki_xen_sysctl_numainfo {
+struct vki_xen_sysctl_numainfo_0000000b {
vki_uint32_t max_node_index;
VKI_XEN_GUEST_HANDLE_64(vki_uint64) node_to_memsize;
VKI_XEN_GUEST_HANDLE_64(vki_uint64) node_to_memfree;
@@ -176,7 +176,7 @@ struct vki_xen_sysctl {
struct vki_xen_sysctl_physinfo_00000008 physinfo_00000008;
struct vki_xen_sysctl_physinfo_0000000a physinfo_0000000a;
struct vki_xen_sysctl_topologyinfo topologyinfo;
- struct vki_xen_sysctl_numainfo numainfo;
+ struct vki_xen_sysctl_numainfo_0000000b numainfo_0000000b;
struct vki_xen_sysctl_sched_id sched_id;
//struct vki_xen_sysctl_perfc_op perfc_op;
struct vki_xen_sysctl_getdomaininfolist_00000008 getdomaininfolist_00000008;
From dac103346e6d6ec76a98366bed3ed79c61cad69c Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:14 +0100
Subject: [PATCH 19/75] xen-4.5: xen_domctl_settimeoffset
Rename settimeoffset to represent layout up to xen-4.5.
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 11 +++++++++--
include/vki/vki-xen-domctl.h | 4 ++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index a5942c33b..95e5e5994 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -983,8 +983,15 @@ PRE(domctl)
break;
case VKI_XEN_DOMCTL_settimeoffset:
- PRE_XEN_DOMCTL_READ(settimeoffset, time_offset_seconds);
- break;
+ switch (domctl->interface_version) {
+ case 0x00000007:
+ case 0x00000008:
+ case 0x00000009:
+ case 0x0000000a:
+ PRE_XEN_DOMCTL_READ(settimeoffset_0000000a, time_offset_seconds);
+ break;
+ }
+ break;
case VKI_XEN_DOMCTL_getvcpuinfo:
PRE_XEN_DOMCTL_READ(getvcpuinfo, vcpu);
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 36767d102..8940e27ba 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -336,7 +336,7 @@ struct vki_xen_domctl_hypercall_init {
vki_xen_uint64_aligned_t gmfn; /* GMFN to be initialised */
};
-struct vki_xen_domctl_settimeoffset {
+struct vki_xen_domctl_settimeoffset_0000000a {
vki_int32_t time_offset_seconds;
};
@@ -609,7 +609,7 @@ struct vki_xen_domctl {
struct vki_xen_domctl_ioport_permission ioport_permission;
struct vki_xen_domctl_hypercall_init hypercall_init;
//struct vki_xen_domctl_arch_setup arch_setup;
- struct vki_xen_domctl_settimeoffset settimeoffset;
+ struct vki_xen_domctl_settimeoffset_0000000a settimeoffset_0000000a;
//struct vki_xen_domctl_disable_migrate disable_migrate;
struct vki_xen_domctl_tsc_info_00000007 tsc_info_00000007;
struct vki_xen_domctl_tsc_info_0000000b tsc_info_0000000b;
From 75476204f440888a407815ea513d00454a41edf8 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:15 +0100
Subject: [PATCH 20/75] xen-4.6: sysctl value
Add 0xc as sysctl value of xen-4.6
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-sysctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 95e5e5994..6b1c585b7 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -584,6 +584,7 @@ PRE(sysctl) {
case 0x00000009:
case 0x0000000a:
case 0x0000000b:
+ case 0x0000000c:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -1716,6 +1717,7 @@ POST(sysctl)
case 0x00000009:
case 0x0000000a:
case 0x0000000b:
+ case 0x0000000c:
break;
default:
return;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 22ac1706f..248a5e12f 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -9,6 +9,7 @@
* - 0x00000009: Xen 4.2
* - 0x0000000a: Xen 4.3 & 4.4
* - 0x0000000b: Xen 4.5
+ * - 0x0000000c: Xen 4.6
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 620229b03e40308f7ca9916de1bc745d54843b2b Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:16 +0100
Subject: [PATCH 21/75] xen-4.6: xen_domctl_createdomain
xen_domctl_createdomain changed layout in xen-4.6
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 13 +++++++++++++
include/vki/vki-xen-domctl.h | 22 ++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 6b1c585b7..b4adf791a 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -797,6 +797,19 @@ PRE(domctl)
PRE_XEN_DOMCTL_READ(createdomain_0000000a, handle);
PRE_XEN_DOMCTL_READ(createdomain_0000000a, flags);
break;
+ case 0x0000000b:
+ PRE_XEN_DOMCTL_READ(createdomain_0000000b, ssidref);
+ PRE_XEN_DOMCTL_READ(createdomain_0000000b, handle);
+ PRE_XEN_DOMCTL_READ(createdomain_0000000b, flags);
+#if defined(__i386__) || defined(__x86_64__)
+ __PRE_XEN_DOMCTL_READ(createdomain_0000000b, createdomain_0000000b, config.dummy);
+#endif
+#if defined(__arm__) || defined(__aarch64__)
+ __PRE_XEN_DOMCTL_READ(createdomain_0000000b, createdomain_0000000b, config.gic_version);
+ __PRE_XEN_DOMCTL_READ(createdomain_0000000b, createdomain_0000000b, config.nr_spis);
+ __PRE_XEN_DOMCTL_READ(createdomain_0000000b, createdomain_0000000b, config.clock_frequency);
+#endif
+ break;
}
break;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 8940e27ba..e5590cbea 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -135,6 +135,27 @@ struct vki_xen_domctl_createdomain_0000000a {
vki_uint32_t flags;
};
+struct vki_xen_arch_domainconfig_0000000b {
+#if defined(__i386__) || defined(__x86_64__)
+ vki_uint8_t dummy;
+#endif
+#if defined(__arm__) || defined(__aarch64__)
+ /* IN/OUT */
+ vki_uint8_t gic_version;
+ /* IN */
+ vki_uint32_t nr_spis;
+ vki_uint32_t clock_frequency;
+#endif
+};
+
+struct vki_xen_domctl_createdomain_0000000b {
+ /* IN parameters */
+ vki_uint32_t ssidref;
+ vki_xen_domain_handle_t handle;
+ vki_uint32_t flags;
+ struct vki_xen_arch_domainconfig_0000000b config;
+};
+
struct vki_xen_domctl_getdomaininfo_00000007 {
/* OUT variables. */
vki_xen_domid_t domain;
@@ -585,6 +606,7 @@ struct vki_xen_domctl {
vki_xen_domid_t domain;
union {
struct vki_xen_domctl_createdomain_0000000a createdomain_0000000a;
+ struct vki_xen_domctl_createdomain_0000000b createdomain_0000000b;
//struct vki_xen_domctl_arm_configuredomain configuredomain;
struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007;
struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008;
From 58c84ebc2895a0bc2725e5ecc647403c233c4ec6 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:17 +0100
Subject: [PATCH 22/75] xen-4.6: xen_domctl_settimeoffset
Handle xen_domctl_settimeoffset layout introduced in xen-4.6
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 3 +++
include/vki/vki-xen-domctl.h | 5 +++++
2 files changed, 8 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index b4adf791a..bf58c0726 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -1004,6 +1004,9 @@ PRE(domctl)
case 0x0000000a:
PRE_XEN_DOMCTL_READ(settimeoffset_0000000a, time_offset_seconds);
break;
+ case 0x0000000b:
+ PRE_XEN_DOMCTL_READ(settimeoffset_0000000b, time_offset_seconds);
+ break;
}
break;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index e5590cbea..2c3c5fcf8 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -361,6 +361,10 @@ struct vki_xen_domctl_settimeoffset_0000000a {
vki_int32_t time_offset_seconds;
};
+struct vki_xen_domctl_settimeoffset_0000000b {
+ vki_int64_t time_offset_seconds;
+};
+
struct vki_xen_domctl_cpuid {
vki_uint32_t input[2];
vki_uint32_t eax;
@@ -632,6 +636,7 @@ struct vki_xen_domctl {
struct vki_xen_domctl_hypercall_init hypercall_init;
//struct vki_xen_domctl_arch_setup arch_setup;
struct vki_xen_domctl_settimeoffset_0000000a settimeoffset_0000000a;
+ struct vki_xen_domctl_settimeoffset_0000000b settimeoffset_0000000b;
//struct vki_xen_domctl_disable_migrate disable_migrate;
struct vki_xen_domctl_tsc_info_00000007 tsc_info_00000007;
struct vki_xen_domctl_tsc_info_0000000b tsc_info_0000000b;
From 8e7fe10461322d9f2f7b67da0ed350c7f7c6eb4c Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:18 +0100
Subject: [PATCH 23/75] xen-4.6: psr_cat_op
Add defines for psr_cat_op introduced in xen-4.6
bz#390553
---
include/vki/vki-xen-domctl.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 2c3c5fcf8..b88c56aba 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -123,6 +123,7 @@
#define VKI_XEN_DOMCTL_psr_cmt_op 75
#define VKI_XEN_DOMCTL_arm_configure_domain 76
#define VKI_XEN_DOMCTL_monitor_op 77 /* new in 4.6 */
+#define VKI_XEN_DOMCTL_psr_cat_op 78
#define VKI_XEN_DOMCTL_gdbsx_guestmemio 1000
#define VKI_XEN_DOMCTL_gdbsx_pausevcpu 1001
#define VKI_XEN_DOMCTL_gdbsx_unpausevcpu 1002
@@ -677,6 +678,7 @@ struct vki_xen_domctl {
struct vki_xen_domctl_monitor_op_0000000b monitor_op_0000000b;
//struct vki_xen_domctl_vnuma vnuma;
//struct vki_xen_domctl_psr_cmt_op psr_cmt_op;
+ //struct vki_xen_domctl_psr_cat_op psr_cat_op;
vki_uint8_t pad[128];
} u;
};
From e72142e040a70b03427b016e842618a4e0aff8de Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:19 +0100
Subject: [PATCH 24/75] xen-4.6: XENMEM_reserved_device_memory_map
Add define for XENMEM_reserved_device_memory_map, introduced in 4.6
bz#390553
---
include/vki/vki-xen-memory.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/vki/vki-xen-memory.h b/include/vki/vki-xen-memory.h
index 4dc233f70..49565636b 100644
--- a/include/vki/vki-xen-memory.h
+++ b/include/vki/vki-xen-memory.h
@@ -53,6 +53,7 @@
#define VKI_XENMEM_claim_pages 24
#define VKI_XENMEM_machphys_compat_mfn_list 25
#define VKI_XENMEM_get_vnumainfo 26
+#define VKI_XENMEM_reserved_device_memory_map 27
struct vki_xen_memory_map {
unsigned int nr_entries;
From 7d104a9be6915e07be2d68fcb85b410edc0ece9e Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:20 +0100
Subject: [PATCH 25/75] xen-4.6: XEN_SYSCTL_numainfo
The XEN_SYSCTL_numainfo changed layout after xen-4.6.
Add new layout and handle runtime of xen-4.6.
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 17 ++++++++++++-----
include/vki/vki-xen-sysctl.h | 15 +++++++++++++++
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index bf58c0726..30726c0be 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -716,12 +716,12 @@ PRE(sysctl) {
PRE_XEN_SYSCTL_READ(numainfo_0000000b, node_to_memfree);
PRE_XEN_SYSCTL_READ(numainfo_0000000b, node_to_node_distance);
break;
+ case 0x0000000c:
default:
- VG_(dmsg)("WARNING: XEN_SYSCTL_numainfo for sysctl version "
- "%"PRIx32" not implemented yet\n",
- sysctl->interface_version);
- SET_STATUS_Failure(VKI_EINVAL);
- return;
+ PRE_XEN_SYSCTL_READ(numainfo_0000000c, num_nodes);
+ PRE_XEN_SYSCTL_READ(numainfo_0000000c, meminfo);
+ PRE_XEN_SYSCTL_READ(numainfo_0000000c, distance);
+ break;
}
break;
@@ -1871,7 +1871,14 @@ POST(sysctl)
sizeof(uint32_t) *
(sysctl->u.numainfo_0000000b.max_node_index * sysctl->u.numainfo_0000000b.max_node_index));
break;
+ case 0x0000000c:
default:
+ POST_XEN_SYSCTL_WRITE(numainfo_0000000c, num_nodes);
+ POST_MEM_WRITE((Addr)sysctl->u.numainfo_0000000c.meminfo.p,
+ sizeof(uint64_t) * sysctl->u.numainfo_0000000c.num_nodes);
+ POST_MEM_WRITE((Addr)sysctl->u.numainfo_0000000c.distance.p,
+ sizeof(uint32_t) *
+ (sysctl->u.numainfo_0000000c.num_nodes * sysctl->u.numainfo_0000000c.num_nodes));
break;
}
break;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 248a5e12f..65ad6d591 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -128,6 +128,20 @@ struct vki_xen_sysctl_numainfo_0000000b {
VKI_XEN_GUEST_HANDLE_64(vki_uint64) node_to_memfree;
VKI_XEN_GUEST_HANDLE_64(vki_uint32) node_to_node_distance;
};
+
+struct vki_xen_xen_sysctl_meminfo_0000000c {
+ vki_uint64_t memsize;
+ vki_uint64_t memfree;
+};
+typedef struct vki_xen_xen_sysctl_meminfo_0000000c vki_xen_xen_sysctl_meminfo_0000000c_t;
+DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_xen_sysctl_meminfo_0000000c_t);
+
+struct vki_xen_sysctl_numainfo_0000000c {
+ vki_uint32_t num_nodes;
+ VKI_XEN_GUEST_HANDLE_64(vki_xen_xen_sysctl_meminfo_0000000c_t) meminfo;
+ VKI_XEN_GUEST_HANDLE_64(vki_uint32) distance;
+};
+
struct vki_xen_sysctl_physinfo_00000008 {
vki_uint32_t threads_per_core;
vki_uint32_t cores_per_socket;
@@ -178,6 +192,7 @@ struct vki_xen_sysctl {
struct vki_xen_sysctl_physinfo_0000000a physinfo_0000000a;
struct vki_xen_sysctl_topologyinfo topologyinfo;
struct vki_xen_sysctl_numainfo_0000000b numainfo_0000000b;
+ struct vki_xen_sysctl_numainfo_0000000c numainfo_0000000c;
struct vki_xen_sysctl_sched_id sched_id;
//struct vki_xen_sysctl_perfc_op perfc_op;
struct vki_xen_sysctl_getdomaininfolist_00000008 getdomaininfolist_00000008;
From d7f5b54cffd3e1d860327cc9c7ace806bfd37ae2 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:22 +0100
Subject: [PATCH 26/75] xen-4.6: XEN_SYSCTL_cputopoinfo
In xen-4.6 XEN_SYSCTL_topologyinfo was replaced by XEN_SYSCTL_cputopoinfo.
Both share the same number. Add code to catch both variants.
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 16 +++++++++++-----
include/vki/vki-xen-sysctl.h | 15 +++++++++++++++
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 30726c0be..69c3b230a 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -682,6 +682,7 @@ PRE(sysctl) {
break;
case VKI_XEN_SYSCTL_topologyinfo:
+// case VKI_XEN_SYSCTL_cputopoinfo:
switch (sysctl->interface_version)
{
case 0x00000007:
@@ -694,12 +695,11 @@ PRE(sysctl) {
PRE_XEN_SYSCTL_READ(topologyinfo, cpu_to_socket);
PRE_XEN_SYSCTL_READ(topologyinfo, cpu_to_node);
break;
+ case 0x0000000c:
default:
- VG_(dmsg)("WARNING: XEN_SYSCTL_cputopoinfo for sysctl version "
- "%"PRIx32" not implemented yet\n",
- sysctl->interface_version);
- SET_STATUS_Failure(VKI_EINVAL);
- return;
+ PRE_XEN_SYSCTL_READ(cputopoinfo_0000000c, num_cpus);
+ PRE_XEN_SYSCTL_READ(cputopoinfo_0000000c, cputopo);
+ break;
}
break;
@@ -1831,6 +1831,7 @@ POST(sysctl)
break;
case VKI_XEN_SYSCTL_topologyinfo:
+// case VKI_XEN_SYSCTL_cputopoinfo:
switch (sysctl->interface_version)
{
case 0x00000007:
@@ -1849,7 +1850,12 @@ POST(sysctl)
POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_node.p,
sizeof(uint32_t) * sysctl->u.topologyinfo.max_cpu_index);
break;
+ case 0x0000000c:
default:
+ POST_XEN_SYSCTL_WRITE(cputopoinfo_0000000c, num_cpus);
+ if (sysctl->u.cputopoinfo_0000000c.cputopo.p)
+ POST_MEM_WRITE((Addr)sysctl->u.cputopoinfo_0000000c.cputopo.p,
+ sizeof(vki_xen_sysctl_cputopo_0000000c_t) * sysctl->u.cputopoinfo_0000000c.num_cpus);
break;
}
break;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 65ad6d591..4f8a7d079 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -35,6 +35,7 @@
#define VKI_XEN_SYSCTL_page_offline_op 14
#define VKI_XEN_SYSCTL_lockprof_op 15
#define VKI_XEN_SYSCTL_topologyinfo 16
+#define VKI_XEN_SYSCTL_cputopoinfo 16 /* Since xen-4.6 */
#define VKI_XEN_SYSCTL_numainfo 17
#define VKI_XEN_SYSCTL_cpupool_op 18
#define VKI_XEN_SYSCTL_scheduler_op 19
@@ -122,6 +123,19 @@ struct vki_xen_sysctl_topologyinfo {
VKI_XEN_GUEST_HANDLE_64(vki_uint32) cpu_to_node;
};
+struct vki_xen_sysctl_cputopo_0000000c {
+ vki_uint32_t core;
+ vki_uint32_t socket;
+ vki_uint32_t node;
+};
+typedef struct vki_xen_sysctl_cputopo_0000000c vki_xen_sysctl_cputopo_0000000c_t;
+DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_sysctl_cputopo_0000000c_t);
+
+struct vki_xen_sysctl_cputopoinfo_0000000c {
+ vki_uint32_t num_cpus;
+ VKI_XEN_GUEST_HANDLE_64(vki_xen_sysctl_cputopo_0000000c_t) cputopo;
+};
+
struct vki_xen_sysctl_numainfo_0000000b {
vki_uint32_t max_node_index;
VKI_XEN_GUEST_HANDLE_64(vki_uint64) node_to_memsize;
@@ -191,6 +205,7 @@ struct vki_xen_sysctl {
struct vki_xen_sysctl_physinfo_00000008 physinfo_00000008;
struct vki_xen_sysctl_physinfo_0000000a physinfo_0000000a;
struct vki_xen_sysctl_topologyinfo topologyinfo;
+ struct vki_xen_sysctl_cputopoinfo_0000000c cputopoinfo_0000000c;
struct vki_xen_sysctl_numainfo_0000000b numainfo_0000000b;
struct vki_xen_sysctl_numainfo_0000000c numainfo_0000000c;
struct vki_xen_sysctl_sched_id sched_id;
From 9ba371d303a4fda7cb28a6a916124c21fdc1fa11 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:23 +0100
Subject: [PATCH 27/75] xen-4.6: support XEN_SYSCTL_pcitopoinfo
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 22 ++++++++++++++++++++++
include/vki/vki-xen-physdev.h | 9 +++++++++
include/vki/vki-xen-sysctl.h | 8 ++++++++
3 files changed, 39 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 69c3b230a..e79b0065a 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -725,6 +725,17 @@ PRE(sysctl) {
}
break;
+ case VKI_XEN_SYSCTL_pcitopoinfo:
+ switch (sysctl->interface_version)
+ {
+ case 0x0000000c:
+ default:
+ PRE_XEN_SYSCTL_READ(pcitopoinfo_0000000c, num_devs);
+ PRE_XEN_SYSCTL_READ(pcitopoinfo_0000000c, devs);
+ break;
+ }
+ break;
+
default:
bad_subop(tid, layout, arrghs, status, flags,
"__HYPERVISOR_sysctl", sysctl->cmd);
@@ -1889,6 +1900,17 @@ POST(sysctl)
}
break;
+ case VKI_XEN_SYSCTL_pcitopoinfo:
+ switch (sysctl->interface_version)
+ {
+ case 0x0000000c:
+ default:
+ POST_XEN_SYSCTL_WRITE(pcitopoinfo_0000000c, num_devs);
+ POST_MEM_WRITE((Addr)sysctl->u.pcitopoinfo_0000000c.nodes.p,
+ sizeof(uint32_t) * sysctl->u.pcitopoinfo_0000000c.num_devs);
+ break;
+ }
+ break;
/* No outputs */
case VKI_XEN_SYSCTL_debug_keys:
break;
diff --git a/include/vki/vki-xen-physdev.h b/include/vki/vki-xen-physdev.h
index 6f8c2c84c..225119821 100644
--- a/include/vki/vki-xen-physdev.h
+++ b/include/vki/vki-xen-physdev.h
@@ -60,6 +60,15 @@ struct vki_xen_physdev_unmap_pirq {
int pirq;
};
+struct vki_physdev_pci_device {
+ /* IN */
+ vki_uint16_t seg;
+ vki_uint8_t bus;
+ vki_uint8_t devfn;
+};
+typedef struct vki_physdev_pci_device vki_physdev_pci_device_t;
+DEFINE_VKI_XEN_GUEST_HANDLE(vki_physdev_pci_device_t);
+
#endif // __VKI_XEN_PHYSDEV_H
/*--------------------------------------------------------------------*/
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 4f8a7d079..bceb14cfd 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -41,6 +41,7 @@
#define VKI_XEN_SYSCTL_scheduler_op 19
#define VKI_XEN_SYSCTL_coverage_op 20
#define VKI_XEN_SYSCTL_psr_cmt_op 21
+#define VKI_XEN_SYSCTL_pcitopoinfo 22
struct vki_xen_sysctl_readconsole {
/* IN */
@@ -136,6 +137,12 @@ struct vki_xen_sysctl_cputopoinfo_0000000c {
VKI_XEN_GUEST_HANDLE_64(vki_xen_sysctl_cputopo_0000000c_t) cputopo;
};
+struct vki_xen_sysctl_pcitopoinfo_0000000c {
+ vki_uint32_t num_devs;
+ VKI_XEN_GUEST_HANDLE_64(vki_physdev_pci_device_t) devs;
+ VKI_XEN_GUEST_HANDLE_64(vki_uint32) nodes;
+};
+
struct vki_xen_sysctl_numainfo_0000000b {
vki_uint32_t max_node_index;
VKI_XEN_GUEST_HANDLE_64(vki_uint64) node_to_memsize;
@@ -206,6 +213,7 @@ struct vki_xen_sysctl {
struct vki_xen_sysctl_physinfo_0000000a physinfo_0000000a;
struct vki_xen_sysctl_topologyinfo topologyinfo;
struct vki_xen_sysctl_cputopoinfo_0000000c cputopoinfo_0000000c;
+ struct vki_xen_sysctl_pcitopoinfo_0000000c pcitopoinfo_0000000c;
struct vki_xen_sysctl_numainfo_0000000b numainfo_0000000b;
struct vki_xen_sysctl_numainfo_0000000c numainfo_0000000c;
struct vki_xen_sysctl_sched_id sched_id;
From 4f6a4c41c46ed66c8a1a68ab6b4aba65537d729e Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:24 +0100
Subject: [PATCH 28/75] xen-4.6: psr_cat_op and tmem_op
Add defines for XEN_SYSCTL_psr_cat_op and XEN_SYSCTL_tmem_op
bz#390553
---
include/vki/vki-xen-sysctl.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index bceb14cfd..c22f285de 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -42,6 +42,8 @@
#define VKI_XEN_SYSCTL_coverage_op 20
#define VKI_XEN_SYSCTL_psr_cmt_op 21
#define VKI_XEN_SYSCTL_pcitopoinfo 22
+#define VKI_XEN_SYSCTL_psr_cat_op 23
+#define VKI_XEN_SYSCTL_tmem_op 24
struct vki_xen_sysctl_readconsole {
/* IN */
@@ -214,6 +216,7 @@ struct vki_xen_sysctl {
struct vki_xen_sysctl_topologyinfo topologyinfo;
struct vki_xen_sysctl_cputopoinfo_0000000c cputopoinfo_0000000c;
struct vki_xen_sysctl_pcitopoinfo_0000000c pcitopoinfo_0000000c;
+ //struct vki_xen_sysctl_cputopoinfo cputopoinfo_0000000c;
struct vki_xen_sysctl_numainfo_0000000b numainfo_0000000b;
struct vki_xen_sysctl_numainfo_0000000c numainfo_0000000c;
struct vki_xen_sysctl_sched_id sched_id;
@@ -233,6 +236,8 @@ struct vki_xen_sysctl {
//struct vki_xen_sysctl_scheduler_op scheduler_op;
//struct vki_xen_sysctl_coverage_op coverage_op;
//struct vki_xen_sysctl_psr_cmt_op psr_cmt_op;
+ //struct vki_xen_sysctl_psr_cat_op psr_cat_op;
+ //struct vki_xen_sysctl_tmem_op tmem_op;
vki_uint8_t pad[128];
} u;
From 51d25fbc1ecfa6d615a33c0264c837281e5c1db8 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:25 +0100
Subject: [PATCH 29/75] xen-4.6: add xenpmu_op
Add define for xenpmu_op, introduced in xen-4.6
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 1 +
include/vki/vki-xen.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index e79b0065a..33ff117c1 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -2384,6 +2384,7 @@ static XenHypercallTableEntry hypercall_table[] = {
HYPXY(__VKI_XEN_domctl, domctl, 1), // 36
// __VKI_XEN_kexec_op // 37
HYPXY(__VKI_XEN_tmem_op, tmem_op, 1), // 38
+ // __VKI_XEN_xenpmu_op // 40
};
static void bad_before ( ThreadId tid,
diff --git a/include/vki/vki-xen.h b/include/vki/vki-xen.h
index 2d65bcc0e..f750a10ce 100644
--- a/include/vki/vki-xen.h
+++ b/include/vki/vki-xen.h
@@ -69,6 +69,7 @@
#define __VKI_XEN_kexec_op 37
#define __VKI_XEN_tmem_op 38
#define __VKI_XEN_xc_reserved_op 39 /* reserved for XenClient */
+#define __VKI_XEN_xenpmu_op 40
#define __DEFINE_VKI_XEN_GUEST_HANDLE(name, type) \
___DEFINE_VKI_XEN_GUEST_HANDLE(name, type); \
From f1d31e3f36cea8bfb71568045a45a59e3be16d28 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:26 +0100
Subject: [PATCH 30/75] xen-4.7: update xen_arch_domainconfig layout
New layout in xen-4.7, update createdomain.
---
coregrind/m_syswrap/syswrap-xen.c | 13 +++++++++++++
include/vki/vki-xen-domctl.h | 23 +++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 33ff117c1..c97c60d89 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -821,6 +821,19 @@ PRE(domctl)
__PRE_XEN_DOMCTL_READ(createdomain_0000000b, createdomain_0000000b, config.clock_frequency);
#endif
break;
+ case 0x0000000c:
+ default:
+ PRE_XEN_DOMCTL_READ(createdomain_0000000c, ssidref);
+ PRE_XEN_DOMCTL_READ(createdomain_0000000c, handle);
+ PRE_XEN_DOMCTL_READ(createdomain_0000000c, flags);
+#if defined(__i386__) || defined(__x86_64__)
+ __PRE_XEN_DOMCTL_READ(createdomain_0000000c, createdomain_0000000c, config.emulation_flags);
+#endif
+#if defined(__arm__) || defined(__aarch64__)
+ __PRE_XEN_DOMCTL_READ(createdomain_0000000c, createdomain_0000000c, config.gic_version);
+ __PRE_XEN_DOMCTL_READ(createdomain_0000000c, createdomain_0000000c, config.nr_spis);
+ __PRE_XEN_DOMCTL_READ(createdomain_0000000c, createdomain_0000000c, config.clock_frequency);
+#endif
}
break;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index b88c56aba..6bb28b3cf 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -157,6 +157,28 @@ struct vki_xen_domctl_createdomain_0000000b {
struct vki_xen_arch_domainconfig_0000000b config;
};
+/* The layout changed in 4.07, which shared domctl with 4.06 */
+struct vki_xen_arch_domainconfig_0000000c {
+#if defined(__i386__) || defined(__x86_64__)
+ vki_uint32_t emulation_flags;
+#endif
+#if defined(__arm__) || defined(__aarch64__)
+ /* IN/OUT */
+ vki_uint8_t gic_version;
+ /* IN */
+ vki_uint32_t nr_spis;
+ vki_uint32_t clock_frequency;
+#endif
+};
+
+struct vki_xen_domctl_createdomain_0000000c {
+ /* IN parameters */
+ vki_uint32_t ssidref;
+ vki_xen_domain_handle_t handle;
+ vki_uint32_t flags;
+ struct vki_xen_arch_domainconfig_0000000c config;
+};
+
struct vki_xen_domctl_getdomaininfo_00000007 {
/* OUT variables. */
vki_xen_domid_t domain;
@@ -612,6 +634,7 @@ struct vki_xen_domctl {
union {
struct vki_xen_domctl_createdomain_0000000a createdomain_0000000a;
struct vki_xen_domctl_createdomain_0000000b createdomain_0000000b;
+ struct vki_xen_domctl_createdomain_0000000c createdomain_0000000c;
//struct vki_xen_domctl_arm_configuredomain configuredomain;
struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007;
struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008;
From ec5afe2ad610b41dc38a296ac460927d92868698 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:27 +0100
Subject: [PATCH 31/75] xen-4.7: XEN_VCPUAFFINITY_FORCE
Add define for new flag XEN_VCPUAFFINITY_FORCE
bz#390553
---
include/vki/vki-xen-domctl.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 6bb28b3cf..f84b1afdc 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -262,6 +262,7 @@ struct vki_xen_domctl_vcpuaffinity_0000000a {
vki_uint32_t vcpu; /* IN */
#define VKI_XEN_VCPUAFFINITY_HARD (1U<<0)
#define VKI_XEN_VCPUAFFINITY_SOFT (1U<<1)
+#define VKI_XEN_VCPUAFFINITY_FORCE (1U<<2)
vki_uint32_t flags; /* IN */
struct vki_xenctl_bitmap cpumap_hard; /* IN/OUT */
struct vki_xenctl_bitmap cpumap_soft; /* IN/OUT */
From ac9fd78be2fb92546fb4aeb95dd9440bd0ad6c8a Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:28 +0100
Subject: [PATCH 32/75] xen-4.7: SCHEDOP put/getvcpuinfo
Add defines for XEN_DOMCTL_SCHEDOP_putvcpuinfo and XEN_DOMCTL_SCHEDOP_getvcpuinfo
bz#390553
---
include/vki/vki-xen-domctl.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index f84b1afdc..ef6d8c780 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -333,6 +333,8 @@ struct vki_xen_domctl_scheduler_op {
vki_uint32_t cmd; /* VKI_XEN_DOMCTL_SCHEDOP_* */
#define VKI_XEN_DOMCTL_SCHEDOP_putinfo 0
#define VKI_XEN_DOMCTL_SCHEDOP_getinfo 1
+#define VKI_XEN_DOMCTL_SCHEDOP_putvcpuinfo 2
+#define VKI_XEN_DOMCTL_SCHEDOP_getvcpuinfo 3
union {
struct xen_domctl_sched_sedf {
vki_xen_uint64_aligned_t period;
From a30771f1d9b5fb151f4651708d1d9a07c0d70b6a Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:29 +0100
Subject: [PATCH 33/75] xen-4.7: soft_reset
Add define for XEN_DOMCTL_soft_reset
bz#390553
---
include/vki/vki-xen-domctl.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index ef6d8c780..5a974d020 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -124,6 +124,7 @@
#define VKI_XEN_DOMCTL_arm_configure_domain 76
#define VKI_XEN_DOMCTL_monitor_op 77 /* new in 4.6 */
#define VKI_XEN_DOMCTL_psr_cat_op 78
+#define VKI_XEN_DOMCTL_soft_reset 79
#define VKI_XEN_DOMCTL_gdbsx_guestmemio 1000
#define VKI_XEN_DOMCTL_gdbsx_pausevcpu 1001
#define VKI_XEN_DOMCTL_gdbsx_unpausevcpu 1002
From 8fd8ee9f79444b8925afcf94e08f51ffe4384abc Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:30 +0100
Subject: [PATCH 34/75] xen-4.7: SCHEDOP_pin_override
Add define for SCHEDOP_pin_override
bz#390553
---
include/vki/vki-xen-schedop.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/vki/vki-xen-schedop.h b/include/vki/vki-xen-schedop.h
index 3c5b2ceeb..b18cdf4bf 100644
--- a/include/vki/vki-xen-schedop.h
+++ b/include/vki/vki-xen-schedop.h
@@ -47,4 +47,6 @@ typedef struct vki_xen_remote_shutdown vki_xen_remote_shutdown_t;
#define VKI_XEN_SCHEDOP_watchdog 6
+#define VKI_XEN_SCHEDOP_pin_override 7
+
#endif /* __VKI_XEN_SCHED_OP_H */
From 3d4735ff60689c45e99faba9ef5ebd7a50ce5dbe Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:31 +0100
Subject: [PATCH 35/75] xen-4.7: support XEN_SYSCTL_get_cpu_featureset
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 24 ++++++++++++++++++++++++
include/vki/vki-xen-sysctl.h | 8 ++++++++
2 files changed, 32 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index c97c60d89..5a85b4e4b 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -736,6 +736,17 @@ PRE(sysctl) {
}
break;
+ case VKI_XEN_SYSCTL_get_cpu_featureset:
+ switch (sysctl->interface_version)
+ {
+ case 0x0000000c:
+ default:
+ PRE_XEN_SYSCTL_READ(cpu_featureset_0000000d, index);
+ PRE_XEN_SYSCTL_READ(cpu_featureset_0000000d, nr_features);
+ break;
+ }
+ break;
+
default:
bad_subop(tid, layout, arrghs, status, flags,
"__HYPERVISOR_sysctl", sysctl->cmd);
@@ -1924,6 +1935,19 @@ POST(sysctl)
break;
}
break;
+
+ case VKI_XEN_SYSCTL_get_cpu_featureset:
+ switch (sysctl->interface_version)
+ {
+ case 0x0000000c:
+ default:
+ POST_XEN_SYSCTL_WRITE(cpu_featureset_0000000d, nr_features);
+ POST_MEM_WRITE((Addr)sysctl->u.cpu_featureset_0000000d.features.p,
+ sizeof(uint32_t) * sysctl->u.cpu_featureset_0000000d.nr_features);
+ break;
+ }
+ break;
+
/* No outputs */
case VKI_XEN_SYSCTL_debug_keys:
break;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index c22f285de..42567fad9 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -44,6 +44,7 @@
#define VKI_XEN_SYSCTL_pcitopoinfo 22
#define VKI_XEN_SYSCTL_psr_cat_op 23
#define VKI_XEN_SYSCTL_tmem_op 24
+#define VKI_XEN_SYSCTL_get_cpu_featureset 26
struct vki_xen_sysctl_readconsole {
/* IN */
@@ -205,6 +206,12 @@ struct vki_xen_sysctl_sched_id {
vki_uint32_t sched_id;
};
+struct vki_xen_sysctl_cpu_featureset_0000000d {
+ vki_uint32_t index;
+ vki_uint32_t nr_features;
+ VKI_XEN_GUEST_HANDLE_64(vki_uint32) features;
+};
+
struct vki_xen_sysctl {
vki_uint32_t cmd;
vki_uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
@@ -238,6 +245,7 @@ struct vki_xen_sysctl {
//struct vki_xen_sysctl_psr_cmt_op psr_cmt_op;
//struct vki_xen_sysctl_psr_cat_op psr_cat_op;
//struct vki_xen_sysctl_tmem_op tmem_op;
+ struct vki_xen_sysctl_cpu_featureset_0000000d cpu_featureset_0000000d;
vki_uint8_t pad[128];
} u;
From 753be5c53a52f3e0bb4a4f6e92c627680c68ec09 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:32 +0100
Subject: [PATCH 36/75] xen-4.7: sysctl for get_cpu_levelling_caps and
livepatch_op
Add defines for XEN_SYSCTL_get_cpu_levelling_caps and
XEN_SYSCTL_livepatch_op
bz#390553
---
include/vki/vki-xen-sysctl.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 42567fad9..68ea0e5bd 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -44,7 +44,9 @@
#define VKI_XEN_SYSCTL_pcitopoinfo 22
#define VKI_XEN_SYSCTL_psr_cat_op 23
#define VKI_XEN_SYSCTL_tmem_op 24
+#define VKI_XEN_SYSCTL_get_cpu_levelling_caps 25
#define VKI_XEN_SYSCTL_get_cpu_featureset 26
+#define VKI_XEN_SYSCTL_livepatch_op 27
struct vki_xen_sysctl_readconsole {
/* IN */
@@ -245,7 +247,9 @@ struct vki_xen_sysctl {
//struct vki_xen_sysctl_psr_cmt_op psr_cmt_op;
//struct vki_xen_sysctl_psr_cat_op psr_cat_op;
//struct vki_xen_sysctl_tmem_op tmem_op;
+ //struct vki_xen_sysctl_cpu_levelling_caps cpu_levelling_caps;
struct vki_xen_sysctl_cpu_featureset_0000000d cpu_featureset_0000000d;
+ //struct vki_xen_sysctl_livepatch_op livepatch;
vki_uint8_t pad[128];
} u;
From 64997751b854938d3de958be8b3b3251cca44c93 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:33 +0100
Subject: [PATCH 37/75] xen-4.7: XENVER_build_id
Add code to handle XENVER_build_id, added in xen-4.7
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 4 ++++
include/vki/vki-xen-version.h | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 5a85b4e4b..78d8d181b 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -532,6 +532,7 @@ PRE(xen_version)
case VKI_XENVER_pagesize:
case VKI_XENVER_guest_handle:
case VKI_XENVER_commandline:
+ case VKI_XENVER_build_id:
/* No inputs */
break;
@@ -1739,6 +1740,9 @@ POST(xen_version)
case VKI_XENVER_commandline:
POST_MEM_WRITE((Addr)ARG2, sizeof(vki_xen_commandline_t));
break;
+ case VKI_XENVER_build_id:
+ POST_MEM_WRITE((Addr)ARG2, sizeof(struct vki_xen_build_id));
+ break;
}
}
diff --git a/include/vki/vki-xen-version.h b/include/vki/vki-xen-version.h
index dfaf7c07e..72bc56625 100644
--- a/include/vki/vki-xen-version.h
+++ b/include/vki/vki-xen-version.h
@@ -38,6 +38,7 @@
#define VKI_XENVER_pagesize 7
#define VKI_XENVER_guest_handle 8
#define VKI_XENVER_commandline 9
+#define VKI_XENVER_build_id 10
typedef char vki_xen_extraversion_t[16];
@@ -63,6 +64,16 @@ struct vki_xen_feature_info {
typedef char vki_xen_commandline_t[1024];
+struct vki_xen_build_id {
+ unsigned int len; /* IN: size of buf[]. */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ unsigned char buf[];
+#elif defined(__GNUC__)
+ unsigned char buf[1]; /* OUT: Variable length buffer with build_id. */
+#endif
+
+};
+
#endif // __VKI_XEN_VERSION_H
/*--------------------------------------------------------------------*/
From c3f05104173bb5ec6e6c65703a7e50667ea26cc1 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:21:34 +0100
Subject: [PATCH 38/75] xen-4.7: sysctl value
Add 0xd as sysctl value of xen-4.7
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-sysctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 78d8d181b..b4ac3c6d1 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -586,6 +586,7 @@ PRE(sysctl) {
case 0x0000000a:
case 0x0000000b:
case 0x0000000c:
+ case 0x0000000d:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -1773,6 +1774,7 @@ POST(sysctl)
case 0x0000000a:
case 0x0000000b:
case 0x0000000c:
+ case 0x0000000d:
break;
default:
return;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 68ea0e5bd..c4f8ddf27 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -10,6 +10,7 @@
* - 0x0000000a: Xen 4.3 & 4.4
* - 0x0000000b: Xen 4.5
* - 0x0000000c: Xen 4.6
+ * - 0x0000000d: Xen 4.7
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 473689eb5a2b7a4686a910c51bcb8ecec59c831b Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:27 +0100
Subject: [PATCH 39/75] xen-4.8: IOCTL_GNTDEV_GRANT_COPY
bz#390553
---
coregrind/m_syswrap/syswrap-linux.c | 15 +++++++++++++++
include/vki/vki-linux.h | 21 +++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 1b6064138..3c475b1af 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8325,6 +8325,15 @@ PRE(sys_ioctl)
(Addr)&args->event_channel_port, sizeof(args->event_channel_port));
}
break;
+ case VKI_XEN_IOCTL_GNTDEV_GRANT_COPY: {
+ struct vki_xen_ioctl_gntdev_grant_copy *args =
+ (struct vki_xen_ioctl_gntdev_grant_copy*)(Addr)(ARG3);
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTDEV_grant_copy(count)",
+ (Addr)&args->count, sizeof(args->count));
+ PRE_MEM_READ("VKI_XEN_IOCTL_GNTDEV_grant_copy(segments)",
+ (Addr)args->segments, sizeof(*(args->segments)) * args->count);
+ }
+ break;
#endif
/* Lustre */
@@ -10832,6 +10841,12 @@ POST(sys_ioctl)
case VKI_XEN_IOCTL_GNTALLOC_SET_UNMAP_NOTIFY:
/* No output */
break;
+ case VKI_XEN_IOCTL_GNTDEV_GRANT_COPY: {
+ struct vki_xen_ioctl_gntdev_grant_copy *args =
+ (struct vki_xen_ioctl_gntdev_grant_copy*)(Addr)(ARG3);
+ POST_MEM_WRITE((Addr)args->segments, sizeof(*(args->segments)) * args->count);
+ }
+ break;
#endif
/* Lustre */
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 6b079ebaf..76a37435a 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3493,6 +3493,27 @@ struct vki_xen_ioctl_gntalloc_set_unmap_notify {
vki_u32 event_channel_port;
};
+#define VKI_XEN_IOCTL_GNTDEV_GRANT_COPY \
+ _VKI_IOC(_VKI_IOC_NONE, 'G', 8, sizeof(struct vki_xen_ioctl_gntdev_grant_copy))
+struct vki_xen_gntdev_grant_copy_segment {
+ union {
+ void *virt;
+ struct {
+ vki_u32 ref; /* grant_ref_t */
+ vki_u16 offset;
+ vki_u16 domid; /* domid_t */
+ } foreign;
+ } source, dest;
+ vki_u16 len;
+ vki_u16 flags; /* GNTCOPY_* */
+ __vki_s16 status; /* GNTST_* */
+};
+
+struct vki_xen_ioctl_gntdev_grant_copy {
+ vki_uint32_t count;
+ struct vki_xen_gntdev_grant_copy_segment *segments;
+};
+
//----------------------------------------------------------------------
// From linux-3.4.0/include/linux/fs.h
//----------------------------------------------------------------------
From 261b1461519b107416fc9ddbde83855aec5d2028 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:28 +0100
Subject: [PATCH 40/75] xen-4.8: xen_domctl_monitor_op
Layout of xen_domctl_monitor_op changed in xen-4.8.
Copy and adjust the existing monitor_op_0000000b handler.
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 19 +++++++++++++
include/vki/vki-xen-domctl.h | 45 +++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index b4ac3c6d1..a2881c999 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -2305,6 +2305,25 @@ POST(domctl){
}
}
+ break;
+ case 0x000000c:
+ if (domctl->u.monitor_op_0000000c.op == VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES) {
+ switch(domctl->u.monitor_op_0000000c.event) {
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_0000000c, u.mov_to_cr);
+ break;
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_0000000c, u.mov_to_msr);
+ break;
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_0000000c, u.guest_request);
+ break;
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_0000000c, u.debug_exception);
+ break;
+ }
+ }
+
break;
}
break;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 5a974d020..b01b0c6fe 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -570,6 +570,9 @@ struct vki_xen_domctl_vcpu_msrs {
#define VKI_XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP 2
#define VKI_XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT 3
#define VKI_XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST 4
+#define VKI_XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION 5
+#define VKI_XEN_DOMCTL_MONITOR_EVENT_CPUID 6
+#define VKI_XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL 7
struct vki_xen_domctl_monitor_op_0000000b {
vki_uint32_t op; /* vki_xen_DOMCTL_MONITOR_OP_* */
@@ -608,6 +611,47 @@ struct vki_xen_domctl_monitor_op_0000000b {
} u;
};
+struct vki_xen_domctl_monitor_op_0000000c {
+ vki_uint32_t op; /* vki_xen_DOMCTL_MONITOR_OP_* */
+
+ /*
+ * When used with ENABLE/DISABLE this has to be set to
+ * the requested vki_xen_DOMCTL_MONITOR_EVENT_* value.
+ * With GET_CAPABILITIES this field returns a bitmap of
+ * events supported by the platform, in the format
+ * (1 << vki_xen_DOMCTL_MONITOR_EVENT_*).
+ */
+ vki_uint32_t event;
+
+ /*
+ * Further options when issuing vki_xen_DOMCTL_MONITOR_OP_ENABLE.
+ */
+ union {
+ struct {
+ /* Which control register */
+ vki_uint8_t index;
+ /* Pause vCPU until response */
+ vki_uint8_t sync;
+ /* Send event only on a change of value */
+ vki_uint8_t onchangeonly;
+ } mov_to_cr;
+
+ struct {
+ vki_uint32_t msr;
+ } mov_to_msr;
+
+ struct {
+ /* Pause vCPU until response */
+ vki_uint8_t sync;
+ } guest_request;
+
+ struct {
+ /* Pause vCPU until response */
+ vki_uint8_t sync;
+ } debug_exception;
+ } u;
+};
+
struct vki_xen_domctl_monitor_op {
vki_uint32_t op;
@@ -703,6 +747,7 @@ struct vki_xen_domctl {
//struct vki_xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
//struct vki_xen_domctl_gdbsx_domstatus gdbsx_domstatus;
struct vki_xen_domctl_monitor_op_0000000b monitor_op_0000000b;
+ struct vki_xen_domctl_monitor_op_0000000c monitor_op_0000000c;
//struct vki_xen_domctl_vnuma vnuma;
//struct vki_xen_domctl_psr_cmt_op psr_cmt_op;
//struct vki_xen_domctl_psr_cat_op psr_cat_op;
From 8d9217f170d9c80f71ca2af366def3a563e3f6f5 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:29 +0100
Subject: [PATCH 41/75] xen-4.8: sysctl value
Add 0xe as sysctl value of xen-4.8
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-sysctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index a2881c999..a204a8db8 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -587,6 +587,7 @@ PRE(sysctl) {
case 0x0000000b:
case 0x0000000c:
case 0x0000000d:
+ case 0x0000000e:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -1775,6 +1776,7 @@ POST(sysctl)
case 0x0000000b:
case 0x0000000c:
case 0x0000000d:
+ case 0x0000000e:
break;
default:
return;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index c4f8ddf27..b9beb2c19 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -11,6 +11,7 @@
* - 0x0000000b: Xen 4.5
* - 0x0000000c: Xen 4.6
* - 0x0000000d: Xen 4.7
+ * - 0x0000000e: Xen 4.8
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 30d8a6775914bb1852deb7c138184a7d5a5f39ce Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:30 +0100
Subject: [PATCH 42/75] xen-4.8: fix domclt version in comment
Version 0xc was introduced in xen-4.8, xen-4.7 has the same version as xen-4.6.
bz#390553
---
include/vki/vki-xen-domctl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index b01b0c6fe..1bdf3ad07 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -37,7 +37,7 @@
* - 0x00000009: Xen 4.3 & 4.4
* - 0x0000000a: Xen 4.5
* - 0x0000000b: Xen 4.6
- * - 0x0000000c: Xen 4.7
+ * - 0x0000000c: Xen 4.8
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 616f2c03fd0d900e96ae7df13bbd63a2b4190a5b Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:31 +0100
Subject: [PATCH 43/75] xen-4.8: domctl
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add 0xc as domctl value of xen-4.8
Fixes commit: d73f2c748 ("Implement additional Xen hypercalls Fixes BZ#373086 Patch by: Mihai DONȚU <mihai.dontu@gmail.com>")
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index a204a8db8..8126203fb 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -1973,6 +1973,7 @@ POST(domctl){
case 0x00000009:
case 0x0000000a:
case 0x0000000b:
+ case 0x0000000c:
break;
default:
return;
From c43f460fe06162bbfe34431ea3e03c083782e737 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:33 +0100
Subject: [PATCH 44/75] xen-4.9: domctl value
Add 0xd as domctl value of xen-4.9
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-domctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 8126203fb..847dcde1d 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -786,6 +786,7 @@ PRE(domctl)
case 0x0000000a:
case 0x0000000b:
case 0x0000000c:
+ case 0x0000000d:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -1974,6 +1975,7 @@ POST(domctl){
case 0x0000000a:
case 0x0000000b:
case 0x0000000c:
+ case 0x0000000d:
break;
default:
return;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 1bdf3ad07..fc6c31979 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -38,6 +38,7 @@
* - 0x0000000a: Xen 4.5
* - 0x0000000b: Xen 4.6
* - 0x0000000c: Xen 4.8
+ * - 0x0000000d: Xen 4.9
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 0be00fe82647dd44a4f8364982a928adbd221958 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:34 +0100
Subject: [PATCH 45/75] xen-4.9: add NULL scheduler
Add define for XEN_SCHEDULER_NULL
bz#390553
---
include/vki/vki-xen-domctl.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index fc6c31979..88a20ce1c 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -332,6 +332,7 @@ struct vki_xen_domctl_scheduler_op {
#define VKI_XEN_SCHEDULER_CREDIT2 6
#define VKI_XEN_SCHEDULER_ARINC653 7
#define VKI_XEN_SCHEDULER_RTDS 8
+#define VKI_XEN_SCHEDULER_NULL 9
vki_uint32_t cmd; /* VKI_XEN_DOMCTL_SCHEDOP_* */
#define VKI_XEN_DOMCTL_SCHEDOP_putinfo 0
#define VKI_XEN_DOMCTL_SCHEDOP_getinfo 1
From 25445f787825219479e17473d21756ca7530f2fb Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:35 +0100
Subject: [PATCH 46/75] xen-4.9: add monitor event INTERRUPT and DESC_ACCESS
Add defines for XEN_DOMCTL_MONITOR_EVENT_INTERRUPT and
XEN_DOMCTL_MONITOR_EVENT_DESC_ACCESS
bz#390553
---
include/vki/vki-xen-domctl.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 88a20ce1c..cd4f77bc0 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -575,6 +575,8 @@ struct vki_xen_domctl_vcpu_msrs {
#define VKI_XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION 5
#define VKI_XEN_DOMCTL_MONITOR_EVENT_CPUID 6
#define VKI_XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL 7
+#define VKI_XEN_DOMCTL_MONITOR_EVENT_INTERRUPT 8
+#define VKI_XEN_DOMCTL_MONITOR_EVENT_DESC_ACCESS 9
struct vki_xen_domctl_monitor_op_0000000b {
vki_uint32_t op; /* vki_xen_DOMCTL_MONITOR_OP_* */
From cd69848be6f4eed00d680471f18f7bf1d6984f6c Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:36 +0100
Subject: [PATCH 47/75] xen-4.9: sysctl value
Add 0xf as sysctl value of xen-4.9
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-sysctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 847dcde1d..7829308d8 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -588,6 +588,7 @@ PRE(sysctl) {
case 0x0000000c:
case 0x0000000d:
case 0x0000000e:
+ case 0x0000000f:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -1778,6 +1779,7 @@ POST(sysctl)
case 0x0000000c:
case 0x0000000d:
case 0x0000000e:
+ case 0x0000000f:
break;
default:
return;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index b9beb2c19..f00cb2295 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -12,6 +12,7 @@
* - 0x0000000c: Xen 4.6
* - 0x0000000d: Xen 4.7
* - 0x0000000e: Xen 4.8
+ * - 0x0000000f: Xen 4.9
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 82bdc86f686473b6e953679387ac5aa429541fcb Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:37 +0100
Subject: [PATCH 48/75] xen-4.9: coverage_op replaced by gcov_op
In xen-4.9 xen_sysctl_coverage_op was replaced by xen_sysctl_gcov_op.
The number remains the same.
bz#390553
---
include/vki/vki-xen-sysctl.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index f00cb2295..214a652b8 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -43,6 +43,7 @@
#define VKI_XEN_SYSCTL_cpupool_op 18
#define VKI_XEN_SYSCTL_scheduler_op 19
#define VKI_XEN_SYSCTL_coverage_op 20
+#define VKI_XEN_SYSCTL_gcov_op 20 /* Since xen-4.9 */
#define VKI_XEN_SYSCTL_psr_cmt_op 21
#define VKI_XEN_SYSCTL_pcitopoinfo 22
#define VKI_XEN_SYSCTL_psr_cat_op 23
@@ -247,6 +248,7 @@ struct vki_xen_sysctl {
struct vki_xen_sysctl_cpupool_op cpupool_op;
//struct vki_xen_sysctl_scheduler_op scheduler_op;
//struct vki_xen_sysctl_coverage_op coverage_op;
+ //struct vki_xen_sysctl_gcov_op gcov_op;
//struct vki_xen_sysctl_psr_cmt_op psr_cmt_op;
//struct vki_xen_sysctl_psr_cat_op psr_cat_op;
//struct vki_xen_sysctl_tmem_op tmem_op;
From 4e87c221e78dead32d672a06d8d21ab3d9ea4b00 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:38 +0100
Subject: [PATCH 49/75] xen-4.9: add dm_op
Handle dm_op hypercall
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 19 +++++++++++++++++++
include/vki/vki-xen.h | 1 +
2 files changed, 20 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 7829308d8..be0bcdddf 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -1566,6 +1566,16 @@ PRE(tmem_op)
#undef __PRE_XEN_TMEMOP_READ
}
+PRE(dm_op)
+{
+ unsigned int domid = ARG1, num = ARG2;
+ struct vki_xen_privcmd_dm_op_buf *args = (void *)(ARG3);
+
+ PRINT("__HYPERVISOR_dm_op ( %lu, %#lx, %lu )", ARG1, ARG2, ARG3);
+
+ PRE_MEM_READ("__HYPERVISOR_dm_op ubuf", (Addr)args, sizeof(*args) * num);
+}
+
POST(memory_op)
{
switch (ARG1) {
@@ -2392,6 +2402,14 @@ POST(tmem_op)
}
}
+POST(dm_op)
+{
+ unsigned int domid = ARG1, num = ARG2;
+ struct vki_xen_privcmd_dm_op_buf *args = (void *)(ARG3);
+
+ POST_MEM_WRITE((Addr) args, sizeof(*args) * num);
+}
+
typedef
struct {
SyscallTableEntry entry;
@@ -2454,6 +2472,7 @@ static XenHypercallTableEntry hypercall_table[] = {
// __VKI_XEN_kexec_op // 37
HYPXY(__VKI_XEN_tmem_op, tmem_op, 1), // 38
// __VKI_XEN_xenpmu_op // 40
+ HYPXY(__VKI_XEN_dm_op, dm_op, 3), // 41
};
static void bad_before ( ThreadId tid,
diff --git a/include/vki/vki-xen.h b/include/vki/vki-xen.h
index f750a10ce..ac8b21400 100644
--- a/include/vki/vki-xen.h
+++ b/include/vki/vki-xen.h
@@ -70,6 +70,7 @@
#define __VKI_XEN_tmem_op 38
#define __VKI_XEN_xc_reserved_op 39 /* reserved for XenClient */
#define __VKI_XEN_xenpmu_op 40
+#define __VKI_XEN_dm_op 41
#define __DEFINE_VKI_XEN_GUEST_HANDLE(name, type) \
___DEFINE_VKI_XEN_GUEST_HANDLE(name, type); \
From 262998f32498effb079cb09edfb5a2c9d7a33417 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:39 +0100
Subject: [PATCH 50/75] xen-4.9: add IOCTL_PRIVCMD_DM_OP
Handle IOCTL_PRIVCMD_DM_OP, add define for IOCTL_PRIVCMD_RESTRICT
bz#390553
---
coregrind/m_syswrap/syswrap-linux.c | 17 +++++++++++++++++
include/vki/vki-linux.h | 15 +++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 3c475b1af..c8f72de74 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8219,6 +8219,17 @@ PRE(sys_ioctl)
(Addr)args->arr, sizeof(*(args->arr)) * args->num);
break;
}
+ case VKI_XEN_IOCTL_PRIVCMD_DM_OP: {
+ struct vki_xen_privcmd_dm_op *args =
+ (struct vki_xen_privcmd_dm_op *)(ARG3);
+ PRE_MEM_READ("VKI_XEN_IOCTL_PRIVCMD_DM_OP(dom)",
+ (Addr)&args->dom, sizeof(args->dom));
+ PRE_MEM_READ("VKI_XEN_IOCTL_PRIVCMD_DM_OP(num)",
+ (Addr)&args->num, sizeof(args->num));
+ PRE_MEM_READ("VKI_XEN_IOCTL_PRIVCMD_DM_OP(ubufs)",
+ (Addr)args->ubufs, sizeof(*(args->ubufs)) * args->num);
+ break;
+ }
case VKI_XEN_IOCTL_EVTCHN_BIND_VIRQ: {
struct vki_xen_ioctl_evtchn_bind_virq *args =
@@ -10800,6 +10811,12 @@ POST(sys_ioctl)
POST_MEM_WRITE((Addr)args->err, sizeof(*(args->err)) * args->num);
}
break;
+ case VKI_XEN_IOCTL_PRIVCMD_DM_OP: {
+ struct vki_xen_privcmd_dm_op *args =
+ (struct vki_xen_privcmd_dm_op *)(ARG3);
+ POST_MEM_WRITE((Addr)args->ubufs, sizeof(*(args->ubufs)) * args->num);
+ }
+ break;
case VKI_XEN_IOCTL_EVTCHN_BIND_VIRQ:
case VKI_XEN_IOCTL_EVTCHN_BIND_INTERDOMAIN:
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 76a37435a..0a0b5c2c1 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3384,12 +3384,27 @@ struct vki_xen_privcmd_mmapbatch_v2 {
int __user *err; /* array of error codes */
};
+struct vki_xen_privcmd_dm_op_buf {
+ void __user *uptr;
+ __vki_kernel_size_t size;
+};
+
+struct vki_xen_privcmd_dm_op {
+ __vki_u16 dom;
+ __vki_u16 num;
+ const struct vki_xen_privcmd_dm_op_buf __user *ubufs;
+};
+
+
#define VKI_XEN_IOCTL_PRIVCMD_HYPERCALL _VKI_IOC(_VKI_IOC_NONE, 'P', 0, sizeof(struct vki_xen_privcmd_hypercall))
#define VKI_XEN_IOCTL_PRIVCMD_MMAP _VKI_IOC(_VKI_IOC_NONE, 'P', 2, sizeof(struct vki_xen_privcmd_mmap))
#define VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH _VKI_IOC(_VKI_IOC_NONE, 'P', 3, sizeof(struct vki_xen_privcmd_mmapbatch))
#define VKI_XEN_IOCTL_PRIVCMD_MMAPBATCH_V2 _VKI_IOC(_VKI_IOC_NONE, 'P', 4, sizeof(struct vki_xen_privcmd_mmapbatch_v2))
+#define VKI_XEN_IOCTL_PRIVCMD_DM_OP _VKI_IOC(_VKI_IOC_NONE, 'P', 5, sizeof(struct vki_xen_privcmd_dm_op))
+#define VKI_XEN_IOCTL_PRIVCMD_RESTRICT _VKI_IOC(_VKI_IOC_NONE, 'P', 6, sizeof(__vki_u16))
+
//----------------------------------------------------------------------
// Xen evtchn IOCTL
//----------------------------------------------------------------------
From b51d38220ffa99e6bb95b6c77036be7c8d1f68ac Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:40 +0100
Subject: [PATCH 51/75] xen-4.10: add domctl value
Add 0xe as domctl value of xen-4.10
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-domctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index be0bcdddf..d3dfeb272 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -788,6 +788,7 @@ PRE(domctl)
case 0x0000000b:
case 0x0000000c:
case 0x0000000d:
+ case 0x0000000e:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -1988,6 +1989,7 @@ POST(domctl){
case 0x0000000b:
case 0x0000000c:
case 0x0000000d:
+ case 0x0000000e:
break;
default:
return;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index cd4f77bc0..d5c59feb0 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -39,6 +39,7 @@
* - 0x0000000b: Xen 4.6
* - 0x0000000c: Xen 4.8
* - 0x0000000d: Xen 4.9
+ * - 0x0000000e: Xen 4.10
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 79a9c5ac046c6f3e63e13979c8e2c9348687562b Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:41 +0100
Subject: [PATCH 52/75] xen-4.10: xen_domctl_assign_device
The flags member moved in xen_domctl_assign_device. Copy the existing
code and handle xen-4.10.
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 66 +++++++++++++++++++++++++++++++
include/vki/vki-xen-domctl.h | 15 +++++++
2 files changed, 81 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index d3dfeb272..7ada2cba5 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -914,6 +914,8 @@ PRE(domctl)
__PRE_XEN_DOMCTL_READ(test_assign_device, assign_device_00000007, machine_sbdf);
break;
case 0x0000000b:
+ case 0x0000000c:
+ case 0x0000000d:
__PRE_XEN_DOMCTL_READ(test_assign_device, assign_device_0000000b, dev);
__PRE_XEN_DOMCTL_READ(test_assign_device, assign_device_0000000b, flag);
switch (domctl->u.assign_device_0000000b.dev) {
@@ -933,6 +935,26 @@ PRE(domctl)
break;
}
break;
+ case 0x0000000e:
+ __PRE_XEN_DOMCTL_READ(test_assign_device, assign_device_0000000e, dev);
+ __PRE_XEN_DOMCTL_READ(test_assign_device, assign_device_0000000e, flags);
+ switch (domctl->u.assign_device_0000000e.dev) {
+ case VKI_XEN_DOMCTL_DEV_PCI:
+ __PRE_XEN_DOMCTL_READ(test_assign_device, assign_device_0000000e, u.pci);
+ break;
+ case VKI_XEN_DOMCTL_DEV_DT:
+ __PRE_XEN_DOMCTL_READ(test_assign_device, assign_device_0000000e, u.dt);
+ PRE_MEM_READ("XEN_DOMTCL_test_assign_device.dt",
+ (Addr)domctl->u.assign_device_0000000e.u.dt.path.p,
+ domctl->u.assign_device_0000000e.u.dt.size);
+ break;
+ default:
+ bad_subop(tid, layout, arrghs, status, flags,
+ "__HYPERVISOR_domctl_test_assign_device dev",
+ domctl->u.assign_device_0000000e.dev);
+ break;
+ }
+ break;
}
break;
case VKI_XEN_DOMCTL_assign_device:
@@ -944,6 +966,8 @@ PRE(domctl)
__PRE_XEN_DOMCTL_READ(assign_device, assign_device_00000007, machine_sbdf);
break;
case 0x0000000b:
+ case 0x0000000c:
+ case 0x0000000d:
__PRE_XEN_DOMCTL_READ(assign_device, assign_device_0000000b, dev);
__PRE_XEN_DOMCTL_READ(assign_device, assign_device_0000000b, flag);
switch (domctl->u.assign_device_0000000b.dev) {
@@ -963,6 +987,26 @@ PRE(domctl)
break;
}
break;
+ case 0x0000000e:
+ __PRE_XEN_DOMCTL_READ(assign_device, assign_device_0000000e, dev);
+ __PRE_XEN_DOMCTL_READ(assign_device, assign_device_0000000e, flags);
+ switch (domctl->u.assign_device_0000000e.dev) {
+ case VKI_XEN_DOMCTL_DEV_PCI:
+ __PRE_XEN_DOMCTL_READ(assign_device, assign_device_0000000e, u.pci);
+ break;
+ case VKI_XEN_DOMCTL_DEV_DT:
+ __PRE_XEN_DOMCTL_READ(assign_device, assign_device_0000000e, u.dt);
+ PRE_MEM_READ("XEN_DOMTCL_assign_device.dt",
+ (Addr)domctl->u.assign_device_0000000e.u.dt.path.p,
+ domctl->u.assign_device_0000000e.u.dt.size);
+ break;
+ default:
+ bad_subop(tid, layout, arrghs, status, flags,
+ "__HYPERVISOR_domctl_assign_device dev",
+ domctl->u.assign_device_0000000e.dev);
+ break;
+ }
+ break;
}
break;
case VKI_XEN_DOMCTL_deassign_device:
@@ -974,6 +1018,8 @@ PRE(domctl)
__PRE_XEN_DOMCTL_READ(deassign_device, assign_device_00000007, machine_sbdf);
break;
case 0x0000000b:
+ case 0x0000000c:
+ case 0x0000000d:
__PRE_XEN_DOMCTL_READ(deassign_device, assign_device_0000000b, dev);
__PRE_XEN_DOMCTL_READ(deassign_device, assign_device_0000000b, flag);
switch (domctl->u.assign_device_0000000b.dev) {
@@ -993,6 +1039,26 @@ PRE(domctl)
break;
}
break;
+ case 0x0000000e:
+ __PRE_XEN_DOMCTL_READ(deassign_device, assign_device_0000000e, dev);
+ __PRE_XEN_DOMCTL_READ(deassign_device, assign_device_0000000e, flags);
+ switch (domctl->u.assign_device_0000000e.dev) {
+ case VKI_XEN_DOMCTL_DEV_PCI:
+ __PRE_XEN_DOMCTL_READ(deassign_device, assign_device_0000000e, u.pci);
+ break;
+ case VKI_XEN_DOMCTL_DEV_DT:
+ __PRE_XEN_DOMCTL_READ(deassign_device, assign_device_0000000e, u.dt);
+ PRE_MEM_READ("XEN_DOMTCL_assign_device.dt",
+ (Addr)domctl->u.assign_device_0000000e.u.dt.path.p,
+ domctl->u.assign_device_0000000e.u.dt.size);
+ break;
+ default:
+ bad_subop(tid, layout, arrghs, status, flags,
+ "__HYPERVISOR_domctl_deassign_device dev",
+ domctl->u.assign_device_0000000e.dev);
+ break;
+ }
+ break;
}
break;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index d5c59feb0..c02357dd7 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -522,6 +522,20 @@ struct vki_xen_domctl_assign_device_0000000b {
vki_uint32_t flag; /* flag of assigned device */
};
+struct vki_xen_domctl_assign_device_0000000e {
+ vki_uint32_t dev; /* XEN_DOMCTL_DEV_* */
+ vki_uint32_t flags;
+ union {
+ struct {
+ vki_uint32_t machine_sbdf; /* machine PCI ID of assigned device */
+ } pci;
+ struct {
+ vki_uint32_t size; /* Length of the path */
+ VKI_XEN_GUEST_HANDLE_64(vki_uint8) path; /* path to the device tree node */
+ } dt;
+ } u;
+};
+
struct vki_xen_domctl_debug_op {
vki_uint32_t op; /* IN */
vki_uint32_t vcpu; /* IN */
@@ -725,6 +739,7 @@ struct vki_xen_domctl {
//struct vki_xen_domctl_get_device_group get_device_group;
struct vki_xen_domctl_assign_device_00000007 assign_device_00000007;
struct vki_xen_domctl_assign_device_0000000b assign_device_0000000b;
+ struct vki_xen_domctl_assign_device_0000000e assign_device_0000000e;
//struct vki_xen_domctl_bind_pt_irq bind_pt_irq;
//struct vki_xen_domctl_memory_mapping memory_mapping;
//struct vki_xen_domctl_ioport_mapping ioport_mapping;
From 54c7be433c080a7534340431bc84915b6968cd0c Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:42 +0100
Subject: [PATCH 53/75] xen-4.10: rename hvmcontext_partial
The layout of xen_domctl_hvmcontext_partial will change in xen-4.10.
Rename existing copy in preparation of following changes.
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 82 +++++++++++++++++++------------
include/vki/vki-xen-domctl.h | 8 +--
2 files changed, 55 insertions(+), 35 deletions(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 7ada2cba5..6f6d040a9 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -872,30 +872,40 @@ PRE(domctl)
break;
case VKI_XEN_DOMCTL_gethvmcontext_partial:
- __PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial, type);
- __PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial, instance);
- __PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial, buffer);
-
- switch (domctl->u.hvmcontext_partial.type) {
- case VKI_HVM_SAVE_CODE(CPU):
- if ( domctl->u.hvmcontext_partial.buffer.p )
- PRE_MEM_WRITE("XEN_DOMCTL_gethvmcontext_partial *buffer",
- (Addr)domctl->u.hvmcontext_partial.buffer.p,
- VKI_HVM_SAVE_LENGTH(CPU));
- break;
- case VKI_HVM_SAVE_CODE(MTRR):
- if ( domctl->u.hvmcontext_partial.buffer.p )
- PRE_MEM_WRITE("XEN_DOMCTL_gethvmcontext_partial *buffer",
- (Addr)domctl->u.hvmcontext_partial.buffer.p,
- VKI_HVM_SAVE_LENGTH(MTRR));
- break;
- default:
- bad_subop(tid, layout, arrghs, status, flags,
+ switch (domctl->interface_version) {
+ case 0x00000007:
+ case 0x00000008:
+ case 0x00000009:
+ case 0x0000000a:
+ case 0x0000000b:
+ case 0x0000000c:
+ case 0x0000000d:
+ __PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial_0000000d, type);
+ __PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial_0000000d, instance);
+ __PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial_0000000d, buffer);
+
+ switch (domctl->u.hvmcontext_partial_0000000d.type) {
+ case VKI_HVM_SAVE_CODE(CPU):
+ if ( domctl->u.hvmcontext_partial_0000000d.buffer.p )
+ PRE_MEM_WRITE("XEN_DOMCTL_gethvmcontext_partial *buffer",
+ (Addr)domctl->u.hvmcontext_partial_0000000d.buffer.p,
+ VKI_HVM_SAVE_LENGTH(CPU));
+ break;
+ case VKI_HVM_SAVE_CODE(MTRR):
+ if ( domctl->u.hvmcontext_partial_0000000d.buffer.p )
+ PRE_MEM_WRITE("XEN_DOMCTL_gethvmcontext_partial *buffer",
+ (Addr)domctl->u.hvmcontext_partial_0000000d.buffer.p,
+ VKI_HVM_SAVE_LENGTH(MTRR));
+ break;
+ default:
+ bad_subop(tid, layout, arrghs, status, flags,
"__HYPERVISOR_domctl_gethvmcontext_partial type",
- domctl->u.hvmcontext_partial.type);
- break;
- }
- break;
+ domctl->u.hvmcontext_partial_0000000d.type);
+ break;
+ }
+ break;
+ }
+ break;
case VKI_XEN_DOMCTL_max_mem:
PRE_XEN_DOMCTL_READ(max_mem, max_memkb);
@@ -2145,14 +2155,24 @@ POST(domctl){
break;
case VKI_XEN_DOMCTL_gethvmcontext_partial:
- switch (domctl->u.hvmcontext_partial.type) {
- case VKI_HVM_SAVE_CODE(CPU):
- if ( domctl->u.hvmcontext_partial.buffer.p )
- POST_MEM_WRITE((Addr)domctl->u.hvmcontext_partial.buffer.p,
- VKI_HVM_SAVE_LENGTH(CPU));
- break;
- }
- break;
+ switch (domctl->interface_version) {
+ case 0x00000007:
+ case 0x00000008:
+ case 0x00000009:
+ case 0x0000000a:
+ case 0x0000000b:
+ case 0x0000000c:
+ case 0x0000000d:
+ switch (domctl->u.hvmcontext_partial_0000000d.type) {
+ case VKI_HVM_SAVE_CODE(CPU):
+ if ( domctl->u.hvmcontext_partial_0000000d.buffer.p )
+ POST_MEM_WRITE((Addr)domctl->u.hvmcontext_partial_0000000d.buffer.p,
+ VKI_HVM_SAVE_LENGTH(CPU));
+ break;
+ }
+ break;
+ }
+ break;
case VKI_XEN_DOMCTL_scheduler_op:
if ( domctl->u.scheduler_op.cmd == VKI_XEN_DOMCTL_SCHEDOP_getinfo ) {
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index c02357dd7..c225287a7 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -436,13 +436,13 @@ struct vki_xen_domctl_hvmcontext {
typedef struct vki_xen_domctl_hvmcontext vki_xen_domctl_hvmcontext_t;
DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_t);
-struct vki_xen_domctl_hvmcontext_partial {
+struct vki_xen_domctl_hvmcontext_partial_0000000d {
vki_uint32_t type; /* IN */
vki_uint32_t instance; /* IN */
VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* IN/OUT buffer */
};
-typedef struct vki_xen_domctl_hvmcontext_partial vki_xen_domctl_hvmcontext_partial_t;
-DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_partial_t);
+typedef struct vki_xen_domctl_hvmcontext_partial_0000000d vki_xen_domctl_hvmcontext_partial_0000000d_t;
+DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_partial_0000000d_t);
struct vki_xen_domctl_pin_mem_cacheattr {
@@ -733,7 +733,7 @@ struct vki_xen_domctl {
struct vki_xen_domctl_tsc_info_0000000b tsc_info_0000000b;
//struct vki_xen_domctl_real_mode_area real_mode_area;
struct vki_xen_domctl_hvmcontext hvmcontext;
- struct vki_xen_domctl_hvmcontext_partial hvmcontext_partial;
+ struct vki_xen_domctl_hvmcontext_partial_0000000d hvmcontext_partial_0000000d;
struct vki_xen_domctl_address_size address_size;
//struct vki_xen_domctl_sendtrigger sendtrigger;
//struct vki_xen_domctl_get_device_group get_device_group;
From 2f75c6af0f30cd3911ca3452734c1020fe2e2572 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:43 +0100
Subject: [PATCH 54/75] xen-4.10: hvmcontext_partial
Handle new layout of xen_domctl_hvmcontext_partial of xen-4.10
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 34 +++++++++++++++++++++++++++++++
include/vki/vki-xen-domctl.h | 9 ++++++++
2 files changed, 43 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 6f6d040a9..a73e702cc 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -904,6 +904,32 @@ PRE(domctl)
break;
}
break;
+ case 0x0000000e:
+ __PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial_0000000e, type);
+ __PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial_0000000e, instance);
+ __PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial_0000000e, bufsz);
+ __PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial_0000000e, buffer);
+
+ switch (domctl->u.hvmcontext_partial_0000000e.type) {
+ case VKI_HVM_SAVE_CODE(CPU):
+ if ( domctl->u.hvmcontext_partial_0000000e.buffer.p )
+ PRE_MEM_WRITE("XEN_DOMCTL_gethvmcontext_partial *buffer",
+ (Addr)domctl->u.hvmcontext_partial_0000000e.buffer.p,
+ VKI_HVM_SAVE_LENGTH(CPU));
+ break;
+ case VKI_HVM_SAVE_CODE(MTRR):
+ if ( domctl->u.hvmcontext_partial_0000000e.buffer.p )
+ PRE_MEM_WRITE("XEN_DOMCTL_gethvmcontext_partial *buffer",
+ (Addr)domctl->u.hvmcontext_partial_0000000e.buffer.p,
+ VKI_HVM_SAVE_LENGTH(MTRR));
+ break;
+ default:
+ bad_subop(tid, layout, arrghs, status, flags,
+ "__HYPERVISOR_domctl_gethvmcontext_partial type",
+ domctl->u.hvmcontext_partial_0000000e.type);
+ break;
+ }
+ break;
}
break;
@@ -2170,6 +2196,14 @@ POST(domctl){
VKI_HVM_SAVE_LENGTH(CPU));
break;
}
+ case 0x0000000e:
+ switch (domctl->u.hvmcontext_partial_0000000e.type) {
+ case VKI_HVM_SAVE_CODE(CPU):
+ if ( domctl->u.hvmcontext_partial_0000000e.buffer.p )
+ POST_MEM_WRITE((Addr)domctl->u.hvmcontext_partial_0000000e.buffer.p,
+ VKI_HVM_SAVE_LENGTH(CPU));
+ break;
+ }
break;
}
break;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index c225287a7..d0c9c28e1 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -444,6 +444,14 @@ struct vki_xen_domctl_hvmcontext_partial_0000000d {
typedef struct vki_xen_domctl_hvmcontext_partial_0000000d vki_xen_domctl_hvmcontext_partial_0000000d_t;
DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_partial_0000000d_t);
+struct vki_xen_domctl_hvmcontext_partial_0000000e {
+ vki_uint32_t type; /* IN */
+ vki_uint32_t instance; /* IN */
+ vki_xen_uint64_aligned_t bufsz; /* IN */
+ VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* IN/OUT buffer */
+};
+typedef struct vki_xen_domctl_hvmcontext_partial_0000000e vki_xen_domctl_hvmcontext_partial_0000000e_t;
+DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_partial_0000000e_t);
struct vki_xen_domctl_pin_mem_cacheattr {
vki_xen_uint64_aligned_t start, end; /* IN */
@@ -734,6 +742,7 @@ struct vki_xen_domctl {
//struct vki_xen_domctl_real_mode_area real_mode_area;
struct vki_xen_domctl_hvmcontext hvmcontext;
struct vki_xen_domctl_hvmcontext_partial_0000000d hvmcontext_partial_0000000d;
+ struct vki_xen_domctl_hvmcontext_partial_0000000e hvmcontext_partial_0000000e;
struct vki_xen_domctl_address_size address_size;
//struct vki_xen_domctl_sendtrigger sendtrigger;
//struct vki_xen_domctl_get_device_group get_device_group;
From e58ecf1802b3e48ad001f868910399a77e8f2176 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:44 +0100
Subject: [PATCH 55/75] xen-4.10: xen_domctl_monitor_op
Handle new layout of xen_domctl_monitor_op in xen-4.10
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 20 ++++++++++++
include/vki/vki-xen-domctl.h | 51 +++++++++++++++++++++++++++++++
2 files changed, 71 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index a73e702cc..05d66bc1d 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -2446,6 +2446,7 @@ POST(domctl){
break;
case 0x000000c:
+ case 0x000000d:
if (domctl->u.monitor_op_0000000c.op == VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES) {
switch(domctl->u.monitor_op_0000000c.event) {
case VKI_XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG:
@@ -2463,6 +2464,25 @@ POST(domctl){
}
}
+ break;
+ case 0x000000e:
+ if (domctl->u.monitor_op_0000000e.op == VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES) {
+ switch(domctl->u.monitor_op_0000000e.event) {
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_0000000e, u.mov_to_cr);
+ break;
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_0000000e, u.mov_to_msr);
+ break;
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_0000000e, u.guest_request);
+ break;
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_0000000e, u.debug_exception);
+ break;
+ }
+ }
+
break;
}
break;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index d0c9c28e1..e7c38a57b 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -679,6 +679,56 @@ struct vki_xen_domctl_monitor_op_0000000c {
} u;
};
+struct vki_xen_domctl_monitor_op_0000000e {
+ vki_uint32_t op; /* vki_xen_DOMCTL_MONITOR_OP_* */
+
+ /*
+ * When used with ENABLE/DISABLE this has to be set to
+ * the requested vki_xen_DOMCTL_MONITOR_EVENT_* value.
+ * With GET_CAPABILITIES this field returns a bitmap of
+ * events supported by the platform, in the format
+ * (1 << vki_xen_DOMCTL_MONITOR_EVENT_*).
+ */
+ vki_uint32_t event;
+
+ /*
+ * Further options when issuing vki_xen_DOMCTL_MONITOR_OP_ENABLE.
+ */
+ union {
+ struct {
+ /* Which control register */
+ vki_uint8_t index;
+ /* Pause vCPU until response */
+ vki_uint8_t sync;
+ /* Send event only on a change of value */
+ vki_uint8_t onchangeonly;
+ /* Allignment padding */
+ vki_uint8_t pad1;
+ vki_uint32_t pad2;
+ /*
+ * Send event only if the changed bit in the control register
+ * is not masked.
+ */
+ vki_xen_uint64_aligned_t bitmask;
+ } mov_to_cr;
+
+ struct {
+ vki_uint32_t msr;
+ } mov_to_msr;
+
+ struct {
+ /* Pause vCPU until response */
+ vki_uint8_t sync;
+ vki_uint8_t allow_userspace;
+ } guest_request;
+
+ struct {
+ /* Pause vCPU until response */
+ vki_uint8_t sync;
+ } debug_exception;
+ } u;
+};
+
struct vki_xen_domctl_monitor_op {
vki_uint32_t op;
@@ -777,6 +827,7 @@ struct vki_xen_domctl {
//struct vki_xen_domctl_gdbsx_domstatus gdbsx_domstatus;
struct vki_xen_domctl_monitor_op_0000000b monitor_op_0000000b;
struct vki_xen_domctl_monitor_op_0000000c monitor_op_0000000c;
+ struct vki_xen_domctl_monitor_op_0000000e monitor_op_0000000e;
//struct vki_xen_domctl_vnuma vnuma;
//struct vki_xen_domctl_psr_cmt_op psr_cmt_op;
//struct vki_xen_domctl_psr_cat_op psr_cat_op;
From 100ac066c9b5025219bd2bcbbbef31c25a2584d8 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:46 +0100
Subject: [PATCH 56/75] xen-4.10: add monitor event EMUL_UNIMPLEMENTED
Add define for XEN_DOMCTL_MONITOR_EVENT_EMUL_UNIMPLEMENTED
bz#390553
---
include/vki/vki-xen-domctl.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index e7c38a57b..465f66bec 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -600,6 +600,7 @@ struct vki_xen_domctl_vcpu_msrs {
#define VKI_XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL 7
#define VKI_XEN_DOMCTL_MONITOR_EVENT_INTERRUPT 8
#define VKI_XEN_DOMCTL_MONITOR_EVENT_DESC_ACCESS 9
+#define VKI_XEN_DOMCTL_MONITOR_EVENT_EMUL_UNIMPLEMENTED 10
struct vki_xen_domctl_monitor_op_0000000b {
vki_uint32_t op; /* vki_xen_DOMCTL_MONITOR_OP_* */
From 3dca8dec04b455d5768e228297d22d99b736c809 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:47 +0100
Subject: [PATCH 57/75] xen-4.10: add set_gnttab_limits and vuart_op
Add defines for XEN_DOMCTL_set_gnttab_limits and XEN_DOMCTL_vuart_op
bz#390553
---
include/vki/vki-xen-domctl.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 465f66bec..b1068eb13 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -127,6 +127,8 @@
#define VKI_XEN_DOMCTL_monitor_op 77 /* new in 4.6 */
#define VKI_XEN_DOMCTL_psr_cat_op 78
#define VKI_XEN_DOMCTL_soft_reset 79
+#define VKI_XEN_DOMCTL_set_gnttab_limits 80
+#define VKI_XEN_DOMCTL_vuart_op 81
#define VKI_XEN_DOMCTL_gdbsx_guestmemio 1000
#define VKI_XEN_DOMCTL_gdbsx_pausevcpu 1001
#define VKI_XEN_DOMCTL_gdbsx_unpausevcpu 1002
@@ -832,6 +834,8 @@ struct vki_xen_domctl {
//struct vki_xen_domctl_vnuma vnuma;
//struct vki_xen_domctl_psr_cmt_op psr_cmt_op;
//struct vki_xen_domctl_psr_cat_op psr_cat_op;
+ //struct vki_xen_domctl_set_gnttab_limits set_gnttab_limits;
+ //struct vki_xen_domctl_vuart_op vuart_op;
vki_uint8_t pad[128];
} u;
};
From 0e657d18770914c7c02db8748b44d189390de319 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:48 +0100
Subject: [PATCH 58/75] xen-4.10: sysctl value
Add 0x10 as sysctl value of xen-4.10
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-sysctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 05d66bc1d..2b33b06bc 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -589,6 +589,7 @@ PRE(sysctl) {
case 0x0000000d:
case 0x0000000e:
case 0x0000000f:
+ case 0x00000010:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -1893,6 +1894,7 @@ POST(sysctl)
case 0x0000000d:
case 0x0000000e:
case 0x0000000f:
+ case 0x00000010:
break;
default:
return;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 214a652b8..7b6e78d85 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -13,6 +13,7 @@
* - 0x0000000d: Xen 4.7
* - 0x0000000e: Xen 4.8
* - 0x0000000f: Xen 4.9
+ * - 0x00000010: Xen 4.10
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From e3070fed0faf48b9a23122b13b831caaed5f2c30 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:49 +0100
Subject: [PATCH 59/75] xen-4.10: xen_sysctl_physinfo
Handle new layout of xen_sysctl_physinfo in xen-4.10
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 16 ++++++++++++++++
include/vki/vki-xen-sysctl.h | 18 ++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 2b33b06bc..88db3a214 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -1988,6 +1988,22 @@ POST(sysctl)
POST_XEN_SYSCTL_WRITE(physinfo_0000000a, hw_cap[8]);
POST_XEN_SYSCTL_WRITE(physinfo_0000000a, capabilities);
break;
+ case 0x00000010:
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, threads_per_core);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, cores_per_socket);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, nr_cpus);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, max_cpu_id);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, nr_nodes);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, max_node_id);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, cpu_khz);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, capabilities);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, total_pages);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, free_pages);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, scrub_pages);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, outstanding_pages);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, max_mfn);
+ POST_XEN_SYSCTL_WRITE(physinfo_00000010, hw_cap[8]);
+ break;
}
break;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index 7b6e78d85..e371b81e4 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -206,6 +206,23 @@ struct vki_xen_sysctl_physinfo_0000000a {
vki_uint32_t capabilities;
};
+struct vki_xen_sysctl_physinfo_00000010 {
+ vki_uint32_t threads_per_core;
+ vki_uint32_t cores_per_socket;
+ vki_uint32_t nr_cpus; /* # CPUs currently online */
+ vki_uint32_t max_cpu_id; /* Largest possible CPU ID on this host */
+ vki_uint32_t nr_nodes; /* # nodes currently online */
+ vki_uint32_t max_node_id; /* Largest possible node ID on this host */
+ vki_uint32_t cpu_khz;
+ vki_uint32_t capabilities; /* XEN_SYSCTL_PHYSCAP_??? */
+ vki_xen_uint64_aligned_t total_pages;
+ vki_xen_uint64_aligned_t free_pages;
+ vki_xen_uint64_aligned_t scrub_pages;
+ vki_xen_uint64_aligned_t outstanding_pages;
+ vki_xen_uint64_aligned_t max_mfn; /* Largest possible MFN on this host */
+ vki_uint32_t hw_cap[8];
+};
+
/* vki_xen_sysctl_physinfo_0000000b is the same as 0000000a */
struct vki_xen_sysctl_sched_id {
@@ -227,6 +244,7 @@ struct vki_xen_sysctl {
//struct vki_xen_sysctl_tbuf_op tbuf_op;
struct vki_xen_sysctl_physinfo_00000008 physinfo_00000008;
struct vki_xen_sysctl_physinfo_0000000a physinfo_0000000a;
+ struct vki_xen_sysctl_physinfo_00000010 physinfo_00000010;
struct vki_xen_sysctl_topologyinfo topologyinfo;
struct vki_xen_sysctl_cputopoinfo_0000000c cputopoinfo_0000000c;
struct vki_xen_sysctl_pcitopoinfo_0000000c pcitopoinfo_0000000c;
From 4bffbd293849bdc43f479324bd19f3443af40654 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:50 +0100
Subject: [PATCH 60/75] xen: handle xen_sysctl_physinfo for more sysctl
versions
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 88db3a214..39abac4e4 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -1974,6 +1974,10 @@ POST(sysctl)
break;
case 0x0000000a:
case 0x0000000b:
+ case 0x0000000c:
+ case 0x0000000d:
+ case 0x0000000e:
+ case 0x0000000f:
POST_XEN_SYSCTL_WRITE(physinfo_0000000a, threads_per_core);
POST_XEN_SYSCTL_WRITE(physinfo_0000000a, cores_per_socket);
POST_XEN_SYSCTL_WRITE(physinfo_0000000a, nr_cpus);
From b6216ed6015ef7d9ff3256b054241a20adfc08ab Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:51 +0100
Subject: [PATCH 61/75] xen-4.10: add set_parameter
Add define for XEN_SYSCTL_set_parameter
bz#390553
---
include/vki/vki-xen-sysctl.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index e371b81e4..d5980a41e 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -52,6 +52,7 @@
#define VKI_XEN_SYSCTL_get_cpu_levelling_caps 25
#define VKI_XEN_SYSCTL_get_cpu_featureset 26
#define VKI_XEN_SYSCTL_livepatch_op 27
+#define VKI_XEN_SYSCTL_set_parameter 28
struct vki_xen_sysctl_readconsole {
/* IN */
@@ -274,6 +275,7 @@ struct vki_xen_sysctl {
//struct vki_xen_sysctl_cpu_levelling_caps cpu_levelling_caps;
struct vki_xen_sysctl_cpu_featureset_0000000d cpu_featureset_0000000d;
//struct vki_xen_sysctl_livepatch_op livepatch;
+ //struct vki_xen_sysctl_set_parameter set_parameter;
vki_uint8_t pad[128];
} u;
From da8c77c57f85013c19eaa3c597cfb2169697453e Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:52 +0100
Subject: [PATCH 62/75] xen: add a concept of "use the latest"
In coregrind/m_syswrap/syswrap-xen.c the handlers of sysctl and domctl check
the current ->interface_version. If it is not yet known, an error is reported.
Otherwise the current ->cmd is processed. Several commands handle various
->interface_version. But none of these handlers have a concept of "use the
latest". If a new interface_version is added at the beginning of the list, each
and every handler must be updated with the newly added version number. I think
it would be simpler to check the supported versions as it is done now, then
each handler uses the latest layout in a "default:" case.
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 40 +++++++++++++++++--------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 39abac4e4..3d525fe2d 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -632,16 +632,11 @@ PRE(sysctl) {
break;
case 0x0000000a:
case 0x0000000b:
+ default:
PRE_XEN_SYSCTL_READ(getdomaininfolist_0000000a, first_domain);
PRE_XEN_SYSCTL_READ(getdomaininfolist_0000000a, max_domains);
PRE_XEN_SYSCTL_READ(getdomaininfolist_0000000a, buffer);
break;
- default:
- VG_(dmsg)("WARNING: XEN_SYSCTL_getdomaininfolist for sysctl version "
- "%"PRIx32" not implemented yet\n",
- sysctl->interface_version);
- SET_STATUS_Failure(VKI_EINVAL);
- return;
}
break;
@@ -906,6 +901,7 @@ PRE(domctl)
}
break;
case 0x0000000e:
+ default:
__PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial_0000000e, type);
__PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial_0000000e, instance);
__PRE_XEN_DOMCTL_READ(gethvmcontext_partial, hvmcontext_partial_0000000e, bufsz);
@@ -973,6 +969,7 @@ PRE(domctl)
}
break;
case 0x0000000e:
+ default:
__PRE_XEN_DOMCTL_READ(test_assign_device, assign_device_0000000e, dev);
__PRE_XEN_DOMCTL_READ(test_assign_device, assign_device_0000000e, flags);
switch (domctl->u.assign_device_0000000e.dev) {
@@ -1025,6 +1022,7 @@ PRE(domctl)
}
break;
case 0x0000000e:
+ default:
__PRE_XEN_DOMCTL_READ(assign_device, assign_device_0000000e, dev);
__PRE_XEN_DOMCTL_READ(assign_device, assign_device_0000000e, flags);
switch (domctl->u.assign_device_0000000e.dev) {
@@ -1077,6 +1075,7 @@ PRE(domctl)
}
break;
case 0x0000000e:
+ default:
__PRE_XEN_DOMCTL_READ(deassign_device, assign_device_0000000e, dev);
__PRE_XEN_DOMCTL_READ(deassign_device, assign_device_0000000e, flags);
switch (domctl->u.assign_device_0000000e.dev) {
@@ -1111,6 +1110,7 @@ PRE(domctl)
__PRE_XEN_DOMCTL_READ(settscinfo, tsc_info_00000007, info.elapsed_nsec);
break;
case 0x0000000b:
+ default:
__PRE_XEN_DOMCTL_READ(settscinfo, tsc_info_0000000b, tsc_mode);
__PRE_XEN_DOMCTL_READ(settscinfo, tsc_info_0000000b, gtsc_khz);
__PRE_XEN_DOMCTL_READ(settscinfo, tsc_info_0000000b, incarnation);
@@ -1149,6 +1149,7 @@ PRE(domctl)
PRE_XEN_DOMCTL_READ(settimeoffset_0000000a, time_offset_seconds);
break;
case 0x0000000b:
+ default:
PRE_XEN_DOMCTL_READ(settimeoffset_0000000b, time_offset_seconds);
break;
}
@@ -1196,6 +1197,7 @@ PRE(domctl)
__PRE_XEN_DOMCTL_READ(getvcpuaffinity, vcpuaffinity_00000009, cpumap.nr_bits);
break;
case 0x0000000a:
+ default:
__PRE_XEN_DOMCTL_READ(getvcpuaffinity, vcpuaffinity_0000000a, vcpu);
if (domctl->u.vcpuaffinity_0000000a.flags & VKI_XEN_VCPUAFFINITY_HARD)
__PRE_XEN_DOMCTL_READ(
@@ -1219,6 +1221,7 @@ PRE(domctl)
domctl->u.vcpuaffinity_00000009.cpumap.nr_bits / 8);
break;
case 0x0000000a:
+ default:
__PRE_XEN_DOMCTL_READ(setvcpuaffinity, vcpuaffinity_0000000a, vcpu);
__PRE_XEN_DOMCTL_READ(setvcpuaffinity, vcpuaffinity_0000000a, flags);
if (domctl->u.vcpuaffinity_0000000a.flags & VKI_XEN_VCPUAFFINITY_HARD) {
@@ -1275,13 +1278,8 @@ PRE(domctl)
break;
case 0x00000009:
- __PRE_XEN_DOMCTL_READ(get_ext_vcpucontext, ext_vcpucontext_00000009, vcpu);
- break;
-
default:
- VG_(dmsg)("WARNING: VKI_XEN_DOMCTL_get_ext_vcpucontext domctl version %#"
- PRIx32" not implemented\n", domctl->interface_version);
- SET_STATUS_Failure(VKI_EINVAL);
+ __PRE_XEN_DOMCTL_READ(get_ext_vcpucontext, ext_vcpucontext_00000009, vcpu);
break;
}
break;
@@ -1315,6 +1313,7 @@ PRE(domctl)
break;
case 0x00000009:
+ default:
__PRE_XEN_DOMCTL_READ(set_ext_vcpucontext, ext_vcpucontext_00000009, vcpu);
__PRE_XEN_DOMCTL_READ(set_ext_vcpucontext, ext_vcpucontext_00000009, size);
#if defined(__i386__) || defined(__x86_64__)
@@ -1343,12 +1342,6 @@ PRE(domctl)
}
#endif
break;
-
- default:
- VG_(dmsg)("WARNING: VKI_XEN_DOMCTL_set_ext_vcpucontext domctl version %#"
- PRIx32" not implemented\n", domctl->interface_version);
- SET_STATUS_Failure(VKI_EINVAL);
- break;
}
break;
@@ -1453,6 +1446,7 @@ PRE(domctl)
__PRE_XEN_DOMCTL_READ(mem_event_op, mem_event_op_00000007, mode);
break;
case 0x0000000b:
+ default:
__PRE_XEN_DOMCTL_READ(vm_event_op, vm_event_op_0000000b, op);
__PRE_XEN_DOMCTL_READ(vm_event_op, vm_event_op_0000000b, mode);
break;
@@ -1483,6 +1477,7 @@ PRE(domctl)
case VKI_XEN_DOMCTL_monitor_op:
switch (domctl->interface_version) {
case 0x000000b:
+ default:
if (domctl->u.monitor_op_0000000b.op == VKI_XEN_DOMCTL_MONITOR_OP_ENABLE ||
domctl->u.monitor_op_0000000b.op == VKI_XEN_DOMCTL_MONITOR_OP_DISABLE) {
switch (domctl->u.monitor_op_0000000b.event) {
@@ -1929,6 +1924,7 @@ POST(sysctl)
break;
case 0x0000000a:
case 0x0000000b:
+ default:
POST_XEN_SYSCTL_WRITE(getdomaininfolist_0000000a, num_domains);
POST_MEM_WRITE((Addr)sysctl->u.getdomaininfolist_0000000a.buffer.p,
sizeof(*sysctl->u.getdomaininfolist_0000000a.buffer.p)
@@ -1993,6 +1989,7 @@ POST(sysctl)
POST_XEN_SYSCTL_WRITE(physinfo_0000000a, capabilities);
break;
case 0x00000010:
+ default:
POST_XEN_SYSCTL_WRITE(physinfo_00000010, threads_per_core);
POST_XEN_SYSCTL_WRITE(physinfo_00000010, cores_per_socket);
POST_XEN_SYSCTL_WRITE(physinfo_00000010, nr_cpus);
@@ -2175,6 +2172,7 @@ POST(domctl){
sizeof(vki_xen_guest_tsc_info_t));
break;
case 0x0000000b:
+ default:
__POST_XEN_DOMCTL_WRITE(gettscinfo, tsc_info_0000000b, tsc_mode);
__POST_XEN_DOMCTL_WRITE(gettscinfo, tsc_info_0000000b, gtsc_khz);
__POST_XEN_DOMCTL_WRITE(gettscinfo, tsc_info_0000000b, incarnation);
@@ -2219,6 +2217,7 @@ POST(domctl){
break;
}
case 0x0000000e:
+ default:
switch (domctl->u.hvmcontext_partial_0000000e.type) {
case VKI_HVM_SAVE_CODE(CPU):
if ( domctl->u.hvmcontext_partial_0000000e.buffer.p )
@@ -2267,6 +2266,7 @@ POST(domctl){
domctl->u.vcpuaffinity_00000009.cpumap.nr_bits / 8);
break;
case 0x0000000a:
+ default:
if (domctl->u.vcpuaffinity_0000000a.flags & VKI_XEN_VCPUAFFINITY_HARD)
POST_MEM_WRITE(
(Addr)domctl->u.vcpuaffinity_0000000a.cpumap_hard.bitmap.p,
@@ -2316,6 +2316,7 @@ POST(domctl){
break;
case 0x00000009:
case 0x0000000a:
+ default:
POST_XEN_DOMCTL_WRITE(getdomaininfo_00000009, domain);
POST_XEN_DOMCTL_WRITE(getdomaininfo_00000009, flags);
POST_XEN_DOMCTL_WRITE(getdomaininfo_00000009, tot_pages);
@@ -2368,6 +2369,7 @@ POST(domctl){
break;
case 0x00000009:
+ default:
__POST_XEN_DOMCTL_WRITE(get_ext_vcpucontext, ext_vcpucontext_00000009, size);
#if defined(__i386__) || defined(__x86_64__)
__POST_XEN_DOMCTL_WRITE(get_ext_vcpucontext, ext_vcpucontext_00000009,
@@ -2444,6 +2446,7 @@ POST(domctl){
__POST_XEN_DOMCTL_WRITE(mem_event_op, mem_event_op_00000007, port);
break;
case 0x0000000b:
+ default:
__POST_XEN_DOMCTL_WRITE(vm_event_op, vm_event_op_0000000b, port);
break;
}
@@ -2488,6 +2491,7 @@ POST(domctl){
break;
case 0x000000e:
+ default:
if (domctl->u.monitor_op_0000000e.op == VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES) {
switch(domctl->u.monitor_op_0000000e.event) {
case VKI_XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG:
From e1f15f6161f44834ace37f2bcba091893baeee23 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:53 +0100
Subject: [PATCH 63/75] xen: support
XENMEM_set_pod_target/XENMEM_get_pod_target
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 20 ++++++++++++++++++++
include/vki/vki-xen-memory.h | 8 ++++++++
2 files changed, 28 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 3d525fe2d..2acbd7a1a 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -234,6 +234,16 @@ PRE(memory_op)
case VKI_XENMEM_get_sharing_shared_pages:
break;
+ case VKI_XENMEM_get_pod_target:
+ case VKI_XENMEM_set_pod_target: {
+ struct vki_xen_pod_target *arg =
+ (struct vki_xen_pod_target *)ARG2;
+ PRE_MEM_READ("XENMEM_set_pod_target target_pages",
+ (Addr)&arg->target_pages, sizeof(arg->target_pages));
+ PRE_MEM_READ("XENMEM_set_pod_target domid",
+ (Addr)&arg->domid, sizeof(arg->domid));
+ break;
+ }
case VKI_XENMEM_access_op: {
struct vki_xen_mem_event_op *arg =
(struct vki_xen_mem_event_op *)ARG2;
@@ -1684,6 +1694,7 @@ POST(memory_op)
case VKI_XENMEM_claim_pages:
case VKI_XENMEM_maximum_gpfn:
case VKI_XENMEM_remove_from_physmap:
+ case VKI_XENMEM_set_pod_target:
case VKI_XENMEM_access_op:
/* No outputs */
break;
@@ -1728,6 +1739,15 @@ POST(memory_op)
case VKI_XENMEM_get_sharing_shared_pages:
/* No outputs */
break;
+ case VKI_XENMEM_get_pod_target: {
+ struct vki_xen_pod_target *arg =
+ (struct vki_xen_pod_target *)ARG2;
+ POST_MEM_WRITE((Addr)&arg->tot_pages, sizeof(arg->tot_pages));
+ POST_MEM_WRITE((Addr)&arg->pod_cache_pages, sizeof(arg->pod_cache_pages));
+ POST_MEM_WRITE((Addr)&arg->pod_entries, sizeof(arg->pod_entries));
+ }
+ break;
+
}
}
diff --git a/include/vki/vki-xen-memory.h b/include/vki/vki-xen-memory.h
index 49565636b..ae77d49c7 100644
--- a/include/vki/vki-xen-memory.h
+++ b/include/vki/vki-xen-memory.h
@@ -99,6 +99,14 @@ struct vki_xen_remove_from_physmap {
vki_xen_pfn_t gpfn;
};
+struct vki_xen_pod_target {
+ vki_uint64_t target_pages;
+ vki_uint64_t tot_pages;
+ vki_uint64_t pod_cache_pages;
+ vki_uint64_t pod_entries;
+ vki_xen_domid_t domid;
+};
+
struct vki_xen_mem_event_op {
vki_uint8_t op;
vki_xen_domid_t domain;
From a1fc996be8b022a140fd35c3fbe613d49e625e6b Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:54 +0100
Subject: [PATCH 64/75] xen-4.10: support xen_domctl_set_gnttab_limits
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 10 ++++++++++
include/vki/vki-xen-domctl.h | 7 ++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 2acbd7a1a..07b092bf4 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -1509,6 +1509,16 @@ PRE(domctl)
}
break;
+ case VKI_XEN_DOMCTL_set_gnttab_limits:
+ switch (domctl->interface_version) {
+ case 0x000000e:
+ default:
+ PRE_XEN_DOMCTL_READ(set_gnttab_limits_0000000e, grant_frames);
+ PRE_XEN_DOMCTL_READ(set_gnttab_limits_0000000e, maptrack_frames);
+ break;
+ }
+ break;
+
default:
bad_subop(tid, layout, arrghs, status, flags,
"__HYPERVISOR_domctl", domctl->cmd);
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index b1068eb13..a6d7d7515 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -755,6 +755,11 @@ struct vki_xen_domctl_monitor_op {
} u;
};
+struct vki_xen_domctl_set_gnttab_limits_0000000e {
+ vki_uint32_t grant_frames;
+ vki_uint32_t maptrack_frames;
+};
+
struct vki_xen_domctl {
vki_uint32_t cmd;
vki_uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
@@ -834,7 +839,7 @@ struct vki_xen_domctl {
//struct vki_xen_domctl_vnuma vnuma;
//struct vki_xen_domctl_psr_cmt_op psr_cmt_op;
//struct vki_xen_domctl_psr_cat_op psr_cat_op;
- //struct vki_xen_domctl_set_gnttab_limits set_gnttab_limits;
+ struct vki_xen_domctl_set_gnttab_limits_0000000e set_gnttab_limits_0000000e;
//struct vki_xen_domctl_vuart_op vuart_op;
vki_uint8_t pad[128];
} u;
From 8755f7fc7d33cdd447dfeb6101a66bc737c98ee7 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:55 +0100
Subject: [PATCH 65/75] xen-4.10: add domctl value from shim
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-domctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 07b092bf4..ff933c1be 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -795,6 +795,7 @@ PRE(domctl)
case 0x0000000c:
case 0x0000000d:
case 0x0000000e:
+ case 0x0000000f:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -2141,6 +2142,7 @@ POST(domctl){
case 0x0000000c:
case 0x0000000d:
case 0x0000000e:
+ case 0x0000000f:
break;
default:
return;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index a6d7d7515..62a72f897 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -40,6 +40,7 @@
* - 0x0000000c: Xen 4.8
* - 0x0000000d: Xen 4.9
* - 0x0000000e: Xen 4.10
+ * - 0x0000000f: Xen 4.10 with shim
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 77ba331dda8cf1b5675ec55e5eed383822d06af0 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Fri, 16 Nov 2018 17:29:56 +0100
Subject: [PATCH 66/75] xen-4.10: xen_domctl_getdomaininfo
Handle new layout of xen_getdomaininfo in xen-4.10 shim
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 26 +++++++++++++++++++++++++-
include/vki/vki-xen-domctl.h | 23 +++++++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index ff933c1be..a9b61030b 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -2348,7 +2348,6 @@ POST(domctl){
break;
case 0x00000009:
case 0x0000000a:
- default:
POST_XEN_DOMCTL_WRITE(getdomaininfo_00000009, domain);
POST_XEN_DOMCTL_WRITE(getdomaininfo_00000009, flags);
POST_XEN_DOMCTL_WRITE(getdomaininfo_00000009, tot_pages);
@@ -2363,6 +2362,31 @@ POST(domctl){
POST_XEN_DOMCTL_WRITE(getdomaininfo_00000009, ssidref);
POST_XEN_DOMCTL_WRITE(getdomaininfo_00000009, handle);
POST_XEN_DOMCTL_WRITE(getdomaininfo_00000009, cpupool);
+ case 0x0000000f:
+ default:
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, domain);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, flags);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, tot_pages);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, max_pages);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, outstanding_pages);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, shr_pages);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, paged_pages);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, shared_info_frame);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, cpu_time);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, nr_online_vcpus);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, max_vcpu_id);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, ssidref);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, handle);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, cpupool);
+ POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, arch_config);
+#if defined(__i386__) || defined(__x86_64__)
+ __POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, getdomaininfo_0000000f, arch_config.emulation_flags);
+#endif
+#if defined(__arm__) || defined(__aarch64__)
+ __POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, getdomaininfo_0000000f, arch_config.gic_version);
+ __POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, getdomaininfo_0000000f, arch_config.nr_spis);
+ __POST_XEN_DOMCTL_WRITE(getdomaininfo_0000000f, getdomaininfo_0000000f, arch_config.clock_frequency);
+#endif
break;
}
break;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index 62a72f897..f1d78e4f2 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -245,6 +245,28 @@ DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000009_t);
/* vki_xen_domctl_getdomaininfo_0000000a is the same as 00000009 */
+struct vki_xen_domctl_getdomaininfo_0000000f {
+ /* OUT variables. */
+ vki_xen_domid_t domain;
+ vki_uint32_t flags;
+ vki_xen_uint64_aligned_t tot_pages;
+ vki_xen_uint64_aligned_t max_pages;
+ vki_xen_uint64_aligned_t outstanding_pages;
+ vki_xen_uint64_aligned_t shr_pages;
+ vki_xen_uint64_aligned_t paged_pages;
+ vki_xen_uint64_aligned_t shared_info_frame;
+ vki_xen_uint64_aligned_t cpu_time;
+ vki_uint32_t nr_online_vcpus;
+ vki_uint32_t max_vcpu_id;
+ vki_uint32_t ssidref;
+ vki_xen_domain_handle_t handle;
+ vki_uint32_t cpupool;
+ struct vki_xen_arch_domainconfig_0000000c arch_config;
+};
+typedef struct vki_xen_domctl_getdomaininfo_0000000f vki_xen_domctl_getdomaininfo_0000000f_t;
+DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_0000000f_t);
+
+
/* Get/set the NUMA node(s) with which the guest has affinity with. */
/* XEN_DOMCTL_setnodeaffinity */
/* XEN_DOMCTL_getnodeaffinity */
@@ -773,6 +795,7 @@ struct vki_xen_domctl {
struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007;
struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008;
struct vki_xen_domctl_getdomaininfo_00000009 getdomaininfo_00000009;
+ struct vki_xen_domctl_getdomaininfo_0000000f getdomaininfo_0000000f;
//struct vki_xen_domctl_getmemlist getmemlist;
//struct vki_xen_domctl_getpageframeinfo getpageframeinfo;
//struct vki_xen_domctl_getpageframeinfo2 getpageframeinfo2;
From 05f94a0834c568cbb4b827ee0600db297e354fec Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Tue, 20 Nov 2018 10:14:52 +0100
Subject: [PATCH 67/75] xen-4.11: sysctl value
Add 0x11 as sysctl value of xen-4.11
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-sysctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index a9b61030b..779ae20e5 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -600,6 +600,7 @@ PRE(sysctl) {
case 0x0000000e:
case 0x0000000f:
case 0x00000010:
+ case 0x00000011:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -1921,6 +1922,7 @@ POST(sysctl)
case 0x0000000e:
case 0x0000000f:
case 0x00000010:
+ case 0x00000011:
break;
default:
return;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index d5980a41e..f68ba3610 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -14,6 +14,7 @@
* - 0x0000000e: Xen 4.8
* - 0x0000000f: Xen 4.9
* - 0x00000010: Xen 4.10
+ * - 0x00000011: Xen 4.11
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 57766db8cb59fbfb906ca929d3e23b8d88612b7b Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Tue, 20 Nov 2018 10:46:49 +0100
Subject: [PATCH 68/75] xen-4.11: domctl value
Add 0x10 as domctl value of xen-4.11
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-domctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 779ae20e5..b59d1975a 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -797,6 +797,7 @@ PRE(domctl)
case 0x0000000d:
case 0x0000000e:
case 0x0000000f:
+ case 0x00000010:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -2145,6 +2146,7 @@ POST(domctl){
case 0x0000000d:
case 0x0000000e:
case 0x0000000f:
+ case 0x00000010:
break;
default:
return;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index f1d78e4f2..f9c76cab2 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -41,6 +41,7 @@
* - 0x0000000d: Xen 4.9
* - 0x0000000e: Xen 4.10
* - 0x0000000f: Xen 4.10 with shim
+ * - 0x00000010: Xen 4.11
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 751773406086216eb079fd68d7a1f4d9a453f3eb Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Tue, 20 Nov 2018 10:55:51 +0100
Subject: [PATCH 69/75] xen-4.11: xen_domctl_monitor_op
Handle new layout of xen_domctl_monitor_op in xen-4.11
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 21 ++++++++++++-
include/vki/vki-xen-domctl.h | 52 +++++++++++++++++++++++++++++++
2 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index b59d1975a..ae89afd08 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -2551,7 +2551,6 @@ POST(domctl){
break;
case 0x000000e:
- default:
if (domctl->u.monitor_op_0000000e.op == VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES) {
switch(domctl->u.monitor_op_0000000e.event) {
case VKI_XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG:
@@ -2569,6 +2568,26 @@ POST(domctl){
}
}
+ break;
+ case 0x0000010:
+ default:
+ if (domctl->u.monitor_op_00000010.op == VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES) {
+ switch(domctl->u.monitor_op_00000010.event) {
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_00000010, u.mov_to_cr);
+ break;
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_00000010, u.mov_to_msr);
+ break;
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_00000010, u.guest_request);
+ break;
+ case VKI_XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION:
+ __POST_XEN_DOMCTL_WRITE(monitor_op, monitor_op_00000010, u.debug_exception);
+ break;
+ }
+ }
+
break;
}
break;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index f9c76cab2..c5936cc76 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -756,6 +756,57 @@ struct vki_xen_domctl_monitor_op_0000000e {
} u;
};
+struct vki_xen_domctl_monitor_op_00000010 {
+ vki_uint32_t op; /* vki_xen_DOMCTL_MONITOR_OP_* */
+
+ /*
+ * When used with ENABLE/DISABLE this has to be set to
+ * the requested vki_xen_DOMCTL_MONITOR_EVENT_* value.
+ * With GET_CAPABILITIES this field returns a bitmap of
+ * events supported by the platform, in the format
+ * (1 << vki_xen_DOMCTL_MONITOR_EVENT_*).
+ */
+ vki_uint32_t event;
+
+ /*
+ * Further options when issuing vki_xen_DOMCTL_MONITOR_OP_ENABLE.
+ */
+ union {
+ struct {
+ /* Which control register */
+ vki_uint8_t index;
+ /* Pause vCPU until response */
+ vki_uint8_t sync;
+ /* Send event only on a change of value */
+ vki_uint8_t onchangeonly;
+ /* Allignment padding */
+ vki_uint8_t pad1;
+ vki_uint32_t pad2;
+ /*
+ * Send event only if the changed bit in the control register
+ * is not masked.
+ */
+ vki_xen_uint64_aligned_t bitmask;
+ } mov_to_cr;
+
+ struct {
+ vki_uint32_t msr;
+ vki_uint8_t onchangeonly;
+ } mov_to_msr;
+
+ struct {
+ /* Pause vCPU until response */
+ vki_uint8_t sync;
+ vki_uint8_t allow_userspace;
+ } guest_request;
+
+ struct {
+ /* Pause vCPU until response */
+ vki_uint8_t sync;
+ } debug_exception;
+ } u;
+};
+
struct vki_xen_domctl_monitor_op {
vki_uint32_t op;
@@ -861,6 +912,7 @@ struct vki_xen_domctl {
struct vki_xen_domctl_monitor_op_0000000b monitor_op_0000000b;
struct vki_xen_domctl_monitor_op_0000000c monitor_op_0000000c;
struct vki_xen_domctl_monitor_op_0000000e monitor_op_0000000e;
+ struct vki_xen_domctl_monitor_op_00000010 monitor_op_00000010;
//struct vki_xen_domctl_vnuma vnuma;
//struct vki_xen_domctl_psr_cmt_op psr_cmt_op;
//struct vki_xen_domctl_psr_cat_op psr_cat_op;
From 3f19cef2fc9eda416acc5706d0de1e802b60ccda Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Tue, 20 Nov 2018 11:05:35 +0100
Subject: [PATCH 70/75] xen-4.11: add IOCTL_PRIVCMD_MMAP_RESOURCE
Add define for IOCTL_PRIVCMD_MMAP_RESOURCE
bz#390553
---
coregrind/m_syswrap/syswrap-linux.c | 17 +++++++++++++++++
include/vki/vki-linux.h | 9 +++++++++
2 files changed, 26 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index c8f72de74..59e07b82b 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8230,6 +8230,23 @@ PRE(sys_ioctl)
(Addr)args->ubufs, sizeof(*(args->ubufs)) * args->num);
break;
}
+ case VKI_XEN_IOCTL_PRIVCMD_MMAP_RESOURCE: {
+ struct vki_xen_privcmd_mmap_resource *args =
+ (struct vki_xen_privcmd_mmap_resource *)(ARG3);
+ PRE_MEM_READ("VKI_XEN_IOCTL_PRIVCMD_MMAP_RESOURCE(dom)",
+ (Addr)&args->dom, sizeof(args->dom));
+ PRE_MEM_READ("VKI_XEN_IOCTL_PRIVCMD_MMAP_RESOURCE(type)",
+ (Addr)&args->type, sizeof(args->type));
+ PRE_MEM_READ("VKI_XEN_IOCTL_PRIVCMD_MMAP_RESOURCE(id)",
+ (Addr)&args->id, sizeof(args->id));
+ PRE_MEM_READ("VKI_XEN_IOCTL_PRIVCMD_MMAP_RESOURCE(idx)",
+ (Addr)&args->idx, sizeof(args->idx));
+ PRE_MEM_READ("VKI_XEN_IOCTL_PRIVCMD_MMAP_RESOURCE(num)",
+ (Addr)&args->num, sizeof(args->num));
+ PRE_MEM_READ("VKI_XEN_IOCTL_PRIVCMD_MMAP_RESOURCE(addr)",
+ (Addr)&args->addr, sizeof(args->addr));
+ break;
+ }
case VKI_XEN_IOCTL_EVTCHN_BIND_VIRQ: {
struct vki_xen_ioctl_evtchn_bind_virq *args =
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 0a0b5c2c1..4aa2ec819 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3395,6 +3395,14 @@ struct vki_xen_privcmd_dm_op {
const struct vki_xen_privcmd_dm_op_buf __user *ubufs;
};
+struct vki_xen_privcmd_mmap_resource {
+ __vki_u16 dom;
+ __vki_u32 type;
+ __vki_u32 id;
+ __vki_u32 idx;
+ __vki_u64 num;
+ __vki_u64 addr;
+};
#define VKI_XEN_IOCTL_PRIVCMD_HYPERCALL _VKI_IOC(_VKI_IOC_NONE, 'P', 0, sizeof(struct vki_xen_privcmd_hypercall))
#define VKI_XEN_IOCTL_PRIVCMD_MMAP _VKI_IOC(_VKI_IOC_NONE, 'P', 2, sizeof(struct vki_xen_privcmd_mmap))
@@ -3404,6 +3412,7 @@ struct vki_xen_privcmd_dm_op {
#define VKI_XEN_IOCTL_PRIVCMD_DM_OP _VKI_IOC(_VKI_IOC_NONE, 'P', 5, sizeof(struct vki_xen_privcmd_dm_op))
#define VKI_XEN_IOCTL_PRIVCMD_RESTRICT _VKI_IOC(_VKI_IOC_NONE, 'P', 6, sizeof(__vki_u16))
+#define VKI_XEN_IOCTL_PRIVCMD_MMAP_RESOURCE _VKI_IOC(_VKI_IOC_NONE, 'P', 7, sizeof(struct vki_xen_privcmd_mmap_resource))
//----------------------------------------------------------------------
// Xen evtchn IOCTL
From 3e77d31513b2e0445e86eeed4ab8a5cdbae255c1 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Tue, 20 Nov 2018 11:29:14 +0100
Subject: [PATCH 71/75] xen-4.12: sysctl value
Add 0x12 as sysctl value of xen-4.12
bz#390553
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-sysctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index ae89afd08..766ca02c4 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -601,6 +601,7 @@ PRE(sysctl) {
case 0x0000000f:
case 0x00000010:
case 0x00000011:
+ case 0x00000012:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -1924,6 +1925,7 @@ POST(sysctl)
case 0x0000000f:
case 0x00000010:
case 0x00000011:
+ case 0x00000012:
break;
default:
return;
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index f68ba3610..bf9cadda8 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -15,6 +15,7 @@
* - 0x0000000f: Xen 4.9
* - 0x00000010: Xen 4.10
* - 0x00000011: Xen 4.11
+ * - 0x00000012: Xen 4.12
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 0940be9b2ec78b9994672a85f1020b700f706b96 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Tue, 20 Nov 2018 11:58:21 +0100
Subject: [PATCH 72/75] xen-4.12 get_cpu_policy
---
include/vki/vki-xen-sysctl.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/vki/vki-xen-sysctl.h b/include/vki/vki-xen-sysctl.h
index bf9cadda8..5f5e78008 100644
--- a/include/vki/vki-xen-sysctl.h
+++ b/include/vki/vki-xen-sysctl.h
@@ -55,6 +55,7 @@
#define VKI_XEN_SYSCTL_get_cpu_featureset 26
#define VKI_XEN_SYSCTL_livepatch_op 27
#define VKI_XEN_SYSCTL_set_parameter 28
+#define VKI_XEN_SYSCTL_get_cpu_policy 29
struct vki_xen_sysctl_readconsole {
/* IN */
@@ -278,6 +279,7 @@ struct vki_xen_sysctl {
struct vki_xen_sysctl_cpu_featureset_0000000d cpu_featureset_0000000d;
//struct vki_xen_sysctl_livepatch_op livepatch;
//struct vki_xen_sysctl_set_parameter set_parameter;
+ //struct vki_xen_sysctl_get_cpu_policy get_cpu_policy;
vki_uint8_t pad[128];
} u;
From 68a2ad9886180d27702e967bf718e5f71ee8341a Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Tue, 20 Nov 2018 12:07:18 +0100
Subject: [PATCH 73/75] xen-4.12: IOCTL_PRIVCMD_UNIMPLEMENTED
---
coregrind/m_syswrap/syswrap-linux.c | 2 ++
include/vki/vki-linux.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 59e07b82b..f079c5ea9 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -8247,6 +8247,8 @@ PRE(sys_ioctl)
(Addr)&args->addr, sizeof(args->addr));
break;
}
+ case VKI_XEN_IOCTL_PRIVCMD_UNIMPLEMENTED:
+ break;
case VKI_XEN_IOCTL_EVTCHN_BIND_VIRQ: {
struct vki_xen_ioctl_evtchn_bind_virq *args =
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 4aa2ec819..f5ae9b45d 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3413,6 +3413,7 @@ struct vki_xen_privcmd_mmap_resource {
#define VKI_XEN_IOCTL_PRIVCMD_DM_OP _VKI_IOC(_VKI_IOC_NONE, 'P', 5, sizeof(struct vki_xen_privcmd_dm_op))
#define VKI_XEN_IOCTL_PRIVCMD_RESTRICT _VKI_IOC(_VKI_IOC_NONE, 'P', 6, sizeof(__vki_u16))
#define VKI_XEN_IOCTL_PRIVCMD_MMAP_RESOURCE _VKI_IOC(_VKI_IOC_NONE, 'P', 7, sizeof(struct vki_xen_privcmd_mmap_resource))
+#define VKI_XEN_IOCTL_PRIVCMD_UNIMPLEMENTED _VKI_IOC(_VKI_IOC_NONE, 'P', 0xff, 0)
//----------------------------------------------------------------------
// Xen evtchn IOCTL
From bd001c940edf89b00441f2401e29e3acfc3fdd2e Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Wed, 21 Nov 2018 10:33:21 +0100
Subject: [PATCH 74/75] xen-4.12: domctl
---
coregrind/m_syswrap/syswrap-xen.c | 2 ++
include/vki/vki-xen-domctl.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index 766ca02c4..f17cae23b 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -799,6 +799,7 @@ PRE(domctl)
case 0x0000000e:
case 0x0000000f:
case 0x00000010:
+ case 0x00000011:
break;
default:
bad_intf_version(tid, layout, arrghs, status, flags,
@@ -2149,6 +2150,7 @@ POST(domctl){
case 0x0000000e:
case 0x0000000f:
case 0x00000010:
+ case 0x00000011:
break;
default:
return;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index c5936cc76..fa62c2fc6 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -42,6 +42,7 @@
* - 0x0000000e: Xen 4.10
* - 0x0000000f: Xen 4.10 with shim
* - 0x00000010: Xen 4.11
+ * - 0x00000011: Xen 4.12
*
* When adding a new subop be sure to include the variants used by all
* of the above, both here and in syswrap-xen.c
From 7172c2bcd6b02d6e58aef653d520573fe3f96250 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Wed, 21 Nov 2018 10:36:06 +0100
Subject: [PATCH 75/75] xen-4.12 : xen_domctl_createdomain
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
coregrind/m_syswrap/syswrap-xen.c | 19 ++++++++++++++++++-
include/vki/vki-xen-domctl.h | 13 +++++++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/coregrind/m_syswrap/syswrap-xen.c b/coregrind/m_syswrap/syswrap-xen.c
index f17cae23b..77e9ff6c3 100644
--- a/coregrind/m_syswrap/syswrap-xen.c
+++ b/coregrind/m_syswrap/syswrap-xen.c
@@ -850,7 +850,6 @@ PRE(domctl)
#endif
break;
case 0x0000000c:
- default:
PRE_XEN_DOMCTL_READ(createdomain_0000000c, ssidref);
PRE_XEN_DOMCTL_READ(createdomain_0000000c, handle);
PRE_XEN_DOMCTL_READ(createdomain_0000000c, flags);
@@ -862,6 +861,24 @@ PRE(domctl)
__PRE_XEN_DOMCTL_READ(createdomain_0000000c, createdomain_0000000c, config.nr_spis);
__PRE_XEN_DOMCTL_READ(createdomain_0000000c, createdomain_0000000c, config.clock_frequency);
#endif
+ break;
+ case 0x00000011:
+ default:
+ PRE_XEN_DOMCTL_READ(createdomain_00000011, ssidref);
+ PRE_XEN_DOMCTL_READ(createdomain_00000011, handle);
+ PRE_XEN_DOMCTL_READ(createdomain_00000011, flags);
+ PRE_XEN_DOMCTL_READ(createdomain_00000011, max_vcpus);
+ PRE_XEN_DOMCTL_READ(createdomain_00000011, max_evtchn_port);
+ PRE_XEN_DOMCTL_READ(createdomain_00000011, max_maptrack_frames);
+#if defined(__i386__) || defined(__x86_64__)
+ __PRE_XEN_DOMCTL_READ(createdomain_00000011, createdomain_00000011, config.emulation_flags);
+#endif
+#if defined(__arm__) || defined(__aarch64__)
+ __PRE_XEN_DOMCTL_READ(createdomain_00000011, createdomain_00000011, config.gic_version);
+ __PRE_XEN_DOMCTL_READ(createdomain_00000011, createdomain_00000011, config.nr_spis);
+ __PRE_XEN_DOMCTL_READ(createdomain_00000011, createdomain_00000011, config.clock_frequency);
+#endif
+ break;
}
break;
diff --git a/include/vki/vki-xen-domctl.h b/include/vki/vki-xen-domctl.h
index fa62c2fc6..699b7dd27 100644
--- a/include/vki/vki-xen-domctl.h
+++ b/include/vki/vki-xen-domctl.h
@@ -187,6 +187,18 @@ struct vki_xen_domctl_createdomain_0000000c {
struct vki_xen_arch_domainconfig_0000000c config;
};
+struct vki_xen_domctl_createdomain_00000011 {
+ /* IN parameters */
+ vki_uint32_t ssidref;
+ vki_xen_domain_handle_t handle;
+ vki_uint32_t flags;
+ vki_uint32_t max_vcpus;
+ vki_uint32_t max_evtchn_port;
+ vki_uint32_t max_grant_frames;
+ vki_uint32_t max_maptrack_frames;
+ struct vki_xen_arch_domainconfig_0000000c config;
+};
+
struct vki_xen_domctl_getdomaininfo_00000007 {
/* OUT variables. */
vki_xen_domid_t domain;
@@ -844,6 +856,7 @@ struct vki_xen_domctl {
struct vki_xen_domctl_createdomain_0000000a createdomain_0000000a;
struct vki_xen_domctl_createdomain_0000000b createdomain_0000000b;
struct vki_xen_domctl_createdomain_0000000c createdomain_0000000c;
+ struct vki_xen_domctl_createdomain_00000011 createdomain_00000011;
//struct vki_xen_domctl_arm_configuredomain configuredomain;
struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007;
struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008;