qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: qemu-devel@nongnu.org
Cc: sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org,
	peter.maydell@linaro.org, alex.bennee@linaro.org,
	xenia.ragiadakou@amd.com, jason.andryuk@amd.com,
	edgar.iglesias@amd.com, xen-devel@lists.xenproject.org,
	qemu-arm@nongnu.org
Subject: [PATCH v2 04/12] hw/arm: xenpvh: Add support for SMP guests
Date: Tue, 20 Aug 2024 16:29:41 +0200	[thread overview]
Message-ID: <20240820142949.533381-5-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <20240820142949.533381-1-edgar.iglesias@gmail.com>

From: "Edgar E. Iglesias" <edgar.iglesias@amd.com>

Add SMP support for Xen PVH ARM guests.
Create ms->smp.max_cpus ioreq servers to handle hotplug.

Note that ms->smp.max_cpus will be passed to us by the
user (Xen tools) set to the guests maxvcpus.

The value in mc->max_cpus is an absolute maximum for the
-smp option and won't be used to setup ioreq servers unless
the user explicitly specifies it with -smp.

If the user doesn't pass -smp on the command-line, smp.cpus
and smp.max_cpus will default to 1.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
---
 hw/arm/xen_arm.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c
index 5f75cc3779..fda65d0d8d 100644
--- a/hw/arm/xen_arm.c
+++ b/hw/arm/xen_arm.c
@@ -173,7 +173,7 @@ static void xen_arm_init(MachineState *machine)
 
     xen_init_ram(machine);
 
-    xen_register_ioreq(xam->state, machine->smp.cpus, &xen_memory_listener);
+    xen_register_ioreq(xam->state, machine->smp.max_cpus, &xen_memory_listener);
 
     xen_create_virtio_mmio_devices(xam);
 
@@ -218,7 +218,26 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data)
     MachineClass *mc = MACHINE_CLASS(oc);
     mc->desc = "Xen PVH ARM machine";
     mc->init = xen_arm_init;
-    mc->max_cpus = 1;
+
+    /*
+     * mc->max_cpus holds the MAX value allowed in the -smp command-line opts.
+     *
+     * 1. If users don't pass any -smp option:
+     *   ms->smp.cpus will default to 1.
+     *   ms->smp.max_cpus will default to 1.
+     *
+     * 2. If users pass -smp X:
+     *   ms->smp.cpus will be set to X.
+     *   ms->smp.max_cpus will also be set to X.
+     *
+     * 3. If users pass -smp X,maxcpus=Y:
+     *   ms->smp.cpus will be set to X.
+     *   ms->smp.max_cpus will be set to Y.
+     *
+     * In scenarios 2 and 3, if X or Y are set to something larger than
+     * mc->max_cpus, QEMU will bail out with an error message.
+     */
+    mc->max_cpus = GUEST_MAX_VCPUS;
     mc->default_machine_opts = "accel=xen";
     /* Set explicitly here to make sure that real ram_size is passed */
     mc->default_ram_size = 0;
-- 
2.43.0



  parent reply	other threads:[~2024-08-20 14:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20 14:29 [PATCH v2 00/12] xen: pvh: Partial QOM:fication with new x86 PVH machine Edgar E. Iglesias
2024-08-20 14:29 ` [PATCH v2 01/12] MAINTAINERS: Add docs/system/arm/xenpvh.rst Edgar E. Iglesias
2024-08-20 14:29 ` [PATCH v2 02/12] hw/arm: xenpvh: Update file header to use SPDX Edgar E. Iglesias
2024-08-20 14:29 ` [PATCH v2 03/12] hw/arm: xenpvh: Tweak machine description Edgar E. Iglesias
2024-08-20 14:29 ` Edgar E. Iglesias [this message]
2024-08-21  0:55   ` [PATCH v2 04/12] hw/arm: xenpvh: Add support for SMP guests Stefano Stabellini
2024-08-20 14:29 ` [PATCH v2 05/12] hw/arm: xenpvh: Remove double-negation in warning Edgar E. Iglesias
2024-08-21  0:56   ` Stefano Stabellini
2024-08-20 14:29 ` [PATCH v2 06/12] hw/arm: xenpvh: Move stubbed functions to xen-stubs.c Edgar E. Iglesias
2024-08-21  1:06   ` Stefano Stabellini
2024-08-20 14:29 ` [PATCH v2 07/12] hw/arm: xenpvh: Break out a common PVH machine Edgar E. Iglesias
2024-08-21  1:16   ` Stefano Stabellini
2024-08-20 14:29 ` [PATCH v2 08/12] hw/arm: xenpvh: Rename xen_arm.c -> xen-pvh.c Edgar E. Iglesias
2024-08-20 14:29 ` [PATCH v2 09/12] hw/arm: xenpvh: Reverse virtio-mmio creation order Edgar E. Iglesias
2024-08-20 14:29 ` [PATCH v2 10/12] hw/xen: pvh-common: Add support for creating PCIe/GPEX Edgar E. Iglesias
2024-08-21  1:22   ` Stefano Stabellini
2024-08-20 14:29 ` [PATCH v2 11/12] hw/i386/xen: Add a Xen PVH x86 machine Edgar E. Iglesias
2024-08-21  1:22   ` Stefano Stabellini
2024-08-20 14:29 ` [PATCH v2 12/12] docs/system/i386: xenpvh: Add a basic description Edgar E. Iglesias

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=20240820142949.533381-5-edgar.iglesias@gmail.com \
    --to=edgar.iglesias@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=anthony@xenproject.org \
    --cc=edgar.iglesias@amd.com \
    --cc=jason.andryuk@amd.com \
    --cc=paul@xen.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xenia.ragiadakou@amd.com \
    /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).