From nobody Fri Dec 19 16:00:25 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1601566878; cv=none; d=zohomail.com; s=zohoarc; b=jQzCkcgNGeWTI4CQUR3mzmriLQfLNmu+P28xlK3ccDo0VEHYYU84DujXUrSfYpdQE9Et9TUfsl1upzqoO2Yp3uFQXtC6v05RrHI6bxhFgMEMBF/l9sE52NLzUf08vD160wkVvCfQ6E2VG8csVh6ZJpQPPTCqFesECru4cLk3KUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601566878; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MXn7GPNB0G2xDNlS9e9pEhshZeJq6tfNJlqpKjovYoA=; b=oBx/ZcRT41ZJnmuUXlHVsCmlcQp4yYc+IpOXfEoA3pxTEgKZ4EvR1urCYoawjY0FLnWKfyRiUaK/r2AJXDoaYwlOEJwBFYUS+JUFSNgFVYrE9HNkdwV/kHLh6ZEufwDd++Zw9/hU/wd3m2b/iRdPQ3lci8rKaCHa3o2G4WrUHzE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601566878599417.35440663014197; Thu, 1 Oct 2020 08:41:18 -0700 (PDT) Received: from localhost ([::1]:52878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kO09Y-0002GD-MO for importer@patchew.org; Thu, 01 Oct 2020 11:05:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kNzsi-0005Nd-UA for qemu-devel@nongnu.org; Thu, 01 Oct 2020 10:48:29 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:34170) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kNzsg-00031w-Ne for qemu-devel@nongnu.org; Thu, 01 Oct 2020 10:48:28 -0400 Received: by mail-wr1-x42f.google.com with SMTP id t10so6135149wrv.1 for ; Thu, 01 Oct 2020 07:48:26 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 70sm342052wme.15.2020.10.01.07.48.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 07:48:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=MXn7GPNB0G2xDNlS9e9pEhshZeJq6tfNJlqpKjovYoA=; b=Mg6QWscXZCnAVSAtJIDqDPmrKifDYscXYB9mlkHBn08cStoy+4AUueT2vkZdnTE5mA nTB53a60uXBGI2h5oVeu2XLLtU5Pz3lVQrHL4bTr5PloaziXlCj3QUl2IlITnaYns2EZ yiiSSqfrTAHdY1hyv67eLseF49+vXCRf/w+bg5WmJkuWkI5ewY6HQrLkp4LJ1e9z3p6m kEBkJUM6m8cFRfMS7Upwn3C7mzxRuuopzNyW7TuZb0cx/frEFlVlkXjkCV8V+DCkwXsL 2IOkNCb1dnT/9X2rvBiV9XY/hecaw6QEGfNn+qfbq/jix5FJx6VbkJ1vMpPG2o4cNLqx KqcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MXn7GPNB0G2xDNlS9e9pEhshZeJq6tfNJlqpKjovYoA=; b=CnFZ4SXI0jsZ9tdKNBt6rXANcM6EmPljuZ6hlgeuEILmOtUU5a3byTmnk/TIO6iU1o U3ajC+/pvqA1CmVrLzI6ldY7/oVdCaTDP3K1qOlqXGzrRjiwaVhUGTqTPYVPC0nwIhWu rb1A/BwaFv+rI7HuBUY+Q+QEf4pbu5jUg6RwtZAjztOguY8vQAv/JjB/TKqcWhyKpShj YCXvfqD/V/9oAf/PSJrY2rvzpdVIukwhqQk4GWhtc2aJ40BYHq34e6PPoOqhuuqLEhph tsmcntKJJCYAHGNSHokyf2x980IRgBb5eZ+IFnZalSD6PQbhVfBzejeMKmKAR2yE8F4E 69ZA== X-Gm-Message-State: AOAM531/jp3EdGuLNR7PRcgLmFonutmIymd8i9gOjL3z7lcuYUG5Lpj4 osS0OXdAEPIjrf0c4NCY3jWPQzMzKxR/R0wn X-Google-Smtp-Source: ABdhPJxhraQVbVmwxc1FmiNRTNOP5DQUrhdxMr7mrV6mD7xmndeWAo8i3OkvTkcYUCnW0q+BW71kNw== X-Received: by 2002:adf:f34a:: with SMTP id e10mr9365472wrp.91.1601563705121; Thu, 01 Oct 2020 07:48:25 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/18] hw/arm/raspi: Remove use of the 'version' value in the board code Date: Thu, 1 Oct 2020 15:47:59 +0100 Message-Id: <20201001144759.5964-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201001144759.5964-1-peter.maydell@linaro.org> References: <20201001144759.5964-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 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 Message-id: 20200924111808.77168-9-f4bug@amsat.org Signed-off-by: Peter Maydell --- 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.20.1