From nobody Thu May 16 15:05:16 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=1600674993; cv=none; d=zohomail.com; s=zohoarc; b=oGcUrCJIvvDnI0sRdAIC9v+f7Py82KUvBKYTMNjNxqWFj78NuheAvOK+ZSHQYk6DBKy8pPjuAy7EAg/8tPZggzf/sTTjq+RbIsEY44sNZOm8wNFOiMWSZVkC3IkrsTDCUsNMIDsYnlnSPaAAG1cTrGDIjGl0nfL7a0N/M5/yxTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600674993; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cW7dIGVbLQRxcINm7s/47MM1xbv6QEuEycp0D1/7E0k=; b=TdybnfDXSYVrLVENbmvg6EF/UWLHYPyaC2Mr1eXYP7laMw6rlypNxVgTKT9sCYtnmKBfKOLWD+A7waXOFUIewToGoMMc6qGf7bdgzOyTdN8+TPfZYbAiZOzgux9eP2pvy4MwSnNajblsUCduuFgIO2LkgfRfz7GwdVXPUDPBYN8= 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 1600674993673884.2603219660754; Mon, 21 Sep 2020 00:56:33 -0700 (PDT) Received: by mail-wm1-f66.google.com with SMTP id e17so11141014wme.0 for ; Mon, 21 Sep 2020 00:56:32 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id o15sm17807538wmh.29.2020.09.21.00.56.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 00:56:31 -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=cW7dIGVbLQRxcINm7s/47MM1xbv6QEuEycp0D1/7E0k=; b=gpgXzVVOO+zBlYb0re2X/evLPDGwyGDIhqHOJnk/q7YD7/asCH0I8PpUlA3uGmRUr/ RdKKNBldda8vjCpLtwP5f94sXXbM6q2HFVgGQxwJU3lc37zedSznVzsBV3Y6F1gtPum9 EP1kN50X3WeiXDrmVJM1u4Y5vFCWmuSd08pt+2QPJJ/gG7mNxbCMwf+CLJJbXruYBlQ4 bWWUhvqGU+XFVIV4QixSPpQBXNxy6kIlUWCk3RmFslRgdRLOqJdoB1lDXxjJZQIJjiF/ EwPNtfOPHO/FxiLDUo7JQvWI5MIDUuwm2j5GpBvZVr1ecebpD+82AWYChomr2RCrOydN SXQQ== 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=cW7dIGVbLQRxcINm7s/47MM1xbv6QEuEycp0D1/7E0k=; b=bI2v+M/NDib3DJOTl/RpX90hNE70U4UpSAdrRW+VJLHKFTnqtUcEghh6kW0yj30S0b RMVMDcYGqcbLKhdzOHerIQLeVUDi0Uc/0ivG/bhUxR0CA3Bd4kYI2TKXy5Bl8fDCtVqh 8CTntLXYn3McUiWZbGkUTobmDjRIJZHGHJL9uhsHOyKIjxT9DwA7popK6Sp3pyR83tGY L6YUkFsZ4VWlLgPWcZScvOSrc3hczcyQE/uBaLlyawap5iMWBlqMV7U9xrRTkRM9cUnP 5ra4SsarDdJo3o9bUHy33TUI5VMdZ1UDQcMu29KCChd+dxovzixKkNv6SfgAgmBBq9Jt 48sA== X-Gm-Message-State: AOAM532EYi49McuPR856PSFN6mMbH8Tn9VMgpTOqaSQerMFV/57YGRP+ wiqWJiHPbvOTXjQ3C71ofRA= X-Google-Smtp-Source: ABdhPJxI/1LlX+OaqnI7x6OSbQKlglj2xH+IBdTAZaHagYNfJkLl9cl0dx5NPyrXp7bYnD3SxZkXgA== X-Received: by 2002:a05:600c:215:: with SMTP id 21mr28514189wmi.105.1600674991610; Mon, 21 Sep 2020 00:56:31 -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: Paul Zimmerman , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel , Andrew Baumann , qemu-arm@nongnu.org Subject: [PATCH v3 1/8] hw/arm/raspi: Display the board revision in the machine description Date: Mon, 21 Sep 2020 09:56:21 +0200 Message-Id: <20200921075628.466506-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921075628.466506-1-f4bug@amsat.org> References: <20200921075628.466506-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) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- 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 Thu May 16 15:05:16 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=1600674994; cv=none; d=zohomail.com; s=zohoarc; b=ZnVbKdEo/0fVHrjh7fFv+U8laIfPx80o6i10s+1hs5eedcPHwwnziiOs7hrmOHmo2SUWb9WuKd7N3vwVXUSCtwpY56fFyI63B62FeFGV6mOs8qTROP/NyI7Dp2QSHUzMY/hOyxF0d6FAVCTLYDil2hFY7DmVArIIuIWudlv/ts0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600674994; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JjzDLZKocLNXbXwLaMQHkkBQ+3Bkq4AUITFlMs6JsJw=; b=Z1S9QDi0hcmA1hWmTD/vxePfjFaX8dVn4nXm6+D1M3uoUNnPccl48zrwhOZmIwd+4H97Kbx6MhLMNoPJ1HWU2kOXe4KU9PQpIp4xHRVrVv2wPFT2CHbkhu2DLvjGowvpTI6RnyfX6tMpaZabALh6LMBJf+Aer9d+wYccew8BblM= 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 1600674994712694.0988570919615; Mon, 21 Sep 2020 00:56:34 -0700 (PDT) Received: by mail-wm1-f68.google.com with SMTP id w2so11140300wmi.1 for ; Mon, 21 Sep 2020 00:56:34 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id o15sm17807538wmh.29.2020.09.21.00.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 00:56:32 -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=JjzDLZKocLNXbXwLaMQHkkBQ+3Bkq4AUITFlMs6JsJw=; b=IHC8jDSZnQUPjMl9lRKd539CmVZ1hVNPFuEPK+oWYapd3NuIH7t8XLuxG0OTGJ66T9 TNj9zMJ/zVqxfqF3TVzfQSXjH9nKYC4OMyZ7tgJOPFdGNaDYaWUQ95rcbmBN/G6qWlzO Q++ndGjzft3lNVaelaXKFFI87P9fPDrjOtutufoaSXYt+/P5E9okGouRE46kkZvpOdiz OnQbR6aTSoAm/skEB0Oly0+0prtcufibcp6ysZa3WV445AhOxoPfjzhQEgQyTICJ6xoJ 8sNP7v7QeGqcR7CEtGkLBRES7Zjb1bVIoDXsoU46uaILClMz1RxJnlAzeu2w0fSL0Pzi tEOw== 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=JjzDLZKocLNXbXwLaMQHkkBQ+3Bkq4AUITFlMs6JsJw=; b=QstfWPTy5OMvDtqEyfTzgY/YAYvnXjsUOZLrUx+83HuCtHLefzlYKcggZYEN/Bx1Co 2bKNhcYlV6YbRutN5Vo5tt25z+KPYSAntmcsjRbxqLWQAYU/I2BddmCNx9G5AFjQVLQz X+o71G1rrj7ypuxJo7xIf94g7oShM1jVbZRcNXnaPkzHphKO97hSmIZBYdrNag6Cm0As nQo5naAOyYFC6eXuihiFuAtuioRUjojxc3Vc/JwhH5/RqpjRkx5YleWVCiQhorXl7Ewa 6S+9cfTe6HSpwRXas9cvFpc/f1gmQH8yvxPC/nMqRMQYiuPUbzH5LqMErg6NxzfIxiXu p1Pg== X-Gm-Message-State: AOAM531L/C0m7UnNynfivBnqsd9YYDJdmNQSQ6aWoptHbuTyOpuZ4xAY pBTeLn6458AvWSbeBqN6oWo= X-Google-Smtp-Source: ABdhPJwkcsGzaGcAs3wJHX6D9hTJM8GvTCfkFXC82vZcZ+QO8TtLnWzbL/Na8lZQL4h2wHX7gawKKw== X-Received: by 2002:a1c:7f14:: with SMTP id a20mr29369727wmd.95.1600674992712; Mon, 21 Sep 2020 00:56:32 -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: Paul Zimmerman , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel , Andrew Baumann , qemu-arm@nongnu.org Subject: [PATCH v3 2/8] hw/arm/raspi: Load the firmware on the first core Date: Mon, 21 Sep 2020 09:56:22 +0200 Message-Id: <20200921075628.466506-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921075628.466506-1-f4bug@amsat.org> References: <20200921075628.466506-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. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- 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 Thu May 16 15:05:16 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 ARC-Seal: i=1; a=rsa-sha256; t=1600674995; cv=none; d=zohomail.com; s=zohoarc; b=SCl/WVdmdc5PfVowWU2ychQY3Gq5X9iGC0TBFCiTrpXy4A6FWcwnAUmMBnzVNV3WJTBT8N+2+2OQGFvtOCkWTXn2+wMlJx782VULiIlEywlm2mLhe+YYX+43gnvg1DFwzLlI08bwJ/WdnzLAdEG/EV4fH54xuaO02Nn3PNxVjQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600674995; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T9CL3aNfJM88wMcSnRqWzQ2xospTK9SQCj76tJrEnoI=; b=DHh4cTDtRlKHOQxBUZbytKVpdJBYpnlC97cyKNJOTiaLrKMNcWD/yiA3wMyw3drgEkTZ1lVAK23vVIyVeYr7ay/8zL+VOrtIvoSq7MXHSQ44DIo8ew8AIxTBfOS85f/3MfWu9mP+v3XIJ+ATUBYNax0pGGHfrOVF3jepBdHXwns= 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 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx.zohomail.com with SMTPS id 1600674995633301.13417171604965; Mon, 21 Sep 2020 00:56:35 -0700 (PDT) Received: by mail-wm1-f65.google.com with SMTP id e17so11141144wme.0 for ; Mon, 21 Sep 2020 00:56:35 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id o15sm17807538wmh.29.2020.09.21.00.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 00:56:33 -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=T9CL3aNfJM88wMcSnRqWzQ2xospTK9SQCj76tJrEnoI=; b=RxVC2BnMBeL9NBjUrIxUrgrg8eOQiVmLqhTQJrs8VJQL5/BsPWTVbrJ/P119c6OVMa 8Y0pphLCwbt+h2ihO4+OMLKkpO6DPBPUdk6DelkWKqALEnc7DgH359YnNawqZ2afVseI pLSUfeJhKmlQqoifVg4t/9KloV5ias9uRYpDVFhkZxFQ1qlUlz7EJUQ3AnaSvrWO9drn GKIl17Yj79ij/Y2qQW9yd8euijg19+aYLeh9hqjYcPx55RB9Cp/yTAs4y7UgLIEbyT02 wc4EF6QFYCgQLORikc5rkXH8si3F0WPkMm+A0IrpG6NztTW1HhANkI+ysP+cXStyXjEy Kugg== 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=T9CL3aNfJM88wMcSnRqWzQ2xospTK9SQCj76tJrEnoI=; b=pDpQfzDFGU71bxD9PiS50tikOspS/5u3igGhgzuz+x2xKxTsQeWacFucslbDz49R/U /RzQUUchvvbRTkgdM7Qcwx7MoBUTWVPW4QiePsRmXql22EEHouh5j6mxVJc+Wrcwra32 e/pEzCuPFUjFRcr86mLR2MzA5JsINAnVhudMBrMXmVJZrmT8nce1aWHancXKOXx5fZPa 9W09Qgrimrnhl6BMeoX3YyYzt/4pj9o8sMx1P4Cpx2JvBZKAZD2ROKtq+av/9Tr+A28R vKLFYbykY1xmE7B4lCaXSZX0k6pK1IiG29Xmyp7R7sMU2kPoDQAjDeXpL9BsAkns0d/V WChA== X-Gm-Message-State: AOAM5303g/9wHnFqnqKcgIgaKvEgCJqkR3CJCOIqm3ovaFT+Rqw+a2oU TujPR42ZwmNuIX07xLLovLk= X-Google-Smtp-Source: ABdhPJwQQZ6qeIcNDvel4K4aXMQoh+tQwuc9xTBRkdA6XBsgrYhDOHJsRr3QGkI4G7+RBSjBMem1lA== X-Received: by 2002:a05:600c:221a:: with SMTP id z26mr30293349wml.131.1600674993864; Mon, 21 Sep 2020 00:56:33 -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: Paul Zimmerman , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel , Andrew Baumann , qemu-arm@nongnu.org Subject: [PATCH v3 3/8] hw/arm/raspi: Move arm_boot_info structure to RaspiMachineState Date: Mon, 21 Sep 2020 09:56:23 +0200 Message-Id: <20200921075628.466506-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921075628.466506-1-f4bug@amsat.org> References: <20200921075628.466506-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. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- 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 Thu May 16 15:05:16 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 ARC-Seal: i=1; a=rsa-sha256; t=1600674996; cv=none; d=zohomail.com; s=zohoarc; b=H8lwBsKAYiHlt1xFnmMUzHQwOH3tB5XosNCcC9stV8TNbeCyX09aHg5zXzCUip8vd9X95E/YDp1FM/InQZNVmz0FMwUe1zMw7lfJqZJaP5eFDUJMxqBnghs+tlTATpcab3bBt0uJ0xhP/L/KBsE8ao3ID1gI7OLeMS1hrxfrfUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600674996; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4jv3gV83IdvS5OKXioOXbKRM8ceNFIHhtNFiZgXYFU8=; b=OnbFozK3ekLuZvYoAyfcE1iZ+mBCZk9aMRbYAvTkoFh5vEo3FLwcNNF6/AQsHfP0o/jJ/mf3ftms2KRRcy2GlVl7T5gZ8hsnAaxgxIWVUe1UGrYBtM1SXMYYEsxXfpfr9U8Tb7h0lrVVHwPjrl8nSfIqaQzTw1y4JaXxMG/yHog= 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 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx.zohomail.com with SMTPS id 160067499680518.457092821912283; Mon, 21 Sep 2020 00:56:36 -0700 (PDT) Received: by mail-wm1-f65.google.com with SMTP id b79so11508717wmb.4 for ; Mon, 21 Sep 2020 00:56:36 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id o15sm17807538wmh.29.2020.09.21.00.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 00:56:34 -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=cHXGAWZjs1mtTUP9QmNplWdwi6b+Rs2EjtEhI6Zo/5ZsnErlZaZoLBlHof1qTAYpX5 XOgWIjJg4+bInmCeLclSYc3xZROxL3KzJoCKsvf7HNeBXIclPj3N/LlQ3vkaYTxsXOr7 BQp39Ys97LMGZcR+QV2DW2QGF4tXVYLn0XskzQoDCt8EFFrzg2G7Guuj5F1X3mMvpUH2 rl5Kxk6Uw9nNPzLSVBMJwZwCIaeCcZRKfVqsUt9RAZ3QGOn5HqooNbwUrQbhchPM+/IK YXzfEuh76kGlo68VZnxc8pXKLBVspvDqfkjrC21PvJ5o5YSMM/b4o2Pd5kpyO5YXFjaE fLZg== 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=luY4PBVwJ6GYIZvWPTHQLS/Jy01t7ryWI+6CUgLWhvLRVbIcxvVUAiwBzE5XzW59Ib r5K9dOS6UxGPJe+icqxTwbD833ZINyq1O8AKf/N1A6czHrB2Sowhkm8B2YTIz4P6m9TY 5pM0PDJwWjFU04gVV0It9Ld7aBTLiJBYc/dN7ERzMt32HtieDY5qYaGj09kfEvFkU5r+ D/rNp+Bd6+xrf0sIBJRp5fHD5+qTLD9Io/YWho8lTeB86nUYLvF+VqapZB/EVeJO/CjZ X2kD/22OY2g+3BzTwc8ZElNUI8rY3EW8f32OxIoefhcctv+T8fwJtyGeNGrntFhD9Cmv gZ4Q== X-Gm-Message-State: AOAM5338u4XF992acUkUhtXKUZee6lwiWE2tGzQ/S1BJRSTMKojYvDjN kFFwPIKyCjQdTXqFkLSpraSO7ATvQM4= X-Google-Smtp-Source: ABdhPJww7xSU+20lcuogel/zC7bg9gL+mkcYm+dtCXKAOrt4i5Ys4AV7wKtMz7Rh1P6MBRUL5Kkihg== X-Received: by 2002:a1c:1f42:: with SMTP id f63mr27866952wmf.1.1600674994992; Mon, 21 Sep 2020 00:56:34 -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: Paul Zimmerman , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel , Andrew Baumann , qemu-arm@nongnu.org, Igor Mammedov , Richard Henderson Subject: [PATCH v3 4/8] hw/arm/raspi: Avoid using TypeInfo::class_data pointer Date: Mon, 21 Sep 2020 09:56:24 +0200 Message-Id: <20200921075628.466506-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921075628.466506-1-f4bug@amsat.org> References: <20200921075628.466506-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 Thu May 16 15:05:16 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=1600674997; cv=none; d=zohomail.com; s=zohoarc; b=ds5WgU5iT9fEqlwJ+PXN2/5Z/fHtu75ae8Nigte1ElwVp18VVJdKpb7RaS6Tv/PZ25YizHda+lvnL1iV3+BqArQaGQUkG5A3NCVqAxTbVyBlc42IXvmaaWo99gh5n82g41Of2q0SToxt7xchRYPOfW1aghs4IRNxbKUjDbceapQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600674997; 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=P0qwWyi9r9OyBHGGj+ywKWFwc/1QZpPLjLJiGyMMLYk+H2mYQS9vcH7l3Oy2sdRa2pWWmpsZprvalAVm/YVbvW4ZAK+e6ZOLQOogOJNk9PSCb9G7e3rGI4wei4c7EuvvhVCcoGT4HHDhWLukgBGZDkPu+DoxSieACfOEoXLJdHo= 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 160067499793867.29203379322223; Mon, 21 Sep 2020 00:56:37 -0700 (PDT) Received: by mail-wm1-f66.google.com with SMTP id w2so11140444wmi.1 for ; Mon, 21 Sep 2020 00:56:37 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id o15sm17807538wmh.29.2020.09.21.00.56.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 00:56:35 -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=CTPbg0CaIHhrO745w+utHk53avcjYQmUHmWhcAYTCveL4v47a6pNMxrDyOXJY2mMxF w8HlBKT1cOqCeMWlICEdyvZeBf7A+YELf9QG2MnM0cd3KpENKrdm6pZ6+kLnQFEFjy22 rYLazSdTmKXMqeTH9158BaOy9V8fi5pqbAOTQdfrbeHeaiKe5k7jVdphKeZb76Q3wD1t bFO7KyyyetbJiUzlKHnayS3vQ53yvJ45ZwnQa32XetvxSHfiTw2UpQl6uKh4bTW057qj hKOe1e+Tak+NRsc8FpUFE2qvyhDxFxyg/oMC7us7CpI83EZfhrL5NS4JQ2mw7neI8MeD DNTA== 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=ecA7VGBdar17S/3vI7kg5Qa6Vi0lh3d+STNqpsa682rhbmGbh2taZXVAhUHtnIWbJl fJhv7T+qIAM+b2bDLb6uVfGlI2CwoX0d+reDnOV7ZA4FFnPjHMIBRdM929xLceYg+xC0 NGAIxWVHeKxYy3z20ZWiqikST9q1+MwgQj0dtiAcJsjt2hAuaqjdngwiX0qjkvkpzkqj OtedygEcj5dZ1EIRRKcwk3rCaShxh/4gq/IPRV46fYV4TVDotezw9R50wajhLV2ImKVr kkdmKh4og09IltQI8MPZO70JY2z3ceQOkocjaTDntuvf2S6MZ9I98BSNMkfZu5teRR6z 8+gg== X-Gm-Message-State: AOAM5325EUqbB9Vbe6+19wmAO03hb8+HCkMHYfPa8etUijt50xI2bdA7 Ja27FI4y6By3iZQilqG/jAc= X-Google-Smtp-Source: ABdhPJzRPSS51oC0+x3IGazpoPxGXl10TNsptbPoANOVjRBMThNJ9tiPtWrjMuB8nGq3BNhh+ogk3g== X-Received: by 2002:a05:600c:414e:: with SMTP id h14mr28130346wmm.2.1600674996053; Mon, 21 Sep 2020 00:56:36 -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: Paul Zimmerman , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel , Andrew Baumann , qemu-arm@nongnu.org Subject: [PATCH v3 5/8] hw/arm/raspi: Use more specific machine names Date: Mon, 21 Sep 2020 09:56:25 +0200 Message-Id: <20200921075628.466506-6-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921075628.466506-1-f4bug@amsat.org> References: <20200921075628.466506-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 Thu May 16 15:05:16 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=1600674998; cv=none; d=zohomail.com; s=zohoarc; b=Av+Yh1nO3Jt+yLwDui9bn0RZbMqBRBviSwgRR3adLEa1EIF2VPxCRoG7xy231G57JLFZynwK8CEGrlZgcTRpAA8/8pok+FSj3wmtsbhErY09SIiuaSzXejvT1F6OpCqWVM3e6kTJNKRSbuh4HMB1yZ65fFJHVicw/NYMUAv65Eg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600674998; 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=oH1wtI8Qq4JcuVOvMldHXI2Lc436y00WXW+ysnqxOwmFFYyvquLOrxQ6wR3XO/16QNoyG6NmfZbeMqvkO8dINoyabIZy7rl84RlgAPahCvPIYiipmlxKFojLwCqEpEJUyoEvMYE48lA+M5J1msRW2LtQw2RbT1yoIpspafMuVXU= 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 1600674998980743.603454823647; Mon, 21 Sep 2020 00:56:38 -0700 (PDT) Received: by mail-wm1-f68.google.com with SMTP id x23so11122881wmi.3 for ; Mon, 21 Sep 2020 00:56:38 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id o15sm17807538wmh.29.2020.09.21.00.56.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 00:56:36 -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=atIgRAocCEop8xYEs1+Tdur9yq7HmwSZav8/4Kw0PFPiWbwak8aUkVWx/yDe+vHJBU i1igu5utpyVZgI0Psypcg6cwXhRq+QZVmevSYdzdhyWJF2DSAnzyIIq6wFVjDAebK5+9 5HPfz5g6fHQ9t5dfW/fD/6BsvxygTqfFGjsTB9rqOPh29YjPBLITybI93lDGUJB7KXSK 03nY98SR9ng6BnlXtf9VFSCg8q0sK4hZshM40FR+5kfKYC2w7DeGbpA4aVg48rzJeTCI VD0ysi/juDiodw7uGdGpAZDp7EGWEvkIx5iRMCK71OCtyos/2dhEYIvF21qDRbRvDcP9 Vy4Q== 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=XyTMGHjIbAj1SqyQYzvnVmgx0SP3HYZq7M+wM5Ki7WVn4w7E9U43kNBVUIB+5P0sm0 fK58i93ur//eLx7gFLKlPdwUKhHTvgEkTZCsbbBv/ocjgJ4Yqu8kdiY1xAElgBzDFK7Z IkcaZaK2t0PXsDcDejG5jA+9XWE6dFc9jdCNaWG0ixP3JE/ZKqLYeDJv77AKJ3ohXyb6 z8jTdj2gdwTT5t7iJNzMSfawtaBEb0wjYLAouINxkcZ9s2q+imdzDtPQdIGTepfpnU90 a/f/KA7H5n7BF9WlZWzz/L6DpcP4kfVvsK6CkFIHhcLcX0hbTEPd3qiu0x1mTASCGsB1 ZE4A== X-Gm-Message-State: AOAM531geKVyja//FEApsUMPwQM5+kd9Kp2GAq+jlfuxe8sE4aIxFn94 B2/sgPXpVDgKHIsENi4m6S4= X-Google-Smtp-Source: ABdhPJxJVyzDa4aB72g0ssN1c/fNQLfrOl5hSpYoyJeTjXBNN6kPn8vWikUC/ganxCLFz7kPeRkSvA== X-Received: by 2002:a05:600c:2317:: with SMTP id 23mr30190066wmo.183.1600674997083; Mon, 21 Sep 2020 00:56:37 -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: Paul Zimmerman , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel , Andrew Baumann , qemu-arm@nongnu.org Subject: [PATCH v3 6/8] hw/arm/raspi: Introduce RaspiProcessorId enum Date: Mon, 21 Sep 2020 09:56:26 +0200 Message-Id: <20200921075628.466506-7-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921075628.466506-1-f4bug@amsat.org> References: <20200921075628.466506-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 Thu May 16 15:05:16 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=1600675000; cv=none; d=zohomail.com; s=zohoarc; b=XwutiwdW6AbSeiHA3XUihMctKNARvJIT5mL2lWDw77JVH7Z0Iy15JYNAOs4XtUCPHg45dCR6mQdIDE3dSgyynzvHKVxpu9AG0LTpvArmOsRLxOqOOF5K+7mKPYDZdidUUk0GEQRbbXQ3CKemAFRn4hxbAh/cjtPfD/Awjgc16tI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600675000; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bdvjopkTSWyYlzzNIYBWFkPl2GYS4eTOsFgqMfsz/M4=; b=X2Id/oMDgY4rvP8pbjodSIMYmXN6lEh+seuh/iFsECyzovyTI92Xr2WU/FQ55qsvZ+oh+WCHu+FQrI0GPWBflUjAroNQL3xVJd/efKvPaVDLuPxjoAZF0uhvqdXzHg6U42XWKfYR2E23CLDSL/I5hBJphZ6jCj+SqKxjZmJ4COo= 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 1600675000033293.30165174083186; Mon, 21 Sep 2020 00:56:40 -0700 (PDT) Received: by mail-wm1-f65.google.com with SMTP id y15so11513691wmi.0 for ; Mon, 21 Sep 2020 00:56:39 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id o15sm17807538wmh.29.2020.09.21.00.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 00:56:37 -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=bdvjopkTSWyYlzzNIYBWFkPl2GYS4eTOsFgqMfsz/M4=; b=AacNfGaIGNK+5xuW8s1l0Qd+TpoVrU/nTYtNc+F7NhNK9yos+VwG5vzFcRyiYaFncc SkPVDbP4U5Bp7OLoJ42D+E59fruC+WJYfr5DytUvXXS8VJvqr7OdrDn8IvBU2FRp4564 iJadkEPZuDyXkiUHnQnMkPupKeVOoYSsd6266ZfBHjGeV7tIuKClIw/5Dv1WY4aTgidS IZ2ej/wT+uu+dz2K0IlnKS+F4b49sd9+Du9qMc7yIIOg/IhTCyhRR4vNob5x0ZbU2rio gIctGbcsO30NG8Gnu6cubOU5upZt7MYNeMLWZebAsjxTRy8dkY0IDiqCG4nWcBe5+6x8 /g6A== 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=bdvjopkTSWyYlzzNIYBWFkPl2GYS4eTOsFgqMfsz/M4=; b=sXxoF/fZQxeN6L6/AvjS8d50h0FTl+xurU067sZeffG3rRofGlf9sC8I/VGlpQBl1T mKja/IUXgxwNMjbZlfZkefxtYFLivilZEewVOZ7PKIJDPczERUzjzLJmbtb+lsvXBaSS vmLGuhZuxa6lbrGfK3o5R2zQr5mgQxwJZNe7FTjWCgh9n8M5RvKwCyyyHJEegG1IyFAK Ecgb3TJVCTpD1nsU1mf8N9wsLIGGO/pLCxFbwF5rJ8FP3LZatiE03iqHua0AkbBl90fb q222dNWIaAdsP+PY9cdpIBKk8Bg5vBsjWKppsqxlB6IXKyT6gC37wnyP6G2SrsKFe2kX D6FQ== X-Gm-Message-State: AOAM531+Rw2CXZn3NazyilcBlz2hL/ElJKIz167Pf1hzH9TmPUn+VpnX t8ut94kpOsNewafWSbz/aW8= X-Google-Smtp-Source: ABdhPJz4KWGoGBmgjPt3scc6aJt1Q2ubx6+vDVKuTC72WwiVAhzOkQSvL5b6IRB6X7rNS35y3XsLjQ== X-Received: by 2002:a7b:c92c:: with SMTP id h12mr28912799wml.121.1600674998178; Mon, 21 Sep 2020 00:56:38 -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: Paul Zimmerman , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel , Andrew Baumann , qemu-arm@nongnu.org Subject: [PATCH v3 7/8] hw/arm/raspi: Use RaspiProcessorId to set the firmware load address Date: Mon, 21 Sep 2020 09:56:27 +0200 Message-Id: <20200921075628.466506-8-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921075628.466506-1-f4bug@amsat.org> References: <20200921075628.466506-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 of the SoC ("processor id") used, not of the version of the board. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Suggested-by: Luc Michel --- 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 Thu May 16 15:05:16 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=1600675001; cv=none; d=zohomail.com; s=zohoarc; b=IM8rcWww5bLPLXUgfDm7G1mfSCd91WYelqPgbwCdH0IeH1Pe9lylhB1uO0CeYAQkJuDOKQViRMVqT2ZhY3IjEFsZBWmAS/m9CbkjklwLpnaw+LeVN0gBZSyYDvr0IHXjcgS8bpsHefefwBWAswpFq0dJWeX0YyRwspiPpSlpm1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600675001; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3cUAmcXEySvZuiPUDhUwrBrWEw0aliYA7aOM+n1UWOI=; b=QiSD/bUpfLoZQqqvF3CKZMcEt0wFe20GRH4KiVVtkfd8UHBIO1orOU+mh++WA+OcXMNZgehW4RnINErB0nP0inTOS+WCOuuKkFDGB18VFCcZoBCsfWYrWNAUQ8MUN4sOdWao5G6Hv3W+tCvTsgNo/prrcx4/p2WI5s94Tv5aj+c= 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 160067500143646.297574708450384; Mon, 21 Sep 2020 00:56:41 -0700 (PDT) Received: by mail-wr1-f67.google.com with SMTP id z4so11644427wrr.4 for ; Mon, 21 Sep 2020 00:56:40 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (65.red-83-57-170.dynamicip.rima-tde.net. [83.57.170.65]) by smtp.gmail.com with ESMTPSA id o15sm17807538wmh.29.2020.09.21.00.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 00:56:38 -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=HHGnt+RFag9XZfkWzme5pKMLKAPNbLZq1vHaYb2qtu+SFuxHrDXFvaz3DELv/QkAnk 3Y74UyD9FYSZZXOW32Al4PVpx6coBMzUUlB5rXR9DY1MEkc9yliI9D6bMBamMtLrwlBg cBZ9qnuA1VX16P2t9zB27TTJDy2Gc86hcgGVedGlSiIDlY24HIRRe7dxzV8bAYMesxCL Gdcrr7HR51fxftvwjXNoGOD0Dfxnjzm8na99RtXDUO1geAN1Glumrqea8QiH5+CA37rz /GaGcyLk0FsEfykRgqEwFapqYMamvd8MCnry759Uh/0kiA9Q06uc5PI2rmhWCq1H2Fd6 Obdg== 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=ZxtywnGpNZ+8klupgTPJ2iFT4LtmOsClQ5maoeu/57m3uAOYfS7yhNEsBesV0ws+hT 33Zbl2y589t5Sc12DHm67mZzvSJTRbsrxZQ+nPynGiJnbE+henmi1Kn3bYJ3hxBctC/c JkNh2MuQFyVtZqiqqLjkMzap5v3WV3Wsz2pE1w0UnBzRkhAYUa6didow/BucfCngl7SC DEL1AGTEDxRIdcLB5JdyovjmhXabOPWB6uCHBHlwPzvhlTFqn9TIikEv/cx/KDTnEDV0 qiZeV99yi4AIEyAbTT0H6I06XU+E+SzWKL0t8S78puSK034Q0RfyfDKNjbD/lWcvH/jM vYiw== X-Gm-Message-State: AOAM533EjusMElb4dWCyDIbvPpKw9escneKM2iFc1KuYAL3NaqsOyg+4 2TIJOc8DITHQKlUnKoBLufU= X-Google-Smtp-Source: ABdhPJyYhBHjfebxHKTyJVFY+HdnLw1Z/14Lys9WpMdXMRbXNFVqgci3j600qn/bWT8Imrxom2LVeg== X-Received: by 2002:a5d:60c6:: with SMTP id x6mr19007867wrt.157.1600674999332; Mon, 21 Sep 2020 00:56:39 -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: Paul Zimmerman , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel , Andrew Baumann , qemu-arm@nongnu.org Subject: [PATCH v3 8/8] hw/arm/raspi: Remove use of the 'version' value in the board code Date: Mon, 21 Sep 2020 09:56:28 +0200 Message-Id: <20200921075628.466506-9-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921075628.466506-1-f4bug@amsat.org> References: <20200921075628.466506-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