From nobody Wed May 15 12:59:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.67 as permitted sender) client-ip=209.85.128.67; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f67.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.67 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1600946293; cv=none; d=zohomail.com; s=zohoarc; b=C092/VW8LTSxRzJsflQzjXMUAarYHdq8FBkplS19aUBUH/dpDwRAWgJj5jUX60ATJsSt5YfvstwHwo3shepyk/nsCDbkKdCLhBOPZVPs4t7voQzFs62gxkEHoxw91MDqQZ4QkxDPmiFeW88tiHB9C5D22B01Sm6PApj+zT3OIto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600946293; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xrbRo504l8HmLzKW94CHr7HRIV9naYmGmvNreSdZ4Y4=; b=iQLrh4Z1p0vrE14KUUNsTjBJjzbo5qkO/mBeHeJZOxmt9xAC7+Q7/zwol8V2YHOkPdbFzoBGhqkykhEFTVK0ETmQDFLxYNjbRM/I3D/XtYugbn94JXsLivDoQ/Io9VfXxDdo9ZL8xbdejC7HB3gvRadse9oOAkl3c0X+ZqerHPk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.67 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by mx.zohomail.com with SMTPS id 1600946293650237.81386798893334; Thu, 24 Sep 2020 04:18:13 -0700 (PDT) Received: by mail-wm1-f67.google.com with SMTP id e2so3191959wme.1 for ; Thu, 24 Sep 2020 04:18:13 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.234]) by smtp.gmail.com with ESMTPSA id h76sm3400363wme.10.2020.09.24.04.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2020 04:18:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xrbRo504l8HmLzKW94CHr7HRIV9naYmGmvNreSdZ4Y4=; b=pT5c55imxwmvC1IsfJ9fpaZo1YMhKpo0WscLY+sWgdDa1npOly1YycADGyNd4mfBkL lI5sc/yipuV2kprHvWCqs61AwhGe4/e8YysVTpnIEcKBUCwS4epzlmAvRqXBjGNl1+Nq j7koYVQUuwzBTxXzC17ltXrVLkOEvdtgUKOgkwbwkSCRLPIK2osybRSvZacazf+pzfN0 tguhymcuTuzn2xVX8hs0/RAKLyyZfwLu/wbFYVINnJ6oU/sXcMcyK/V4G/QSAEsejhaX pE77Lk7cVA0SCf0tfNyVv0g/SrH1g/kF8DloErj5Y2d2Tgh4n02MUgDHVu/9iMoVqBRc jV1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xrbRo504l8HmLzKW94CHr7HRIV9naYmGmvNreSdZ4Y4=; b=TdZrIlRLDtF/Ml9TyJv0Gl1O6fnyAh6Z69apy0Wct3+rnslvw64oJqsn5QD6KkRTws gvgVrNhJplELY6jTeMA+u3VvfeciRhuWCNmH9R9tuOpReVVh2+Jerbju9szc3N11kefm 9oRQ/HkFD0K6zmW2oQRAV2BjTOWCSVT9PwZ5D20h78Mll4jJWni9aeialluEBPO0udil 4FWAiEasCElIwOsmmylhvcsD1QoHIZrWajhx/1oOHZv9CRd05rKPsWbeAtsvweTZkk2U RcR7YsxZP+lay1NkAbK1plw2OtBRxzLfghrF5ZHOT4YB1Dq8bPJ7OOMiViRILnNuSv9F fWSA== X-Gm-Message-State: AOAM532smmKuJ2w7bbfoi/hteR1LbqzSnOYi/hEPgMYVRqHdHEBT3ily iZSg5exbrPdUE2kcT7TT8Xk= X-Google-Smtp-Source: ABdhPJyq+oD4O9J8WV4mf8RztBKJFYLPJiLSE5dVoZQj9L9mf5ISdNh0RE7vXPXap9wLBQReu/eeTQ== X-Received: by 2002:a1c:398a:: with SMTP id g132mr4099071wma.41.1600946291778; Thu, 24 Sep 2020 04:18:11 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Andrew Baumann , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Subject: [PATCH v4 1/8] hw/arm/raspi: Display the board revision in the machine description Date: Thu, 24 Sep 2020 13:18:01 +0200 Message-Id: <20200924111808.77168-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924111808.77168-1-f4bug@amsat.org> References: <20200924111808.77168-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Display the board revision in the machine description. Before: $ qemu-system-aarch64 -M help | fgrep raspi raspi2 Raspberry Pi 2B raspi3 Raspberry Pi 3B After: raspi2 Raspberry Pi 2B (revision 1.1) raspi3 Raspberry Pi 3B (revision 1.2) Reviewed-by: Luc Michel Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/raspi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 811eaf52ff5..46d9ed7f054 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -312,7 +312,9 @@ static void raspi_machine_class_init(ObjectClass *oc, v= oid *data) uint32_t board_rev =3D (uint32_t)(uintptr_t)data; =20 rmc->board_rev =3D board_rev; - mc->desc =3D g_strdup_printf("Raspberry Pi %s", board_type(board_rev)); + mc->desc =3D g_strdup_printf("Raspberry Pi %s (revision 1.%u)", + board_type(board_rev), + FIELD_EX32(board_rev, REV_CODE, REVISION)); mc->init =3D raspi_machine_init; mc->block_default_type =3D IF_SD; mc->no_parallel =3D 1; --=20 2.26.2 From nobody Wed May 15 12:59:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.66 as permitted sender) client-ip=209.85.128.66; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f66.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1600946294; cv=none; d=zohomail.com; s=zohoarc; b=V+e5V3CESyS56suq4aWXytQtz6xe3RppmxjAg1sk49DfuarPH2tRcXyIWuZyMaiYFTeVa/N3BbJf2nOu4mpZbG/Ca/qSrC7QCQplnTxOUoSryEk9UAcR+abzSVcsoYgqG9fLOja8AJ+w5IwUsl0J3as0xRcqGKfLl95FGx3BnQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600946294; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=45JbwGiTU0XnEwI0yz801a4d2AUl+45skNEUNaweO3I=; b=gDJDVfFJNhxiHHPcuI4P8nSTs1aI+7XC1VV4Svpk1jdDEjILl9EgKWwdsIHq6imfwcFsLkjulw4RSD1Uoh622QAbaxIHP/WwTclU2J6TPv13Fn6fTAlhSwSiNNgBJIXdPX2YlGIf3756Bpg5FhUHTspa4ZVPEyDZLfG+GWcQ2nU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.zohomail.com with SMTPS id 1600946294828326.23961947985356; Thu, 24 Sep 2020 04:18:14 -0700 (PDT) Received: by mail-wm1-f66.google.com with SMTP id x23so3113122wmi.3 for ; Thu, 24 Sep 2020 04:18:14 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.234]) by smtp.gmail.com with ESMTPSA id h76sm3400363wme.10.2020.09.24.04.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2020 04:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=45JbwGiTU0XnEwI0yz801a4d2AUl+45skNEUNaweO3I=; b=OLEZuBzp7AbwKad6vBWF2idBQSBhdXp7gT6Lt2Sje6DczgkG1vxLwQx7r3zbZ8L7U7 fE7+GMYyiJav0vMae2lTwOx2GPuedPJv5OQqwQnn+pfMTRVXFWwv+lcdMc3l7zZLdrEU dNG4IW9BHG6psS0J4N24q5+d/BbLBxEgNAUN85uwsKF6SXVqU5PTItLc92Mjk0N5qJeD 7GY+xpSZwUIzwQaREczuJjQWQKbEAHq0RUoDK6018ryKRO8zSwAQTQu8TPwsrTFpDjFY hYUFm5n+kRI4rnVkk+aRlqas6NMTUBVYmGdh1c6PkZZiE5fmQ//UuRsCl6KVOknnkmbY xJGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=45JbwGiTU0XnEwI0yz801a4d2AUl+45skNEUNaweO3I=; b=JL3I3OGQpkjzJYfL4olvYQE7OdMIjD0beiO5x0LxZTR8B5Wf6fojzUZ6NrXad2hib0 S37SvcdGzTKoFTHGrzRA/q9yQO8aK/WWIa8PT6KnMGp6cZ8zAzpNZwzMRAV7wGI8TSm+ 7vjD4+DA9klZ8WQkww0l+zgyemEASVDTAhwMMKdk+srrMC76lwXY/g+5Ic/wccxnsSOd DDwGpqHaVPrqGz71gjfVMAnQEgWLcIuvDF9p/7YCNRkGfyAtlHx/fRupAvFTkN4GXUTt 9XuHuIhKQ3kUIMGXcBSmthWGNrIP7XcJEk0ds6lu8xgt2y8/E+AfV9EUzc/wVrW9mgay DCLw== X-Gm-Message-State: AOAM5338MbXO56pxShfX46IsCECePkoZf+mEpHPNGvsM1Gl+5Y6742Vg vUdI7UpBaVJcR9q27vcCm1KiNTSnUdo= X-Google-Smtp-Source: ABdhPJz/rf8WaiYg3QZluJPadk0tRdlgxon3S9BEVJRf2QlNKVH0l2OMy5n8LNdyu89o3tGUpxzV6w== X-Received: by 2002:a1c:65c1:: with SMTP id z184mr4037187wmb.61.1600946292926; Thu, 24 Sep 2020 04:18:12 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Andrew Baumann , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Subject: [PATCH v4 2/8] hw/arm/raspi: Load the firmware on the first core Date: Thu, 24 Sep 2020 13:18:02 +0200 Message-Id: <20200924111808.77168-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924111808.77168-1-f4bug@amsat.org> References: <20200924111808.77168-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) The 'first_cpu' is more a QEMU accelerator-related concept than a variable the machine requires to use. Since the machine is aware of its CPUs, directly use the first one to load the firmware. Reviewed-by: Luc Michel Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/raspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 46d9ed7f054..8716a80a75e 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -205,6 +205,7 @@ static void reset_secondary(ARMCPU *cpu, const struct a= rm_boot_info *info) =20 static void setup_boot(MachineState *machine, int version, size_t ram_size) { + RaspiMachineState *s =3D RASPI_MACHINE(machine); static struct arm_boot_info binfo; int r; =20 @@ -253,7 +254,7 @@ static void setup_boot(MachineState *machine, int versi= on, size_t ram_size) binfo.firmware_loaded =3D true; } =20 - arm_load_kernel(ARM_CPU(first_cpu), machine, &binfo); + arm_load_kernel(&s->soc.cpu[0].core, machine, &binfo); } =20 static void raspi_machine_init(MachineState *machine) --=20 2.26.2 From nobody Wed May 15 12:59:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.66 as permitted sender) client-ip=209.85.221.66; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f66.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1600946296; cv=none; d=zohomail.com; s=zohoarc; b=Tb4luXcbWHyIwXevaEin4kYVYwo67susBFKV7fMeaPXUHDrXMdEg9GlnDsSBZOVzw52HsQ3MnnV7utlWCr2R6CutIfXXaUl49c3McS/hQhsdNopas+wp1eVK8v8/cDXTuHRfwmLEP0jNSv1c6/7chmYPOx0tR+sUzGBXUrP6uE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600946296; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pqQjOUWtcLPC8L4qk6a3pit1FoREjeT8r9pPsJuQ7/Y=; b=RGM3MtO6HsiO8lRz52EXkaoeFNiER3OftSoJpb3wsH20g0XVRLHSR8fjoBYsKPl0H+Y1Qf/mwkX14n++jRLO1oZZLNYwjUFHpHx2E1piTaXzWBjhrKAZ21gCfCsS/CHM0VL2RferQ+o4LqaWE39u507NmkRfkJxWhgFFTqWZGMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.zohomail.com with SMTPS id 1600946295996202.81658568158673; Thu, 24 Sep 2020 04:18:15 -0700 (PDT) Received: by mail-wr1-f66.google.com with SMTP id z1so3393007wrt.3 for ; Thu, 24 Sep 2020 04:18:15 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.234]) by smtp.gmail.com with ESMTPSA id h76sm3400363wme.10.2020.09.24.04.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2020 04:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pqQjOUWtcLPC8L4qk6a3pit1FoREjeT8r9pPsJuQ7/Y=; b=FXeim/rJjWU6LkaUraj/OoBym0yEzXqTPieMK9tHHjSOzEQb4IVlZKcCes8QtjQVGF coLEr1oIzD6NLF1oFsxIqrAWiyiCCA3RFVFUKQ25Q5dG3N/aq/AVixM8aQSP76y/xgzk OtExW5qE/a77oralWtAM3yz+Opn9ujWzP4EC2I6y/apiB/MYmW8b5eDNHWTXPwuQMMRv KQPZQ3XDkvoah+i3FpeoZ2hdqngRANDw45IcfDEeEthXuu7jvWMYtg2cxwq+uxShqgAn Vd2S/bmXX+yLECac5G4XHxN5FjTFEi9sXpH8Hn+NahPg194rEnx1/HawTIhwI9EjHfOL 6pMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=pqQjOUWtcLPC8L4qk6a3pit1FoREjeT8r9pPsJuQ7/Y=; b=ZezDtmri9VWIyAaK6EWZ8/wXUVJlRDq5yo7PZXK7KBgS96zr9HjfPm+Amdiz1iteTd T3qyny9wtApSwAdf4RRM0G+f07QM0DfUpf3+3Fyb2fQpKLiCYpXG1pg1KxT1kV7QRtvV pXUH5Volk42AB8N1LCPd1ZKAFXkRV7VJIDtg/m0/BT8QysWklX+CET9kbP0QpwZ1g6ZI 7IZxc6B0cv92xV8jSB47rfVtsA7HOWKAsCHjE0V/4ZF2ZcaDiP3Gke4loQ5+zlZxBSul TtY3PPMaNpckRqGBMtt2TP1C9cpeW2yOpsTgez3DMTOJIo8bN4+PzzN0mXxwC7Wsl4jU PlqA== X-Gm-Message-State: AOAM533gPkUNBXDkQdgrSmLrBLbdsrxbZ04qLNWyjw89hsi88LdbfhyN GHUoPDlyFzNE219+esOfHlQ= X-Google-Smtp-Source: ABdhPJzXu6MVOW9JpbhEogq2CCgBkbw5OI7/ALbN7FusoM1q3D7GcSYGftg7P6h2NfXXCn4xii0J8g== X-Received: by 2002:adf:f544:: with SMTP id j4mr4506941wrp.74.1600946294118; Thu, 24 Sep 2020 04:18:14 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Andrew Baumann , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Subject: [PATCH v4 3/8] hw/arm/raspi: Move arm_boot_info structure to RaspiMachineState Date: Thu, 24 Sep 2020 13:18:03 +0200 Message-Id: <20200924111808.77168-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924111808.77168-1-f4bug@amsat.org> References: <20200924111808.77168-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) The arm_boot_info structure belong to the machine, move it to RaspiMachineState. Reviewed-by: Luc Michel Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/raspi.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 8716a80a75e..16e6c83c925 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -41,6 +41,7 @@ struct RaspiMachineState { MachineState parent_obj; /*< public >*/ BCM283XState soc; + struct arm_boot_info binfo; }; typedef struct RaspiMachineState RaspiMachineState; =20 @@ -206,12 +207,11 @@ static void reset_secondary(ARMCPU *cpu, const struct= arm_boot_info *info) static void setup_boot(MachineState *machine, int version, size_t ram_size) { RaspiMachineState *s =3D RASPI_MACHINE(machine); - static struct arm_boot_info binfo; int r; =20 - binfo.board_id =3D MACH_TYPE_BCM2708; - binfo.ram_size =3D ram_size; - binfo.nb_cpus =3D machine->smp.cpus; + s->binfo.board_id =3D MACH_TYPE_BCM2708; + s->binfo.ram_size =3D ram_size; + s->binfo.nb_cpus =3D machine->smp.cpus; =20 if (version <=3D 2) { /* The rpi1 and 2 require some custom setup code to run in Secure @@ -220,21 +220,21 @@ static void setup_boot(MachineState *machine, int ver= sion, size_t ram_size) * firmware for some cache maintenance operations. * The rpi3 doesn't need this. */ - binfo.board_setup_addr =3D BOARDSETUP_ADDR; - binfo.write_board_setup =3D write_board_setup; - binfo.secure_board_setup =3D true; - binfo.secure_boot =3D true; + s->binfo.board_setup_addr =3D BOARDSETUP_ADDR; + s->binfo.write_board_setup =3D write_board_setup; + s->binfo.secure_board_setup =3D true; + s->binfo.secure_boot =3D true; } =20 /* Pi2 and Pi3 requires SMP setup */ if (version >=3D 2) { - binfo.smp_loader_start =3D SMPBOOT_ADDR; + s->binfo.smp_loader_start =3D SMPBOOT_ADDR; if (version =3D=3D 2) { - binfo.write_secondary_boot =3D write_smpboot; + s->binfo.write_secondary_boot =3D write_smpboot; } else { - binfo.write_secondary_boot =3D write_smpboot64; + s->binfo.write_secondary_boot =3D write_smpboot64; } - binfo.secondary_cpu_reset_hook =3D reset_secondary; + s->binfo.secondary_cpu_reset_hook =3D reset_secondary; } =20 /* If the user specified a "firmware" image (e.g. UEFI), we bypass @@ -250,11 +250,11 @@ static void setup_boot(MachineState *machine, int ver= sion, size_t ram_size) exit(1); } =20 - binfo.entry =3D firmware_addr; - binfo.firmware_loaded =3D true; + s->binfo.entry =3D firmware_addr; + s->binfo.firmware_loaded =3D true; } =20 - arm_load_kernel(&s->soc.cpu[0].core, machine, &binfo); + arm_load_kernel(&s->soc.cpu[0].core, machine, &s->binfo); } =20 static void raspi_machine_init(MachineState *machine) --=20 2.26.2 From nobody Wed May 15 12:59:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.65 as permitted sender) client-ip=209.85.221.65; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f65.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1600946297; cv=none; d=zohomail.com; s=zohoarc; b=L3wiaZF3W79apGenqv9lTcuOWERIl9RXiQkYNxoo5dN8cgBOOOQFZoaUvg/0krIcArNl/0ww/cXjjDqrBsfNPrz2peha2L8lL0uLlWrl9siuX/CtvrMnJ6+sAaQtuaRVhRnVdak9LLf4X5SDiqSC0NRTbIPNk17x/pnfXercToQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600946297; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4jv3gV83IdvS5OKXioOXbKRM8ceNFIHhtNFiZgXYFU8=; b=Zo9R9ffGhzIO231T6P06ZnJF5o9Dpimzg9Yh3pT6jsneMf58nIrxMSkRa9Kho8Evr8MwVDx0cLrh9pxwyj50OHQZjTDuYw8SDrkic5bw4QmUCXIQUs5dZttY57M4HIe9cvS2IzysOMD9f3NGzYU8Li4LV6ODLEomndCcXSCT9+0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.zohomail.com with SMTPS id 1600946297464522.660390464338; Thu, 24 Sep 2020 04:18:17 -0700 (PDT) Received: by mail-wr1-f65.google.com with SMTP id e16so3404928wrm.2 for ; Thu, 24 Sep 2020 04:18:16 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.234]) by smtp.gmail.com with ESMTPSA id h76sm3400363wme.10.2020.09.24.04.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2020 04:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4jv3gV83IdvS5OKXioOXbKRM8ceNFIHhtNFiZgXYFU8=; b=XHB3f84kgvUwuD6XO/36aeszXDbun0OLCbns4Yk7pIQmZ4SajnFzoIMTp4YtQC34Z+ cyciTFdmw5ip92S/UZQVAzxhm98G+efTXlTo8qgy1NgcdylN8NF0ZDFLx8L+Gtza1BMY jGGcgO7U8fEOKV9WPDI+ku40JKKucffZOsJZk8JyMOZU8vmLeoN3ukjTZxRqShTC6QER okcmjx7cOSkzRG+rbXfCe0qcS05SgyXyydPyMKlFYjlHagids+bmsblu90pjvF1VkUuV hcAaocjCNYkr+ybDZNaJkJuj+Yly3aAkqFTJO2s/b1ngs+4N4Dk0T489nJZKEsdgFzG8 4vGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4jv3gV83IdvS5OKXioOXbKRM8ceNFIHhtNFiZgXYFU8=; b=rd5idZLYogK3MrTwZgIimdjfT1bxaHUfkMVYESSZyx6Plvid0XOYDhEwHCUKe/ctl7 4YH8YFSrmsXn2KyNC822rEG+G9gLvZRmFh+w332f8SLU9jxqxaRNc7ChaL/bZCLj1ihq FHK8pDoZsqAobLilKaqoFbkQ3SsxnX/5fB/v56VkHVKFaDi7dbcWiKp91V6pJwlpiiKE UXMOhcBjz81RCeF16LVk2474CH6/mkcUEp7SknNnuI2Y/mGYCzXjXkUnTEac3EhI/9Yx krME0XocKP+GvEsIcRsvC2eFDtKg0ismkicG9E1JeFlrtXX8N2mRjZKMoUWVW16QoCgj dLxw== X-Gm-Message-State: AOAM5335E9CwB1Sa7/9dkeifWvFdJoTA1wPQB72tIxYrPoY2W3yRNE35 lGeHBUQLAAjIC4qZN7mhDtLPfnCE7hI= X-Google-Smtp-Source: ABdhPJxIrnObjrxVhKnT2THbXujgxVzxkQe+42ar0eFTr5CjtwFO2lBGiV8989uRES8FT+3Ma0uaBA== X-Received: by 2002:adf:f88b:: with SMTP id u11mr4418818wrp.376.1600946295632; Thu, 24 Sep 2020 04:18:15 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Andrew Baumann , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Igor Mammedov , Richard Henderson Subject: [PATCH v4 4/8] hw/arm/raspi: Avoid using TypeInfo::class_data pointer Date: Thu, 24 Sep 2020 13:18:04 +0200 Message-Id: <20200924111808.77168-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924111808.77168-1-f4bug@amsat.org> References: <20200924111808.77168-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Using class_data pointer to create a MachineClass is not the recommended way anymore. The correct way is to open-code the MachineClass::fields in the class_init() method. We can not use TYPE_RASPI_MACHINE::class_base_init() because it is called *before* each machine class_init(), therefore the board_rev field is not populated. We have to manually call raspi_machine_class_common_init() for each machine. This partly reverts commit a03bde3674e. Suggested-by: Igor Mammedov Reviewed-by: Richard Henderson Reviewed-by: Igor Mammedov Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/raspi.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 16e6c83c925..3000e6d57e6 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -306,13 +306,9 @@ static void raspi_machine_init(MachineState *machine) setup_boot(machine, version, machine->ram_size - vcram_size); } =20 -static void raspi_machine_class_init(ObjectClass *oc, void *data) +static void raspi_machine_class_common_init(MachineClass *mc, + uint32_t board_rev) { - MachineClass *mc =3D MACHINE_CLASS(oc); - RaspiMachineClass *rmc =3D RASPI_MACHINE_CLASS(oc); - uint32_t board_rev =3D (uint32_t)(uintptr_t)data; - - rmc->board_rev =3D board_rev; mc->desc =3D g_strdup_printf("Raspberry Pi %s (revision 1.%u)", board_type(board_rev), FIELD_EX32(board_rev, REV_CODE, REVISION)); @@ -326,18 +322,36 @@ static void raspi_machine_class_init(ObjectClass *oc,= void *data) mc->default_ram_id =3D "ram"; }; =20 +static void raspi2b_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + RaspiMachineClass *rmc =3D RASPI_MACHINE_CLASS(oc); + + rmc->board_rev =3D 0xa21041; + raspi_machine_class_common_init(mc, rmc->board_rev); +}; + +#ifdef TARGET_AARCH64 +static void raspi3b_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + RaspiMachineClass *rmc =3D RASPI_MACHINE_CLASS(oc); + + rmc->board_rev =3D 0xa02082; + raspi_machine_class_common_init(mc, rmc->board_rev); +}; +#endif /* TARGET_AARCH64 */ + static const TypeInfo raspi_machine_types[] =3D { { .name =3D MACHINE_TYPE_NAME("raspi2"), .parent =3D TYPE_RASPI_MACHINE, - .class_init =3D raspi_machine_class_init, - .class_data =3D (void *)0xa21041, + .class_init =3D raspi2b_machine_class_init, #ifdef TARGET_AARCH64 }, { .name =3D MACHINE_TYPE_NAME("raspi3"), .parent =3D TYPE_RASPI_MACHINE, - .class_init =3D raspi_machine_class_init, - .class_data =3D (void *)0xa02082, + .class_init =3D raspi3b_machine_class_init, #endif }, { .name =3D TYPE_RASPI_MACHINE, --=20 2.26.2 From nobody Wed May 15 12:59:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) client-ip=209.85.128.68; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f68.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1600946298; cv=none; d=zohomail.com; s=zohoarc; b=bvvKtzGwaAoj2zHxo2s0124Gx78Um81CN/rRz2fRu9Ig45r8xtFiDzTPu/UqTVjQ+CzgR2/m22U255MWEI/N+ri+y0yyF/n3v80ZAbs5rtxRyZDa6cTdxdJZ34LgTTUEND20eZbN0h4l5CfHGK22tbYQoAzL7y3Qxy5SNyc6P/o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600946298; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ic/xY7slvI0DSSOiTKsUuGtbaH5pAUlsTrPjkrl/0T0=; b=Ni6Bgr7yQ3LX1Dhv/wtUDDlPBK3fRIXYO1tfWMpEWwtfb+z3qbItatCXM4/qIqd73e8t8gFCye5JwW5hxDpIh38Xy7gNeZ/d72ezneQC+3GxxGWu9HS6CI0DuZQeIlRwOCQfr1Y8pdlMJZdE352ih/89A+NSNRPmDQy7jk1WKYo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.68 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mx.zohomail.com with SMTPS id 160094629877852.65160972311355; Thu, 24 Sep 2020 04:18:18 -0700 (PDT) Received: by mail-wm1-f68.google.com with SMTP id e2so3192252wme.1 for ; Thu, 24 Sep 2020 04:18:18 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.234]) by smtp.gmail.com with ESMTPSA id h76sm3400363wme.10.2020.09.24.04.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2020 04:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ic/xY7slvI0DSSOiTKsUuGtbaH5pAUlsTrPjkrl/0T0=; b=teHC3bGiY98HfGXrepDW2gdO8nfj9B311vXkwv9f/s9VfnsH37bfHLe5De9SVxJewP /d9JnF9XzCXjjeqxTdVarYZbUw/g8PlO/tSGb7OBPn7yLZWNMfCaMQBJdYGGK3+6+OBQ QDJwjFLz5v0yY8wkOX/p7UXmleLA1A+htHL9hLJdXhz99nAwpmVn6Qj5FAjyUr6ZUJXb BCqPhnt6oYcdTjhWn7yms9CGxUWF+XA76n8EtOWxmm9xuQCx99d8eAuJHAZNbeUCZhdY lDMP5KhLOsnDXvZCr+kKdb4W9VwV5Wi1mYeyj8Vf6BhJRpp/B/vMZt2P7pBzNBC2zmny aQ5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ic/xY7slvI0DSSOiTKsUuGtbaH5pAUlsTrPjkrl/0T0=; b=dy3PDMHNMKjddt9RGnfHwo9VTmavpNMCIM9q4Kc6xIovhHiza+vSl0hcFWfAFgyzIs XSIHIiJRKp6wwY5aCuLN78CgaM5YUTxE6G5GSt4MGvxaPxW7Fg1kIoGiJwvz+IlVLHo8 uW8w4ZMdQ93qdpkS3hwQWmg/EMSjiO9ooxPLRc1OyqeUuaqv9+1lyp4FaFIpG0w531S0 8BGVAGeuCxGHUNJJBTKZdN5cHxJwxOteG6n2DWk1vNvLUM3TniiMxJIxRYYkZdI+1RL9 D2TxWj6t0JJpC+sYN6ZDfaySv8LXirhhclApfSEG1wQgc5a6YSt3S26r7AjXwqbgonji 6upA== X-Gm-Message-State: AOAM530FVtYZUZGx7575dvfDY6xMsDC6qCd6i2AgVsupKDitPB64Y+P4 j6e4iPpJNGsDHkbtISZo2kg= X-Google-Smtp-Source: ABdhPJyRnY1hWsgCbw/Nw8Y70OTeIYRdDUYfKOUoK9nrQ6bmQ58KyEkIcvDkSCi/MAuk1tZ8F3GqYA== X-Received: by 2002:a1c:18e:: with SMTP id 136mr4226272wmb.22.1600946296745; Thu, 24 Sep 2020 04:18:16 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Andrew Baumann , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Subject: [PATCH v4 5/8] hw/arm/raspi: Use more specific machine names Date: Thu, 24 Sep 2020 13:18:05 +0200 Message-Id: <20200924111808.77168-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924111808.77168-1-f4bug@amsat.org> References: <20200924111808.77168-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Now that we can instantiate different machines based on their board_rev register value, we can have various raspi2 and raspi3. In commit fc78a990ec103 we corrected the machine description. Correct the machine names too. For backward compatibility, add an alias to the previous generic name. Reviewed-by: Luc Michel Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/raspi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 3000e6d57e6..3426521379e 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -327,6 +327,7 @@ static void raspi2b_machine_class_init(ObjectClass *oc,= void *data) MachineClass *mc =3D MACHINE_CLASS(oc); RaspiMachineClass *rmc =3D RASPI_MACHINE_CLASS(oc); =20 + mc->alias =3D "raspi2"; rmc->board_rev =3D 0xa21041; raspi_machine_class_common_init(mc, rmc->board_rev); }; @@ -337,6 +338,7 @@ static void raspi3b_machine_class_init(ObjectClass *oc,= void *data) MachineClass *mc =3D MACHINE_CLASS(oc); RaspiMachineClass *rmc =3D RASPI_MACHINE_CLASS(oc); =20 + mc->alias =3D "raspi3"; rmc->board_rev =3D 0xa02082; raspi_machine_class_common_init(mc, rmc->board_rev); }; @@ -344,12 +346,12 @@ static void raspi3b_machine_class_init(ObjectClass *o= c, void *data) =20 static const TypeInfo raspi_machine_types[] =3D { { - .name =3D MACHINE_TYPE_NAME("raspi2"), + .name =3D MACHINE_TYPE_NAME("raspi2b"), .parent =3D TYPE_RASPI_MACHINE, .class_init =3D raspi2b_machine_class_init, #ifdef TARGET_AARCH64 }, { - .name =3D MACHINE_TYPE_NAME("raspi3"), + .name =3D MACHINE_TYPE_NAME("raspi3b"), .parent =3D TYPE_RASPI_MACHINE, .class_init =3D raspi3b_machine_class_init, #endif --=20 2.26.2 From nobody Wed May 15 12:59:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.128.65 as permitted sender) client-ip=209.85.128.65; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-f65.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1600946299; cv=none; d=zohomail.com; s=zohoarc; b=jbn1F+IZOTN3jiNbkLD0HkOenx4+xMqAJZQTf2O01/2j1kOBPdgQyaONy0lvj7u3tVC8m8ANqMTyKQjO3FwoK81ZqC5KcGr89E46Dg15KIIqgOnWNtrld/zsJcytdsG33KyUZHHPNmWMAnT6tGgMMhBcRE5yK2vsC9KCvN8G6eM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600946299; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PocNKqZn4p1bTkwGmp+nEPuAjYmk0VY+dPd4muqyYJI=; b=TtNXJNLzDvD/1CLFmqYX8E0bTaX4krnkCyZsA3Q5A9C/Gr7l3NoFb9nFbtcZc4xDjZlpHEZgjllsFT0YJycytyEOSCPBtetkb59u9Lwftp6MfDzjIhIb86nwiox75jk4G3sy4Z4IOwFjEpqMO8qajVX/4eGk27ggeQgvtOz7/fM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.128.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx.zohomail.com with SMTPS id 1600946299710665.2988334358247; Thu, 24 Sep 2020 04:18:19 -0700 (PDT) Received: by mail-wm1-f65.google.com with SMTP id y15so3201169wmi.0 for ; Thu, 24 Sep 2020 04:18:19 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.234]) by smtp.gmail.com with ESMTPSA id h76sm3400363wme.10.2020.09.24.04.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2020 04:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PocNKqZn4p1bTkwGmp+nEPuAjYmk0VY+dPd4muqyYJI=; b=ShotNMr6DAnlxQtldQDuMt5c4YW74YxTLbKH1//mF+LUqs6vJxHj0RjtrplEGcL19j sRAxHfiFeQrRPVCWuEb1IGrMWuvv/g/yCamgsv/zbp3ginzFAcVZ5F9SkUnTcp5Biu6y yiDEYrwVsp8IABGxBROqCBwN3MnptKgxyZ5SThaBE7FQ8s8fMy6d3TaQh/kyUNNlQILj BAdfyG92NXa2WKrdbmUNaugWUh0ZqrnhyMHLtvGDaqo//lcMpCdbDrf6V9MtQJ4oLYJd upgLlI7gBQmjvPvrUHHxR9GnJed0r/jnJGGuTc9EKaDMqOfgETjRpgt7qVguClf+N2LH y5Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=PocNKqZn4p1bTkwGmp+nEPuAjYmk0VY+dPd4muqyYJI=; b=H+eKVQJ0O9F+2ZG0oZIdKCDSpVdTRhFFW21a7PIchvHeMItENRyvWEsIDEVHzjzTGh dKp9PdkPen/uOEGUhGYpkgQYP+AlMHOTY7sH43/fDOesTj0VZXoUkmEAtYh65qoTtlpT rMzYOYB53pnwyhbdtM4+2iYxPyYbQ7KhR8nuLjLzYXwMuIQS7xVRush8oRacTT4A/SbZ ZXckybQFwzeSXhrzNskTChTQjkho6SWnP3q7I/CVLHSZ9wQ5UEtYB25FlXQCfoZIGEZp 2aL8jbshmC8A2/TxghMAdrAJgDHmM7kAL3HcMQ0+DPt0BX2YTMV316RVAWtfmRe3ZlEM SNRQ== X-Gm-Message-State: AOAM533QD+n4EvS59EAX7Db4xnKCq/PDalgMHosR2oCPWZfAvDBkpISp LS09Cm9kG9uduQK5vCams7A= X-Google-Smtp-Source: ABdhPJwiIBjKw1WHonGQh/aBe4NDBJJ6f1zBukZR8FP06cuTY1aGAS11ckgQxAAmXZ7ptqAUsSQwGA== X-Received: by 2002:a1c:8f:: with SMTP id 137mr4232847wma.158.1600946297860; Thu, 24 Sep 2020 04:18:17 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Andrew Baumann , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Subject: [PATCH v4 6/8] hw/arm/raspi: Introduce RaspiProcessorId enum Date: Thu, 24 Sep 2020 13:18:06 +0200 Message-Id: <20200924111808.77168-7-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924111808.77168-1-f4bug@amsat.org> References: <20200924111808.77168-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) As we only support a reduced set of the REV_CODE_PROCESSOR id encoded in the board revision, define the PROCESSOR_ID values as an enum. We can simplify the board_soc_type and cores_count methods. Reviewed-by: Luc Michel Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/raspi.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 3426521379e..0d8e5a34c78 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -69,16 +69,33 @@ FIELD(REV_CODE, MANUFACTURER, 16, 4); FIELD(REV_CODE, MEMORY_SIZE, 20, 3); FIELD(REV_CODE, STYLE, 23, 1); =20 +typedef enum RaspiProcessorId { + PROCESSOR_ID_BCM2836 =3D 1, + PROCESSOR_ID_BCM2837 =3D 2, +} RaspiProcessorId; + +static const struct { + const char *type; + int cores_count; +} soc_property[] =3D { + [PROCESSOR_ID_BCM2836] =3D {TYPE_BCM2836, BCM283X_NCPUS}, + [PROCESSOR_ID_BCM2837] =3D {TYPE_BCM2837, BCM283X_NCPUS}, +}; + static uint64_t board_ram_size(uint32_t board_rev) { assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ return 256 * MiB << FIELD_EX32(board_rev, REV_CODE, MEMORY_SIZE); } =20 -static int board_processor_id(uint32_t board_rev) +static RaspiProcessorId board_processor_id(uint32_t board_rev) { + int proc_id =3D FIELD_EX32(board_rev, REV_CODE, PROCESSOR); + assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ - return FIELD_EX32(board_rev, REV_CODE, PROCESSOR); + assert(proc_id < ARRAY_SIZE(soc_property) && soc_property[proc_id].typ= e); + + return proc_id; } =20 static int board_version(uint32_t board_rev) @@ -88,32 +105,12 @@ static int board_version(uint32_t board_rev) =20 static const char *board_soc_type(uint32_t board_rev) { - static const char *soc_types[] =3D { - NULL, TYPE_BCM2836, TYPE_BCM2837, - }; - int proc_id =3D board_processor_id(board_rev); - - if (proc_id >=3D ARRAY_SIZE(soc_types) || !soc_types[proc_id]) { - error_report("Unsupported processor id '%d' (board revision: 0x%x)= ", - proc_id, board_rev); - exit(1); - } - return soc_types[proc_id]; + return soc_property[board_processor_id(board_rev)].type; } =20 static int cores_count(uint32_t board_rev) { - static const int soc_cores_count[] =3D { - 0, BCM283X_NCPUS, BCM283X_NCPUS, - }; - int proc_id =3D board_processor_id(board_rev); - - if (proc_id >=3D ARRAY_SIZE(soc_cores_count) || !soc_cores_count[proc_= id]) { - error_report("Unsupported processor id '%d' (board revision: 0x%x)= ", - proc_id, board_rev); - exit(1); - } - return soc_cores_count[proc_id]; + return soc_property[board_processor_id(board_rev)].cores_count; } =20 static const char *board_type(uint32_t board_rev) --=20 2.26.2 From nobody Wed May 15 12:59:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.65 as permitted sender) client-ip=209.85.221.65; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f65.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1600946300; cv=none; d=zohomail.com; s=zohoarc; b=levtmTwBEBJniFPnmt1cyQZn+kBOHeu+vzm6whrjwRTQ719xZYMDuK5+OskxJAhdpQv50zef4u4NCzIp3kw1vnsEAV517PTsqvQTMJkg+NEUpd/VlO84vmt5Kd+Omkb1SO9WzXQ86DRKaXrmffQ32ZadaDdx77Q86/xWB5vEE54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600946300; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jy59s2K9kYiBxlA0hJextDJqNNjzNOlqp0zEmQTHIzI=; b=SSXCUQKu0vnZ/QbVa1UnC5xodnrssX3Dv23C5QVDcriNn1L5Zqt9Ppsoy7J5dQCVHFnORsC4jXSiwt9ChqxJWMufWMUrNmL1lt3hcQFN3hHS2vLFjA0f96M7qow/Mul8ubttdNzNdpPJRrTmkfzcYpWZe9IN2AO+N92Mwe/VhC8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.zohomail.com with SMTPS id 1600946300830772.2578103902423; Thu, 24 Sep 2020 04:18:20 -0700 (PDT) Received: by mail-wr1-f65.google.com with SMTP id o5so3310191wrn.13 for ; Thu, 24 Sep 2020 04:18:20 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.234]) by smtp.gmail.com with ESMTPSA id h76sm3400363wme.10.2020.09.24.04.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2020 04:18:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jy59s2K9kYiBxlA0hJextDJqNNjzNOlqp0zEmQTHIzI=; b=Qsk1Esf95NymoPBfYMmfEKzU7xIIx35y4/E2mkp26+k6533cKzCFMjp4dY1kAX5597 lf/tcKryKPtVezN1cK8QMWRWvgBUAHWpxXycifdCCXbq3UAllL7AjtFIs4dpZPevx7Sh +Oe1/trLIN6A9I3XZxW0zxnPgoKq0D3uM3yrUbF/XE4O1Z24ychNiKDpEC3qVglFS+f7 ypAxavSq+CvcF/u3wAPXk1gepKehS1qaz35IPCrG8ICLXwHnVG8OiaTGqIYeY1pGnuDb 4k2SJNHAfUXg9YPhr5mCGPMlF//VzujLmOZ1eixa1fhP61XJpeMhF0V/GG5xFwrk1Y/1 6zVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=jy59s2K9kYiBxlA0hJextDJqNNjzNOlqp0zEmQTHIzI=; b=azZv74wdou7QEv6kCVxaXY9En8plahkNb4LrLTEe86p/ULRGyk1emJntYPzxwnBd+v JuUhkdEdQo3LHTn5HQU2WtGhZG72Kx5x9dQ8ypInPy5hojegtO4bEPdmYiiDaQJaKH7L 4q4m+XZU4B9yCMz/Y1KHstTQpRxGdeLcB4Gj4N2VlIhDjKTsDv+/YbKAfwQLuNNt4nNU K/cTMOvJUmfIbQ+4lvPBtsOOHfcbOXL1M5RKzI3OnXFbe13xVWtiP5jC6VX9DBYDSadn dCbpn+P00CjUVilHL8UyhIDNlpQ12yBKllH+B/LdIKgeRT453Hcq9hp9EtwD34IHAEKU WF0Q== X-Gm-Message-State: AOAM530Y+1rTVl5CzrRtLTI6lkbysY/PHHIe8ZpLHiA+T3zgAFgJSQ8N xrsImN/dKTvXPisOFPIPQwU= X-Google-Smtp-Source: ABdhPJwNk8TjMTRLAuASLyAKy3j7Ia3GzHXDkSajFMpTlFM7txSicGhOwAhumtkpuhGvtDbZF1zn+A== X-Received: by 2002:a05:6000:1c8:: with SMTP id t8mr4472553wrx.3.1600946299022; Thu, 24 Sep 2020 04:18:19 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Andrew Baumann , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Subject: [PATCH v4 7/8] hw/arm/raspi: Use RaspiProcessorId to set the firmware load address Date: Thu, 24 Sep 2020 13:18:07 +0200 Message-Id: <20200924111808.77168-8-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924111808.77168-1-f4bug@amsat.org> References: <20200924111808.77168-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) The firmware load address depends on the SoC ("processor id") used, not on the version of the board. Suggested-by: Luc Michel Reviewed-by: Luc Michel Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/raspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 0d8e5a34c78..ae98a2fbfca 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -238,7 +238,8 @@ static void setup_boot(MachineState *machine, int versi= on, size_t ram_size) * the normal Linux boot process */ if (machine->firmware) { - hwaddr firmware_addr =3D version =3D=3D 3 ? FIRMWARE_ADDR_3 : FIRM= WARE_ADDR_2; + hwaddr firmware_addr =3D processor_id <=3D PROCESSOR_ID_BCM2836 + ? FIRMWARE_ADDR_2 : FIRMWARE_ADDR_3; /* load the firmware image (typically kernel.img) */ r =3D load_image_targphys(machine->firmware, firmware_addr, ram_size - firmware_addr); --=20 2.26.2 From nobody Wed May 15 12:59:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.67 as permitted sender) client-ip=209.85.221.67; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f67.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.67 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1600946302; cv=none; d=zohomail.com; s=zohoarc; b=DCJoq/0tg9re5NOkA7NLH5OA6tJBHT5FwQLP7gNnrV4IgB7bWdTxFHh/iFoZ+p3F6dmUFpnT2IuqPQYqzfcw8iFCPlAu0/BBrfuu7/kLDo4+C/pTVTr/G5C+yoMvLvsD4X/s8q9k04Qzz3bkUAUTZZhrzHWeQ0wDLRgXgV5vCUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600946302; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3cUAmcXEySvZuiPUDhUwrBrWEw0aliYA7aOM+n1UWOI=; b=H2k06I6z/mCdZAJslmuuUTjKo7hfHnIpnAK6fmhum2ENzgktJYgZIIK21nS8G/xn1cCWnH1p9VPZCyA8HCNGDG3SlxZoertOitCxGEXChO4Dz8gjmD9Fq8GI2BD3dNzxwKDjAKIJKWdxTDX1WvVib1Pujs83wCxHa/8/zo2UBNA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.67 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.zohomail.com with SMTPS id 1600946302262990.026335478464; Thu, 24 Sep 2020 04:18:22 -0700 (PDT) Received: by mail-wr1-f67.google.com with SMTP id k15so3346662wrn.10 for ; Thu, 24 Sep 2020 04:18:21 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (234.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.234]) by smtp.gmail.com with ESMTPSA id h76sm3400363wme.10.2020.09.24.04.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Sep 2020 04:18:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3cUAmcXEySvZuiPUDhUwrBrWEw0aliYA7aOM+n1UWOI=; b=PjIW+BmgLsKEZY9qkfmsSor2H6j+T9xbonpSLJspIo4y+RTfBJMul+RxYn7a4He+4w Ld24PDO5BYIypImJBU/eFoYoPY/2uuP2Bs1smRGvb2HjzWDnoTM+ANM1lPTdiG7QqsKh pJlDjhWHINAuZuB5FmExPCJqKtdgOY8I0CVznXDzM2W28Tipjov1U4hm5LeQDQ5kwN5v 0pNbsOuY2UCAMsD3DInDcDGmE6n/QSiA+miMXoLDJMA9QcUxqXoPWzm/3SpjDXgAg/uO 6CayQHcGRqsP+j2DKN6wrL9rvgcE5MkYuMRos1lf7eZbMKM5VlVl537oqENNPiWb/lPF HCFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=3cUAmcXEySvZuiPUDhUwrBrWEw0aliYA7aOM+n1UWOI=; b=K8KbO3Frzcr8tmDJP1risLqvUxsBqmCY3iGG91zr/8XhaHVXuHjtJMwfTBIw3v8TGG UtQC+KgrW/1oTnS3QflnOkbNm9mUMUduJd92PzM/o8Bh80gFiUWXq1IVVF1DW2339ye1 PFlR0gmwzx+40FxW+Pcv4tkLlOWW+t2ty/o2aqIL9+7WpyoVYYHcOn9M2c9d29XCeNB6 c5CNgwUAPDBw8hJZKLik3gVCJI1aUUVs4PdrbDtmLOGCjLF0whDwJH1wfraYiPDAj6vV ep/MxUZsjQ4N7T80CltR3Y3c6bQKENXiIBEhh63TppjpZHLnkEwZwjiSmrXfxNhqAnl7 JW2A== X-Gm-Message-State: AOAM5300k93mJQso7OV0/WeK3GPpnufiR9VBFbSimMrlDpmBudcIwI34 6LSxEXw7ItvUejdxcL10r+w= X-Google-Smtp-Source: ABdhPJw9RQ3k2RuaETV+Qs200DJcOncAxypTluLRxCKJ70WlPG1KXYtGtRGmS1oNylqNNeiSriak4g== X-Received: by 2002:adf:eb86:: with SMTP id t6mr4494533wrn.411.1600946300289; Thu, 24 Sep 2020 04:18:20 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Andrew Baumann , Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Subject: [PATCH v4 8/8] hw/arm/raspi: Remove use of the 'version' value in the board code Date: Thu, 24 Sep 2020 13:18:08 +0200 Message-Id: <20200924111808.77168-9-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200924111808.77168-1-f4bug@amsat.org> References: <20200924111808.77168-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) We expected the 'version' ID to match the board processor ID, but this is not always true (for example boards with revision id 0xa02042/0xa22042 are Raspberry Pi 2 with a BCM2837 SoC). This was not important because we were not modelling them, but since the recent refactor now allow to model these boards, it is safer to check the processor id directly. Remove the version check. Suggested-by: Peter Maydell Reviewed-by: Luc Michel Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/raspi.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index ae98a2fbfca..b5b30f0f38f 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -98,11 +98,6 @@ static RaspiProcessorId board_processor_id(uint32_t boar= d_rev) return proc_id; } =20 -static int board_version(uint32_t board_rev) -{ - return board_processor_id(board_rev) + 1; -} - static const char *board_soc_type(uint32_t board_rev) { return soc_property[board_processor_id(board_rev)].type; @@ -201,7 +196,8 @@ static void reset_secondary(ARMCPU *cpu, const struct a= rm_boot_info *info) cpu_set_pc(cs, info->smp_loader_start); } =20 -static void setup_boot(MachineState *machine, int version, size_t ram_size) +static void setup_boot(MachineState *machine, RaspiProcessorId processor_i= d, + size_t ram_size) { RaspiMachineState *s =3D RASPI_MACHINE(machine); int r; @@ -210,12 +206,13 @@ static void setup_boot(MachineState *machine, int ver= sion, size_t ram_size) s->binfo.ram_size =3D ram_size; s->binfo.nb_cpus =3D machine->smp.cpus; =20 - if (version <=3D 2) { - /* The rpi1 and 2 require some custom setup code to run in Secure - * mode before booting a kernel (to set up the SMC vectors so - * that we get a no-op SMC; this is used by Linux to call the + if (processor_id <=3D PROCESSOR_ID_BCM2836) { + /* + * The BCM2835 and BCM2836 require some custom setup code to run + * in Secure mode before booting a kernel (to set up the SMC vecto= rs + * so that we get a no-op SMC; this is used by Linux to call the * firmware for some cache maintenance operations. - * The rpi3 doesn't need this. + * The BCM2837 doesn't need this. */ s->binfo.board_setup_addr =3D BOARDSETUP_ADDR; s->binfo.write_board_setup =3D write_board_setup; @@ -223,10 +220,10 @@ static void setup_boot(MachineState *machine, int ver= sion, size_t ram_size) s->binfo.secure_boot =3D true; } =20 - /* Pi2 and Pi3 requires SMP setup */ - if (version >=3D 2) { + /* BCM2836 and BCM2837 requires SMP setup */ + if (processor_id >=3D PROCESSOR_ID_BCM2836) { s->binfo.smp_loader_start =3D SMPBOOT_ADDR; - if (version =3D=3D 2) { + if (processor_id =3D=3D PROCESSOR_ID_BCM2836) { s->binfo.write_secondary_boot =3D write_smpboot; } else { s->binfo.write_secondary_boot =3D write_smpboot64; @@ -260,7 +257,6 @@ static void raspi_machine_init(MachineState *machine) RaspiMachineClass *mc =3D RASPI_MACHINE_GET_CLASS(machine); RaspiMachineState *s =3D RASPI_MACHINE(machine); uint32_t board_rev =3D mc->board_rev; - int version =3D board_version(board_rev); uint64_t ram_size =3D board_ram_size(board_rev); uint32_t vcram_size; DriveInfo *di; @@ -301,7 +297,8 @@ static void raspi_machine_init(MachineState *machine) =20 vcram_size =3D object_property_get_uint(OBJECT(&s->soc), "vcram-size", &error_abort); - setup_boot(machine, version, machine->ram_size - vcram_size); + setup_boot(machine, board_processor_id(mc->board_rev), + machine->ram_size - vcram_size); } =20 static void raspi_machine_class_common_init(MachineClass *mc, --=20 2.26.2