From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Claudio Fontana" <cfontana@suse.de>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Anthony Perard <anthony.perard@citrix.com>,
Paul Durrant <paul@xen.org>,
"open list:X86 Xen CPUs" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 1/2] hw/xen: detect when running inside stubdomain
Date: Tue, 20 Feb 2024 07:50:24 +0100 [thread overview]
Message-ID: <429a5a27-21b9-45bd-a1a6-a1c2ccc484c9@linaro.org> (raw)
In-Reply-To: <20240219181627.282097-1-marmarek@invisiblethingslab.com>
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(+)
> diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
> index 37ecc91fc3..ecb89ecfc1 100644
> --- a/include/hw/xen/xen.h
> +++ b/include/hw/xen/xen.h
> @@ -36,6 +36,7 @@ enum xen_mode {
> extern uint32_t xen_domid;
> extern enum xen_mode xen_mode;
> extern bool xen_domid_restrict;
> +extern bool xen_is_stubdomain;
>
> int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num);
> int xen_set_pci_link_route(uint8_t link, uint8_t irq);
> diff --git a/system/globals.c b/system/globals.c
> index b6d4e72530..ac27d88bd4 100644
> --- a/system/globals.c
> +++ b/system/globals.c
> @@ -62,6 +62,7 @@ bool qemu_uuid_set;
> uint32_t xen_domid;
> enum xen_mode xen_mode = XEN_DISABLED;
> bool xen_domid_restrict;
> +bool xen_is_stubdomain;
Note for myself, Paolo and Claudio, IIUC these fields belong
to TYPE_XEN_ACCEL in accel/xen/xen-all.c. Maybe resulting in
smth like:
-- >8 --
diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c
index 5ff0cb8bd9..fc25d8c912 100644
--- a/accel/xen/xen-all.c
+++ b/accel/xen/xen-all.c
@@ -24,11 +24,31 @@
#include "migration/global_state.h"
#include "hw/boards.h"
-bool xen_allowed;
+struct XenAccelState
+{
+ AccelState parent_obj;
+
+ bool xen_allowed;
+
+ enum xen_mode xen_mode;
+
+ uint32_t xen_domid;
+ bool xen_domid_restrict;
xc_interface *xen_xc;
xenforeignmemory_handle *xen_fmem;
xendevicemodel_handle *xen_dmod;
+};
+
+struct XenAccelOpsClass
+{
+ AccelOpsClass parent_class;
+
+ struct evtchn_backend_ops *xen_evtchn_ops;
+ struct gnttab_backend_ops *xen_gnttab_ops;
+ struct foreignmem_backend_ops *xen_foreignmem_ops;
+ struct xenstore_backend_ops *xen_xenstore_ops;
+}
static void xenstore_record_dm_state(const char *state)
{
@@ -114,6 +134,13 @@ static int xen_init(MachineState *ms)
return 0;
}
+static void xen_accel_init(Object *obj)
+{
+ XenAccelState *s = XEN_ACCEL(obj);
+
+ s->xen_mode = XEN_DISABLED;
+}
+
static void xen_accel_class_init(ObjectClass *oc, void *data)
{
AccelClass *ac = ACCEL_CLASS(oc);
@@ -142,6 +169,8 @@ static void xen_accel_class_init(ObjectClass *oc,
void *data)
static const TypeInfo xen_accel_type = {
.name = TYPE_XEN_ACCEL,
.parent = TYPE_ACCEL,
+ .instance_size = sizeof(XenAccelState),
+ .instance_init = xen_accel_init,
.class_init = xen_accel_class_init,
};
@@ -157,6 +186,7 @@ static const TypeInfo xen_accel_ops_type = {
.parent = TYPE_ACCEL_OPS,
.class_init = xen_accel_ops_class_init,
+ .class_size = sizeof(XenAccelOpsClass),
.abstract = true,
};
---
next prev parent reply other threads:[~2024-02-20 6:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 18:16 [PATCH 1/2] hw/xen: detect when running inside stubdomain Marek Marczykowski-Górecki
2024-02-19 18:16 ` [PATCH 2/2] xen: fix stubdom PCI addr Marek Marczykowski-Górecki
2024-02-19 22:23 ` Marek Marczykowski-Górecki
2024-02-24 22:38 ` Jason Andryuk
2024-02-20 6:50 ` Philippe Mathieu-Daudé [this message]
2024-02-25 22:09 ` [PATCH 1/2] hw/xen: detect when running inside stubdomain Jason Andryuk
2024-02-25 22:05 ` Jason Andryuk
2024-02-26 8:23 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=429a5a27-21b9-45bd-a1a6-a1c2ccc484c9@linaro.org \
--to=philmd@linaro.org \
--cc=anthony.perard@citrix.com \
--cc=cfontana@suse.de \
--cc=marmarek@invisiblethingslab.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).