From patchwork Thu Sep 24 11:18:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 272848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31A4DC4363D for ; Thu, 24 Sep 2020 11:19:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B673A2388A for ; Thu, 24 Sep 2020 11:19:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pT5c55im" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B673A2388A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLPI3-0005oA-Pq for qemu-devel@archiver.kernel.org; Thu, 24 Sep 2020 07:19:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLPGS-0004Bx-1N; Thu, 24 Sep 2020 07:18:16 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:51876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLPGQ-0003uQ-ES; Thu, 24 Sep 2020 07:18:15 -0400 Received: by mail-wm1-x344.google.com with SMTP id w2so3131456wmi.1; 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=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=lr96Q7lPDvLVxVfSbiFtFSt5wKJQxU6EnuCtBgVpSyfBFE6WxSbshDk36wFQe13bdD txYOIyM7bWeo4IBpAiig69KbEc75c5NdqucvfGry60ICgYqKXRopWT+DTVhwKcW4Rz/b 5rBWc7HsppOSxC2hJxPHuPA4uFK+aUz+/EU7uhe0iXSx4/5CFaZDIyQPRrc8RbpaEwEQ kgfkElSjE3w1sH4ATJ25mcrjsEyjyPnXvIydq0dKnv6L7USvxXXfjUvxPpRkVqnEgAb8 l0aAGDmdDnAANMGaocwYzMgLzgMVXoUoCuOTIqkXokwwbC1wyARg0iG6xWvwlYprFPVY YYSA== X-Gm-Message-State: AOAM533nTcBdPBfxRXVFFb9jQahYF01u58j4aFBP7l3yylbkFHlmo9I5 ELQ143APjdaQb6Q8+empueiiQd3Wkpo= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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, void *data) uint32_t board_rev = (uint32_t)(uintptr_t)data; rmc->board_rev = board_rev; - mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev)); + mc->desc = g_strdup_printf("Raspberry Pi %s (revision 1.%u)", + board_type(board_rev), + FIELD_EX32(board_rev, REV_CODE, REVISION)); mc->init = raspi_machine_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; From patchwork Thu Sep 24 11:18:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 304524 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CCA8C4727D for ; Thu, 24 Sep 2020 11:19:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 899DB239D4 for ; Thu, 24 Sep 2020 11:19:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OLEZuBzp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 899DB239D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLPI5-0005rd-9U for qemu-devel@archiver.kernel.org; Thu, 24 Sep 2020 07:19:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLPGT-0004DD-72; Thu, 24 Sep 2020 07:18:17 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:55450) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLPGR-0003ue-6K; Thu, 24 Sep 2020 07:18:16 -0400 Received: by mail-wm1-x344.google.com with SMTP id d4so3110361wmd.5; 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=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=R3grbKGifZlGEhfTqr0QBgjyrRDT/iSVi7I9YmNvnKjaJSk3V5H4p1cahuczMzuWL5 wViL0c0kPvPOsUtS9/QtaPKrhMTkNEaCfv0eFx13SwBHomT2bBp9Pd4Bkqi8WZdm3yMn j9/R8WiWU+b+Co2R5fqQeH9Y2rmRAj5wVZ44y3a16HMN8Wgzbb+0qQoeH6kUiodDPHhY uZLca9bVtg2Eq+y3s7Vjt+bIpNupoo+2BhuOHb8GgiARVk3bCVvhfhZ1svFgKKQFLWmh sBXpAhF9ORFUeUSZHAPoL9Ux5FVy/Aj0DgXT1OYVDSJ83YQS2a1oriXzl6W8xeqUgOcv ESlg== X-Gm-Message-State: AOAM533I71neIhzz8UkqO96V8QzqqAPvYzPKS0MM09rKMgtL2iavrj8V I0hN/AGcLW9oHKzDqBaj5HtiimvBoVc= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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 arm_boot_info *info) static void setup_boot(MachineState *machine, int version, size_t ram_size) { + RaspiMachineState *s = RASPI_MACHINE(machine); static struct arm_boot_info binfo; int r; @@ -253,7 +254,7 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) binfo.firmware_loaded = true; } - arm_load_kernel(ARM_CPU(first_cpu), machine, &binfo); + arm_load_kernel(&s->soc.cpu[0].core, machine, &binfo); } static void raspi_machine_init(MachineState *machine) From patchwork Thu Sep 24 11:18:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 304523 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBEE9C4363D for ; Thu, 24 Sep 2020 11:21:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1267F2395B for ; Thu, 24 Sep 2020 11:21:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FXeim/rJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1267F2395B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLPJo-00005V-3K for qemu-devel@archiver.kernel.org; Thu, 24 Sep 2020 07:21:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLPGT-0004DV-L5; Thu, 24 Sep 2020 07:18:17 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:43437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLPGS-0003ux-2X; Thu, 24 Sep 2020 07:18:17 -0400 Received: by mail-wr1-x443.google.com with SMTP id k15so3346338wrn.10; Thu, 24 Sep 2020 04:18:15 -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=hZlB8psHxeaANN0rcZo1K9ERYwDP6+rRMmr8H5X1SJlt48/F3iZzdOZlj5KHGfpVWW O6wrZGAQirK+CCdrvFJobjs/wAgyV4bxH9e4li5blN2Kc97OqYLCP48LEZOTUHxkDtGF oxKWWxlGy/CTUx3lQe41vFHpuJQW9A4uhtk191vuY9xCDCW4LCU6AxLR1A42C7+Eo8d5 wvCeooLKoltXsclV/SM31wv77jYmf5+C/z6ZgyWkpb7NWeYzcZLGLSOtSkYGt6JlVZk3 COhzNrhnhr7KCKpuL2u5i4Kq3mgPqDvaTeoWjOR8QjNc4BBGx2SDHsTadNWTETMSETBH tC1A== X-Gm-Message-State: AOAM532ZgkkZDSPSw9C2lxojuMHTl3ul9vFoV4tLHNUCTp5n4/4Rur6k r12crMJybspDVfPDUT4p7XL4T+oLjpE= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The arm_boot_info structure belong to the machine, move it to RaspiMachineState. Reviewed-by: Luc Michel Signed-off-by: Philippe Mathieu-Daudé --- 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; @@ -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 = RASPI_MACHINE(machine); - static struct arm_boot_info binfo; int r; - binfo.board_id = MACH_TYPE_BCM2708; - binfo.ram_size = ram_size; - binfo.nb_cpus = machine->smp.cpus; + s->binfo.board_id = MACH_TYPE_BCM2708; + s->binfo.ram_size = ram_size; + s->binfo.nb_cpus = machine->smp.cpus; if (version <= 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 version, size_t ram_size) * firmware for some cache maintenance operations. * The rpi3 doesn't need this. */ - binfo.board_setup_addr = BOARDSETUP_ADDR; - binfo.write_board_setup = write_board_setup; - binfo.secure_board_setup = true; - binfo.secure_boot = true; + s->binfo.board_setup_addr = BOARDSETUP_ADDR; + s->binfo.write_board_setup = write_board_setup; + s->binfo.secure_board_setup = true; + s->binfo.secure_boot = true; } /* Pi2 and Pi3 requires SMP setup */ if (version >= 2) { - binfo.smp_loader_start = SMPBOOT_ADDR; + s->binfo.smp_loader_start = SMPBOOT_ADDR; if (version == 2) { - binfo.write_secondary_boot = write_smpboot; + s->binfo.write_secondary_boot = write_smpboot; } else { - binfo.write_secondary_boot = write_smpboot64; + s->binfo.write_secondary_boot = write_smpboot64; } - binfo.secondary_cpu_reset_hook = reset_secondary; + s->binfo.secondary_cpu_reset_hook = reset_secondary; } /* If the user specified a "firmware" image (e.g. UEFI), we bypass @@ -250,11 +250,11 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) exit(1); } - binfo.entry = firmware_addr; - binfo.firmware_loaded = true; + s->binfo.entry = firmware_addr; + s->binfo.firmware_loaded = true; } - arm_load_kernel(&s->soc.cpu[0].core, machine, &binfo); + arm_load_kernel(&s->soc.cpu[0].core, machine, &s->binfo); } static void raspi_machine_init(MachineState *machine) From patchwork Thu Sep 24 11:18:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 272847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87C38C4363D for ; Thu, 24 Sep 2020 11:20:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 03A7D2388A for ; Thu, 24 Sep 2020 11:20:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XHB3f84k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03A7D2388A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLPIB-00065v-0a for qemu-devel@archiver.kernel.org; Thu, 24 Sep 2020 07:20:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLPGV-0004Ge-3U; Thu, 24 Sep 2020 07:18:19 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:41183) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLPGT-0003vU-GE; Thu, 24 Sep 2020 07:18:18 -0400 Received: by mail-wr1-x442.google.com with SMTP id w5so3360069wrp.8; 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=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=rwNvyN7q5H+xT4q7qnYjywHiyUdpVJYZb/WcxTacJxXYgY0YCJSK9mItyIxhBINYro TQc+Zeu3dh9WrmqnyQH0+HqodGk5avYeVWrwE28veoTGdiZ7yu/6mg9hel+DFDXC5PDY v1aSglUgts8AprR+vybQE49JhkRX+9TE3yL6Q3F2Vea/Y+cuMJVekauTqH0vvxOyVPMd Yqsql3E4J6Oo5RO6Ypst5eZ+zISuH0DTZ++IYEyC5uoRZutBnC9ACpHYHwqSkqki/TbY vQLix2e+2vB4DWUQJ8cN4roWzGrQ5Qk4jqq2da7yifAuXTbPO+W03nB6G7c4GFGOF1Ns wnyg== X-Gm-Message-State: AOAM533LON21iWO5pw02ChrQbCjKbIbjG76ZrVt1WIrSCKWQftN0lMMn 85mchEAVH3iK3X2RZNHQbPW1RXIqWf8= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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); } -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 = MACHINE_CLASS(oc); - RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); - uint32_t board_rev = (uint32_t)(uintptr_t)data; - - rmc->board_rev = board_rev; mc->desc = 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 = "ram"; }; +static void raspi2b_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + + rmc->board_rev = 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 = MACHINE_CLASS(oc); + RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + + rmc->board_rev = 0xa02082; + raspi_machine_class_common_init(mc, rmc->board_rev); +}; +#endif /* TARGET_AARCH64 */ + static const TypeInfo raspi_machine_types[] = { { .name = MACHINE_TYPE_NAME("raspi2"), .parent = TYPE_RASPI_MACHINE, - .class_init = raspi_machine_class_init, - .class_data = (void *)0xa21041, + .class_init = raspi2b_machine_class_init, #ifdef TARGET_AARCH64 }, { .name = MACHINE_TYPE_NAME("raspi3"), .parent = TYPE_RASPI_MACHINE, - .class_init = raspi_machine_class_init, - .class_data = (void *)0xa02082, + .class_init = raspi3b_machine_class_init, #endif }, { .name = TYPE_RASPI_MACHINE, From patchwork Thu Sep 24 11:18:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 304522 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A54D3C4363D for ; Thu, 24 Sep 2020 11:22:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2904A23A1B for ; Thu, 24 Sep 2020 11:22:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="teHC3bGi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2904A23A1B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLPKG-0001ID-4o for qemu-devel@archiver.kernel.org; Thu, 24 Sep 2020 07:22:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLPGW-0004KZ-JQ; Thu, 24 Sep 2020 07:18:20 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:39110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLPGU-0003vg-Eu; Thu, 24 Sep 2020 07:18:20 -0400 Received: by mail-wm1-x341.google.com with SMTP id b79so3169373wmb.4; 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=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=Mdh05pebUlagYyGn06I9T57+wW1GOioNY0YgWRFRmBE2WUdvDgY53rqwv0iQMTEs+7 NBF/k9PuWjsDrj4pac/dZ8vrX3NCIhh3Ey0JPdipcyDaj11kN7jtJhRE4wQM31DHCOfP liTmi2/+MuqVANuCCG5y88yFXZyAq3hzXkc19IePnJnX1RcnaD2AsKQAqihk2AmeKQiD xfGAzgQK0ESEWJ+UfgYVeu5vm3+9DTVUb34hVLuRmhdzXPq/7GxIkZyjzyw9E5tW3eDG L6IDRXlX9srTWkUfGlIqPCiM4s1WP2VlZlpJ8ANNp+GMWMRANl7ja3nD8IfBXkx62UvH P4FA== X-Gm-Message-State: AOAM533qOG2oWKuG5BnpjHEK4RABq2a3s8hA+QEO62S7lAy+a0D+eMFk dqN5CzOB5EqfT+PAhp9PbzYP+PP+wPQ= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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 = MACHINE_CLASS(oc); RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + mc->alias = "raspi2"; rmc->board_rev = 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 = MACHINE_CLASS(oc); RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + mc->alias = "raspi3"; rmc->board_rev = 0xa02082; raspi_machine_class_common_init(mc, rmc->board_rev); }; @@ -344,12 +346,12 @@ static void raspi3b_machine_class_init(ObjectClass *oc, void *data) static const TypeInfo raspi_machine_types[] = { { - .name = MACHINE_TYPE_NAME("raspi2"), + .name = MACHINE_TYPE_NAME("raspi2b"), .parent = TYPE_RASPI_MACHINE, .class_init = raspi2b_machine_class_init, #ifdef TARGET_AARCH64 }, { - .name = MACHINE_TYPE_NAME("raspi3"), + .name = MACHINE_TYPE_NAME("raspi3b"), .parent = TYPE_RASPI_MACHINE, .class_init = raspi3b_machine_class_init, #endif From patchwork Thu Sep 24 11:18:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 272845 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22729C4363D for ; Thu, 24 Sep 2020 11:22:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 84A3A2395B for ; Thu, 24 Sep 2020 11:22:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ShotNMr6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84A3A2395B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLPKP-0001VK-FJ for qemu-devel@archiver.kernel.org; Thu, 24 Sep 2020 07:22:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLPGX-0004Mz-FB; Thu, 24 Sep 2020 07:18:21 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:40182) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLPGV-0003vv-Mw; Thu, 24 Sep 2020 07:18:21 -0400 Received: by mail-wm1-x342.google.com with SMTP id k18so3160624wmj.5; 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=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=mOL4yuDjhf9/VO8ShnGZOKkinhgPRK1RerDpmPq8Lu2zjwToP2lSqIqyy66PrzLpw9 NoK+2dabB0h+T6WdQPpRQ74rKzHV01YIa38AnDjMYJg6JJ0Wcm+USwl7ctBktHct36U1 PtaL379lUWqu0FrcjHgD/W+POKeUAuuaLR1BaL0N2Uc9dYBbiRJ7Vf5c5LIjOiOARfRv RrMUQIHZ+KyuRX4ULRqLc02LRmBjH1hNmgKp3xr4xI8GsqjFfijjB/tp1R5X/YFNxcVd AQaf/wp0quT1LatWrEi5OmAZkzJY3CNOlqFpYdcMzJMjnCS10WFujCdrFepb0wxFPZ0L hZ9Q== X-Gm-Message-State: AOAM530DnkOrI52/iu8hLHBABuvsjtfBoNX5EsnwSbhcWQZnFFyK4Zdc WANVShM3JyyzBR/5swWftHVlo7ZMYwA= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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); +typedef enum RaspiProcessorId { + PROCESSOR_ID_BCM2836 = 1, + PROCESSOR_ID_BCM2837 = 2, +} RaspiProcessorId; + +static const struct { + const char *type; + int cores_count; +} soc_property[] = { + [PROCESSOR_ID_BCM2836] = {TYPE_BCM2836, BCM283X_NCPUS}, + [PROCESSOR_ID_BCM2837] = {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); } -static int board_processor_id(uint32_t board_rev) +static RaspiProcessorId board_processor_id(uint32_t board_rev) { + int proc_id = 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].type); + + return proc_id; } static int board_version(uint32_t board_rev) @@ -88,32 +105,12 @@ static int board_version(uint32_t board_rev) static const char *board_soc_type(uint32_t board_rev) { - static const char *soc_types[] = { - NULL, TYPE_BCM2836, TYPE_BCM2837, - }; - int proc_id = board_processor_id(board_rev); - - if (proc_id >= 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; } static int cores_count(uint32_t board_rev) { - static const int soc_cores_count[] = { - 0, BCM283X_NCPUS, BCM283X_NCPUS, - }; - int proc_id = board_processor_id(board_rev); - - if (proc_id >= 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; } static const char *board_type(uint32_t board_rev) From patchwork Thu Sep 24 11:18:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 272844 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 234CCC4363D for ; Thu, 24 Sep 2020 11:24:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 894652395B for ; Thu, 24 Sep 2020 11:24:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qsk1Esf9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 894652395B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLPMt-00052o-KK for qemu-devel@archiver.kernel.org; Thu, 24 Sep 2020 07:24:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLPGY-0004Ps-Gl; Thu, 24 Sep 2020 07:18:22 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:44631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLPGX-0003w5-0l; Thu, 24 Sep 2020 07:18:22 -0400 Received: by mail-wr1-x441.google.com with SMTP id s12so3333962wrw.11; Thu, 24 Sep 2020 04:18:20 -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=nCy1UZhv0I8PbFgttAw9X/H3EG34gC8MfwOiaCGNVasIcenJW+WuTmOISAYpf+pPCg vJKiTjt1DhNHNHwSvPjypyRAkVZm4YGiuN/LVXFGybdHuYWLuhCxJnJOHU3FuBcLs30/ 8kBxG/ggHYOYzBPSMltP+9srSoeNZ0kCnAkiRdGa+ge8TtN/gziMX+6vfItkEtojudR3 PPEIFTkWvfwypYEeoAMTHU2l92NUS4f0a/7f1eJLxEtTCo8ZKc981XZi0xJV9t1tC5BB 21SiMqIg+xPAb7e4+hZHHY66znMQ7DSjTZ3QpHhV6J6er8J6xXHtm9rY7uYYYH9wySq2 8ZsQ== X-Gm-Message-State: AOAM533FLULscSo4DcEOl/qsI56OvK2J5/uNpbrRvjFAXA6RnHuHNE+B FEHRRIn2xlow7/+mzQGYqfCmwEvKdyI= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::441; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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 version, size_t ram_size) * the normal Linux boot process */ if (machine->firmware) { - hwaddr firmware_addr = version == 3 ? FIRMWARE_ADDR_3 : FIRMWARE_ADDR_2; + hwaddr firmware_addr = processor_id <= PROCESSOR_ID_BCM2836 + ? FIRMWARE_ADDR_2 : FIRMWARE_ADDR_3; /* load the firmware image (typically kernel.img) */ r = load_image_targphys(machine->firmware, firmware_addr, ram_size - firmware_addr); From patchwork Thu Sep 24 11:18:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 304521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC367C4363D for ; Thu, 24 Sep 2020 11:27:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27D8F2395B for ; Thu, 24 Sep 2020 11:27:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PjIW+Bmg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27D8F2395B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLPPX-00009A-67 for qemu-devel@archiver.kernel.org; Thu, 24 Sep 2020 07:27:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLPGZ-0004TG-Ol; Thu, 24 Sep 2020 07:18:23 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:33029) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLPGY-0003wH-6Z; Thu, 24 Sep 2020 07:18:23 -0400 Received: by mail-wr1-x442.google.com with SMTP id m6so3416564wrn.0; Thu, 24 Sep 2020 04:18:21 -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=QG36ae7IMA3CJEPdoAHlpMN+If9L8ILPBkSRsNkPm7QQLoNLu5qDQQtwnMAf4DO9IA k+zF0tePBrMklbMlhIizZ3B1XSw9vOv6AsOk+ZwUJ5FPYUxtOOCdxq2JrY/v21VH4x47 4bjvoaAV1JvhNnJQmWwJZg7M2mTv4kUjdGpVwrb8hhEwA5+vCJU/K9O19V6+LO8bX98y uMuWYgsN0aCmt+ZVwzHj415ua39guFGi6/OlErNCWNBEskk0PelS83Hw5dLlxT51KtNb zMt8iBVHF2R3dgzbr5l3JSEZHHr+YFdQFP+qh65XTu26NdoBHktEH725ZQtzKujPu1uN MKhA== X-Gm-Message-State: AOAM530Rhi07kX1toI27HCRUCnOc7FrQuMAyGE0i621DsQl7h0Drju5s 2jAjSco4UukFhv5kPX7RpOwLTC5ytEE= 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Luc Michel , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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 board_rev) return proc_id; } -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 arm_boot_info *info) cpu_set_pc(cs, info->smp_loader_start); } -static void setup_boot(MachineState *machine, int version, size_t ram_size) +static void setup_boot(MachineState *machine, RaspiProcessorId processor_id, + size_t ram_size) { RaspiMachineState *s = RASPI_MACHINE(machine); int r; @@ -210,12 +206,13 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) s->binfo.ram_size = ram_size; s->binfo.nb_cpus = machine->smp.cpus; - if (version <= 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 <= 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 vectors + * 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 = BOARDSETUP_ADDR; s->binfo.write_board_setup = write_board_setup; @@ -223,10 +220,10 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) s->binfo.secure_boot = true; } - /* Pi2 and Pi3 requires SMP setup */ - if (version >= 2) { + /* BCM2836 and BCM2837 requires SMP setup */ + if (processor_id >= PROCESSOR_ID_BCM2836) { s->binfo.smp_loader_start = SMPBOOT_ADDR; - if (version == 2) { + if (processor_id == PROCESSOR_ID_BCM2836) { s->binfo.write_secondary_boot = write_smpboot; } else { s->binfo.write_secondary_boot = write_smpboot64; @@ -260,7 +257,6 @@ static void raspi_machine_init(MachineState *machine) RaspiMachineClass *mc = RASPI_MACHINE_GET_CLASS(machine); RaspiMachineState *s = RASPI_MACHINE(machine); uint32_t board_rev = mc->board_rev; - int version = board_version(board_rev); uint64_t ram_size = board_ram_size(board_rev); uint32_t vcram_size; DriveInfo *di; @@ -301,7 +297,8 @@ static void raspi_machine_init(MachineState *machine) vcram_size = 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); } static void raspi_machine_class_common_init(MachineClass *mc,