From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940176510581.8459252136536; Mon, 17 Feb 2020 03:49:36 -0800 (PST) Received: from localhost ([::1]:44144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eu7-0003KB-5h for importer@patchew.org; Mon, 17 Feb 2020 06:49:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40555) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqJ-0006Qi-Cp for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqI-0002K7-E0 for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:39 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:38341) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqI-0002IN-7c; Mon, 17 Feb 2020 06:45:38 -0500 Received: by mail-wr1-x443.google.com with SMTP id y17so19314236wrh.5; Mon, 17 Feb 2020 03:45:38 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:36 -0800 (PST) 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=CQieaLe+XzdG/scqrmf0SdvellEvi4/sJOsfkTjUk/k=; b=IXIUOD/tMMjlZo2zjX9iGESFe/AKtsDvRbx/V/mhLn3FuF42j6ZcuBvCJtqv/b9lrN vZK4CNKbTZnZzbFN9DAwiTMlp5OWHCpktH38QBI05Vzm5TQGW8JynuIVYxCGLjNy7qdN bVkSf3cROrY2WGaZZFKFq3cHSEDqHu7KeLivWZqmtR6QykTuq6GoIFXEIPgIH8iQ/1TR ypGAkGM7lkxSeWBGVR43IFUe2COBUjCcdx11eVonxxAw17JNXMiQXfhxjZqydbSjeStJ YydpEdzBvFWCaqr2Qk0Ar44ZRKPnbKbHrifH47c4EBJihaOBQ2W9E7bT+qtOFfuKXW9J q2bw== 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=CQieaLe+XzdG/scqrmf0SdvellEvi4/sJOsfkTjUk/k=; b=pxeIHzmNdiiqDaw8+l4YK8Rl+wIsKk8kpNTECsSGAwTDJnB8AWm4Y1/GNKX5/C/5CJ NoZSUriqYYlWwXG6xrNUOmBLv1kTv2MTqSkqjLz26UE9+P8+TzXEx1L+mZ9eccFkpdC3 ZAFdXG5JcIzbXvnXDm0Tqh0cvEDndmS3Cy4Q0gfo9FxrhXgtAxEO8c9moqkr+h5o5EGi e8Jubr2lRAwFMBlH1kUHB4P/YEzYIbmDiVrygSfHLBuBGjKkJ9z9sgHeULUVtWUStB6A vkkxa1t1MOOZcsTnCA6Ru4Mr8R8NBPipjf1c7+WzmvjxYkNmKWfcexMM5yvvtcX7ctHr oIGg== X-Gm-Message-State: APjAAAViVpFNv2Ub8nC/HC8JE9N1a0maxQ0maiIByHrvuQw5g1gNRPoY MgGtGgIwLe/MvtfsjnPFyzzXbxrNpZ4= X-Google-Smtp-Source: APXvYqyCyTaSKoOnUMXxlNNSRIZtMwfx7erIGg+tbxIRjMLG/vF1Cc1ozev3c6CJPx+/z7ZhQmHNrA== X-Received: by 2002:a5d:5273:: with SMTP id l19mr22952522wrc.175.1581939937009; Mon, 17 Feb 2020 03:45:37 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 01/13] hw/arm/raspi: Remove ignore_memory_transaction_failures on the raspi2 Date: Mon, 17 Feb 2020 12:45:21 +0100 Message-Id: <20200217114533.17779-2-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 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=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Commit 1c3db49d39 added the raspi3, which uses the same peripherals than the raspi2 (but with different ARM cores). The raspi3 was introduced without the ignore_memory_transaction_failures flag. Almost 2 years later, the machine is usable running U-Boot and Linux. In commit 00cbd5bd74 we mapped a lot of unimplemented devices, commit d442d95f added thermal block and commit 0e5bbd7406 the system timer. As we are happy with the raspi3, let's remove this flag on the raspi2. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- hw/arm/raspi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 90ad9b8115..221356933e 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -324,9 +324,6 @@ static void raspi_machine_class_init(ObjectClass *oc, v= oid *data) mc->no_cdrom =3D 1; mc->default_cpus =3D mc->min_cpus =3D mc->max_cpus =3D cores_count(boa= rd_rev); mc->default_ram_size =3D board_ram_size(board_rev); - if (board_version(board_rev) =3D=3D 2) { - mc->ignore_memory_transaction_failures =3D true; - } }; =20 static const TypeInfo raspi_machine_types[] =3D { --=20 2.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940043906111.06551572629485; Mon, 17 Feb 2020 03:47:23 -0800 (PST) Received: from localhost ([::1]:44120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3ery-0000Es-Fy for importer@patchew.org; Mon, 17 Feb 2020 06:47:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40574) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqK-0006Ru-O3 for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqJ-0002Mm-Ka for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:40 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:45282) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqJ-0002KV-EG; Mon, 17 Feb 2020 06:45:39 -0500 Received: by mail-wr1-x442.google.com with SMTP id g3so19302238wrs.12; Mon, 17 Feb 2020 03:45:39 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:37 -0800 (PST) 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=VKFmxLOGnHffoRhD3MbqsWU4YBZCUj/Q1JFXeGbGN9Q=; b=rrlg03E7oHFT3lxqyAj65RWWIB8Y2kApUR+nWdEaPS/bdSGkudrbIYMni9wMJwBInH E0kMsuUyUPOyj/vEf1hxHoXBXXuvE6QZlkJCNAYE2asJyMiLxNfWnFem9xoJwRk0+ctb yzFPjHIt0lNt5aKsa08StwWfVMpZDbYO3jZFP/+Z6IL06Qj7BWqxUFMCkQT3EO/KrfaY uRAtmVGfeHLjTOFHt0CXSN7xszSoJu217ohdnMVLcq7R5HmasLOG+jGQzYvXXUBmZfi5 JmPyJTU2d9+V2USWl2qC0u+jfyVBZFBSJaFKrYkrcMqMajcTKsD0MoVOXcNqSiLDopJH yILw== 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=VKFmxLOGnHffoRhD3MbqsWU4YBZCUj/Q1JFXeGbGN9Q=; b=jZKH+uEWFqkG7uFQEcttzfFJx9hLVJWF/nZO4g7NiUkA0U1Gay83i7F7AO00Ugf05j oOECYxR+WE7uDAatqXlBczosazgH0j7U/Fa0fbo17HjwzyD6y/Kxubqi2AIZKTPAVIi6 j0anPMSHOUo3tK5kwMjcaM+QdOO7rilHHs2l+QOM8U0HK/eTLDyRBaJRkWPmFTI69Aus +HBBOAuPJnk8nykCYE8k/GfPM060Y3xf5XreuZaj8LjuZxLLt4T4X12ztLNCea4a5raE BeT9pIyfZa4OYlR73WMYG2ODRCqJ0DFBeSvMEkPH9FiBSqRY16S2YU9je8YhmdV8yI8H oblw== X-Gm-Message-State: APjAAAUrD7IqSe1zWrQo7+/krPrXtH5p5+/J4XuX1dmewR40+tKYBi+f Ix9U8+HimbZ4KE0qi0CxUuzIwpnTp6E= X-Google-Smtp-Source: APXvYqzw8q4SfWTSLL7434ZNJrma2dGGGo5cuuaymAhygwSwMKpzU+cJuxEWRtvWsdZeX0W8Huw3IQ== X-Received: by 2002:adf:f0cb:: with SMTP id x11mr21975408wro.421.1581939938204; Mon, 17 Feb 2020 03:45:38 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 02/13] hw/arm/raspi: Avoid using TypeInfo::class_data pointer Date: Mon, 17 Feb 2020 12:45:22 +0100 Message-Id: <20200217114533.17779-3-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 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=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Igor Mammedov --- 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 221356933e..1a8c135dc6 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -309,13 +309,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", board_type(board_rev)); mc->init =3D raspi_machine_init; mc->block_default_type =3D IF_SD; @@ -326,18 +322,36 @@ static void raspi_machine_class_init(ObjectClass *oc,= void *data) mc->default_ram_size =3D board_ram_size(board_rev); }; =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.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940035764314.6844334747067; Mon, 17 Feb 2020 03:47:15 -0800 (PST) Received: from localhost ([::1]:44112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3erq-0008MC-8Q for importer@patchew.org; Mon, 17 Feb 2020 06:47:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40598) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqL-0006TH-VM for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqK-0002OT-Vg for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:41 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:45282) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqK-0002NS-Pm; Mon, 17 Feb 2020 06:45:40 -0500 Received: by mail-wr1-x441.google.com with SMTP id g3so19302341wrs.12; Mon, 17 Feb 2020 03:45:40 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:38 -0800 (PST) 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=nvtVA24YsHTPrSYwj3qF+5DzrFJmWkSlCMlNJG9JnqE=; b=VQF9b72RHHe7Ve/RYts9HftY4hap3MiHLjyWjcgzehS0c+FM//w6Jjqqm8mj6okGhZ ZR5Bn4xmXPzDuPzxKlXGPkddOlJn5iwIMen2m44Uw+lgIBmiC2DD76VybtxlF8P1ULou 2y8F6trv96sbadbq9GdLlqW2uKrnSUhClFrtaYxkVySNjdVwigIpj97FLp4vBmMO2UTj jxXD4pBiUkPifDaDyQ3QEoMgSjii0iUhpJHOJasqqPESWe6gfursFxVOTmtWSesb1wRA jT+bi6pQBeeeolI0ysrZWZ/UOhm5qG1XPOjcPtf79ICO4yyPnoLmIFXa5Yk50ik2TNu+ C9dA== 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=nvtVA24YsHTPrSYwj3qF+5DzrFJmWkSlCMlNJG9JnqE=; b=VwNiq275GV5p7l1Bzbhv1va0E8A9kRG+fiRBfEJQSFubEV/7th2P/mdFHhzu9pB86h nsQA3dviZLXMAlOmPlnfI94j+IOH/n54qOFS2oFetnD5OeyhShBwwDQbpKPNOUmiiN++ Kgb63J41r0jLLHpxMkjWSyuYc3Ye7LCaDGl+ncUKtDzkqWTXi1xSIjohI6tsWejFOLRD Tv7GD+U0zx840t+W3V5I6PhBErd2yYrXDyaFkdTM5ZWeBOOaZ4hwVjXeBo32vq37fGKn m2BKSimn+z8pVt/WA12V+XypMqRYB7kBETRMeAx8XSVJGHchawpjfOd/SxA6MNua16Rg cEKQ== X-Gm-Message-State: APjAAAXwdQblR71unA/lgBnNXNrpbH9/n/XHNHEX1+OjME/9GVD/qvSU mg6jI96q+hYpmGkeV2dH4uvGWphnygs= X-Google-Smtp-Source: APXvYqys9gdI4WIvl1HTytt/s8/fdZZO0S+4nqbKCR6trw5eKJo+PWp9YLJv364WkSGZ01x6MS1LQw== X-Received: by 2002:adf:ec0d:: with SMTP id x13mr21591033wrn.400.1581939939548; Mon, 17 Feb 2020 03:45:39 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 03/13] hw/arm/raspi: Use more specific machine names Date: Mon, 17 Feb 2020 12:45:23 +0100 Message-Id: <20200217114533.17779-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- 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 1a8c135dc6..d9e8acfe3b 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.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940150136822.0604307243539; Mon, 17 Feb 2020 03:49:10 -0800 (PST) Received: from localhost ([::1]:44138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3etg-0002fl-SW for importer@patchew.org; Mon, 17 Feb 2020 06:49:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40618) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqN-0006VY-Fj for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqM-0002Po-BV for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:43 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:51764) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqM-0002P7-5H; Mon, 17 Feb 2020 06:45:42 -0500 Received: by mail-wm1-x341.google.com with SMTP id t23so16826858wmi.1; Mon, 17 Feb 2020 03:45:42 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:40 -0800 (PST) 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=GA3hSTRvUjj0h1sIVU2hxdzg27YAXWTu1THZdiNMV1A=; b=VyI27O8qMg45Z8IULsRRahYlyIn66s55ZoN7piORnzwJE1lT40pqywukJ7PhcuDo35 PFtafWyqmuD3ysSf900SWt5sXt3tRtaHYGFRTBjbTTJxCwQcQyCIcs2n9VdmzjJSdUQo wgQQOxwtaBi1ZzZlKfU8L/TynqVNQ1KnqzFYrWv1OKa9PGZ7mRu+KvKJttLC97KnxUVC K/5UXkV7ADoMPFiguIkZCjdtjvE4hDRzXMepyj/SGIT8cNa8ZLBHxB4/ETCjwELZhB7G 5CyxTge0jSmMkz+WRFJJeNMaSGaUEAJMwLJUIJVkjf4nEmYNbw0L3hXN9j1uGZr2PVVF QjYQ== 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=GA3hSTRvUjj0h1sIVU2hxdzg27YAXWTu1THZdiNMV1A=; b=Q9c8NDmenPBWFEfCznAY9pEUD5WWsgk/wei5ecPhwl1+THpuHXa+UjEBWh4saOmzha Sid8WRYjvtbRsVW9LfolTjGS/BnoEEWp56K+QIJTxRfHbtHioWW4cBmNdcuXe0dw9NGu /FFIM/Tm58+CKdxfbL3UVXb+DD1LyS0BnvbbunwN2x5RlXhEh9x9LVzmqVYZ666f4E06 2hSrPFLi4g8FmsWFqiKVHjfVujepJykATyHbPAhdg7T4tV9EpPcG0u4XYFBaO3bGfioE 3Eo173JVpwESSAKkmuCzBNcmVRH9Svxt7mRmcDrK/3fZRuiWVVdMLEEZZgWZBvKa/Lwj TnsQ== X-Gm-Message-State: APjAAAUUYbG7Ju4I6x0p1GZAvOlfct7mZ1h4XXWh8Bk2KKS5GjqCXRWj IK9nJg57dr41b3vCw9j/JsHJ/gITwYE= X-Google-Smtp-Source: APXvYqyW6KGbl2DL28qt4BzkxFfHoEuCamqT/0zWHnB/UKhBz+fum1f8lgDh4aUTeZXGZUyJbLASHQ== X-Received: by 2002:a7b:ce18:: with SMTP id m24mr21938382wmc.123.1581939940880; Mon, 17 Feb 2020 03:45:40 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 04/13] hw/arm/raspi: Introduce RaspiProcessorId enum Date: Mon, 17 Feb 2020 12:45:24 +0100 Message-Id: <20200217114533.17779-5-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- 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 d9e8acfe3b..b628dadf34 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.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940289668176.48656811756564; Mon, 17 Feb 2020 03:51:29 -0800 (PST) Received: from localhost ([::1]:44178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3evw-00067k-Gi for importer@patchew.org; Mon, 17 Feb 2020 06:51:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40644) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqP-0006Ys-4y for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqN-0002Qi-LJ for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:45 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:34753) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqN-0002Q7-Em; Mon, 17 Feb 2020 06:45:43 -0500 Received: by mail-wr1-x444.google.com with SMTP id n10so17385980wrm.1; Mon, 17 Feb 2020 03:45:43 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:41 -0800 (PST) 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=3UiEjEXttuM7t0xfD+phHvJNwF4QMG2Y+xuMq2THqy8=; b=nfBTBu4k1ml1skKW92aonJI6EY7SGTutu+amIEpRNTWBW//lrsFj6chx1hinP7lqF0 /GoTEjoFWL6oxduseO7xScOUdgmId/IT+3+w7BBlYKJq0R2X6xoxDkctXDaXAOjVrpD3 RV7dBXOgF5w26vN/U49JEctKqpDOscxw0jqLiRUbSqgsEcm2CqSRsaiZXtztIS69W8OK Agf58/JmUseO3wiagTFFC/GCiOhyDFpkyTDrxH2MdUaDlk0Jbl49n2ZaJTQ5T2OZdMoh 0ZutvSapnWRqhgPBHhBIWmXxjE+5s6zGxSXNsMb/gC8iFD1+kr3P83ng3V8KtDNk9itx CurA== 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=3UiEjEXttuM7t0xfD+phHvJNwF4QMG2Y+xuMq2THqy8=; b=G2k5Tscb7vGd0obc1MnL3/q47ZQFtOhJMp0BVtveHq4sxIPB+YJcZL9n6pJ5RxJUwk qpust/pUVfk245ic02pJclvKpFNYbnhQCxdrr8DZA5B/wmk6mKMPFvS8J2+VOQHwUjrk u2d0QLZKPmAc2YAITRJxT7yC4aQIgy+/t0H+S3JyY46t5J8E3e6f7jVgE51p59QzTsjH ucmuinicGTWyBApVUmPdD5CP9p+9OxZoMl2YIktZnEQkUa6KCK33TE3E/j0gz1rFRb+e qsYBgTfgxGTecFw2XqgTWIb7Mw82eRYCWtGNBIWdf9FDc5JTpb71sGVp0um3kNZXu4wQ jWOA== X-Gm-Message-State: APjAAAX75CTcjARpVo4/v8E59Ce9fjfIS88Hc2MHy2pWOVJmj+ZLhWjM LOzDm0es1gpbRAZq1htPsRiQ1g71L1s= X-Google-Smtp-Source: APXvYqyFMIrWOCv1C8DrCglln7p6Nn242A1A3D5jYBLPffCQphODihEENkETGoWIwbOKA0F5QOVhgA== X-Received: by 2002:a5d:6a88:: with SMTP id s8mr21712664wru.173.1581939942103; Mon, 17 Feb 2020 03:45:42 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 05/13] hw/arm/raspi: Remove use of the 'version' value in the board code Date: Mon, 17 Feb 2020 12:45:25 +0100 Message-Id: <20200217114533.17779-6-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- hw/arm/raspi.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index b628dadf34..fff501affb 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) { static struct arm_boot_info binfo; int r; @@ -210,12 +206,13 @@ static void setup_boot(MachineState *machine, int ver= sion, size_t ram_size) binfo.ram_size =3D ram_size; 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. */ binfo.board_setup_addr =3D BOARDSETUP_ADDR; 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) 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) { binfo.smp_loader_start =3D SMPBOOT_ADDR; - if (version =3D=3D 2) { + if (processor_id =3D=3D PROCESSOR_ID_BCM2836) { binfo.write_secondary_boot =3D write_smpboot; } else { binfo.write_secondary_boot =3D write_smpboot64; @@ -238,7 +235,13 @@ static void setup_boot(MachineState *machine, int vers= ion, 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; + + if (processor_id =3D=3D PROCESSOR_ID_BCM2837) { + firmware_addr =3D FIRMWARE_ADDR_3; + } else { + firmware_addr =3D FIRMWARE_ADDR_2; + } /* load the firmware image (typically kernel.img) */ r =3D load_image_targphys(machine->firmware, firmware_addr, ram_size - firmware_addr); @@ -259,7 +262,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; @@ -303,7 +305,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.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940312122862.40027423178; Mon, 17 Feb 2020 03:51:52 -0800 (PST) Received: from localhost ([::1]:44184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3ewI-0006w7-Vi for importer@patchew.org; Mon, 17 Feb 2020 06:51:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40652) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqP-0006aS-QM for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqO-0002RT-Qj for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:45 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35865) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqO-0002Qy-Jt; Mon, 17 Feb 2020 06:45:44 -0500 Received: by mail-wr1-x442.google.com with SMTP id z3so19378521wru.3; Mon, 17 Feb 2020 03:45:44 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:42 -0800 (PST) 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=OGYngzYgREXVWzhCGP1KWkhVF6aFvpDG4pbFEluMwuQ=; b=QQLSRNBaRAbOPnzZTq2kaydk6Q7gCayLTtsryRjJKNprdH6mGkp5syAr+WkKiCdj4a hcjUXLMjwCR7J+TKLoFZtZFYMomQFVX20za4c7Ty87vR/nMnsfCyA68JBmQTWacZtS3v hwZOGH1V8QqauiyDXodPyED+wyc+14N6XRIbrVDPNVuf8Hyp8H5sbTb2YWEEoapT/Vm0 Ow1HN/GN0fWdtagKdMWTYfXl7Rg9/E6BBjWCqexffmtS261uuKUAZwXfmLPjeyrD7f0O MYOVy7q6lBy5lfLNrd6AJNkf4shWuJVSsgpDKtsN+Cmn4RLS3UvGQ7+KtQ10mDFWiNfS tREw== 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=OGYngzYgREXVWzhCGP1KWkhVF6aFvpDG4pbFEluMwuQ=; b=p6AaJOrqv0FfsqIQ8Eeo+V84qibI+hsHADc8eQtDHw6CicNmV86x3z7OCfdN4ASaUD zJJ8DcpXsgmvyzGxley9q5u1sHDRCVdvMqf+n0tHhSJnzUuCrBbU0Ti6LiReeVknLJI+ qawDYpJS1CqA5et/Q5MxArN3tOiyYZoFJftZIXKynKTW3EUUbII1ZA2bJWkiV/Lz8C46 cTMwBfhVu3HNZ4qQn9226ImJZDWle5GvK7qFtBFT6/EcjHMHPQcBqh3kcDvpNmZPvGom HK60eQx/Iab01C31FDQ4LvDDcdy3fjfAONXkRsBjkc+e5mtRjycwy4O5PyYfynNshLUQ 0xew== X-Gm-Message-State: APjAAAWfXfdunK0uCTbVyANX+DlUQjBBWvcHbp7G5L9ojNh/KoN3GTvj E0I3CMQ9f1bQdv5K8OdurXrPYKoz6E0= X-Google-Smtp-Source: APXvYqzq2oDUO2lb2hEx/6O9Ukt0YBDRakzjPGVtbENKrR3Z57qbU+bDa515P2Ir7eUnvEtw0TGEdg== X-Received: by 2002:a5d:4ec2:: with SMTP id s2mr20501096wrv.291.1581939943462; Mon, 17 Feb 2020 03:45:43 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 06/13] hw/arm/bcm2836: Restrict BCM283XClass declaration to C source Date: Mon, 17 Feb 2020 12:45:26 +0100 Message-Id: <20200217114533.17779-7-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) No code out of bcm2836.c uses (or requires) this declarations. Move it locally to the C source file. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- include/hw/arm/bcm2836.h | 12 ------------ hw/arm/bcm2836.c | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h index 92a6544816..acc75bf553 100644 --- a/include/hw/arm/bcm2836.h +++ b/include/hw/arm/bcm2836.h @@ -42,16 +42,4 @@ typedef struct BCM283XState { BCM2835PeripheralState peripherals; } BCM283XState; =20 -typedef struct BCM283XInfo BCM283XInfo; - -typedef struct BCM283XClass { - DeviceClass parent_class; - const BCM283XInfo *info; -} BCM283XClass; - -#define BCM283X_CLASS(klass) \ - OBJECT_CLASS_CHECK(BCM283XClass, (klass), TYPE_BCM283X) -#define BCM283X_GET_CLASS(obj) \ - OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X) - #endif /* BCM2836_H */ diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 38e2941bab..24109fef1d 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -16,6 +16,15 @@ #include "hw/arm/raspi_platform.h" #include "hw/sysbus.h" =20 +typedef struct BCM283XInfo BCM283XInfo; + +typedef struct BCM283XClass { + /*< private >*/ + DeviceClass parent_class; + /*< public >*/ + const BCM283XInfo *info; +} BCM283XClass; + struct BCM283XInfo { const char *name; const char *cpu_type; @@ -24,6 +33,11 @@ struct BCM283XInfo { int clusterid; }; =20 +#define BCM283X_CLASS(klass) \ + OBJECT_CLASS_CHECK(BCM283XClass, (klass), TYPE_BCM283X) +#define BCM283X_GET_CLASS(obj) \ + OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X) + static const BCM283XInfo bcm283x_socs[] =3D { { .name =3D TYPE_BCM2836, --=20 2.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940405316302.8073467145392; Mon, 17 Feb 2020 03:53:25 -0800 (PST) Received: from localhost ([::1]:44218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3exn-0000pH-Sc for importer@patchew.org; Mon, 17 Feb 2020 06:53:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40691) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqS-0006fm-6k for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqQ-0002Su-KY for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:48 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:35276) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqQ-0002S8-DS; Mon, 17 Feb 2020 06:45:46 -0500 Received: by mail-wm1-x344.google.com with SMTP id b17so18119939wmb.0; Mon, 17 Feb 2020 03:45:46 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:44 -0800 (PST) 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=pPEcldfHD5OEhzQuYmprGj9+p4+mZQlzGRO9gMQy3Os=; b=Qrj8GGLKFR7uM64GuIhrtbZBoNRel8Grj4mZMXE531KxCMkBwaQcgnv6wBLKSmO4Jk 8MGUrI6XOB/DHdsIqUQqGWnHpWqr/VPzZ4ftJRgt+1I3cWq/iUkObdcwzdo+McTWVqY/ WNGE7AlrVS3UnBu3mzY7BoqsICtLGj+SIPqVaHovdLrxIrYhytGzGK4RgVroLWNbMEVx nXspmElSS2D+x+LF2KB0rHPK9bqdEQ0cLkyJv52RX3v89aNp9FCsNeQee3Uv9FbvuxSS iJRC7blPV6EBHjI043qJvoJPwd4pGHeCph+OIcJJy0UktMFofI5e2Bt4Uc9NK7o0EqiV nUwA== 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=pPEcldfHD5OEhzQuYmprGj9+p4+mZQlzGRO9gMQy3Os=; b=fmaJH5Pocbr+xyNsQRUnNRIXoRpHP5HlVVWwEOfO3E/hxp/bbpBE3Q2h6f4RYKohcY 4YjrbOdySZZV05g2trjpv4bhdPoxc5aL8IZvQFe+bUZwzm5ICxaVRuSLhIa/OK9Rlvo4 or+M4QeZ2IzkXbkx2BuKZBum3IQe2dzBkXnUyWiPot8ozdf8OD5ZYmGe95mIOv5/EodQ S2l90Hwd4m4vflHVYEXsCJM4bRfLxNsOzX+FpylOyFWIbhPS6hat2pp57ClqGmN48Uq9 pRQL9pZQegyfoLtFjpvpXvgWjzvEj47UWyIfVjGHNjt8g7D+CQePYYhywADWvL+FDkCl h5xQ== X-Gm-Message-State: APjAAAUELAwUcD8uu53Vdqr+gA8bXBiV7++HhLb1qSzkButISay+WqDX PcbpBXdh1iFRM6QTjRE8RRcub5FDsw4= X-Google-Smtp-Source: APXvYqxt87KMI2usukXccCNaajbtInER62r4uuSzAmmteMq0eSA6b1IxhtLNc9dMW9pKseUAlcweeQ== X-Received: by 2002:a1c:a404:: with SMTP id n4mr21935617wme.186.1581939945081; Mon, 17 Feb 2020 03:45:45 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 07/13] hw/arm/bcm2836: QOM'ify more by adding class_init() to each SoC type Date: Mon, 17 Feb 2020 12:45:27 +0100 Message-Id: <20200217114533.17779-8-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, Igor Mammedov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Remove usage of TypeInfo::class_data. Instead fill the fields in the corresponding class_init(). Cc: Igor Mammedov Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/bcm2836.c | 109 ++++++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 58 deletions(-) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 24109fef1d..683d04d6ea 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -16,57 +16,30 @@ #include "hw/arm/raspi_platform.h" #include "hw/sysbus.h" =20 -typedef struct BCM283XInfo BCM283XInfo; - typedef struct BCM283XClass { /*< private >*/ DeviceClass parent_class; /*< public >*/ - const BCM283XInfo *info; -} BCM283XClass; - -struct BCM283XInfo { - const char *name; const char *cpu_type; hwaddr peri_base; /* Peripheral base address seen by the CPU */ hwaddr ctrl_base; /* Interrupt controller and mailboxes etc. */ int clusterid; -}; +} BCM283XClass; =20 #define BCM283X_CLASS(klass) \ OBJECT_CLASS_CHECK(BCM283XClass, (klass), TYPE_BCM283X) #define BCM283X_GET_CLASS(obj) \ OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X) =20 -static const BCM283XInfo bcm283x_socs[] =3D { - { - .name =3D TYPE_BCM2836, - .cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a7"), - .peri_base =3D 0x3f000000, - .ctrl_base =3D 0x40000000, - .clusterid =3D 0xf, - }, -#ifdef TARGET_AARCH64 - { - .name =3D TYPE_BCM2837, - .cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a53"), - .peri_base =3D 0x3f000000, - .ctrl_base =3D 0x40000000, - .clusterid =3D 0x0, - }, -#endif -}; - static void bcm2836_init(Object *obj) { BCM283XState *s =3D BCM283X(obj); BCM283XClass *bc =3D BCM283X_GET_CLASS(obj); - const BCM283XInfo *info =3D bc->info; int n; =20 for (n =3D 0; n < BCM283X_NCPUS; n++) { object_initialize_child(obj, "cpu[*]", &s->cpu[n].core, - sizeof(s->cpu[n].core), info->cpu_type, + sizeof(s->cpu[n].core), bc->cpu_type, &error_abort, NULL); } =20 @@ -85,7 +58,6 @@ static void bcm2836_realize(DeviceState *dev, Error **err= p) { BCM283XState *s =3D BCM283X(dev); BCM283XClass *bc =3D BCM283X_GET_CLASS(dev); - const BCM283XInfo *info =3D bc->info; Object *obj; Error *err =3D NULL; int n; @@ -119,7 +91,7 @@ static void bcm2836_realize(DeviceState *dev, Error **er= rp) } =20 sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), 0, - info->peri_base, 1); + bc->peri_base, 1); =20 /* bcm2836 interrupt controller (and mailboxes, etc.) */ object_property_set_bool(OBJECT(&s->control), true, "realized", &err); @@ -128,7 +100,7 @@ static void bcm2836_realize(DeviceState *dev, Error **e= rrp) return; } =20 - sysbus_mmio_map(SYS_BUS_DEVICE(&s->control), 0, info->ctrl_base); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->control), 0, bc->ctrl_base); =20 sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 0, qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-irq", 0)); @@ -137,11 +109,11 @@ static void bcm2836_realize(DeviceState *dev, Error *= *errp) =20 for (n =3D 0; n < BCM283X_NCPUS; n++) { /* TODO: this should be converted to a property of ARM_CPU */ - s->cpu[n].core.mp_affinity =3D (info->clusterid << 8) | n; + s->cpu[n].core.mp_affinity =3D (bc->clusterid << 8) | n; =20 /* set periphbase/CBAR value for CPU-local registers */ object_property_set_int(OBJECT(&s->cpu[n].core), - info->peri_base, + bc->peri_base, "reset-cbar", &err); if (err) { error_propagate(errp, err); @@ -190,38 +162,59 @@ static Property bcm2836_props[] =3D { static void bcm283x_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); - BCM283XClass *bc =3D BCM283X_CLASS(oc); =20 - bc->info =3D data; - dc->realize =3D bcm2836_realize; - device_class_set_props(dc, bcm2836_props); /* Reason: Must be wired up in code (see raspi_init() function) */ dc->user_creatable =3D false; } =20 -static const TypeInfo bcm283x_type_info =3D { - .name =3D TYPE_BCM283X, - .parent =3D TYPE_DEVICE, - .instance_size =3D sizeof(BCM283XState), - .instance_init =3D bcm2836_init, - .class_size =3D sizeof(BCM283XClass), - .abstract =3D true, +static void bcm2836_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + BCM283XClass *bc =3D BCM283X_CLASS(oc); + + bc->cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a7"); + bc->peri_base =3D 0x3f000000; + bc->ctrl_base =3D 0x40000000; + bc->clusterid =3D 0xf; + dc->realize =3D bcm2836_realize; + device_class_set_props(dc, bcm2836_props); }; =20 -static void bcm2836_register_types(void) +#ifdef TARGET_AARCH64 +static void bcm2837_class_init(ObjectClass *oc, void *data) { - int i; + DeviceClass *dc =3D DEVICE_CLASS(oc); + BCM283XClass *bc =3D BCM283X_CLASS(oc); =20 - type_register_static(&bcm283x_type_info); - for (i =3D 0; i < ARRAY_SIZE(bcm283x_socs); i++) { - TypeInfo ti =3D { - .name =3D bcm283x_socs[i].name, - .parent =3D TYPE_BCM283X, - .class_init =3D bcm283x_class_init, - .class_data =3D (void *) &bcm283x_socs[i], - }; - type_register(&ti); + bc->cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a53"); + bc->peri_base =3D 0x3f000000; + bc->ctrl_base =3D 0x40000000; + bc->clusterid =3D 0x0; + dc->realize =3D bcm2836_realize; + device_class_set_props(dc, bcm2836_props); +}; +#endif + +static const TypeInfo bcm283x_types[] =3D { + { + .name =3D TYPE_BCM2836, + .parent =3D TYPE_BCM283X, + .class_init =3D bcm2836_class_init, +#ifdef TARGET_AARCH64 + }, { + .name =3D TYPE_BCM2837, + .parent =3D TYPE_BCM283X, + .class_init =3D bcm2837_class_init, +#endif + }, { + .name =3D TYPE_BCM283X, + .parent =3D TYPE_DEVICE, + .instance_size =3D sizeof(BCM283XState), + .instance_init =3D bcm2836_init, + .class_size =3D sizeof(BCM283XClass), + .class_init =3D bcm283x_class_init, + .abstract =3D true, } -} +}; =20 -type_init(bcm2836_register_types) +DEFINE_TYPES(bcm283x_types) --=20 2.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940479050395.7432687188957; Mon, 17 Feb 2020 03:54:39 -0800 (PST) Received: from localhost ([::1]:44234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eyz-0002YC-UA for importer@patchew.org; Mon, 17 Feb 2020 06:54:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40701) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqS-0006hU-Us for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqR-0002Ti-Q7 for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:48 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:35225) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqR-0002TI-KY; Mon, 17 Feb 2020 06:45:47 -0500 Received: by mail-wr1-x443.google.com with SMTP id w12so19333906wrt.2; Mon, 17 Feb 2020 03:45:47 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:45 -0800 (PST) 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=i66d8bTofo8A1vTFZIP/v8pdqf575/6M5yHqFaN2D1Y=; b=vWjv0UnrVB8fjx4RaHN8b3G/mooA72TRn2WGdB5N06+c0rCcSYzJpZM4WNnuoVTAWp KDM1y5h4XGQud5RgTHbIB14lKKXmb/188Sg5EjV3KZKx3ipTF5cFPvO9H1YYeU3Se0Nv MiUfBNEEI5tTkqcgLsPoeAWAI/GqfL5nPd0WbuVzIOQGQo64qghaKNmPSxyr687Hla4j ZePh2AwRQyHO05yXI/yf473SqmDVzTLtvHILM5mPNAk5856l4oJQYzHX50oHT0lH1G6M 4+XElfYTBQkFfOo/BPjCNKgpUZWvpol1vrodEwhYOqtRi0O51y3FpJbx/OU1qMFlpnnU 5lJQ== 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=i66d8bTofo8A1vTFZIP/v8pdqf575/6M5yHqFaN2D1Y=; b=Uncx5N25OqUDVu2U9Ad/UFhy+r9tjAcfA+gXm141p49iXl1RnwJL1hcb7KkfSwlMAe a18OfrjLcnwMnn8rXTUzNlvWK/k4EDTGk89VSHC6AaW5XmSkh1j/LYHY9Z7kUKyfn9OL RWBwS3SyFYF0tBdba7jEejVhrxr2bIQDfFuFqLpRY7ArTFhOXw85ooIDBAOp9Q9M22Gj xoEbnHOp2Z3F4ZSUa+pAsruvJKd66/E7qZDNkGJTWZmrjfZh2CMzli1PBeH3zSABVkhn pFRkKcvdHCFeZzeGlboi6XdQk2jnaHtvZ1Q0alj0RGTUvYG1Q7BUxmmID9CL55MCwQus jV1w== X-Gm-Message-State: APjAAAV5gFRHyw9jJZ9OTRQWDMN4qjcwvTmq+H49me2vAqgb8pHfd8gR RrmSZGssjzTokBqFmSkUpK+QBMAJYF8= X-Google-Smtp-Source: APXvYqyH1rAMaKeBpi4vF52P6SqsGeirL1HC44wNUq97UJwXlrtnEpVRTHMM14Qt01+NAAzTsb2+Ew== X-Received: by 2002:adf:fd91:: with SMTP id d17mr23281923wrr.340.1581939946474; Mon, 17 Feb 2020 03:45:46 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 08/13] hw/arm/bcm2836: Introduce BCM283XClass::core_count Date: Mon, 17 Feb 2020 12:45:28 +0100 Message-Id: <20200217114533.17779-9-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The BCM2835 has only one core. Introduce the core_count field to be able to use values different than BCM283X_NCPUS (4). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- hw/arm/bcm2836.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 683d04d6ea..3b95ad11e9 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -21,6 +21,7 @@ typedef struct BCM283XClass { DeviceClass parent_class; /*< public >*/ const char *cpu_type; + int core_count; hwaddr peri_base; /* Peripheral base address seen by the CPU */ hwaddr ctrl_base; /* Interrupt controller and mailboxes etc. */ int clusterid; @@ -37,7 +38,7 @@ static void bcm2836_init(Object *obj) BCM283XClass *bc =3D BCM283X_GET_CLASS(obj); int n; =20 - for (n =3D 0; n < BCM283X_NCPUS; n++) { + for (n =3D 0; n < bc->core_count; n++) { object_initialize_child(obj, "cpu[*]", &s->cpu[n].core, sizeof(s->cpu[n].core), bc->cpu_type, &error_abort, NULL); @@ -107,7 +108,7 @@ static void bcm2836_realize(DeviceState *dev, Error **e= rrp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1, qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0)); =20 - for (n =3D 0; n < BCM283X_NCPUS; n++) { + for (n =3D 0; n < bc->core_count; n++) { /* TODO: this should be converted to a property of ARM_CPU */ s->cpu[n].core.mp_affinity =3D (bc->clusterid << 8) | n; =20 @@ -173,6 +174,7 @@ static void bcm2836_class_init(ObjectClass *oc, void *d= ata) BCM283XClass *bc =3D BCM283X_CLASS(oc); =20 bc->cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a7"); + bc->core_count =3D BCM283X_NCPUS; bc->peri_base =3D 0x3f000000; bc->ctrl_base =3D 0x40000000; bc->clusterid =3D 0xf; @@ -187,6 +189,7 @@ static void bcm2837_class_init(ObjectClass *oc, void *d= ata) BCM283XClass *bc =3D BCM283X_CLASS(oc); =20 bc->cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a53"); + bc->core_count =3D BCM283X_NCPUS; bc->peri_base =3D 0x3f000000; bc->ctrl_base =3D 0x40000000; bc->clusterid =3D 0x0; --=20 2.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940574259157.3489608190414; Mon, 17 Feb 2020 03:56:14 -0800 (PST) Received: from localhost ([::1]:44260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3f0X-0004U5-4l for importer@patchew.org; Mon, 17 Feb 2020 06:56:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40723) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqU-0006kf-BL for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqT-0002Uu-9G for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:50 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:38343) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqT-0002UQ-2e; Mon, 17 Feb 2020 06:45:49 -0500 Received: by mail-wr1-x442.google.com with SMTP id y17so19314973wrh.5; Mon, 17 Feb 2020 03:45:48 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:47 -0800 (PST) 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=uxynYOVPY9FVrupSLyC8th1oxyDcEka8bWnY9WEi7fw=; b=s9GPf9p0R2STFOzaGw4bh+SxG+CZMAZEgpgLIdIU9XAC4AEvm5hS8F/feqqDHfxwID 70AkD/qLQf8dGKpYaAqiER9jDUa69eV1C4wU58tOLklbJ/RAAFXHU0DD/W7DIGhu4je2 Gu0Z2SQ9vBp/RNfShBHCRn6abI5RJqUCunqcogJnIEqRLiVEDuE4X6IsOwq6TFMG63OR fLdOXA02uvfdLmCIzpSFtV/7+xlpI5ivr4Ud0sCmyxhnTxapWeOdrLAty7e4jtjZhfqe 0pANuVJZPMTPR1kDJu6dNAMMCjOX4kCJ8QHB5vhpVRhIfnSL70VkhY+d6ZUBjd6sYagB k4rw== 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=uxynYOVPY9FVrupSLyC8th1oxyDcEka8bWnY9WEi7fw=; b=sNY9Ah8TuQlZwbK2e1w6I1SJEqLLTcO+czX9bF4HZeBo5siDq3hxyi/gVkYpjUCX1g vGCRDo9vv8CdUjrrSUI6u8kMm02SLIttgFYDmXmT0nGFicbKiVjRzo4cKroQbRC7avDG wZs4SZ+6h3Rc+oHbJdlY1SVYwse2/BqyMqgAdjHMDIupRUAPMKcSunz8sJ4r7tQc58Jo S44Fon+3oPXz4IRk2ZhPtPfKOOrlp4vvKVAIr1PvBNDGv0GuTHQUexQZbR2LazKp7b2X TZogrQGNM2EhtmgL4L6eLG2V5t+zbNmyjPeKnnGo23HHr/95Cl3GmGo9FYvHeicpLV59 /pwA== X-Gm-Message-State: APjAAAVmbhrGNd9RmvC1R3LbVxdpEQLj0nA2u/Q/TczlrR0mq6skF+xy ToitXOOdKwwXDZFVeyhDhKiSF7OhHco= X-Google-Smtp-Source: APXvYqxIlah5lIud2Jk/dYxX9uP1e3YzCLlDFhZtdJR4fhicmTqQF2oTBBFbfewB51UETJRMKqWPZA== X-Received: by 2002:adf:df0f:: with SMTP id y15mr21423847wrl.26.1581939947940; Mon, 17 Feb 2020 03:45:47 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 09/13] hw/arm/bcm2836: Only provide "enabled-cpus" property to multicore SoCs Date: Mon, 17 Feb 2020 12:45:29 +0100 Message-Id: <20200217114533.17779-10-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) It makes no sense to set enabled-cpus=3D0 on single core SoCs. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- hw/arm/bcm2836.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 3b95ad11e9..caaa4b625e 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -32,6 +32,9 @@ typedef struct BCM283XClass { #define BCM283X_GET_CLASS(obj) \ OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X) =20 +static Property bcm2836_enabled_cores_property =3D + DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus, 0); + static void bcm2836_init(Object *obj) { BCM283XState *s =3D BCM283X(obj); @@ -43,6 +46,10 @@ static void bcm2836_init(Object *obj) sizeof(s->cpu[n].core), bc->cpu_type, &error_abort, NULL); } + if (bc->core_count) { + qdev_property_add_static(DEVICE(obj), &bcm2836_enabled_cores_prope= rty); + qdev_prop_set_uint32(DEVICE(obj), "enabled-cpus", bc->core_count); + } =20 sysbus_init_child_obj(obj, "control", &s->control, sizeof(s->control), TYPE_BCM2836_CONTROL); @@ -154,12 +161,6 @@ static void bcm2836_realize(DeviceState *dev, Error **= errp) } } =20 -static Property bcm2836_props[] =3D { - DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus, - BCM283X_NCPUS), - DEFINE_PROP_END_OF_LIST() -}; - static void bcm283x_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); @@ -179,7 +180,6 @@ static void bcm2836_class_init(ObjectClass *oc, void *d= ata) bc->ctrl_base =3D 0x40000000; bc->clusterid =3D 0xf; dc->realize =3D bcm2836_realize; - device_class_set_props(dc, bcm2836_props); }; =20 #ifdef TARGET_AARCH64 @@ -194,7 +194,6 @@ static void bcm2837_class_init(ObjectClass *oc, void *d= ata) bc->ctrl_base =3D 0x40000000; bc->clusterid =3D 0x0; dc->realize =3D bcm2836_realize; - device_class_set_props(dc, bcm2836_props); }; #endif =20 --=20 2.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940177496142.78161145073057; Mon, 17 Feb 2020 03:49:37 -0800 (PST) Received: from localhost ([::1]:44146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eu7-0003PV-RY for importer@patchew.org; Mon, 17 Feb 2020 06:49:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40748) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqV-0006nW-KK for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqU-0002Vu-IA for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:51 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:37975) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqU-0002VA-BS; Mon, 17 Feb 2020 06:45:50 -0500 Received: by mail-wm1-x344.google.com with SMTP id a9so18104180wmj.3; Mon, 17 Feb 2020 03:45:50 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:48 -0800 (PST) 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=B1P152VP3CyxvJ0hiqDereblCgbtylimKSTziv7Dq7E=; b=BFYWtC4de4m57/QFzUEK6JRbESVVyU3dCcqMynOlC+14Um/fDzN7/eHLTijiInRmpa y4XxwmAnhs62s3qDtFV03qvyP5yQT+Pcx9hpuIJBa4EVh9r6fdXkAG94w/pmgJgUZtZm CfRaWMi2vRwDm/KROueDyMOUHKRYtAE1ycZbW6BbMlscTcCHO1D3qrkzrOWrRhgp9HqY b6IDFxFbaW2vkxoNLO3JGAVYP8WvYSn6MJa86H9jKuDrtJTPsyYkwPVdBr+l2hKC25kO KPTSxClVEQHifGyBwj6bLYuyaHuSlT8Vso6+UoG8EFl1U9eSMWfbzCxNLKahh8ZCJa2f tU9A== 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=B1P152VP3CyxvJ0hiqDereblCgbtylimKSTziv7Dq7E=; b=h4O3iwXJixVs70qujGouUgwL1hMrsUDBL+djP2hFN5RYd32A3vOz3pcxwHzD4QZE5O WNER9jcVH24I78PQYjzEZDvDb12pS4E11uDm4G5OkBIlxUTZX8MwnMr4PtKHQigG+C33 vdkHXbvMrT1sCAY3P5FZzogZVyFm+jEMMSK1JmbKf43TyPLeleYcEnxVSpu/SLs2nsPU lwLYTqAsXBBpFs5jpFHLCYf3Rjir+yrr3maoErZDSW60MehgSMA2GHaqYf8nW3D/psRM t8AHBnDXsFjRKMZGVXZ5X+VbLX26Ym5f0SNCSTVqZnox9fEtxX/9lyXQzKsfRkQVb9d2 6SXA== X-Gm-Message-State: APjAAAUDHfdzYTTDX+p1VdEj8IFLdlm/wYgj6Qh7OzAOK+XfJmb84wiO 7g7NzhmzWfWoF9PxPrrdrAL7mt47Y84= X-Google-Smtp-Source: APXvYqwTLOdVlajvmzABohMyhV1AvdvzW6qCSTDV65ExmenF5O4z/VndsqJXXoyGLwM7tExbAVV5qg== X-Received: by 2002:a05:600c:2187:: with SMTP id e7mr21750318wme.11.1581939949211; Mon, 17 Feb 2020 03:45:49 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 10/13] hw/arm/bcm2836: Split out common realize() code Date: Mon, 17 Feb 2020 12:45:30 +0100 Message-Id: <20200217114533.17779-11-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The realize() function is clearly composed of two parts, each described by a comment: void realize() { /* common peripherals from bcm2835 */ ... /* bcm2836 interrupt controller (and mailboxes, etc.) */ ... } Split the two part, so we can reuse the common part with other SoCs from this family. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- hw/arm/bcm2836.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index caaa4b625e..2b6fe31139 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -51,8 +51,10 @@ static void bcm2836_init(Object *obj) qdev_prop_set_uint32(DEVICE(obj), "enabled-cpus", bc->core_count); } =20 - sysbus_init_child_obj(obj, "control", &s->control, sizeof(s->control), - TYPE_BCM2836_CONTROL); + if (bc->ctrl_base) { + sysbus_init_child_obj(obj, "control", &s->control, + sizeof(s->control), TYPE_BCM2836_CONTROL); + } =20 sysbus_init_child_obj(obj, "peripherals", &s->peripherals, sizeof(s->peripherals), TYPE_BCM2835_PERIPHERALS= ); @@ -62,13 +64,12 @@ static void bcm2836_init(Object *obj) "vcram-size", &error_abort); } =20 -static void bcm2836_realize(DeviceState *dev, Error **errp) +static void bcm283x_common_realize(DeviceState *dev, Error **errp) { BCM283XState *s =3D BCM283X(dev); BCM283XClass *bc =3D BCM283X_GET_CLASS(dev); Object *obj; Error *err =3D NULL; - int n; =20 /* common peripherals from bcm2835 */ =20 @@ -100,6 +101,20 @@ static void bcm2836_realize(DeviceState *dev, Error **= errp) =20 sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), 0, bc->peri_base, 1); +} + +static void bcm2836_realize(DeviceState *dev, Error **errp) +{ + BCM283XState *s =3D BCM283X(dev); + BCM283XClass *bc =3D BCM283X_GET_CLASS(dev); + Error *err =3D NULL; + int n; + + bcm283x_common_realize(dev, &err); + if (err) { + error_propagate(errp, err); + return; + } =20 /* bcm2836 interrupt controller (and mailboxes, etc.) */ object_property_set_bool(OBJECT(&s->control), true, "realized", &err); --=20 2.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940666092620.5267228317857; Mon, 17 Feb 2020 03:57:46 -0800 (PST) Received: from localhost ([::1]:44274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3f20-0005ZZ-Kk for importer@patchew.org; Mon, 17 Feb 2020 06:57:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40779) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqa-0006qT-0M for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqY-0002YS-66 for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:55 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:54673) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqW-0002W8-9e; Mon, 17 Feb 2020 06:45:52 -0500 Received: by mail-wm1-x330.google.com with SMTP id g1so16815320wmh.4; Mon, 17 Feb 2020 03:45:52 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:49 -0800 (PST) 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=ux9PEPOM3HzoCcwHXWuWj9LnAFV7GP+CVR1oHredxx0=; b=g1cvsPHCrbjUuWltWY6BJvvEc8Jvk8iKqrOFIq0zzbm6BxHNuKDSYEJbIs3r+WyuVD 9n3Exze4YkWDnSe23tZCWaFhPI/p6yc9/aDXqzEviNoXll/eByxZygBnq1wyGWaqq7an LFWKEK0RXpY/9IU+00JGDM1ExRZ6Pr6dAaa2LVbzKtrum/tYBSF1kUBnZhaku89z/gLD aN29QGWgkE7IkoP4X9LGsfrd05ipFzL6UIf4jqmb4A0nSOVcVxRhcfXuM5Qs5JnndWgv F8n0I+5v9wqC79tKwZ6DeSg21wi8DdGiMF5rRB/7kHwAKtF48CHq1YdBulQGlEV1CsK7 THxQ== 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=ux9PEPOM3HzoCcwHXWuWj9LnAFV7GP+CVR1oHredxx0=; b=LF2mFOaLjI4kYBd75pmUtYwVrzZgGt36lTuaREVHD1B0MJIwcChcb9wxtBxZcY2rRq lTKRDH6ATfklFl4Tpb3sNFHtWP+OrDkc4MA4FuAT0dsLnvlztL7GtGLXfgiNR+r1BC1x 0IyV09I//4kHNLVn5tW2au054g30NPFgbHnk/9lZWrwVSBLlqiWc0mOlWD3CJIekwG/x fzjnJW+Mu9hVVzBH9zUz8xlmL+absqR9q39LcgPfYmHTKDwImUHFSN2P6tJsO8gaoBfb 0h/9JgtFUWlIusZiS5MH6GMH6jgdSBuinVP9Q9Q1B9ufv5+pfZNDEPpAVlnLBDEO/ko3 jmlg== X-Gm-Message-State: APjAAAUrz8U4FiuOuaNAUQBh7Ze225wZs0tfRJpRuYSHgohnV0f0pnyQ M3pc7kgs3Ff3a6Lz1/vLepJIrq/CdIg= X-Google-Smtp-Source: APXvYqwAqrRqndyzvK7VgkkpCAOkaMS5qBNQuGvJBcCSN+9E4JokKs3/ICR5zzUWskwxwvHx8GxBKw== X-Received: by 2002:a1c:3d46:: with SMTP id k67mr22606979wma.171.1581939950423; Mon, 17 Feb 2020 03:45:50 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 11/13] hw/arm/bcm2836: Introduce the BCM2835 SoC Date: Mon, 17 Feb 2020 12:45:31 +0100 Message-Id: <20200217114533.17779-12-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- include/hw/arm/bcm2836.h | 1 + hw/arm/bcm2836.c | 40 ++++++++++++++++++++++++++++++++++++++++ hw/arm/raspi.c | 2 ++ 3 files changed, 43 insertions(+) diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h index acc75bf553..3d46469a73 100644 --- a/include/hw/arm/bcm2836.h +++ b/include/hw/arm/bcm2836.h @@ -24,6 +24,7 @@ * them, code using these devices should always handle them via the * BCM283x base class, so they have no BCM2836(obj) etc macros. */ +#define TYPE_BCM2835 "bcm2835" #define TYPE_BCM2836 "bcm2836" #define TYPE_BCM2837 "bcm2837" =20 diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 2b6fe31139..bce5f8a866 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -103,6 +103,31 @@ static void bcm283x_common_realize(DeviceState *dev, E= rror **errp) bc->peri_base, 1); } =20 +static void bcm2835_realize(DeviceState *dev, Error **errp) +{ + BCM283XState *s =3D BCM283X(dev); + Error *err =3D NULL; + + bcm283x_common_realize(dev, &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_bool(OBJECT(&s->cpu[0].core), true, + "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + + /* Connect irq/fiq outputs from the interrupt controller. */ + sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 0, + qdev_get_gpio_in(DEVICE(&s->cpu[0].core), ARM_CPU_IRQ)); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1, + qdev_get_gpio_in(DEVICE(&s->cpu[0].core), ARM_CPU_FIQ)); +} + static void bcm2836_realize(DeviceState *dev, Error **errp) { BCM283XState *s =3D BCM283X(dev); @@ -184,6 +209,17 @@ static void bcm283x_class_init(ObjectClass *oc, void *= data) dc->user_creatable =3D false; } =20 +static void bcm2835_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + BCM283XClass *bc =3D BCM283X_CLASS(oc); + + bc->cpu_type =3D ARM_CPU_TYPE_NAME("arm1176"); + bc->core_count =3D 1; + bc->peri_base =3D 0x20000000; + dc->realize =3D bcm2835_realize; +}; + static void bcm2836_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); @@ -214,6 +250,10 @@ static void bcm2837_class_init(ObjectClass *oc, void *= data) =20 static const TypeInfo bcm283x_types[] =3D { { + .name =3D TYPE_BCM2835, + .parent =3D TYPE_BCM283X, + .class_init =3D bcm2835_class_init, + }, { .name =3D TYPE_BCM2836, .parent =3D TYPE_BCM283X, .class_init =3D bcm2836_class_init, diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index fff501affb..3537a329ac 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -70,6 +70,7 @@ FIELD(REV_CODE, MEMORY_SIZE, 20, 3); FIELD(REV_CODE, STYLE, 23, 1); =20 typedef enum RaspiProcessorId { + PROCESSOR_ID_BCM2835 =3D 0, PROCESSOR_ID_BCM2836 =3D 1, PROCESSOR_ID_BCM2837 =3D 2, } RaspiProcessorId; @@ -78,6 +79,7 @@ static const struct { const char *type; int cores_count; } soc_property[] =3D { + [PROCESSOR_ID_BCM2835] =3D {TYPE_BCM2835, 1}, [PROCESSOR_ID_BCM2836] =3D {TYPE_BCM2836, BCM283X_NCPUS}, [PROCESSOR_ID_BCM2837] =3D {TYPE_BCM2837, BCM283X_NCPUS}, }; --=20 2.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940303331483.60683011583546; Mon, 17 Feb 2020 03:51:43 -0800 (PST) Received: from localhost ([::1]:44182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3ewA-0006dj-6n for importer@patchew.org; Mon, 17 Feb 2020 06:51:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40784) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqa-0006qb-GQ for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqZ-0002ZI-9C for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:56 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:37122) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqY-0002XL-5U; Mon, 17 Feb 2020 06:45:54 -0500 Received: by mail-wr1-x42e.google.com with SMTP id w15so19340216wru.4; Mon, 17 Feb 2020 03:45:52 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:51 -0800 (PST) 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=ASmcAKpB+GmaZAnYISHB6Asx8SF2xpTt96K1WQnZHhw=; b=jKTQCUnfO4l8OkOwCIXXw2lG2dEZTgiy7leI1vivIB6zZoppA8LK6yJPasxCkmVTvC NUWB9x2IrU5Y4OLnp4jnbRkTGsbyok8zNNzr2fdYb13r+hdEgF+lUfSGBOC1IQ+w0UXI desjbqMNuPT4uFWdqnR2SoZTLZ3XpgG2dkLSfIqFPckBvaxbO/gXnVSNujCGn4F0g9GL bIqJkq2imeOPvAtIlyFLVsM92kmWgg9/qMbH5ksXuQ+ocnEZ9wGzmmC3mhFeD4T70nrs K3vb38IeKgN5lCCXYlW8EbLxbO9wMUnx78/NzK0N2HA9Y8JzZAMm98TFaDfZI264Wx5t CE4Q== 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=ASmcAKpB+GmaZAnYISHB6Asx8SF2xpTt96K1WQnZHhw=; b=ccpHVkGsOEW9bUoys2Na3tJxYjr8I8hlHCy/rE9wMbyZtjxjLuMk85la2dor9e7jHA VYHNdEnH5yUbBlDK9P1dpZYjEDS9gsCFO+nC+IGZEp3P/TC2I9li/b/OvwOh5D1h+QD0 Xr8hDp/J7/WrVUxLuF3y8bJcAsf5B2XBWDlYo/uzIBnoTDNcSBRAMNcPW/2wuxTNSX7W 7EUU42Jkry5zVG/koi3RQfWxmab2mv5MXuPdLf3RtCliO1vdAmwTgEu6gARy3leTA+La HT0qhmdYt6bHSN7JSFDBFl9YwNnbrDpPP4mN5pTMvun7u5bJc7xerfwQTjorW1FgPP5X 5eIQ== X-Gm-Message-State: APjAAAXvr/MWt78+5eCkX5/99szCnnF6UHvbaIfiaXcE6B6q6QmO4n2N x0TVz7O/8Pmzsoc10yje1mw4CeU5AEM= X-Google-Smtp-Source: APXvYqxyPBfM3ngoLLQTjNlH/Dr6ElXo3N62Y+7QI5aT7qfcA2LXTPR6AJo6zQyIpycjSCSF3p39lQ== X-Received: by 2002:adf:f012:: with SMTP id j18mr21769544wro.314.1581939951573; Mon, 17 Feb 2020 03:45:51 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 12/13] hw/arm/raspi: Add the Raspberry Pi B+ machine Date: Mon, 17 Feb 2020 12:45:32 +0100 Message-Id: <20200217114533.17779-13-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) $ qemu-system-arm -M raspi1b -serial stdio \ -kernel raspberrypi/firmware/boot/kernel.img \ -dtb raspberrypi/firmware/boot/bcm2708-rpi-b.dtb \ -append 'printk.time=3D0 earlycon=3Dpl011,0x20201000 console=3DttyAMA= 0' [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.19.69+ (dom@buildbot) (gcc version 4.9.3 (= crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep 3 20:21:01 BST= 2019 [ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARM= v7), cr=3D00c5387d [ 0.000000] CPU: VIPT aliasing data cache, unknown instruction cache [ 0.000000] OF: fdt: Machine model: Raspberry Pi Model B [ 0.000000] earlycon: pl11 at MMIO 0x20201000 (options '') [ 0.000000] bootconsole [pl11] enabled [ 0.000000] Memory policy: Data cache writeback [ 0.000000] cma: Reserved 8 MiB at 0x1b800000 [ 0.000000] random: get_random_bytes called from start_kernel+0x8c/0x4= 9c with crng_init=3D0 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113= 680 [ 0.000000] Kernel command line: printk.time=3D0 earlycon=3Dpl011,0x20= 201000 console=3DttyAMA0 Dentry cache hash table entries: 65536 (order: 6, 262144 bytes) Inode-cache hash table entries: 32768 (order: 5, 131072 bytes) Memory: 434380K/458752K available (6971K kernel code, 635K rwdata, 2080K = rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved) ... Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/raspi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 3537a329ac..2d9f4e3085 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -324,6 +324,15 @@ static void raspi_machine_class_common_init(MachineCla= ss *mc, mc->default_ram_size =3D board_ram_size(board_rev); }; =20 +static void raspi1b_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + RaspiMachineClass *rmc =3D RASPI_MACHINE_CLASS(oc); + + rmc->board_rev =3D 0x900032; + raspi_machine_class_common_init(mc, rmc->board_rev); +}; + static void raspi2b_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -348,6 +357,10 @@ static void raspi3b_machine_class_init(ObjectClass *oc= , void *data) =20 static const TypeInfo raspi_machine_types[] =3D { { + .name =3D MACHINE_TYPE_NAME("raspi1b"), + .parent =3D TYPE_RASPI_MACHINE, + .class_init =3D raspi1b_machine_class_init, + }, { .name =3D MACHINE_TYPE_NAME("raspi2b"), .parent =3D TYPE_RASPI_MACHINE, .class_init =3D raspi2b_machine_class_init, --=20 2.21.1 From nobody Thu Nov 13 16:34:15 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581940741025213.94590124277647; Mon, 17 Feb 2020 03:59:01 -0800 (PST) Received: from localhost ([::1]:44280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3f3D-0006U3-Aq for importer@patchew.org; Mon, 17 Feb 2020 06:58:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40801) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j3eqb-0006r0-A7 for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j3eqa-0002Zn-0v for qemu-devel@nongnu.org; Mon, 17 Feb 2020 06:45:57 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:37415) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j3eqY-0002Y2-8C; Mon, 17 Feb 2020 06:45:55 -0500 Received: by mail-wm1-x341.google.com with SMTP id a6so18119764wme.2; Mon, 17 Feb 2020 03:45:54 -0800 (PST) Received: from x1w.redhat.com (78.red-88-21-202.staticip.rima-tde.net. [88.21.202.78]) by smtp.gmail.com with ESMTPSA id i2sm268149wmb.28.2020.02.17.03.45.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 03:45:52 -0800 (PST) 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=e6o40FQDzdl6CfxP9P4N29oFY6w25k3CvNK8SZvDQSU=; b=kIeub963KMmxDyr5Sbk+hECgTs5ZIWGNz9Tb72w2oYXCzzU1sNViMWeNMUt8To/dkX DwGAHk0hYeN2P9gyjcJFVInGAHOXI8F9LWKpLQ33xkDavUSIURTKCJJBOmQ2/+1FO+Xw lEsvJf6u/t2C2OoNhy8KRDEF/cQfdtbjTnYeERk243xrF3SJzN09XyLpzoFGyVOXfi4J HzZ0KuNWU7sIV7ebCdE5qdr0jFmDaW5ywTA8SLTHGOiQZ2c032A6O7t33Qec4mP8RW5V ONvgTYYHKxsHu/uqTkYETQADCGHehr+2aSfzLPiwNJdPZctnYorkSeeXnBXCBqwQp6UY gosw== 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=e6o40FQDzdl6CfxP9P4N29oFY6w25k3CvNK8SZvDQSU=; b=iaQL2jnMs/9vp6Ju1BTt/qnvRBSjwhE55fLuqmmaGmaJTZnM6nAS+UdzBkFKYfgiE0 c5Qxg+BYhWsmfstdJLbz8+jt+LlAk0hjFe4lL+ALz4Q86oIydTTRKmQJQ6XKZu4xqOIx CzbZUDsR/FlfW53AULjJg9Nq3ZisZhI739RNmAmpqM2/KYz+pNAsw98D5+nqokyxobQq p3B6GmqHm3ALPZ1en2oHG8sYoDektkplyEXbOZNanZ9wZ2/T7Y3nIKKrkano9+7/3UtT LAVFORGUdiBH+7H3rDpJQEK2Qjwz5hzEDSAc0czsREbfHuJhQbLn3JySMBTZPtWI79Gu Q5Rg== X-Gm-Message-State: APjAAAX0v6di2vFl6sgrMw8ITl1cKK1HNs5kwP/uL1RtsqY4SvHrngAR 0EQ6S5ihHLNhSbQiPATxPLhYxeeUUlw= X-Google-Smtp-Source: APXvYqz8JLE0arWdW4YKhFhU/4jSZ159FDNDb40+mJuIkaiUzapNwJsiR3LKSkuXU/+DOaa6BI7UGA== X-Received: by 2002:a1c:988c:: with SMTP id a134mr21058122wme.163.1581939953007; Mon, 17 Feb 2020 03:45:53 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 13/13] hw/arm/raspi: Add the Raspberry Pi Zero machine Date: Mon, 17 Feb 2020 12:45:33 +0100 Message-Id: <20200217114533.17779-14-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200217114533.17779-1-f4bug@amsat.org> References: <20200217114533.17779-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-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 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 , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Luc Michel Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Add a Raspberry Pi Zero machine. $ qemu-system-arm -M raspi0w -serial stdio \ -kernel raspberrypi/firmware/boot/kernel.img \ -dtb raspberrypi/firmware/boot/bcm2708-rpi-zero-w.dtb \ -append 'printk.time=3D0 earlycon=3Dpl011,0x20201000 console=3DttyAMA= 0' [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.19.69+ (dom@buildbot) (gcc version 4.9.3 (= crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1261 Tue Sep 3 20:21:01 BST= 2019 [ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARM= v7), cr=3D00c5387d [ 0.000000] CPU: VIPT aliasing data cache, unknown instruction cache [ 0.000000] OF: fdt: Machine model: Raspberry Pi Zero W [ 0.000000] earlycon: pl11 at MMIO 0x20201000 (options '') [ 0.000000] bootconsole [pl11] enabled [ 0.000000] Memory policy: Data cache writeback [ 0.000000] cma: Reserved 8 MiB at 0x1b800000 [ 0.000000] random: get_random_bytes called from start_kernel+0x8c/0x4= 9c with crng_init=3D0 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113= 680 [ 0.000000] Kernel command line: printk.time=3D0 earlycon=3Dpl011,0x20= 201000 console=3DttyAMA0 root=3D/dev/mmcblk0 rootwait Dentry cache hash table entries: 65536 (order: 6, 262144 bytes) Inode-cache hash table entries: 32768 (order: 5, 131072 bytes) Memory: 434380K/458752K available (6971K kernel code, 635K rwdata, 2080K = rodata, 464K init, 797K bss, 16180K reserved, 8192K cma-reserved) Virtual kernel memory layout: vector : 0xffff0000 - 0xffff1000 ( 4 kB) fixmap : 0xffc00000 - 0xfff00000 (3072 kB) vmalloc : 0xdc800000 - 0xff800000 ( 560 MB) lowmem : 0xc0000000 - 0xdc000000 ( 448 MB) modules : 0xbf000000 - 0xc0000000 ( 16 MB) .text : 0x(ptrval) - 0x(ptrval) (6973 kB) .init : 0x(ptrval) - 0x(ptrval) ( 464 kB) .data : 0x(ptrval) - 0x(ptrval) ( 636 kB) .bss : 0x(ptrval) - 0x(ptrval) ( 798 kB) SLUB: HWalign=3D32, Order=3D0-3, MinObjects=3D0, CPUs=3D1, Nodes=3D1 ftrace: allocating 25193 entries in 74 pages NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16 sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 214748364= 7500ns clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns:= 1911260446275 ns bcm2835: system timer (irq =3D 27) Console: colour dummy device 80x30 ... Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel --- hw/arm/raspi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 2d9f4e3085..d59d7c4294 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -324,6 +324,15 @@ static void raspi_machine_class_common_init(MachineCla= ss *mc, mc->default_ram_size =3D board_ram_size(board_rev); }; =20 +static void raspi0w_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + RaspiMachineClass *rmc =3D RASPI_MACHINE_CLASS(oc); + + rmc->board_rev =3D 0x9000c1; + raspi_machine_class_common_init(mc, rmc->board_rev); +}; + static void raspi1b_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -357,6 +366,10 @@ static void raspi3b_machine_class_init(ObjectClass *oc= , void *data) =20 static const TypeInfo raspi_machine_types[] =3D { { + .name =3D MACHINE_TYPE_NAME("raspi0w"), + .parent =3D TYPE_RASPI_MACHINE, + .class_init =3D raspi0w_machine_class_init, + }, { .name =3D MACHINE_TYPE_NAME("raspi1b"), .parent =3D TYPE_RASPI_MACHINE, .class_init =3D raspi1b_machine_class_init, --=20 2.21.1