aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-04-26 12:54:47 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-04-26 12:54:47 +0100
commitf7526eece29cd2e36a63b6703508b24453095eb8 (patch)
tree5b9447cf21e53ce4fec524e8f9e836fcfd4780da /exec.c
parent3284aa128153750f14a61e8a96fd085e6f2999b6 (diff)
parent41c3d4269b1c18d12d33c5bf089dace25d08e82e (diff)
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20190425' into staging
- properly detect page size of initial memory - support for IPL (boot) from ECKD DASD passed through via vfio-ccw # gpg: Signature made Thu 25 Apr 2019 14:11:18 BST # gpg: using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF # gpg: issuer "cohuck@redhat.com" # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown] # gpg: aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full] # gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full] # gpg: aka "Cornelia Huck <cohuck@kernel.org>" [unknown] # gpg: aka "Cornelia Huck <cohuck@redhat.com>" [unknown] # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0 18CE DECF 6B93 C6F0 2FAF * remotes/cohuck/tags/s390x-20190425: exec: Introduce qemu_maxrampagesize() and rename qemu_getrampagesize() s390x/kvm: Configure page size after memory has actually been initialized pc-bios/s390: Update firmware images s390-bios: Use control unit type to find bootable devices s390-bios: Support booting from real dasd device s390-bios: Add channel command codes/structs needed for dasd-ipl s390-bios: Use control unit type to determine boot method s390-bios: Refactor virtio to run channel programs via cio s390-bios: Factor finding boot device out of virtio code path s390-bios: Extend find_dev() for non-virtio devices s390-bios: cio error handling s390-bios: Support for running format-0/1 channel programs s390-bios: ptr2u32 and u32toptr s390-bios: Map low core memory s390-bios: Decouple channel i/o logic from virtio s390-bios: Clean up cio.h s390-bios: decouple common boot logic from virtio s390-bios: decouple cio setup from virtio s390 vfio-ccw: Add bootindex property and IPLB data Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/exec.c b/exec.c
index 2646207661..bb1dff423a 100644
--- a/exec.c
+++ b/exec.c
@@ -1688,7 +1688,7 @@ void ram_block_dump(Monitor *mon)
* when we actually open and map them. Iterate over the file
* descriptors instead, and use qemu_fd_getpagesize().
*/
-static int find_max_supported_pagesize(Object *obj, void *opaque)
+static int find_min_backend_pagesize(Object *obj, void *opaque)
{
long *hpsize_min = opaque;
@@ -1704,7 +1704,27 @@ static int find_max_supported_pagesize(Object *obj, void *opaque)
return 0;
}
-long qemu_getrampagesize(void)
+static int find_max_backend_pagesize(Object *obj, void *opaque)
+{
+ long *hpsize_max = opaque;
+
+ if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) {
+ HostMemoryBackend *backend = MEMORY_BACKEND(obj);
+ long hpsize = host_memory_backend_pagesize(backend);
+
+ if (host_memory_backend_is_mapped(backend) && (hpsize > *hpsize_max)) {
+ *hpsize_max = hpsize;
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * TODO: We assume right now that all mapped host memory backends are
+ * used as RAM, however some might be used for different purposes.
+ */
+long qemu_minrampagesize(void)
{
long hpsize = LONG_MAX;
long mainrampagesize;
@@ -1724,7 +1744,7 @@ long qemu_getrampagesize(void)
*/
memdev_root = object_resolve_path("/objects", NULL);
if (memdev_root) {
- object_child_foreach(memdev_root, find_max_supported_pagesize, &hpsize);
+ object_child_foreach(memdev_root, find_min_backend_pagesize, &hpsize);
}
if (hpsize == LONG_MAX) {
/* No additional memory regions found ==> Report main RAM page size */
@@ -1747,8 +1767,24 @@ long qemu_getrampagesize(void)
return hpsize;
}
+
+long qemu_maxrampagesize(void)
+{
+ long pagesize = qemu_mempath_getpagesize(mem_path);
+ Object *memdev_root = object_resolve_path("/objects", NULL);
+
+ if (memdev_root) {
+ object_child_foreach(memdev_root, find_max_backend_pagesize,
+ &pagesize);
+ }
+ return pagesize;
+}
#else
-long qemu_getrampagesize(void)
+long qemu_minrampagesize(void)
+{
+ return getpagesize();
+}
+long qemu_maxrampagesize(void)
{
return getpagesize();
}