From patchwork Tue Dec 12 16:29:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 753089 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp2010231wrs; Tue, 12 Dec 2023 08:31:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiqlC4cDIDkO3UTBnfybUTJRFDaBqXG6sTxKJLOo7UMhvFFKP+Hr5u1Cdkj1m79psgzncL X-Received: by 2002:a05:6214:5013:b0:67a:52eb:7a00 with SMTP id jo19-20020a056214501300b0067a52eb7a00mr9569749qvb.7.1702398680242; Tue, 12 Dec 2023 08:31:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702398680; cv=none; d=google.com; s=arc-20160816; b=oVgrntfK/TO9MO7eQV9IyVdWNhfygB7ewER+8vMlc7n77Wy1mLa/UJmAicEFFw3/eM DuuKAkZNXXhXX23GSgoYbe8ODLCz4wi63LaNu6NwhhfClF1TFLbrf3KyJnBopvddViH1 4ZpRqyBfBVSQDRo34ntfaZtLBveA+PLBrNC2pQX4UpSGzW13F20rYHyticC4kjoxHKeo zo/N/Ekp1tl7ekgBzOefEawREO1xlSEwokOA1ltOvRX9fKudjv3Em+viULT25cfyjxqz P+MH/QSXgsbfxokrESvij1b3mWByWbQN6vx3ZRJcTI95bVNWwjCk5Bjejty5Qgvh0+t1 Ns+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5LE88JwgY2y1IWpLN7sGqf0VCLp2wC33lSYw5ePt+UY=; fh=CkupYgn1Qmdh7jizui9HJgGegpqbRR5NXz1VyjRE1Hs=; b=KW+s7oaATOTiHQp0T3ZfU9NaayIMC3tcxRmje5e3pZlI3/JOr4oibaIQSyIhMl5GBC 3f2vglMm4Uxe6SyZQPDjHTN+txUOLpux3b1HJEVhISKGfE9HtaZqCWToo/AzvtADN2lo XhDC246reqbDNXT0DdpfrqJ1cSICviDWIiL84sYkMB+ZzQP+0VLKMVxc6r5XdlxbrNMw 7ygHfPdQcmx4AVm7JuPAQmc+IHeQkJkk+7WHNgoapc7vCja59wGWrKP806MSWgg2rX8M suSFPDyKYN9jnYG7pxcLqdt3komZih/OSem+wyV5wW3SRruHu1h40StLZrueavts7ApI Ra6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b4LlBkNf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u3-20020a05622a198300b00423f2f520a4si11422160qtc.801.2023.12.12.08.31.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Dec 2023 08:31:20 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b4LlBkNf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rD5do-0000qA-Pd; Tue, 12 Dec 2023 11:29:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rD5dn-0000pW-0j for qemu-devel@nongnu.org; Tue, 12 Dec 2023 11:29:51 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rD5dl-0006x6-8M for qemu-devel@nongnu.org; Tue, 12 Dec 2023 11:29:50 -0500 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a1e35c2807fso782194066b.3 for ; Tue, 12 Dec 2023 08:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702398587; x=1703003387; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5LE88JwgY2y1IWpLN7sGqf0VCLp2wC33lSYw5ePt+UY=; b=b4LlBkNfYNdiIPsSP5DJATsEuaydfYIN6POSs/30b+rNy9NuOy8YbTCXvBxdy9s/rU tg1iDozWceGtVhpnSEk2viHwR+nAkehECChv2pX4G5v0ImA6KidVOiGUwY56C0yq/Cm8 vMSwenjzcuDqBJnnISijtUo89/FBUZoie7TqmLVxckVt6iyXSA9pPuXt5g1tFUOLtL8v xju4lDJIAWHsZvSMALuZMqJGQgq59eHyMxMwm9sTMVmgduFuomdoWOHWXaPWiv54imD+ IZVgD/+taXt6sRhih3Xxm00eRnqKyK29iXURM1v0I5bnHH9gnjHWunGDRT8eHCwAQ+K3 EY4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702398587; x=1703003387; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5LE88JwgY2y1IWpLN7sGqf0VCLp2wC33lSYw5ePt+UY=; b=OKMfxbXK7sxCgDegu2PwzckJL69go1Yg9ILjcpBscggCCtsS/d6YDDlUGd0yX9sFWs lqkm+f9tCbzx3KdNZU2EuJ0SJ7g+I1QU/ieM9YMbaHyFweIcZv6RlMc+YFEjmSX0mJct k34OyIgCXlR4gzUT9OxzV8vF5St7CUhxnklcM66wRqJkwtN9MoReVjxqrtR23J7l93Sa UNU86AyFpIJSePj7c4EPCUtRZi++FmuFeyuASalfNSfGV7jP2kb5lIsy/z7A1gEVjIUZ 7KUPEbDYSQQ1Fh304RFk5xCbF92szkGauhI3f1lhXBG1E3DMpv6ehZ6r36fhEEOR1cUC ngyw== X-Gm-Message-State: AOJu0YxO2EGgM/JI2zDpdCd0X7H9eWEoMKFtVIWs39Ef5DO1jv5Z6Pev lZZZk8bgSZTRW40tklaG8bY++Hsq+gSgfmsWSLA= X-Received: by 2002:a17:906:414f:b0:a00:b4ab:cb6d with SMTP id l15-20020a170906414f00b00a00b4abcb6dmr2946269ejk.69.1702398587565; Tue, 12 Dec 2023 08:29:47 -0800 (PST) Received: from m1x-phil.lan ([176.176.175.193]) by smtp.gmail.com with ESMTPSA id vs6-20020a170907a58600b00a1f99e749dasm3754142ejc.210.2023.12.12.08.29.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Dec 2023 08:29:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Tyrone Ting , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Eduardo Habkost , Joel Stanley , Alistair Francis , Anton Johansson , Andrey Smirnov , Peter Maydell , Hao Wu , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Jean-Christophe Dubois , Igor Mitsyanko , "Edgar E. Iglesias" , Andrew Jeffery , Rob Herring , qemu-arm@nongnu.org, Mark Cave-Ayland , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 01/33] hw/arm/boot: Propagate vCPU to arm_load_dtb() Date: Tue, 12 Dec 2023 17:29:01 +0100 Message-ID: <20231212162935.42910-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231212162935.42910-1-philmd@linaro.org> References: <20231212162935.42910-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=philmd@linaro.org; helo=mail-ej1-x62c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In heterogeneous setup the first vCPU might not be the one expected, better pass it explicitly. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater --- include/hw/arm/boot.h | 4 +++- hw/arm/boot.c | 11 ++++++----- hw/arm/virt.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/hw/arm/boot.h b/include/hw/arm/boot.h index 80c492d742..b12bf61ca8 100644 --- a/include/hw/arm/boot.h +++ b/include/hw/arm/boot.h @@ -160,6 +160,7 @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu, * @binfo: struct describing the boot environment * @addr_limit: upper limit of the available memory area at @addr * @as: address space to load image to + * @cpu: ARM CPU object * * Load a device tree supplied by the machine or by the user with the * '-dtb' command line option, and put it at offset @addr in target @@ -176,7 +177,8 @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu, * Note: Must not be called unless have_dtb(binfo) is true. */ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, - hwaddr addr_limit, AddressSpace *as, MachineState *ms); + hwaddr addr_limit, AddressSpace *as, MachineState *ms, + ARMCPU *cpu); /* Write a secure board setup routine with a dummy handler for SMCs */ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 84ea6a807a..334e4640fd 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -432,13 +432,12 @@ out: return ret; } -static void fdt_add_psci_node(void *fdt) +static void fdt_add_psci_node(void *fdt, ARMCPU *armcpu) { uint32_t cpu_suspend_fn; uint32_t cpu_off_fn; uint32_t cpu_on_fn; uint32_t migrate_fn; - ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0)); const char *psci_method; int64_t psci_conduit; int rc; @@ -512,7 +511,8 @@ static void fdt_add_psci_node(void *fdt) } int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, - hwaddr addr_limit, AddressSpace *as, MachineState *ms) + hwaddr addr_limit, AddressSpace *as, MachineState *ms, + ARMCPU *cpu) { void *fdt = NULL; int size, rc, n = 0; @@ -655,7 +655,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, } } - fdt_add_psci_node(fdt); + fdt_add_psci_node(fdt, cpu); if (binfo->modify_dtb) { binfo->modify_dtb(binfo, fdt); @@ -1321,7 +1321,8 @@ void arm_load_kernel(ARMCPU *cpu, MachineState *ms, struct arm_boot_info *info) * decided whether to enable PSCI and set the psci-conduit CPU properties. */ if (!info->skip_dtb_autoload && have_dtb(info)) { - if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms) < 0) { + if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, + as, ms, cpu) < 0) { exit(1); } } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index be2856c018..4a1d1550f5 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1678,7 +1678,7 @@ void virt_machine_done(Notifier *notifier, void *data) vms->memmap[VIRT_PLATFORM_BUS].size, vms->irqmap[VIRT_PLATFORM_BUS]); } - if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms) < 0) { + if (arm_load_dtb(info->dtb_start, info, info->dtb_limit, as, ms, cpu) < 0) { exit(1); }