[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] hw/xen: detect when running inside stubdomain
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 1/2] hw/xen: detect when running inside stubdomain |
Date: |
Mon, 26 Feb 2024 09:23:17 +0100 |
User-agent: |
Mozilla Thunderbird |
On 19/2/24 19:16, Marek Marczykowski-Górecki wrote:
Introduce global xen_is_stubdomain variable when qemu is running inside
a stubdomain instead of dom0. This will be relevant for subsequent
patches, as few things like accessing PCI config space need to be done
differently.
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
hw/xen/xen-legacy-backend.c | 15 +++++++++++++++
include/hw/xen/xen.h | 1 +
system/globals.c | 1 +
3 files changed, 17 insertions(+)
+static bool xen_check_stubdomain(void)
+{
+ char *dm_path = g_strdup_printf("/local/domain/%d/image", xen_domid);
+ uint32_t dm_domid;
+ bool is_stubdom = false;
+
+ if (!xenstore_read_int(dm_path, "device-model-domid", &dm_domid))
BTW missing braces for QEMU coding style: {
+ is_stubdom = dm_domid != 0;
}
+
+ g_free(dm_path);
+ return is_stubdom;
+}