From: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
To: Portia Stephens <portias@oss.tenstorrent.com>, qemu-devel@nongnu.org
Cc: "Nicholas Piggin" <npiggin@gmail.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Chao Liu" <chao.liu@processmission.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
qemu-riscv@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Joel Stanley" <joel@jms.id.au>,
"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"Weiwei Li" <liwei1518@gmail.com>,
"Anirudh Srinivasan" <asrinivasan@oss.tenstorrent.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Michael Ellerman" <mpe@kernel.org>
Subject: Re: [PATCH 07/12] machine: Support extra board CPUs outside -smp
Date: Thu, 15 Oct 2026 17:31:33 -0300 [thread overview]
Message-ID: <b87a7231-ca35-4c1d-bc05-ffeee15eebf0@oss.qualcomm.com> (raw)
In-Reply-To: <20261015031804.2406055-8-portias@oss.tenstorrent.com>
Phil, Pierrick,
This patch seems to dwell around your turf. Did you think about how to
instantiate different CPUs that might have different SMP topologies in
the context of single binary/split accel work?
Thanks,
Daniel
On 10/15/2026 12:17 AM, Portia Stephens wrote:
> From: Joel Stanley <joel@jms.id.au>
>
> Boards may instantiate one or more CPUs that are not part of the
> user's -smp layout, for example an a management or boot core of a
> different CPU model. As TCG sizes its vCPU context from smp.max_cpus
> during init, creating more CPUState objects than smp.max_cpus trips the
> assert in tcg_register_thread().
>
> smp.max_cpus is finalized before the accelerator is initialised and the
> board's init() runs later still, so a board's initialise cannot influence
> the count TCG uses.
>
> Add a MachineClass::extra_cpus that boards set at class init time to
> declare these additional CPUs. TCG can then add it to max_threads. The
> field defaults to 0, so existing machines are unaffected.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> Signed-off-by: Portia Stephens <portias@oss.tenstorrent.com>
> ---
> accel/tcg/tcg-all.c | 2 +-
> include/hw/core/boards.h | 4 ++++
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
> index 767e880555..655609ebbb 100644
> --- a/accel/tcg/tcg-all.c
> +++ b/accel/tcg/tcg-all.c
> @@ -126,7 +126,7 @@ static int tcg_init_machine(AccelState *as, MachineState *ms)
> */
> if (mttcg_supported && !icount_enabled()) {
> s->mttcg_enabled = ON_OFF_AUTO_ON;
> - max_threads = ms->smp.max_cpus;
> + max_threads = ms->smp.max_cpus + MACHINE_GET_CLASS(ms)->extra_cpus;
> } else {
> s->mttcg_enabled = ON_OFF_AUTO_OFF;
> }
> diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h
> index d0e4ad9820..575c6bcb31 100644
> --- a/include/hw/core/boards.h
> +++ b/include/hw/core/boards.h
> @@ -189,6 +189,9 @@ typedef struct {
> * @max_cpus: maximum number of CPUs supported. Default: 1
> * @min_cpus: minimum number of CPUs supported. Default: 1
> * @default_cpus: number of CPUs instantiated if none are specified. Default: 1
> + * @extra_cpus: number of additional CPUs the board always instantiates beyond
> + * the -smp topology (e.g. an always-present management core). Accelerators
> + * add this to the per-vCPU state they allocate. Default: 0
> * @is_default:
> * If true QEMU will use this machine by default if no '-M' option is given.
> * @get_hotplug_handler: this function is called during bus-less
> @@ -287,6 +290,7 @@ struct MachineClass {
> int max_cpus;
> int min_cpus;
> int default_cpus;
> + int extra_cpus;
> unsigned int no_serial:1,
> no_parallel:1,
> no_floppy:1,
next prev parent reply other threads:[~2026-10-15 20:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 3:17 [PATCH 00/12] Add the RCPU to Tenstorrent Atlantis Portia Stephens
2026-10-15 3:17 ` [PATCH 01/12] hw/riscv/atlantis: Set valid_cpu_types for Atlantis machine Portia Stephens
2026-10-15 3:17 ` [PATCH 02/12] hw/riscv/atlantis: Update fdt functions to take generic parameters Portia Stephens
2026-10-15 3:17 ` [PATCH 03/12] hw/riscv/atlantis: Move Ascalon into cluster struct Portia Stephens
2026-10-15 3:17 ` [PATCH 04/12] hw/riscv/atlantis: Store Ascalon memory in " Portia Stephens
2026-10-15 3:17 ` [PATCH 05/12] hw/riscv/atlantis: Create CPU cluster for Atlantis cpus Portia Stephens
2026-10-15 3:17 ` [PATCH 06/12] target/riscv: Add Tenstorrent Real-time CPU Portia Stephens
2026-10-15 3:17 ` [PATCH 07/12] machine: Support extra board CPUs outside -smp Portia Stephens
2026-10-15 20:31 ` Daniel Henrique Barboza [this message]
2026-10-16 10:26 ` Daniel P. Berrangé
2026-10-16 11:23 ` Daniel Henrique Barboza
2026-10-15 3:18 ` [PATCH 08/12] hw/riscv/atlantis: Add the RCPU to the Atlantis SoC Portia Stephens
2026-10-15 3:18 ` [PATCH 09/12] hw/riscv/atlantis: Back RCPU memory region by unimplemented device Portia Stephens
2026-10-15 3:18 ` [PATCH 10/12] hw/riscv/atlantis: Load the RCPU bootrom Portia Stephens
2026-10-15 3:18 ` [PATCH 11/12] tests/functional/riscv64: Add rcpu to tt-atlantis tests Portia Stephens
2026-10-15 3:18 ` [PATCH 12/12] docs/atlantis: Update Atlantis documentation to include the RCPU Portia Stephens
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=b87a7231-ca35-4c1d-bc05-ffeee15eebf0@oss.qualcomm.com \
--to=daniel.barboza@oss.qualcomm.com \
--cc=alex.bennee@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=asrinivasan@oss.tenstorrent.com \
--cc=chao.liu@processmission.com \
--cc=joel@jms.id.au \
--cc=liwei1518@gmail.com \
--cc=mpe@kernel.org \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=philmd@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=portias@oss.tenstorrent.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=zhao1.liu@intel.com \
--cc=zhiwei_liu@linux.alibaba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.