From patchwork Thu Feb 6 01:17:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234068 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=dhzqRfTT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CgZ04T2xz9sRG for ; Thu, 6 Feb 2020 12:19:04 +1100 (AEDT) Received: from localhost ([::1]:59152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVos-0000Ci-Gu for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:19:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53486) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVo2-00007e-1d for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVo0-0001bk-IL for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:09 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51252) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVo0-0001UD-Bh; Wed, 05 Feb 2020 20:18:08 -0500 Received: by mail-wm1-x342.google.com with SMTP id t23so4501839wmi.1; Wed, 05 Feb 2020 17:18:07 -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=+Tq5S/N+0JOq8c9dlCr3FKmOhtjiwItYwYRBLhuDC7A=; b=dhzqRfTTMKnc/slCd2A5GK/4tWWJj3ctlKsJLVN+0ksxF6qMVXbwGLTPou3wGKErLP 0R1toyGDwFopCyVih6C5Y+KJr0/24mqduJWEOqqPmvWMNurr7G+XeXTxQW+MH4CO23oQ HPpsWwRVORk9uunFCovL/5go9YJisIK31kvnlZqEbKBLw7Pz92ctBK47BotgvcneWK/w VEOCvNnbCsXXiBYerqCGbmg+pZPQnY5IJq+gwvnbVRNY3pZnRKiWuavLPW70iBqtCqO9 RrPomb7igtIOlVZUl05R1ELXTPCH7bkqc2pim0lgrC636FyouTaYUOwRb16ocCOzVSsY cXfA== 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=+Tq5S/N+0JOq8c9dlCr3FKmOhtjiwItYwYRBLhuDC7A=; b=VtChgoYJWXo44YWyLaDTYVN9oPcxo1J/APRcN7Y6NX5UX4ksiIn1n6n+LfeK5UAwwv 1dZ5eJoYpchM1oKya8CqXX6fnN8s6roc/I6XCiCBu/epSyCNXIhOrbEdyUrJDT5UhLtL 13+WLgonsu8kTb1Fvi3wzgCmI6C/l2GS/DYagJj6LT72o7XiKemV6XEyqOAbOK5e4pYk ADxjJP+eFDfNEiFGcN9+DmaDjLzvMQ2ZrMTuPWpVBkjdK7tBhD2Yxmi6xUfuhXWtbhDJ FZLVYOpSs41kSd4x6GhgNy6+2KGgpapAMPLQpueTbfCjsTCfSx3/6RPJmSTm48brQCyf vpAA== X-Gm-Message-State: APjAAAW9OSH70OYZJyR3rXEqApG4sBAQEW+D21UC/I3eLbBwAB2kja83 LrZSwCXEvRzp+pTMM3aNYb9I5Dlf X-Google-Smtp-Source: APXvYqyW6tUwif5U2Bb1Vtbf9o2ziHlZ1h35j8VG4lrisNawe8vnGtNkZ0xGBY4J8fYmYUoZD4Ds9g== X-Received: by 2002:a7b:c19a:: with SMTP id y26mr662146wmi.152.1580951882851; Wed, 05 Feb 2020 17:18:02 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 01/30] hw/arm/raspi: Use BCM2708 machine type with pre Device Tree kernels Date: Thu, 6 Feb 2020 02:17:27 +0100 Message-Id: <20200206011756.2413-2-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 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 , Stephen Warren , =?utf-8?q?Zolt=C3=A1n_Baldaszti?= , Joaquin de Andres , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, Alistair Francis , Michael Chan , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?b?RGF1ZMOp?= , Pekka Enberg , Kshitij Soni Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When booting without device tree, the Linux kernels uses the $R1 register to determine the machine type. The list of values is registered at [1]. There are two entries for the Raspberry Pi: - https://www.arm.linux.org.uk/developer/machines/list.php?mid=3138 name: MACH_TYPE_BCM2708 value: 0xc42 (3138) status: Active, not mainlined date: 15 Oct 2010 - https://www.arm.linux.org.uk/developer/machines/list.php?mid=4828 name: MACH_TYPE_BCM2835 value: 4828 status: Active, mainlined date: 6 Dec 2013 QEMU always used the non-mainlined type MACH_TYPE_BCM2708. The value 0xc43 is registered to 'MX51_GGC' (processor i.MX51), and 0xc44 to 'Western Digital Sharespace NAS' (processor Marvell 88F5182). The Raspberry Pi foundation bootloader only sets the BCM2708 machine type, see [2] or [3]: 133 9: 134 mov r0, #0 135 ldr r1, =3138 @ BCM2708 machine id 136 ldr r2, atags @ ATAGS 137 bx r4 U-Boot only uses MACH_TYPE_BCM2708 (see [4]): 25 /* 26 * 2835 is a SKU in a series for which the 2708 is the first or primary SoC, 27 * so 2708 has historically been used rather than a dedicated 2835 ID. 28 * 29 * We don't define a machine type for bcm2709/bcm2836 since the RPi Foundation 30 * chose to use someone else's previously registered machine ID (3139, MX51_GGC) 31 * rather than obtaining a valid ID:-/ 32 * 33 * For the bcm2837, hopefully a machine type is not needed, since everything 34 * is DT. 35 */ While the definition MACH_BCM2709 with value 0xc43 was introduced in a commit described "Add 2709 platform for Raspberry Pi 2" out of the mainline Linux kernel, it does not seem used, and the platform is introduced with Device Tree support anyway (see [5] and [6]). Remove the unused values (0xc43 introduced in commit 1df7d1f9303aef "raspi: add raspberry pi 2 machine" and 0xc44 in commit bade58166f4 "raspi: Raspberry Pi 3 support"), keeping only MACH_TYPE_BCM2708. [1] https://www.arm.linux.org.uk/developer/machines/ [2] https://github.com/raspberrypi/tools/blob/920c7ed2e/armstubs/armstub7.S#L135 [3] https://github.com/raspberrypi/tools/blob/49719d554/armstubs/armstub7.S#L64 [4] https://gitlab.denx.de/u-boot/u-boot/blob/v2015.04/include/configs/rpi-common.h#L18 [5] https://github.com/raspberrypi/linux/commit/d9fac63adac#diff-6722037d79570df5b392a49e0e006573R526 [6] http://lists.infradead.org/pipermail/linux-rpi-kernel/2015-February/001268.html Cc: Zoltán Baldaszti Cc: Pekka Enberg Cc: Stephen Warren Cc: Kshitij Soni Cc: Michael Chan Cc: Andrew Baumann Reviewed-by: Alistair Francis Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 3996f6c63a..ef76a27f33 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -29,8 +29,7 @@ #define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */ #define SPINTABLE_ADDR 0xd8 /* Pi 3 bootloader spintable */ -/* Table of Linux board IDs for different Pi versions */ -static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44}; +#define MACH_TYPE_BCM2708 3138 /* Linux board IDs */ typedef struct RasPiState { BCM283XState soc; @@ -116,7 +115,7 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) static struct arm_boot_info binfo; int r; - binfo.board_id = raspi_boardid[version]; + binfo.board_id = MACH_TYPE_BCM2708; binfo.ram_size = ram_size; binfo.nb_cpus = machine->smp.cpus; From patchwork Thu Feb 6 01:17:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=AUfo/W9t; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgb46VGbz9sRG for ; Thu, 6 Feb 2020 12:20:00 +1100 (AEDT) Received: from localhost ([::1]:59156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVpm-0001Ro-Pa for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:19:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53471) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVo1-00007c-Hp for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVo0-0001bO-HY for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:09 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:34210) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVo0-0001UC-Af; Wed, 05 Feb 2020 20:18:08 -0500 Received: by mail-wr1-x42c.google.com with SMTP id t2so5155344wrr.1; Wed, 05 Feb 2020 17:18:07 -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=UVyn7DVfh5CLRBiwnsBkNYjNqPu43cXEQWrJu301xpo=; b=AUfo/W9thrhMxSoZJdlgMGst/XPuRov6AzY03twTPbptlnh83vKxw7aXmVjSc7HfA0 8rPqSC+jXwvq77ejRibs8QAYj7qdp9E9Ba7aEjyCbtvcjAeb5UiEdrk2hmZxtdueavWH xDUQAqWsubgJMeOGZf7VNneqpPrQTERrZBHN7Iw+01OKutZKrMuDbiTA/yI5YkCldFkq 7SgHeDDasfqD0atmxfdIwfzOYfBwwQRVVxZHIFE+sZYPl0619ZxgCdHQpGALYOKR8HuY bJbK/MSeDRZXgMCTsv2abPaQ+1WfY9VJAULlx4UrR7R6/+OrloLWHbKvB0/ec9OLZF/I 3ybA== 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=UVyn7DVfh5CLRBiwnsBkNYjNqPu43cXEQWrJu301xpo=; b=JywsU4aloe7b35++OV8LRJbuesfdnONZsC/QYPKgu8LVQU/8FXumbkw+6GN4rcPNk4 ixWF5i+B8zsftFkPKE0OXqYC9CIDnu0Fk0kt+QgGyYOUiMOju6t3buU+Mk8Hyp5YbY10 9bTHomLs0Vkwv37M68D9iuXedFnV2KsAN6xrvxfJS8tXD6t6Vnpc3pPojwR4qBAtOyR0 Q58DqziHRlTuTNvh1ennknZD4QD4vLJkO8IwufCr2KpTIWT0elmUS1ifFE34m6YA1AMX ERneah34a4rR28AHYnrapXSO217Z5OkR1GELuHLv9ntlqtE5RxZmsnyNu7/gT5FXgjTA ahtA== X-Gm-Message-State: APjAAAWrNzwbKyumFirg4NyOuhBoovYK5RCvuaAGdpT06kmgObI0RTlD 7O5AzMdUJ4beKbnRHeB/LAoH4isK X-Google-Smtp-Source: APXvYqwfZc1fTlxtSggonIYkMiSRBJV6aRbTUpDWgwWH+TwS+SI9jIJkRIgkMzucZebKHERgWN579g== X-Received: by 2002:a5d:4687:: with SMTP id u7mr363985wrq.176.1580951884832; Wed, 05 Feb 2020 17:18:04 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:04 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 02/30] hw/arm/raspi: Correct the board descriptions Date: Thu, 6 Feb 2020 02:17:28 +0100 Message-Id: <20200206011756.2413-3-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We hardcode the board revision as 0xa21041 for the raspi2, and 0xa02082 for the raspi3: 166 static void raspi_init(MachineState *machine, int version) 167 { ... 194 int board_rev = version == 3 ? 0xa02082 : 0xa21041; These revision codes are for the 2B and 3B models, see: https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md Correct the board description. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index ef76a27f33..3b892bb509 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -220,7 +220,7 @@ static void raspi2_init(MachineState *machine) static void raspi2_machine_init(MachineClass *mc) { - mc->desc = "Raspberry Pi 2"; + mc->desc = "Raspberry Pi 2B"; mc->init = raspi2_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; @@ -242,7 +242,7 @@ static void raspi3_init(MachineState *machine) static void raspi3_machine_init(MachineClass *mc) { - mc->desc = "Raspberry Pi 3"; + mc->desc = "Raspberry Pi 3B"; mc->init = raspi3_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; From patchwork Thu Feb 6 01:17:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ffnts1uE; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgdf3TwDz9sRG for ; Thu, 6 Feb 2020 12:22:14 +1100 (AEDT) Received: from localhost ([::1]:59210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVrw-0005O1-Bq for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:22:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53472) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVo1-00007d-I7 for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVo0-0001ar-GH for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:09 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:36270) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVo0-0001Y7-9J; Wed, 05 Feb 2020 20:18:08 -0500 Received: by mail-wm1-x341.google.com with SMTP id p17so5061860wma.1; Wed, 05 Feb 2020 17:18:08 -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=i+qx0RUWdCwdD1mrdUasvrUyqSxfDdWxzzEP/v8L4ms=; b=ffnts1uEq5g7Lf+uRsN26sMj2pItEHhMPXIa39PB2ZjoAt2rBwdeX3m7CKclXl+EQk 8OpYTIqAJX1F5J7F1GzxTxr/6SMiR7TZr9YndkrkEsKF5SZN19gtynRTsSpoYm7BIPB3 izK5t3kLx8v6ufj/QD0cQtwiq0na5hwPXP1+UonuG5YZOHOhoIn5D43kjCv/IcDPS9p8 gy5ZNEHwwU648OK1xXXOm4R2NwLhmjrkeOqpUK7n6WsLShMOYmq5SAdd7XjQKCIB7voI UGCSahPoXzkzdVKcKhch4A2fMXJZTkw2aB7BJNTC8+Pw3Lua/7QeGVshsEIr5cmBJAr5 bhVg== 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=i+qx0RUWdCwdD1mrdUasvrUyqSxfDdWxzzEP/v8L4ms=; b=GwSLe6uvpAzkVd61QoVQH6wz5cu3IOSGHEZE5WiFV0gUmJdVsoi2gGmmUoc414VdXZ 21erM09IGYnIHCcBqCrLZXwCuC3s3Qfv/zzD5BZZYMZjpcMpLnD8lvItIVMQk9ybyp/x PnvMxAduEx7gEhWwtcxKqGqO21ACXaYYNjYm9GPlw+Fx69stXlmUDJ4yBL8hJnjtRiHV Yxj5THwLNn/JruRz4DRgVWLhNm3geSPAmlbXdnbgP5MrliIV2KAFcv8Bb9rMmpq4u6Sm LFuAaw0HTRw1coyrFDK4/wRf13FCwoXgq5NPnMB0HtLrLi4dDL1QQuRC9f3yrkZb0H/h YDdg== X-Gm-Message-State: APjAAAWWWAvMySOjLKmWLm1094Fy7LynyHydZbYzl2XIH/2R7nT6H8n7 z9j1yLkLtdZUErLCbgso336si7ip X-Google-Smtp-Source: APXvYqyP0z6zgJnEv3eLuJkObFRBy2wzYHeycTDLHMhN15O+U/RUX+tzaB3XABhCHElNcmfCNd8bQA== X-Received: by 2002:a05:600c:214a:: with SMTP id v10mr650354wml.182.1580951886969; Wed, 05 Feb 2020 17:18:06 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 03/30] hw/arm/raspi: Extract the version from the board revision Date: Thu, 6 Feb 2020 02:17:29 +0100 Message-Id: <20200206011756.2413-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , Alistair Francis , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The board revision encode the board version. Add a helper to extract the version, and use it. Signed-off-by: Philippe Mathieu-Daudé --- Cc: Alistair Francis hw/arm/raspi.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 3b892bb509..13d41dfce6 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -16,6 +16,7 @@ #include "qapi/error.h" #include "cpu.h" #include "hw/arm/bcm2836.h" +#include "hw/registerfields.h" #include "qemu/error-report.h" #include "hw/boards.h" #include "hw/loader.h" @@ -36,6 +37,28 @@ typedef struct RasPiState { MemoryRegion ram; } RasPiState; +/* + * Board revision codes: + * www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/ + */ +FIELD(REV_CODE, REVISION, 0, 4); +FIELD(REV_CODE, TYPE, 4, 8); +FIELD(REV_CODE, PROCESSOR, 12, 4); +FIELD(REV_CODE, MANUFACTURER, 16, 4); +FIELD(REV_CODE, MEMORY_SIZE, 20, 3); +FIELD(REV_CODE, STYLE, 23, 1); + +static int board_processor_id(uint32_t board_rev) +{ + assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ + return FIELD_EX32(board_rev, REV_CODE, PROCESSOR); +} + +static int board_version(uint32_t board_rev) +{ + return board_processor_id(board_rev) + 1; +} + static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) { static const uint32_t smpboot[] = { @@ -163,9 +186,10 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) arm_load_kernel(ARM_CPU(first_cpu), machine, &binfo); } -static void raspi_init(MachineState *machine, int version) +static void raspi_init(MachineState *machine, uint32_t board_rev) { RasPiState *s = g_new0(RasPiState, 1); + int version = board_version(board_rev); uint32_t vcram_size; DriveInfo *di; BlockBackend *blk; @@ -191,7 +215,6 @@ static void raspi_init(MachineState *machine, int version) /* Setup the SOC */ object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram), &error_abort); - int board_rev = version == 3 ? 0xa02082 : 0xa21041; object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev", &error_abort); object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_abort); @@ -215,7 +238,7 @@ static void raspi_init(MachineState *machine, int version) static void raspi2_init(MachineState *machine) { - raspi_init(machine, 2); + raspi_init(machine, 0xa21041); } static void raspi2_machine_init(MachineClass *mc) @@ -237,7 +260,7 @@ DEFINE_MACHINE("raspi2", raspi2_machine_init) #ifdef TARGET_AARCH64 static void raspi3_init(MachineState *machine) { - raspi_init(machine, 3); + raspi_init(machine, 0xa02082); } static void raspi3_machine_init(MachineClass *mc) From patchwork Thu Feb 6 01:17:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=p7WH3EBP; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CgZD2Xxrz9sRG for ; Thu, 6 Feb 2020 12:19:16 +1100 (AEDT) Received: from localhost ([::1]:59154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVp4-0000e2-99 for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:19:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53540) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVo3-00008O-Hr for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVo2-0001od-HD for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:11 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:38845) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVo2-0001jh-A4; Wed, 05 Feb 2020 20:18:10 -0500 Received: by mail-wm1-x341.google.com with SMTP id a9so5038948wmj.3; Wed, 05 Feb 2020 17:18:10 -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=4WczbDSImLLtijqx5Y5H1xU/l5A4G3al/zgyXMX6VZo=; b=p7WH3EBPk/tvwrL3whPX3zmHC6R8L6Y0IO6etrq5XYvmr7idx/4k0aGodwU5X+sIDk GuUDO2aUnoHf+tOlgr3/M9V7qAZxL/7kr0fzfLX/kOPu4je7hk3mWCwOB837aa06j82l cp5GM01EEHeC9/xiyb5IDW7ORNEMzTY0W+V/MyzyWb79Wv93NWhOKi6du2OUw4jTkCrU /JgBe30P5vF5tlPmPsttKlz6zL3806mqQFY1meSm+JUsLfTIv8st6u8onNVqwS9FUjRC 8TYIVkYCkeG5hdC4cP4N+tj6B66J8gboI8VW+oYALF9ncRyocB4fBeiz2QBtEg9fni6P ldtg== 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=4WczbDSImLLtijqx5Y5H1xU/l5A4G3al/zgyXMX6VZo=; b=ZwuKpFJnyCE46fspWF45hcPeHfpJqX8wq9fASlSCL3PlvuX+IXEBpKwxKvZ+EipU0w y92hdUewLV3wLyRrpuI9obBtFj/U0QFmeh51lSf6YORwPaZtiTevcYJyAWcz0fR/FPf9 EOWl68lzm7Kh6s4T+gOm7vFv0lxUhwidOKCV9EnWu7Prr/AkFcDyIKyWy6mneQDTqGr8 A4nVxAafXd5TXfwFxZML2nxl8MhPOM8nMI9cz4k+DW0foY6ra3DWu7ebR8q4t1c8prrq LWJOXKzc8L5SzTyBjTvNNuwROeQQ9ajxQ1VeJ0vbWJNN0cyGvXKJyL/8kpsGI3qeqMvb 2H6w== X-Gm-Message-State: APjAAAUGevUkTK8gJaZMBM2IeRNxdKD/2VKz3i01R6K9+oJ6+w7MKnwj 5qsSm8MgY05VdUYhMR8lD+KEL+lG X-Google-Smtp-Source: APXvYqxxF8zlF/lj0u674oQnF2w5+w4rrvm55coSb9lMBCtdMzfiYk800ZjDdgqvsJszh1pczOExNg== X-Received: by 2002:a7b:c318:: with SMTP id k24mr685004wmj.54.1580951889166; Wed, 05 Feb 2020 17:18:09 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:08 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 04/30] hw/arm/raspi: Extract the RAM size from the board revision Date: Thu, 6 Feb 2020 02:17:30 +0100 Message-Id: <20200206011756.2413-5-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , Alistair Francis , =?utf-8?q?Philippe_Mathieu?= =?utf-8?q?-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The board revision encode the amount of RAM. Add a helper to extract the RAM size, and use it. Since the amount of RAM is fixed (it is impossible to physically modify to have more or less RAM), do not allow sizes different than the one anounced by the manufacturer. Acked-by: Igor Mammedov Signed-off-by: Philippe Mathieu-Daudé --- Cc: Alistair Francis hw/arm/raspi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 13d41dfce6..2f5cd32c5e 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/cutils.h" #include "qapi/error.h" #include "cpu.h" #include "hw/arm/bcm2836.h" @@ -48,6 +49,12 @@ FIELD(REV_CODE, MANUFACTURER, 16, 4); FIELD(REV_CODE, MEMORY_SIZE, 20, 3); FIELD(REV_CODE, STYLE, 23, 1); +static uint64_t board_ram_size(uint32_t board_rev) +{ + assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ + return 256 * MiB << FIELD_EX32(board_rev, REV_CODE, MEMORY_SIZE); +} + static int board_processor_id(uint32_t board_rev) { assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ @@ -190,15 +197,17 @@ static void raspi_init(MachineState *machine, uint32_t board_rev) { RasPiState *s = g_new0(RasPiState, 1); int version = board_version(board_rev); + uint64_t ram_size = board_ram_size(board_rev); uint32_t vcram_size; DriveInfo *di; BlockBackend *blk; BusState *bus; DeviceState *carddev; - if (machine->ram_size > 1 * GiB) { - error_report("Requested ram size is too large for this machine: " - "maximum is 1GB"); + if (machine->ram_size != ram_size) { + char *size_str = size_to_str(ram_size); + error_report("This machine can only be used with %s", size_str); + g_free(size_str); exit(1); } From patchwork Thu Feb 6 01:17:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234071 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Fnunndk7; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CgdL1Zg1z9sRG for ; Thu, 6 Feb 2020 12:21:57 +1100 (AEDT) Received: from localhost ([::1]:59202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVre-0004cV-V8 for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:21:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53603) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVo6-0000Dh-El for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVo4-0001zA-Ew for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:14 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:38846) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVo4-0001uz-8B; Wed, 05 Feb 2020 20:18:12 -0500 Received: by mail-wm1-x341.google.com with SMTP id a9so5038992wmj.3; Wed, 05 Feb 2020 17:18:12 -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=DoWpvyfK+WfXXi5X9tns5WnEcL/fdg1MifgQLNVT/tQ=; b=Fnunndk7H0/ivXOE4GMqkk66DOc9U0xIZ5sLtA7MHt5fANK9TycDh7/BK+KOBWRCEz FPt5kpPILvX0AIjQqCUOnFGrB2ls86njaU8ZVDv96a9QNWWDJ7d3m/GtjNCHOCJcG8lN RegpaIaeDira5pFGzHkhg1OU0/HyTw0ELAcsFmB9XIX2F/P2KsVlV3y0XTuFkJw0BoRC abw5n8RHxkfv8KAy2BqIcWZkzgppjvg8lF+id5zPT1bGf9kHpRx0EPCjS4+GdEeylpO4 I2u099wnVSMxahc8tHXKfE8hHijHrsLcU7TPpyyDJKeCZ+PfGqkZKQ97mj0YvEUEtyml i+Fw== 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=DoWpvyfK+WfXXi5X9tns5WnEcL/fdg1MifgQLNVT/tQ=; b=JA4QsgwjxM5GE6l1ktF9ug96Ya5TmDzFdTvN40AWS80cH1jnu8htGbi+1OgVHLQSom xAkH3DcaUDdv7O/CarWZL9UnA/s3InyWVlJ8vd71cEBqwUOjUJAPKNqqiKnEoSurQI+C KdFuYl957S+S/e2dudmZY7oMtBCwOqhWfm9io8UZUnrydPuAcBNnewZmX05TFyZCnap8 axx3+IG/hyYIKDl5D/z74d8QCWegBut3BV7pyFkFDNUSZCQZWpDVnMXhpMGK0Uz/JYQz SObS/VuZYAWWDuKyuchzVYdoA3/86USfcxOu8X3U394cHXm86Yr/oumnZ0BnXekHWuiV 0I9g== X-Gm-Message-State: APjAAAXnxcyQJhaFgYQzdzC9wxWLlXr7tO2Wb1i4FR8ffDvpqB6bviOe jetSpXDcTLHpRl5Y9M7RqvTOnb5t X-Google-Smtp-Source: APXvYqwNb260l6xW1ZyqsZkmbnoB64ruSEIkOpLCV7y4nmMa52R70aO0rFImc3bKczUivTODbYp2zQ== X-Received: by 2002:a1c:988a:: with SMTP id a132mr579281wme.113.1580951891181; Wed, 05 Feb 2020 17:18:11 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 05/30] hw/arm/raspi: Extract the processor type from the board revision Date: Thu, 6 Feb 2020 02:17:31 +0100 Message-Id: <20200206011756.2413-6-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The board revision encode the processor type. Add a helper to extract the type, and use it. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 2f5cd32c5e..20195227eb 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -66,6 +66,21 @@ 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) +{ + static const char *soc_types[] = { + NULL, TYPE_BCM2836, TYPE_BCM2837, + }; + int proc_id = board_processor_id(board_rev); + + if (proc_id >= ARRAY_SIZE(soc_types) || !soc_types[proc_id]) { + error_report("Unsupported processor id '%d' (board revision: 0x%x)", + proc_id, board_rev); + exit(1); + } + return soc_types[proc_id]; +} + static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) { static const uint32_t smpboot[] = { @@ -212,8 +227,7 @@ static void raspi_init(MachineState *machine, uint32_t board_rev) } object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc), - version == 3 ? TYPE_BCM2837 : TYPE_BCM2836, - &error_abort, NULL); + board_soc_type(board_rev), &error_abort, NULL); /* Allocate and map RAM */ memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram", From patchwork Thu Feb 6 01:17:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Jyc0WFcr; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cggb32jSz9sRK for ; Thu, 6 Feb 2020 12:23:55 +1100 (AEDT) Received: from localhost ([::1]:59236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVtZ-0008El-Bz for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:23:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53651) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVo7-0000Hy-Vm for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVo6-0002BL-UO for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:15 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:55406) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVo6-00024a-Na; Wed, 05 Feb 2020 20:18:14 -0500 Received: by mail-wm1-x343.google.com with SMTP id q9so4473833wmj.5; Wed, 05 Feb 2020 17:18:14 -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=W2XB7avCzY/On5eAKW5ymwIRtI2E5aDh8P+f+vF2jdQ=; b=Jyc0WFcrxYoKMiOxbcPKERxqQug5mK3/ZyHPNMIW3WFOT8LxPxDcBO17kVpLJlFFIE 4hy98q/k4tobPbyxRmDYCWqVd3AxL+HNRy2kLrN4aGUITPthE4J2AZtFqdOFaZaJsqMp YY48MZOeKrlqYc1NXqgfM2OvT1RfwQGbdeMfyJk75HBvYkmvvHwXhpBfmuEBSfS2FOdt dldFCXO47BnmcK/55UWFP/oo1i7W8qY2cWV73FrXLRzqmmXdG2k9w6otEy7jIN6wSWPA o5KpxF355R0rFOmcgP0u6dphHQ2iPGPfg4T7UfCrGZnFkHoGUvaCk65gzNTg9APHTDqW fGkA== 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=W2XB7avCzY/On5eAKW5ymwIRtI2E5aDh8P+f+vF2jdQ=; b=Res+HPN/vS/iPwE9GvYW1SX5NhA7o4lYVKNHHxmWBQHiQuRtXR0W4bQ0UPGaENIFFF r+bF7BQJRg7bfPrjMXqNjgCtrAY8PR0s3N62Mi2HMksA0syHG4rlv0Lo90ft1eGR6y9d IWYIs48t++rVTm7AknrvpwpEns6fdcmjDoGmykKjIAkxXuFqFzSa/rIKAjQON0WlUmqT fHY7JFW3/qXqmlmzmmd4AMO1Lz1hfxErbjDKPIkpo3lYYz76fnmYiI136ES3+NqgiVdK T76jzl8VQXytdxXCd5mg5zPxInrrcdaKWrnF51+kBbpE0XFxe7+pi2dfXv5rkSX9uB6o p6Ug== X-Gm-Message-State: APjAAAXCu5JIvlvKgezNJGNAroQURNQlad355xSPb37ZM2PYNvEVWq0o aFKW+dcaWrbu2Ydw+cYMrz1HmLdj X-Google-Smtp-Source: APXvYqz85deY74w3KyntT+LwF1bq55/fJ8GhkiGkDO9Ok1137DIGA+7gf9B7K+pnFVBNgYF1E/w7lQ== X-Received: by 2002:a1c:e488:: with SMTP id b130mr606177wmh.108.1580951893551; Wed, 05 Feb 2020 17:18:13 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:12 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 06/30] hw/arm/raspi: Trivial code movement Date: Thu, 6 Feb 2020 02:17:32 +0100 Message-Id: <20200206011756.2413-7-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 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 , "open list:Trivial patches" , Joaquin de Andres , Michael Tokarev , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , Andrew Baumann , Laurent Vivier , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There is no point in creating the SoC object before allocating the RAM. Move the call to keep all the SoC-related calls together. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 20195227eb..fab361939c 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -226,9 +226,6 @@ static void raspi_init(MachineState *machine, uint32_t board_rev) exit(1); } - object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc), - board_soc_type(board_rev), &error_abort, NULL); - /* Allocate and map RAM */ memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram", machine->ram_size); @@ -236,6 +233,8 @@ static void raspi_init(MachineState *machine, uint32_t board_rev) memory_region_add_subregion_overlap(get_system_memory(), 0, &s->ram, 0); /* Setup the SOC */ + object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc), + board_soc_type(board_rev), &error_abort, NULL); object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram), &error_abort); object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev", From patchwork Thu Feb 6 01:17:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234074 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=cMd09c25; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgf542gXz9sRG for ; Thu, 6 Feb 2020 12:22:37 +1100 (AEDT) Received: from localhost ([::1]:59222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVsJ-00062O-Ef for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:22:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53721) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoB-0000Pz-DC for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVo9-0002Na-4t for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:19 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:41479) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVo8-0002K0-US; Wed, 05 Feb 2020 20:18:17 -0500 Received: by mail-wr1-x434.google.com with SMTP id c9so5118036wrw.8; Wed, 05 Feb 2020 17:18:16 -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=WLnZ45NIm/vPLcZBLPmTGbE9FGNbyG4Wr/Aibf/Pthg=; b=cMd09c25kNyj9L9Ib6uWicSoFvPXeuWv8aK2aJeM81vZzLKv7GrQ/EFPIdNdvQJ1A9 i1cehYNFWZZ94C0MT5OqVMtOHSp5FRN4CwOny6x7zQf++mOSM5NYGOO4HV8lzPQu5k6k 6h6QqLE5OkVrNHN2nwxLzNzgxjK9P1mYl0Vj5TMDOtmYren5d2pRcc/UNmV7DzCFt3UQ gSFKNOl338uUGKFvg8Ezt89wcSacD2t/7/h6j6TiXZ+LKYrQtCGg3zqJZN74Sz4bZOia Rp0Hv6mPhDcoqeph2eQhrVWxEpEqRmF3tuGcDW6jSmMiFF1dDWc793of5e8HMELcH2s2 lf8w== 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=WLnZ45NIm/vPLcZBLPmTGbE9FGNbyG4Wr/Aibf/Pthg=; b=ZXrRlXGOaNWj2DSjtABQsj4Vsl1PVBSXdrUqiOBg6LitI8Am0roi/Vup48KXpnJcHQ drlJw7vmGtRRkPTfp1MFo7JEWxbxLmkTLqeEgTt0LG9RK6Xda2utFdxxc1jpJsfKBZkJ vHWdp4gPzN8jipoZ2xMjwr6ZG/wL12bP9+4Y6U+ZkYLOAobFbPKU7hUjTnR83fhuckah 1cKuLvdulinCNB8+VmJn+wr/x2UBVlKneGydvz2SmDV059KRa8fe2+ZeOOIRFq+cpau9 X1nXwglKNpJ69i+MkPh1gEpfQ4ulwvH7BCGODDu99ZGRBCzROKWdXGc3RNAybj0HKVzm ceTQ== X-Gm-Message-State: APjAAAUdSqoYPv9Czb804lrNOU+93vIsxWYug80kjTMsHCimznTFhChe ZXOK0faOdPMS03DKjNY8RvHgeuW8 X-Google-Smtp-Source: APXvYqxJAW+XTTbwotJW2sYkWd+73SETZesHIyOsprmTE3tLlRvipwJUE/AF7Qrd34/8dklytqRNZg== X-Received: by 2002:adf:f7c6:: with SMTP id a6mr402781wrq.164.1580951895652; Wed, 05 Feb 2020 17:18:15 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:15 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 07/30] hw/arm/raspi: Make machines children of abstract RaspiMachineClass Date: Thu, 6 Feb 2020 02:17:33 +0100 Message-Id: <20200206011756.2413-8-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" QOM'ify RaspiMachineState. Now machines inherite of RaspiMachineClass. Cc: Igor Mammedov Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 56 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index fab361939c..edf3e1c0d5 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -33,10 +33,28 @@ #define MACH_TYPE_BCM2708 3138 /* Linux board IDs */ -typedef struct RasPiState { +typedef struct RaspiMachineState { + /*< private >*/ + MachineState parent_obj; + /*< public >*/ BCM283XState soc; MemoryRegion ram; -} RasPiState; +} RaspiMachineState; + +typedef struct RaspiMachineClass { + /*< private >*/ + MachineClass parent_obj; + /*< public >*/ +} RaspiMachineClass; + +#define TYPE_RASPI_MACHINE MACHINE_TYPE_NAME("raspi-common") +#define RASPI_MACHINE(obj) \ + OBJECT_CHECK(RaspiMachineState, (obj), TYPE_RASPI_MACHINE) + +#define RASPI_MACHINE_CLASS(klass) \ + OBJECT_CLASS_CHECK(RaspiMachineClass, (klass), TYPE_RASPI_MACHINE) +#define RASPI_MACHINE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(RaspiMachineClass, (obj), TYPE_RASPI_MACHINE) /* * Board revision codes: @@ -210,7 +228,7 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) static void raspi_init(MachineState *machine, uint32_t board_rev) { - RasPiState *s = g_new0(RasPiState, 1); + RaspiMachineState *s = RASPI_MACHINE(machine); int version = board_version(board_rev); uint64_t ram_size = board_ram_size(board_rev); uint32_t vcram_size; @@ -263,8 +281,10 @@ static void raspi2_init(MachineState *machine) raspi_init(machine, 0xa21041); } -static void raspi2_machine_init(MachineClass *mc) +static void raspi2_machine_class_init(ObjectClass *oc, void *data) { + MachineClass *mc = MACHINE_CLASS(oc); + mc->desc = "Raspberry Pi 2B"; mc->init = raspi2_init; mc->block_default_type = IF_SD; @@ -277,7 +297,6 @@ static void raspi2_machine_init(MachineClass *mc) mc->default_ram_size = 1 * GiB; mc->ignore_memory_transaction_failures = true; }; -DEFINE_MACHINE("raspi2", raspi2_machine_init) #ifdef TARGET_AARCH64 static void raspi3_init(MachineState *machine) @@ -285,8 +304,10 @@ static void raspi3_init(MachineState *machine) raspi_init(machine, 0xa02082); } -static void raspi3_machine_init(MachineClass *mc) +static void raspi3_machine_class_init(ObjectClass *oc, void *data) { + MachineClass *mc = MACHINE_CLASS(oc); + mc->desc = "Raspberry Pi 3B"; mc->init = raspi3_init; mc->block_default_type = IF_SD; @@ -298,5 +319,26 @@ static void raspi3_machine_init(MachineClass *mc) mc->default_cpus = BCM283X_NCPUS; mc->default_ram_size = 1 * GiB; } -DEFINE_MACHINE("raspi3", raspi3_machine_init) #endif + +static const TypeInfo raspi_machine_types[] = { + { + .name = MACHINE_TYPE_NAME("raspi2"), + .parent = TYPE_RASPI_MACHINE, + .class_init = raspi2_machine_class_init, +#ifdef TARGET_AARCH64 + }, { + .name = MACHINE_TYPE_NAME("raspi3"), + .parent = TYPE_RASPI_MACHINE, + .class_init = raspi3_machine_class_init, +#endif + }, { + .name = TYPE_RASPI_MACHINE, + .parent = TYPE_MACHINE, + .instance_size = sizeof(RaspiMachineState), + .class_size = sizeof(RaspiMachineClass), + .abstract = true, + } +}; + +DEFINE_TYPES(raspi_machine_types) From patchwork Thu Feb 6 01:17:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234076 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=RoPBEx5H; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cghg0GK1z9sRK for ; Thu, 6 Feb 2020 12:24:51 +1100 (AEDT) Received: from localhost ([::1]:59240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVuS-0000Sa-Tr for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:24:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53757) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoD-0000S9-4g for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoB-0002VN-2C for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:20 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:43329) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoA-0002Q8-RF; Wed, 05 Feb 2020 20:18:18 -0500 Received: by mail-wr1-x441.google.com with SMTP id z9so5097592wrs.10; Wed, 05 Feb 2020 17:18:18 -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=FcTo9TN8PYsENDGEQjBiXZU3Vioo+Qv1b4+0maH8RB0=; b=RoPBEx5HmP/j2LP1WivPYfg+K+Aag+N5eFumOi2sePyI2e2KSvcJMkKWFYgaDXDIEx +m1zTPX8160CCy6FEcK50ToN4yQQ/3zsHnJTqllQVyjIMMFqKiJ0YiZl5bITqmu82wR1 dUzCHZLq19NhxBuoztcjvrmLWTy3SfknJ5sCQY5yFgOP0LnOsYef2OEFAgJDg1XoujjG dNyWD/QrVDO68OhV5rYxSp3HZnZhDDmtqX7Zuk3mYuTVPTUADyCjD1dQbSSqJvORkvHW 4L8ADR3UG8Sppeh05Vh4YmwahHe6bW/tTFCwF+Fq0wIFJlG+pJ7+b34AWMFAh1goHjVQ DeOg== 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=FcTo9TN8PYsENDGEQjBiXZU3Vioo+Qv1b4+0maH8RB0=; b=UjV4D6EoekrifacV0fjouSTEAJVDJnlEmhrDHYja8hFbRrpC1JH/fVP8S1rjCjGMJ+ dDYxa1E28FQ1n+KUsEfr9NloBQ1bWTMF5W5wW2t3oRAhshqkGIwVeakPNfYCOx4/2xRv QDD8jtiZZdRDSAZkMxX6wqX3lyqIrQvgVcbO7gS8oUCjGJOuIUNe3HBqVbXr2Qssyz8Y uNtTd7bejkoaGLSjuvoPPdPX5Wv+9YaVzXRZDXjKn6jv+i+FPu148x45PRGvWKFPSN+Q 5aaiWLGo2bhXaRhEqdN0MggAzzcjW7ydYGJJLEN20o14VFgD0DpNTe8BVZJ0H1KgP5hY IGuw== X-Gm-Message-State: APjAAAXG2SNb5YqzZhMlhqCDPM9Dht0UW3TRuPoKZmBD+ZxB9zTSvHcb ZOmbJMMtLQ/hR9hFau8YLrac4jZP X-Google-Smtp-Source: APXvYqxgcyo0uaMIeZLPZzYLWsowWcDLUxgDtTzbQWmtVoG3hFwrTogVAhqTk7wXtjlifcl/cHYSmA== X-Received: by 2002:adf:82ce:: with SMTP id 72mr397455wrc.14.1580951897636; Wed, 05 Feb 2020 17:18:17 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 08/30] hw/arm/raspi: Make board_rev a field of RaspiMachineClass Date: Thu, 6 Feb 2020 02:17:34 +0100 Message-Id: <20200206011756.2413-9-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We want to have a common class_init(). The only value that matters (and changes) is the board revision. Pass the board_rev as class_data to class_init(). Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index edf3e1c0d5..885abced57 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -45,6 +45,7 @@ typedef struct RaspiMachineClass { /*< private >*/ MachineClass parent_obj; /*< public >*/ + uint32_t board_rev; } RaspiMachineClass; #define TYPE_RASPI_MACHINE MACHINE_TYPE_NAME("raspi-common") @@ -226,9 +227,11 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) arm_load_kernel(ARM_CPU(first_cpu), machine, &binfo); } -static void raspi_init(MachineState *machine, uint32_t board_rev) +static void raspi_init(MachineState *machine) { + RaspiMachineClass *mc = RASPI_MACHINE_GET_CLASS(machine); RaspiMachineState *s = RASPI_MACHINE(machine); + uint32_t board_rev = mc->board_rev; int version = board_version(board_rev); uint64_t ram_size = board_ram_size(board_rev); uint32_t vcram_size; @@ -278,13 +281,16 @@ static void raspi_init(MachineState *machine, uint32_t board_rev) static void raspi2_init(MachineState *machine) { - raspi_init(machine, 0xa21041); + raspi_init(machine); } static void raspi2_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + uint32_t board_rev = (uint32_t)(uintptr_t)data; + rmc->board_rev = board_rev; mc->desc = "Raspberry Pi 2B"; mc->init = raspi2_init; mc->block_default_type = IF_SD; @@ -301,13 +307,16 @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) #ifdef TARGET_AARCH64 static void raspi3_init(MachineState *machine) { - raspi_init(machine, 0xa02082); + raspi_init(machine); } static void raspi3_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); + uint32_t board_rev = (uint32_t)(uintptr_t)data; + rmc->board_rev = board_rev; mc->desc = "Raspberry Pi 3B"; mc->init = raspi3_init; mc->block_default_type = IF_SD; @@ -326,11 +335,13 @@ static const TypeInfo raspi_machine_types[] = { .name = MACHINE_TYPE_NAME("raspi2"), .parent = TYPE_RASPI_MACHINE, .class_init = raspi2_machine_class_init, + .class_data = (void *)0xa21041, #ifdef TARGET_AARCH64 }, { .name = MACHINE_TYPE_NAME("raspi3"), .parent = TYPE_RASPI_MACHINE, .class_init = raspi3_machine_class_init, + .class_data = (void *)0xa02082, #endif }, { .name = TYPE_RASPI_MACHINE, From patchwork Thu Feb 6 01:17:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=PfwqIART; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CgmM0vTcz9sRK for ; Thu, 6 Feb 2020 12:28:03 +1100 (AEDT) Received: from localhost ([::1]:59300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVxY-00053W-Vg for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:28:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53881) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoI-0000bw-5j for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoE-0002hc-1h for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:26 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:41280) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoD-0002bv-Rb; Wed, 05 Feb 2020 20:18:21 -0500 Received: by mail-wr1-x442.google.com with SMTP id c9so5118155wrw.8; Wed, 05 Feb 2020 17:18:21 -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=ZQ7H/VBhBbZJ296rEwB4ccWCzYWB0TCAGh2KT8v1BXA=; b=PfwqIARTtpneD4rrFiXDXY96Eob+ltk9t0V/RdthzIrKRXrZZ20Z/2gD8aL0Nkd1Q8 SDXVzWAP+IitWq3RwmV9+DQv3NU8b3hiNGoeBoAj0FHMKsyzZkQVU5X2v7kX8wDV4AxK wBnDLrUg2ADf74Tm5pVtWEAvmsp1mYWNWVgvrK3YVypYFXtv1U7eKMZN5dS/lpEW6hh9 iDF4iOCUIMY4mDMcbGwEpgH2xifi7WDaY1DK62tHER0J+3oMB5fJboZRHTIteZ95HtVy 6KX3ZOt9BaLvQHnJym8Om3kCfI4lEE7VDbNYu1Est0yULHrSFeHZfd6RP6DGZ0sDsFuo nSMg== 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=ZQ7H/VBhBbZJ296rEwB4ccWCzYWB0TCAGh2KT8v1BXA=; b=JrPExzwaHKiygeOB6F1QIp+kJWOThMNtZ/AYM2/k/6fXOnbqpsd6BCqD9sB/4Tn2eQ LAYBkMDEIGdFxxyfwxwJPAfJRLHdOK87FLUfYFYwZ9hXM8R5vVrErV8htLSzJYqZPr8b ZnCtrQuTHjrmnQL47EeOdvoeiLHaZ9LoB/6Gi0fTR7Qs8CMuIVCj55nhX44LM5nX1B+z glMLF8Dln5V+7fKhOjvQFzrtlat8YUWA1UXVBWnlS68U+Wf00mK0JUNwJRVfqpPcksM4 Lw11BCQBlzu1NKjABJ1gbpuEdAnPPu2p3iQ/AemlgejvnrnleFqxAbzqpDBsh+Of2y4p Vv8w== X-Gm-Message-State: APjAAAWzBjAjuDrb0tmX4GH6p5RaKGIgSNqQ1XldYcL4P7LsNmhZ3pJz 9MQxSSnfcdTcZCaNTDSWKUBBhiHc X-Google-Smtp-Source: APXvYqz0cUqAqKv+uWdZutGn7xjYP2Lz8TV0bvurgKzLJ2Ep630iaNoXOQGaY/+OiAaOGkSD4puTtg== X-Received: by 2002:adf:cd92:: with SMTP id q18mr319541wrj.261.1580951899561; Wed, 05 Feb 2020 17:18:19 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:19 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 09/30] hw/arm/raspi: Let class_init() directly call raspi_machine_init() Date: Thu, 6 Feb 2020 02:17:35 +0100 Message-Id: <20200206011756.2413-10-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" raspi_machine_init() access to board_rev via RaspiMachineClass. raspi2_init() and raspi3_init() do nothing. Call raspi_machine_init directly. Signed-off-by: Philippe Mathieu-Daudé --- Squash with previous? --- hw/arm/raspi.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 885abced57..651585ebfb 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -227,7 +227,7 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size) arm_load_kernel(ARM_CPU(first_cpu), machine, &binfo); } -static void raspi_init(MachineState *machine) +static void raspi_machine_init(MachineState *machine) { RaspiMachineClass *mc = RASPI_MACHINE_GET_CLASS(machine); RaspiMachineState *s = RASPI_MACHINE(machine); @@ -279,11 +279,6 @@ static void raspi_init(MachineState *machine) setup_boot(machine, version, machine->ram_size - vcram_size); } -static void raspi2_init(MachineState *machine) -{ - raspi_init(machine); -} - static void raspi2_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -292,7 +287,7 @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) rmc->board_rev = board_rev; mc->desc = "Raspberry Pi 2B"; - mc->init = raspi2_init; + mc->init = raspi_machine_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; mc->no_floppy = 1; @@ -305,11 +300,6 @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) }; #ifdef TARGET_AARCH64 -static void raspi3_init(MachineState *machine) -{ - raspi_init(machine); -} - static void raspi3_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -318,7 +308,7 @@ static void raspi3_machine_class_init(ObjectClass *oc, void *data) rmc->board_rev = board_rev; mc->desc = "Raspberry Pi 3B"; - mc->init = raspi3_init; + mc->init = raspi_machine_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; mc->no_floppy = 1; From patchwork Thu Feb 6 01:17:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=mNXgTA7k; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgj44CHJz9sRK for ; Thu, 6 Feb 2020 12:25:12 +1100 (AEDT) Received: from localhost ([::1]:59248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVuo-00010n-FT for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:25:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53831) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoF-0000Xo-Ue for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoF-0002iy-19 for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:23 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:39337) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoE-0002i6-Ri; Wed, 05 Feb 2020 20:18:22 -0500 Received: by mail-wr1-x443.google.com with SMTP id y11so5131491wrt.6; Wed, 05 Feb 2020 17:18:22 -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=26NlFhB7W/cGbdiqG5QYqxUB4TwmMhCNQJ4yaNv34Is=; b=mNXgTA7kADDjSX/C1lu3LYdrez6H66N07uAVR5iI9y1uJV5CkjfSACSIQMDrNLEPuK xyjDVSvzrp6xnJeUbAGN+71rquyTKTnICaQ4FhoqIvxXhH13hYghOS2mlhZ3ZVKl/6Kn fiN4rUjbe8louxbxG8us2qDadtUvJeWCC5KjQUshwkOX02jFbRu0LVP80Bz4dfek1G5w rlLXVqxVseaSkylXtqtldqkwKfuMj9cbGl1KzsYzkan67WGvSJvtNPNXiAREv6HopDGD jctgDLuZPDgZhmH8umZjxVTfac1FQWp2n4H3TTrVdCEBqyDEs6C6i3kWQEF73bTo7I7B OgSw== 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=26NlFhB7W/cGbdiqG5QYqxUB4TwmMhCNQJ4yaNv34Is=; b=OTFljgnJ4gHbXMjnXUei/fz8ObrU9VJ4bUZOrvDb8k8s336WOfDEgfrO1UXRhkrQOm FXmGIuSzkorFYJmkI8wZ1P3eoUXah0Lbzsu93aoEjsimX9TrrOdPaK2LJO8J7ytOXBVq OzScAh71GpiffMwMbG6O7+xAs65KX0+5w3FWYAsh8VA5dFIRmfOKKN1nGPhUvgvyV3pJ +epZ1B3I1i5cVDjjoPHav1krTLIhCnekfNvB6adCjDCzeUqwMv9L+Vf4DSrWU0BDNe5i ZF96Iu0eoyBEI0VRz9cqPBcCKM3JiyU/L0ZqF5wlftnbaj48e3JmphmpweR526DO2znX 4kqw== X-Gm-Message-State: APjAAAVdTYYzKr+ZvtT6T6sGVnIFcJ84XgGteJ/GDaxneEWNLpqWrJyQ /bF1/2LkmXdgAGZDfTFKEQ/dIImT X-Google-Smtp-Source: APXvYqzjqbMCkaksaMMEAI9kvtXH78k2e0Hc49y2UubO4C4CrxexqH9Gb+y/mwp0xaYh9AcLGQYqzA== X-Received: by 2002:adf:bbcf:: with SMTP id z15mr376135wrg.266.1580951901629; Wed, 05 Feb 2020 17:18:21 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:21 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 10/30] hw/arm/raspi: Set default RAM size to size encoded in board revision Date: Thu, 6 Feb 2020 02:17:36 +0100 Message-Id: <20200206011756.2413-11-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We added a helper to extract the RAM size from the board revision, and made board_rev a field of RaspiMachineClass. The class_init() can now use the helper to extract from the board revision the board-specific amount of RAM. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 651585ebfb..43f8b1d677 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -295,7 +295,7 @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) mc->max_cpus = BCM283X_NCPUS; mc->min_cpus = BCM283X_NCPUS; mc->default_cpus = BCM283X_NCPUS; - mc->default_ram_size = 1 * GiB; + mc->default_ram_size = board_ram_size(board_rev); mc->ignore_memory_transaction_failures = true; }; @@ -316,7 +316,7 @@ static void raspi3_machine_class_init(ObjectClass *oc, void *data) mc->max_cpus = BCM283X_NCPUS; mc->min_cpus = BCM283X_NCPUS; mc->default_cpus = BCM283X_NCPUS; - mc->default_ram_size = 1 * GiB; + mc->default_ram_size = board_ram_size(board_rev); } #endif From patchwork Thu Feb 6 01:17:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234084 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=oDYsSvVo; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgqc5bGYz9sRK for ; Thu, 6 Feb 2020 12:30:52 +1100 (AEDT) Received: from localhost ([::1]:59336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW0I-0008V6-Lk for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:30:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53920) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoK-0000g7-30 for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoH-0002t0-2k for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:27 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:53668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoG-0002oW-SQ; Wed, 05 Feb 2020 20:18:25 -0500 Received: by mail-wm1-x342.google.com with SMTP id s10so4480604wmh.3; Wed, 05 Feb 2020 17:18:24 -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=CaYU6v4i3WvFRx68YJRb27EPqhasUqGFaQXAfnDzbnU=; b=oDYsSvVoAnK+fleW203J5v18J7cLt0lZECznvNdNzWHYwf6AoYx0zPeKcEhNhl+S7d 4/AykB4FWmhq364XXS7MA2Jx0CiZZNH2cV3JjNvTY2QQicLniLVo/ksKHkjrlPZHnkD0 9Nmw9jQY57b7CicbOmHbDphaDDkxtdbxaNbcnh1Bs4Po6DRU2metifkWcywQXudSe4vS moi2bReNTSegKX3mEcAAdqwKsChLkp4MUKIQRcziIloEAaS7VWM+Z6/Fr1JklFWCV/Iz YM1dALyw1Sgy+KNHzt87Cna0dfM/nXRrP2Fkx/8HSZSyoacR3CMdGxG2wjDZOA40nSu3 M/qw== 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=CaYU6v4i3WvFRx68YJRb27EPqhasUqGFaQXAfnDzbnU=; b=c6mi6bw4IgT1X16vHzhz9QxqcNtPC/K5BrYBDSvUb2A3xFba9ghSkvwIoBqPP/1Fb9 4/oqiKCPgv+dF8JUjhLzos5lPQ8NqWKCmYIYnEaZ+WUsmHLW+8eglHNOKhMFDZB/5ChD BE1WVD5dj5WHPxWK3xNOwBx6r0FQwGitk01Y/2rzQnz/tZBrvQi8S6PGHcVIqI1kS/fr h1+7RFCh/ALQc/MRoqpuzOenhLDNLzABsGf6tDWR2vRNirhurivoILo3NKpANRZRd7X1 mgmxUMSpLs08bjuI8SDyZI+qtadTFgCuNDkkIXLmaMi2i6X5k3hjuETz0EbKWhQpFIJQ 4sCA== X-Gm-Message-State: APjAAAU/PMm6DrbzQK59B4ShYViai7U87sc33LC2WswbxCLtiE6omof0 BrGEz2Rsa1pv8mBtW588IPCKQhuh X-Google-Smtp-Source: APXvYqzZ5zvun2rf/MRbfVb6wGacrQyyXjG3h5Sd4V+ASNme0bESYeS6kY1H3TNM5YASsqSP+FHvlg== X-Received: by 2002:a1c:41c4:: with SMTP id o187mr638752wma.24.1580951903726; Wed, 05 Feb 2020 17:18:23 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:23 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 11/30] hw/arm/raspi: Extract the board model from the board revision Date: Thu, 6 Feb 2020 02:17:37 +0100 Message-Id: <20200206011756.2413-12-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The board revision encode the model type. Add a helper to extract the model, and use it. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 43f8b1d677..a104393cb2 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -100,6 +100,20 @@ static const char *board_soc_type(uint32_t board_rev) return soc_types[proc_id]; } +static const char *board_type(uint32_t board_rev) +{ + static const char *types[] = { + "A", "B", "A+", "B+", "2B", "Alpha", "CM1", NULL, "3B", "Zero", + "CM3", NULL, "Zero W", "3B+", "3A+", NULL, "CM3+", "4B", + }; + assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ + int bt = FIELD_EX32(board_rev, REV_CODE, TYPE); + if (bt >= ARRAY_SIZE(types) || !types[bt]) { + return "Unknown"; + } + return types[bt]; +} + static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) { static const uint32_t smpboot[] = { @@ -286,7 +300,7 @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) uint32_t board_rev = (uint32_t)(uintptr_t)data; rmc->board_rev = board_rev; - mc->desc = "Raspberry Pi 2B"; + mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev)); mc->init = raspi_machine_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; @@ -307,7 +321,7 @@ static void raspi3_machine_class_init(ObjectClass *oc, void *data) uint32_t board_rev = (uint32_t)(uintptr_t)data; rmc->board_rev = board_rev; - mc->desc = "Raspberry Pi 3B"; + mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev)); mc->init = raspi_machine_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; From patchwork Thu Feb 6 01:17:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ZesKS19e; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cglp3Gm3z9sRK for ; Thu, 6 Feb 2020 12:27:34 +1100 (AEDT) Received: from localhost ([::1]:59295 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVx6-0004hZ-AK for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:27:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53976) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoN-0000jd-6c for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoK-00033G-29 for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:31 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:54680) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoJ-0002xM-Rj; Wed, 05 Feb 2020 20:18:28 -0500 Received: by mail-wm1-x342.google.com with SMTP id g1so4472302wmh.4; Wed, 05 Feb 2020 17:18:26 -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=rQmOHgOI+RgkOPwFIK/xpNJ3XvDpycIgclU+wSqLCT0=; b=ZesKS19eWq5MK0nAAMdsUOfUNqjZHzfFpfmjMR45YQj+mMPwyHDRqfry+1LjCNZwkT LvGvT4FEVIMiKfHyDBUXvityBPd3/nrp1U+MaH3B7yRiNDDQOIfLZU7PgGafzZ5RfjSW YVlLv1IbX6dSbmwRFedrh/p4rDiAlvwaC11szo9e69DiO1+rfQi2jtSS2LEIKIxBdcc6 cEXhNhO4b+N6p/AGUnnFp1tCAdKc+joep8M7RQub/taFfzthNxvsVnnIKHCJS88Rki53 B/M3Pmck1ZJoPSmoKDR6xC88onL9dD4ZVOWdiV5RXeqBVDpDQYaTRBYGBQphAJmf5zpq OZXA== 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=rQmOHgOI+RgkOPwFIK/xpNJ3XvDpycIgclU+wSqLCT0=; b=aujt+R2imGDdP+A///AZGbg9hEwFJtHXa85Hw4y/ywHr3B4MgY57jsSzvai0AFMrDR 0O2hK2uNE1X2AXGZiESm0lE12uQq1lXhNqVDv3VY8kzWCYd9wWkEzlHg7soEBq1hsZYY WGb75cfKFsXybDRP0nKA/R4JlzN4+aI7ZYk1quSbHD3LFnL8iA2CN8zMTZ4vQkVckc6U iVq3SwUEmsJypzrXtCT/rwLzpE8/ndEy6kpLwqDKf638V9+/b3dSkYMJz9Ctha+Kndy1 9VtkQJOfSbLFKqYMHoeYMAxQlK9VqBrq1RWJ8qmAHB7rQ+GUiPLu7jcerNtNSRtleB6H DxMg== X-Gm-Message-State: APjAAAWcxbhfspng/WK6ul1JlQo5d//j8olOVFe+ypkJL/nySlhGX94n lvyicbkSs0rN5PNkCCRY/kICvjpR X-Google-Smtp-Source: APXvYqxQFRbbfZrfALDcn5oCY5qhQDF2Q+lVoJE9RgvaU+pDWGJxF53k2Buc8ZrUKDSfBEffZWFn8g== X-Received: by 2002:a7b:c109:: with SMTP id w9mr630872wmi.14.1580951905661; Wed, 05 Feb 2020 17:18:25 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 12/30] hw/arm/raspi: Use a unique raspi_machine_class_init() method Date: Thu, 6 Feb 2020 02:17:38 +0100 Message-Id: <20200206011756.2413-13-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" With the exception of the ignore_memory_transaction_failures flag set for the raspi2, both machine_class_init() methods are now identical. Merge them to keep a unique method. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index a104393cb2..8fe07db47a 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -293,7 +293,7 @@ static void raspi_machine_init(MachineState *machine) setup_boot(machine, version, machine->ram_size - vcram_size); } -static void raspi2_machine_class_init(ObjectClass *oc, void *data) +static void raspi_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); @@ -310,41 +310,22 @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) mc->min_cpus = BCM283X_NCPUS; mc->default_cpus = BCM283X_NCPUS; mc->default_ram_size = board_ram_size(board_rev); - mc->ignore_memory_transaction_failures = true; + if (board_version(board_rev) == 2) { + mc->ignore_memory_transaction_failures = true; + } }; -#ifdef TARGET_AARCH64 -static void raspi3_machine_class_init(ObjectClass *oc, void *data) -{ - MachineClass *mc = MACHINE_CLASS(oc); - RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc); - uint32_t board_rev = (uint32_t)(uintptr_t)data; - - rmc->board_rev = board_rev; - mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev)); - mc->init = raspi_machine_init; - mc->block_default_type = IF_SD; - mc->no_parallel = 1; - mc->no_floppy = 1; - mc->no_cdrom = 1; - mc->max_cpus = BCM283X_NCPUS; - mc->min_cpus = BCM283X_NCPUS; - mc->default_cpus = BCM283X_NCPUS; - mc->default_ram_size = board_ram_size(board_rev); -} -#endif - static const TypeInfo raspi_machine_types[] = { { .name = MACHINE_TYPE_NAME("raspi2"), .parent = TYPE_RASPI_MACHINE, - .class_init = raspi2_machine_class_init, + .class_init = raspi_machine_class_init, .class_data = (void *)0xa21041, #ifdef TARGET_AARCH64 }, { .name = MACHINE_TYPE_NAME("raspi3"), .parent = TYPE_RASPI_MACHINE, - .class_init = raspi3_machine_class_init, + .class_init = raspi_machine_class_init, .class_data = (void *)0xa02082, #endif }, { From patchwork Thu Feb 6 01:17:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234073 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=rbRx0UVN; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgf36s3tz9sRG for ; Thu, 6 Feb 2020 12:22:35 +1100 (AEDT) Received: from localhost ([::1]:59218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVsF-0005xk-IH for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:22:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54018) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoP-0000mc-5q for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoN-0003Ae-2e for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:33 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:55408) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoM-00034O-RE; Wed, 05 Feb 2020 20:18:30 -0500 Received: by mail-wm1-x341.google.com with SMTP id q9so4474243wmj.5; Wed, 05 Feb 2020 17:18:29 -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=1Sth+jzkQIFIFbQJHNGyUBHjEOjdQyCxDQru8urvXnA=; b=rbRx0UVNbeybfwuMXarIV7EXseTKqianAfuz/QXeBu1vm7hUPEaKky2FG03uaUkkav e3L7RvF0zPuoZ14+fsELDZ0a2okTb7H4hEtfzHXhYpa29RgxSuKxCB9ABdjyTYX6hyyy 7Oydl1/RdyOjabX3GPHYPfPMSrt9/yPLbBB+PSY3mUe0wX+fgFkgJvZwFjN103mV3G0G qpiDPxaO/ziByk7zEMUpPQeMamnc9FU309dQcj4YgaM7Kxkb1R469EswJuTJuGg1CUmq 1Q4R61FQ+AAdakCgMgxTre8jzwo7+gUSox+a8U/sc4L/vv6f+jo6d+QgObjDJkdcnRuJ Xasg== 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=1Sth+jzkQIFIFbQJHNGyUBHjEOjdQyCxDQru8urvXnA=; b=ndfm/pfx7RpWll4IvpG6IBvu6mpYn9G217H6EHKrKe+3jP2c3IRC/o916yBnaDYkj8 M8dv9xqjdVsubweXhyh0vWhYES0zgqs5+8MiMhsEEGKatVHHdK9XPiAYAhcaRYIPz5wd zwZm+D3GbU+hafmVnxaMzzxXENClF2T7hi66px2rOxX6so700tGauTJhEWPV32nkxOfG +D4Oz9BIYVLM4ptPVnwL0/yJH5yY1FtbHQhhWnMXKbwFlA6kgivGwdAtN3BCRVR0BoRT Pum6iL6DkRB4fFJ5//6KLWWwdLnbHt/bXy7GKaE4ucOKDd/gzElT3A/wsIYv6jlsrjNr 3tng== X-Gm-Message-State: APjAAAX5c5/1iUjhd1WKN7HAvbKuNhAdYqkmH1QACaiAP1Afi8hzQY8g 5j2IYgpMYYbN5CBjiHtUIQ2N77Nb X-Google-Smtp-Source: APXvYqwyl6ZWZkvV8uVq3fVnnMwTvogMLbMByyr7jZpj2x7rg3mAO3Mj7SudjAuTjhGmQtcLcBVrIA== X-Received: by 2002:a1c:a78b:: with SMTP id q133mr638318wme.28.1580951907662; Wed, 05 Feb 2020 17:18:27 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 13/30] hw/arm/raspi: Extract the cores count from the board revision Date: Thu, 6 Feb 2020 02:17:39 +0100 Message-Id: <20200206011756.2413-14-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The board revision encode the count of ARM cores. Add a helper to extract the number of cores, and use it. This will be helpful when we add the Raspi0/1 that have a single core. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 8fe07db47a..4f7e5ecfab 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -100,6 +100,21 @@ static const char *board_soc_type(uint32_t board_rev) return soc_types[proc_id]; } +static int cores_count(uint32_t board_rev) +{ + static const int soc_cores_count[] = { + 0, BCM283X_NCPUS, BCM283X_NCPUS, + }; + int proc_id = board_processor_id(board_rev); + + if (proc_id >= ARRAY_SIZE(soc_cores_count) || !soc_cores_count[proc_id]) { + error_report("Unsupported processor id '%d' (board revision: 0x%x)", + proc_id, board_rev); + exit(1); + } + return soc_cores_count[proc_id]; +} + static const char *board_type(uint32_t board_rev) { static const char *types[] = { @@ -306,9 +321,7 @@ static void raspi_machine_class_init(ObjectClass *oc, void *data) mc->no_parallel = 1; mc->no_floppy = 1; mc->no_cdrom = 1; - mc->max_cpus = BCM283X_NCPUS; - mc->min_cpus = BCM283X_NCPUS; - mc->default_cpus = BCM283X_NCPUS; + mc->default_cpus = mc->min_cpus = mc->max_cpus = cores_count(board_rev); mc->default_ram_size = board_ram_size(board_rev); if (board_version(board_rev) == 2) { mc->ignore_memory_transaction_failures = true; From patchwork Thu Feb 6 01:17:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=e+ZtxNzr; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgvd38Clz9sRK for ; Thu, 6 Feb 2020 12:34:21 +1100 (AEDT) Received: from localhost ([::1]:59386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW3f-0004Bs-48 for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:34:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54030) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoP-0000nj-IA for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoN-0003CS-9T for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:33 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:35610) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoN-00036Y-2P; Wed, 05 Feb 2020 20:18:31 -0500 Received: by mail-wr1-x444.google.com with SMTP id w12so5157244wrt.2; Wed, 05 Feb 2020 17:18:30 -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=e+ZtxNzraCnCFpA44qCYL1DhQ9sC+mCGzbpaRJu8oBsIvBs4PJJgueRGrM+gRfdTIK zq5MvIvyVcdWFhOTB9/iUgJr1xKkLL1irKqV3DI1zhGkoQBqKvG0qqu3Lev+Uih/1XW4 fhH1x0SPOzGj/tQ5wrRz37c+zZEVjwSdtADQeXu0Ur6emYyqvP9RTApta9s+zI7rjzQx dq3iiCZzhGyTXZUhYUuiX7ssJ12l9IrnvNnCUakLoK1pS+c71GpWw2WlcMz73zyxxon1 OpsycIvDCc992oGwqlacawG9abE/okknrjIOrEmg5Xt/8AzrLnZ/cvUYRrt++0Z2KaeP INxw== 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=VgZYeBv8xzoclcwQNp4e6VsRY0CHwx9N/1reS1kxcPBl2pdigMPaLTLSwAgUANTUjd uWjwujiiI69pd2Ty9BDvYG1dLhTlToe3GAcUE85xYUy0LhNE2WMpXHQikOIY4t6pbN72 jn+ah8oY+HREcCNXnIB7tkl6scHKKoV7pzqAUE7kcw/bSMKayiJnf9gAZf1rw78Ms5/J L6UD2Xu4mwMxZ39OeKKP5a9kY/MKjMAQ/zmVwbdLStvS6yuCn3yxj+Taby2MxJUJdSqs 8sHOVGbHqCaTPMoCrStqQCtBppCFsDlZDeT9uC59npTfgky/6fOshwjCmeiGdiRKkqqI TPBA== X-Gm-Message-State: APjAAAUbf6ZRNAWUmbVJefLkyHXMaPzPXP1hNkWobcYkMKzhNcfX/zQd JyI0au0JDbKdrmyHmFazBc2uKj5A X-Google-Smtp-Source: APXvYqxI/NSpQzLw1fjm+zatnYpIlXWixmPO/M+DO7/Ww1/1hnXEFtX+mvU6cnlXaSMm1PAH+NYs7A== X-Received: by 2002:adf:e542:: with SMTP id z2mr358528wrm.346.1580951909826; Wed, 05 Feb 2020 17:18:29 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:29 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 14/30] hw/arm/bcm2836: Restrict BCM283XClass declaration to C source Date: Thu, 6 Feb 2020 02:17:40 +0100 Message-Id: <20200206011756.2413-15-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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é --- 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; -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" +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; }; +#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[] = { { .name = TYPE_BCM2836, From patchwork Thu Feb 6 01:17:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=sg+B164a; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgj62W0Wz9sRK for ; Thu, 6 Feb 2020 12:25:14 +1100 (AEDT) Received: from localhost ([::1]:59247 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVuq-0000v5-6O for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:25:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54072) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoQ-0000qL-Qk for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoP-0003K5-An for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:34 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:37397) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoP-0003G9-3N; Wed, 05 Feb 2020 20:18:33 -0500 Received: by mail-wm1-x341.google.com with SMTP id f129so5040912wmf.2; Wed, 05 Feb 2020 17:18:33 -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=sg+B164acpd10Ot1eVzMANO13+d9ztapzZdA7cyUYdBIjTbYmv0pBGWk74jcdlGLhy RdOFF1TJN9KTxKxtuX/++0iYM3msAglBoCRAwBsFW2dllrRaNqvkSTKWQYOQ7g2f9mHV uMbPK0Yesi0OCRnn1M1YdOAGJagEVzhKrYgvfrhhKT9Lju9/Us/S0UkyJbw9sxjx4vpu Lp7Iz5coEJmNk1Rt7pG2ezGRMbILRyJTI/t0bHAKBGZwMYsl3hKG7BN15GkTl+eNRrqp A/cmo+5lO+kyRZuRkn42kAg/v5RtPKW98XlsHKmEd9TXPI37J9yhprycNCDuj9srpjKJ 6ugA== 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=c/9wRzBU9ptArn7T+wNqwqEaqBHKKrw/ZJEXTpYJ00iFGMWSQK+UG1BdjzYBmNa94x 2UpyCIbbJvMSQTL1M3HHLQrc/IefT0HaDEFX0u/eRwRI4Fi2j3luCDwyAbiGthsAuB4+ RJf8CaYme622jmvpv1VvZE1QNmWZWU/UREBgW6VD7AXiFEWoEViW0acfQxGJw/+jFtcZ XRtyWLgV7T4zEj0VJU07caAdgHSgqa6fYqZmOvQCTT8lHYS7cJ0nYWL0hXUXPd3daJE8 6q8pNBQQQ1t7i56coJaSGUfQH1gYuK7A2utdK+aEv/QXuXVsZDgRmBu24bpMUFV8HzKK dGbQ== X-Gm-Message-State: APjAAAXuFaIoKrQlvv9pMfyNcNZKljwj+s/AZ1sayKP0bWH5N9vD2F/7 p6GEBtL25zKXa3Ri167onYVUJuK1 X-Google-Smtp-Source: APXvYqz8ZuId+IWFhGRFoKG8Dsk+aoHHW7XDrbpC8TB3r1hHOMeqsx1+eoI93s3VFe7Lhx4vTm0X9g== X-Received: by 2002:a7b:c774:: with SMTP id x20mr601593wmk.67.1580951911932; Wed, 05 Feb 2020 17:18:31 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:31 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 15/30] hw/arm/bcm2836: QOM'ify more by adding class_init() to each SoC type Date: Thu, 6 Feb 2020 02:17:41 +0100 Message-Id: <20200206011756.2413-16-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Remove usage of TypeInfo::class_data. Instead fill the fields in the corresponding class_init(). Cc: Igor Mammedov Signed-off-by: Philippe Mathieu-Daudé --- 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" -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; #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[] = { - { - .name = TYPE_BCM2836, - .cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"), - .peri_base = 0x3f000000, - .ctrl_base = 0x40000000, - .clusterid = 0xf, - }, -#ifdef TARGET_AARCH64 - { - .name = TYPE_BCM2837, - .cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"), - .peri_base = 0x3f000000, - .ctrl_base = 0x40000000, - .clusterid = 0x0, - }, -#endif -}; - static void bcm2836_init(Object *obj) { BCM283XState *s = BCM283X(obj); BCM283XClass *bc = BCM283X_GET_CLASS(obj); - const BCM283XInfo *info = bc->info; int n; for (n = 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); } @@ -85,7 +58,6 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) { BCM283XState *s = BCM283X(dev); BCM283XClass *bc = BCM283X_GET_CLASS(dev); - const BCM283XInfo *info = bc->info; Object *obj; Error *err = NULL; int n; @@ -119,7 +91,7 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) } sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), 0, - info->peri_base, 1); + bc->peri_base, 1); /* 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 **errp) return; } - sysbus_mmio_map(SYS_BUS_DEVICE(&s->control), 0, info->ctrl_base); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->control), 0, bc->ctrl_base); 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) for (n = 0; n < BCM283X_NCPUS; n++) { /* TODO: this should be converted to a property of ARM_CPU */ - s->cpu[n].core.mp_affinity = (info->clusterid << 8) | n; + s->cpu[n].core.mp_affinity = (bc->clusterid << 8) | n; /* 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[] = { static void bcm283x_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); - BCM283XClass *bc = BCM283X_CLASS(oc); - bc->info = data; - dc->realize = bcm2836_realize; - device_class_set_props(dc, bcm2836_props); /* Reason: Must be wired up in code (see raspi_init() function) */ dc->user_creatable = false; } -static const TypeInfo bcm283x_type_info = { - .name = TYPE_BCM283X, - .parent = TYPE_DEVICE, - .instance_size = sizeof(BCM283XState), - .instance_init = bcm2836_init, - .class_size = sizeof(BCM283XClass), - .abstract = true, +static void bcm2836_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + BCM283XClass *bc = BCM283X_CLASS(oc); + + bc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"); + bc->peri_base = 0x3f000000; + bc->ctrl_base = 0x40000000; + bc->clusterid = 0xf; + dc->realize = bcm2836_realize; + device_class_set_props(dc, bcm2836_props); }; -static void bcm2836_register_types(void) +#ifdef TARGET_AARCH64 +static void bcm2837_class_init(ObjectClass *oc, void *data) { - int i; + DeviceClass *dc = DEVICE_CLASS(oc); + BCM283XClass *bc = BCM283X_CLASS(oc); - type_register_static(&bcm283x_type_info); - for (i = 0; i < ARRAY_SIZE(bcm283x_socs); i++) { - TypeInfo ti = { - .name = bcm283x_socs[i].name, - .parent = TYPE_BCM283X, - .class_init = bcm283x_class_init, - .class_data = (void *) &bcm283x_socs[i], - }; - type_register(&ti); + bc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"); + bc->peri_base = 0x3f000000; + bc->ctrl_base = 0x40000000; + bc->clusterid = 0x0; + dc->realize = bcm2836_realize; + device_class_set_props(dc, bcm2836_props); +}; +#endif + +static const TypeInfo bcm283x_types[] = { + { + .name = TYPE_BCM2836, + .parent = TYPE_BCM283X, + .class_init = bcm2836_class_init, +#ifdef TARGET_AARCH64 + }, { + .name = TYPE_BCM2837, + .parent = TYPE_BCM283X, + .class_init = bcm2837_class_init, +#endif + }, { + .name = TYPE_BCM283X, + .parent = TYPE_DEVICE, + .instance_size = sizeof(BCM283XState), + .instance_init = bcm2836_init, + .class_size = sizeof(BCM283XClass), + .class_init = bcm283x_class_init, + .abstract = true, } -} +}; -type_init(bcm2836_register_types) +DEFINE_TYPES(bcm283x_types) From patchwork Thu Feb 6 01:17:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234081 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=o3C2cGTU; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CgmC3Y4Lz9sRm for ; Thu, 6 Feb 2020 12:27:55 +1100 (AEDT) Received: from localhost ([::1]:59296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVxR-0004ke-9s for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:27:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54150) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoW-0000vY-Cf for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoR-0003TU-8D for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:37 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:34522) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoR-0003Nb-0z; Wed, 05 Feb 2020 20:18:35 -0500 Received: by mail-wr1-x441.google.com with SMTP id t2so5156362wrr.1; Wed, 05 Feb 2020 17:18:34 -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=o3C2cGTU1Kc9KzWq9T8GNuM1518PtaEFDbrys/Dop5pX8DY52dxFn+AtjlyHn8vQJH nPanDxZUAq2OFb03WBL3sQyPJcJDAXG3NcUzEN2Jgw158IvX5g3tRHndb7g6tfbqnYA/ 00NCxaoH+x4UntWJxbBVujLBOVAyRvT8vgKgVxt0wKsI9pZOY+El41fL7Q4xIeXf8k6m jYiJFMrNRC1RI87hui04tmktyyjqv79fZNJWaaG4cIIfLJqp2xtuKMQ8qOl9DLoEu9Am hNWnHuOBefwdP2k/2HtrzkFlFvhpXCmL8o7IfT9DjaRYvewobzzgcJ1+XCX+e+JzKhy8 971g== 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=EFwG5FFo26RmfVMv454ZmLa/eESBd7ixqS4j5KZuoAuKYcBcH717ZlUc1tXVoDolsg CqrGGoCjyIfg2zOxxsoGV90zsyRiA4V+Tiara9ymt9p7vVYnwBPBenCjLF+oO/QDS3Qv PB4fp3YB9vpc6hON3aVjHKH445uiJBp4CYKGeYmqjJQ0DGyVyEBQz5OSBLibv6V0Rp/d BybSlNJ/dMW44LlNztFqs9chplTLnGRnXU84Ifq8x4qVbVvy/vxQZLjYX14Vuuf+T9UC Z01Dx3SRle93kuEi3rNuxcSUvwp1jvqbmtk/2qsG4CVv0e+NmSsD7q+Lqoo7mRPe3NPA nSTw== X-Gm-Message-State: APjAAAUcaS3rKkCsTlRGrz6ikXxgLI+mZqEx559SlRz+W/DHzCTWgoSi Do0nAoav+iC+doPad6tnAjOioxVj X-Google-Smtp-Source: APXvYqwC5H2cpb3vPG/ozQCEWxiZGYBVraC2hBHAvkqcLaICqo8OqcHEGJC5rST3Fzzz5APPYEQ4jg== X-Received: by 2002:adf:f10b:: with SMTP id r11mr317923wro.307.1580951913884; Wed, 05 Feb 2020 17:18:33 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:33 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 16/30] hw/arm/bcm2836: Introduce BCM283XClass::core_count Date: Thu, 6 Feb 2020 02:17:42 +0100 Message-Id: <20200206011756.2413-17-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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é --- 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 = BCM283X_GET_CLASS(obj); int n; - for (n = 0; n < BCM283X_NCPUS; n++) { + for (n = 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 **errp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->peripherals), 1, qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0)); - for (n = 0; n < BCM283X_NCPUS; n++) { + for (n = 0; n < bc->core_count; n++) { /* TODO: this should be converted to a property of ARM_CPU */ s->cpu[n].core.mp_affinity = (bc->clusterid << 8) | n; @@ -173,6 +174,7 @@ static void bcm2836_class_init(ObjectClass *oc, void *data) BCM283XClass *bc = BCM283X_CLASS(oc); bc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"); + bc->core_count = BCM283X_NCPUS; bc->peri_base = 0x3f000000; bc->ctrl_base = 0x40000000; bc->clusterid = 0xf; @@ -187,6 +189,7 @@ static void bcm2837_class_init(ObjectClass *oc, void *data) BCM283XClass *bc = BCM283X_CLASS(oc); bc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"); + bc->core_count = BCM283X_NCPUS; bc->peri_base = 0x3f000000; bc->ctrl_base = 0x40000000; bc->clusterid = 0x0; From patchwork Thu Feb 6 01:17:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234079 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=DnEPlkg9; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cglb3V9jz9sRK for ; Thu, 6 Feb 2020 12:27:21 +1100 (AEDT) Received: from localhost ([::1]:59286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVws-0004LV-Qz for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:27:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54159) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoW-0000vl-5U for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoT-0003bU-3w for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:40 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:44902) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoS-0003Y5-U1; Wed, 05 Feb 2020 20:18:37 -0500 Received: by mail-wr1-x443.google.com with SMTP id m16so5105046wrx.11; Wed, 05 Feb 2020 17:18: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=uxynYOVPY9FVrupSLyC8th1oxyDcEka8bWnY9WEi7fw=; b=DnEPlkg9gxk004kUnFnkYNnpchTdTY70nFkLVQf17Ok8GoDrK2VBLesZMOqp6oGtJJ yIJFfw9bhsZNOidY2KeAxdYIYz8SG4h+djyZmf/yWOJvqve/q+/mwrBPYPUQtk8247CD reOj6azRk8iomiRILRJqmN8rLXMQCNM3v7vSUdVq/g/X25IGNwOCzlFXqHWNeIZlhBQi VgGPHz7GeYpwDziQpNQq4FxGxvQqW9J4nlmcxftn193CO4+fy9WyKfyTF2vfGTPuhXpy DLbzgYbLNQrj687oNGwVQRCw97vvCdW5kp2/zu1dR4rqtevjIqBSYP/2Qh59D71ukNYP 7fWA== 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=YwkZriaUYv7RpADFNPI6Cdan2haL+7gT1Vua0EEWgvYnUgapvvE+ZxtUFTi6jMEoUH TYQwUgixAUTPt9mjvClVjfEjdYUCxwkQASQQTMXOhpzEfBbUoTY16xwzT3SRqNiPtC77 cnuS9tGw6/YXkLwu8bDG0ag4dwp34NUkfThwoa7Yk6aKx8LRy6b/BiaVpCt1xQsuG43T HIF0WIi6SpYfT6fR7PGZqYBLdBN7D6hTeydFbmDaYttovXxA+R5MN/RHnd4M85nhZHWy kaaxZjVOdmUOFaI6ftZQQi3Y1iPYrb3OngDd3neXfvoJPmXd5YF3dwILgSCc55Cu6Lzy lRPA== X-Gm-Message-State: APjAAAVtAO3D6pOTsgRAsQvlnrJjk5DIWT/7EydiKuJR1b/Mw3gD2RDx 3hoveRnQV7JxOPRgq/xpAOOqpuzb X-Google-Smtp-Source: APXvYqxyW65fEG0rV9O9MaKaeTFetznCcAKCzshX/jNDViAOaGHbwUnr6xk3h9rv7N9ntCU7VqExtw== X-Received: by 2002:a5d:62c8:: with SMTP id o8mr362951wrv.316.1580951915866; Wed, 05 Feb 2020 17:18:35 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 17/30] hw/arm/bcm2836: Only provide "enabled-cpus" property to multicore SoCs Date: Thu, 6 Feb 2020 02:17:43 +0100 Message-Id: <20200206011756.2413-18-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" It makes no sense to set enabled-cpus=0 on single core SoCs. Signed-off-by: Philippe Mathieu-Daudé --- 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) +static Property bcm2836_enabled_cores_property = + DEFINE_PROP_UINT32("enabled-cpus", BCM283XState, enabled_cpus, 0); + static void bcm2836_init(Object *obj) { BCM283XState *s = 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_property); + qdev_prop_set_uint32(DEVICE(obj), "enabled-cpus", bc->core_count); + } 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) } } -static Property bcm2836_props[] = { - 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 = DEVICE_CLASS(oc); @@ -179,7 +180,6 @@ static void bcm2836_class_init(ObjectClass *oc, void *data) bc->ctrl_base = 0x40000000; bc->clusterid = 0xf; dc->realize = bcm2836_realize; - device_class_set_props(dc, bcm2836_props); }; #ifdef TARGET_AARCH64 @@ -194,7 +194,6 @@ static void bcm2837_class_init(ObjectClass *oc, void *data) bc->ctrl_base = 0x40000000; bc->clusterid = 0x0; dc->realize = bcm2836_realize; - device_class_set_props(dc, bcm2836_props); }; #endif From patchwork Thu Feb 6 01:17:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=o0biDPwt; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgr25VnFz9sRK for ; Thu, 6 Feb 2020 12:31:14 +1100 (AEDT) Received: from localhost ([::1]:59340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW0d-0000DT-Fr for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:31:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54245) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoY-00012D-G9 for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoX-0003kj-9v for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:42 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:36280) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoX-0003bp-1j; Wed, 05 Feb 2020 20:18:41 -0500 Received: by mail-wm1-x343.google.com with SMTP id p17so5062770wma.1; Wed, 05 Feb 2020 17:18: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=B1P152VP3CyxvJ0hiqDereblCgbtylimKSTziv7Dq7E=; b=o0biDPwthid9iFIRvD5pWCxc0e1Gj158XdbKDYmH1e6zGL1J5Rjvj3P4GcZpO4JkNS P3FnNYYe18HTwUVYS5fECl0XwuEg2MDtlL/oDSg0hX9qt6BTOX8cyLYmDBokQqHiHgfX IPH4480fJz9X0/VsWxgJeCWNwttcMo2q+QRKo1KuWPmH5AgKOGq1dEwf0FYLBIqzCzIK b/odmNLpzp4yIRa/IVG7IFs47uO/lD8xO3TS2IrsbB9QqlA8raVplRvE1uf1Je5Oc2ad ojbI+raM7bG9o9AXM50UWvS1TxtEyOXdM5fUgu5wHuEkLsBaCPT65YBEVvXTrU6P5HAW eLrg== 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=A2ep4AuwKyMk5UdshSirFssi0hQuLv/wsesuGZlKjIFrvyYlnGWEZIAOtQAskGUSoH mUTreIhwPNKqLJK6sbVRwzPkVSbq6/oxCeF75QJN66dOQjVQxj6j00Zarl1d4BzlVZAH /yyLTcbJIjQHn+Tbu52VdtBJRbi00DaE3ionDKEc4Xz8roExMJWPQQaGRKJmvXiqqZmd LeUBj/lbCQYEz/m95lVLgcCgS5Nt+lJwnM9X1UsK1DfqNWCgx7IkV+83c1/Kaj30VdHN YT27yEeCOZcHO4QyWx4l9T3SE8pIf6ynIEbRLhAoh1utS0QkQABS8HZRpPrWin23QFsI glZg== X-Gm-Message-State: APjAAAXG8eNpnIc4Ot95sdK2U/q4rghTmzDG+gIzsRhwTIcbVnE//Hql o6cOfQx12sbJujBMBUkF6/IgTlVV X-Google-Smtp-Source: APXvYqzEZDX4yMMaj7BEDv+6IUHXNrNe35dw1xHiAVYXxW2Vnt2Jf+EfTwFrLNbqEeAaNsYNNGrb/g== X-Received: by 2002:a7b:cf08:: with SMTP id l8mr576418wmg.169.1580951917859; Wed, 05 Feb 2020 17:18:37 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 18/30] hw/arm/bcm2836: Split out common realize() code Date: Thu, 6 Feb 2020 02:17:44 +0100 Message-Id: <20200206011756.2413-19-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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é --- 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); } - 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); + } 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); } -static void bcm2836_realize(DeviceState *dev, Error **errp) +static void bcm283x_common_realize(DeviceState *dev, Error **errp) { BCM283XState *s = BCM283X(dev); BCM283XClass *bc = BCM283X_GET_CLASS(dev); Object *obj; Error *err = NULL; - int n; /* common peripherals from bcm2835 */ @@ -100,6 +101,20 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), 0, bc->peri_base, 1); +} + +static void bcm2836_realize(DeviceState *dev, Error **errp) +{ + BCM283XState *s = BCM283X(dev); + BCM283XClass *bc = BCM283X_GET_CLASS(dev); + Error *err = NULL; + int n; + + bcm283x_common_realize(dev, &err); + if (err) { + error_propagate(errp, err); + return; + } /* bcm2836 interrupt controller (and mailboxes, etc.) */ object_property_set_bool(OBJECT(&s->control), true, "realized", &err); From patchwork Thu Feb 6 01:17:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234086 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=lDmugTXx; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CgrW1LhZz9sRK for ; Thu, 6 Feb 2020 12:31:39 +1100 (AEDT) Received: from localhost ([::1]:59342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW12-0000Tn-Uk for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:31:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54268) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoZ-000137-Kk for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoX-0003kx-AW for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:42 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:37017) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoX-0003fV-1h; Wed, 05 Feb 2020 20:18:41 -0500 Received: by mail-wm1-x336.google.com with SMTP id f129so5041118wmf.2; Wed, 05 Feb 2020 17:18: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=/UJgNTzw4Gx4xqlDoFjvxGAMlpuH/2K8HEVCtznof0k=; b=lDmugTXxXUkIAWebkrZ2Oph5cBmnJi3cHYIotx7pAUf34EisrFfay9K7P5gsU9zU30 HSjZM+0ZCNEMX8FrOa4s5EkqxXGXBS23Ap8Cf44Aj9CZXYYObpZUMSBm6RLp1vxsSOqF 6SvJ9zvQAIKQ1EHHBwClPElY8CdV4H53VIQdDDKd9+BDS0JBynJ5Jeb3uxPLW+LRBjEG rkaw9EvpSXmH3KGMYQsTfvYovPyi+oI6zyuyh6QBQ1uwBIcq41e6LjGvU5/RhcAW2J5A qdnrIrRVsxgq2LwJpOF+X7l16VFwjMUQfUmGHCua3/K25RRL9p8TkZNxQkZ+wiQCDyI2 +Kow== 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=/UJgNTzw4Gx4xqlDoFjvxGAMlpuH/2K8HEVCtznof0k=; b=ABZamC3+xbaOQFn7+8WeryvruJ6PMdvTesMVt852Baf07WKMVeF+dD2SpymMx7QPES 4+lknMfjq0bqu1J2os56oHWvR20SLH5qxi6qxBhjYlnrJB7kESkmAc8NQcMhQGz/OQgb ws5RBsbX0VeRcyNfW1Lp1fvmZDokL/RPj9jMI7ur4nH8bdGwvJ0Ug7swATXOAA2M9qne p/7EmCJDvSGW029DbcjE1b3DKEvyjXuO3wmT3J0o5qNws0mlNqpiudySBfDaaeiHJVhi BuIxCeh0oTObrsbZQtSOM8+dbMa+LgYJgVhqwr9Wzwg60awehGLo60DNvZlSUPCs0WaC dJZA== X-Gm-Message-State: APjAAAWhU7HqChvXz76onR6siYo06Axipu/+xvd8vE92N9/cgn81Grqb c6DaXJJ5v3aUvAboOpI9kiQYX4EG X-Google-Smtp-Source: APXvYqyGm+iF5p8CMSsSSsM3yUk6NSZx9k1rp/RFyM4LcMOtJ3LWnXht5fMOPt+r3khBQVjfexWcfQ== X-Received: by 2002:a05:600c:21ce:: with SMTP id x14mr619657wmj.120.1580951919723; Wed, 05 Feb 2020 17:18:39 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:39 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 19/30] hw/arm/bcm2836: Introduce the BCM2835 SoC Date: Thu, 6 Feb 2020 02:17:45 +0100 Message-Id: <20200206011756.2413-20-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/bcm2836.h | 1 + hw/arm/bcm2836.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 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" 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, Error **errp) bc->peri_base, 1); } +static void bcm2835_realize(DeviceState *dev, Error **errp) +{ + BCM283XState *s = BCM283X(dev); + Error *err = 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 = BCM283X(dev); @@ -184,6 +209,17 @@ static void bcm283x_class_init(ObjectClass *oc, void *data) dc->user_creatable = false; } +static void bcm2835_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + BCM283XClass *bc = BCM283X_CLASS(oc); + + bc->cpu_type = ARM_CPU_TYPE_NAME("arm1176"); + bc->core_count = 1; + bc->peri_base = 0x20000000; + dc->realize = bcm2835_realize; +}; + static void bcm2836_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); @@ -214,6 +250,10 @@ static void bcm2837_class_init(ObjectClass *oc, void *data) static const TypeInfo bcm283x_types[] = { { + .name = TYPE_BCM2835, + .parent = TYPE_BCM283X, + .class_init = bcm2835_class_init, + }, { .name = TYPE_BCM2836, .parent = TYPE_BCM283X, .class_init = bcm2836_class_init, From patchwork Thu Feb 6 01:17:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=FEmQYqv2; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CgqR35Chz9sRK for ; Thu, 6 Feb 2020 12:30:43 +1100 (AEDT) Received: from localhost ([::1]:59322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW09-0008Cw-1y for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:30:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54310) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVob-00015k-Jh for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoa-000405-8T for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:45 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:46308) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoa-0003t7-1I; Wed, 05 Feb 2020 20:18:44 -0500 Received: by mail-wr1-x443.google.com with SMTP id z7so5086824wrl.13; Wed, 05 Feb 2020 17:18:43 -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=8Iprr4A0vBZTEX9NcyGJBQBnH/tFZPAN6KVSAGt3jwY=; b=FEmQYqv2bA56jiWhJU27uqqcKxszU/7wHOzJi6t4iFkhiqXaIS0EV0wcUYXswtJoTe 5sFjQYAVpxNPLlQ370W0wFQmtAErNoCNVT8daRzF8QjECcHQEETdB/k1fAG6y2K6b7SL GyVnqTLKOLIWJJvzAApBR67w7QFQ5gT9tgiRp45MX1ij7WkWUfHoX8dkXceMm23tP/7L Bqcqj29xKxwNliarSxoEV3qFyfZYExV6FY9LN+wahO0VcrZiZ3oyrDrcVy4lj3upYkZh ImHkF82W3xYStdjMEILKCBSCYSkmySKdfnJHObi+iMZiNqmBnpxAhmwZ3uh3ElitKrhY vU7A== 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=8Iprr4A0vBZTEX9NcyGJBQBnH/tFZPAN6KVSAGt3jwY=; b=hdNodpmtCES6Z9G1n7SShHUmOUQzIQ8CN+e4kR/KUjmMHeEcPpdfw8EhGsf1K6Um9p +8FK5r/j3xWOhIfHIClFZwPxSzPCGtSZUxu8FhUgcUFXndXjIYsT1MXZiOyPUQF9++6v 6nbllAMXHAW5EjmXSIW/GuQKX5wYnn0z0MZxnoKn45qUgAXEUpzzsSsDKscrCI9RHS+y hQXgypPcv0mlcfr8Q3H1OXgbYXNGiC/4IhRZAsOmwUv0awSKhW724CDkD/WNn5V2z7Ms 8EGAfBb/Wy2ZMBHy/deciKalGAoknCY2FuaFaAnyAvQ54i7bTsxf539TkSteNvXn9/Zj g3Xg== X-Gm-Message-State: APjAAAXckGuuKzv/9KCms3avwwPMbg1KgpAFDtLmrHInl+yzV8+0WAbL a2k1YYu5bG/ANb4k9cl8JRqOyz4i X-Google-Smtp-Source: APXvYqw7RXUgbTsnjtdeksf+sCPmx41u1w8MMeryx/ZyGIu9AFzaqRzIEqcSfL7T1FwXMXHV/+z7GQ== X-Received: by 2002:adf:f0ca:: with SMTP id x10mr317731wro.423.1580951921875; Wed, 05 Feb 2020 17:18:41 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 20/30] hw/arm/raspi: Add the Raspberry Pi Zero machine Date: Thu, 6 Feb 2020 02:17:46 +0100 Message-Id: <20200206011756.2413-21-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a Raspberry Pi Zero machine. $ qemu-system-arm -M raspi0 -serial stdio \ -kernel raspberrypi/firmware/boot/kernel.img \ -dtb raspberrypi/firmware/boot/bcm2708-rpi-zero-w.dtb \ -append 'printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0' [ 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 (ARMv7), cr=00c5387d [ 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/0x49c with crng_init=0 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113680 [ 0.000000] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0 root=/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=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 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 2147483647500ns clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns bcm2835: system timer (irq = 27) Console: colour dummy device 80x30 ... Signed-off-by: Philippe Mathieu-Daudé --- TODO: Add acceptance test --- hw/arm/raspi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 4f7e5ecfab..0d1f15e08c 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -88,7 +88,7 @@ static int board_version(uint32_t board_rev) static const char *board_soc_type(uint32_t board_rev) { static const char *soc_types[] = { - NULL, TYPE_BCM2836, TYPE_BCM2837, + TYPE_BCM2835, TYPE_BCM2836, TYPE_BCM2837, }; int proc_id = board_processor_id(board_rev); @@ -103,7 +103,7 @@ static const char *board_soc_type(uint32_t board_rev) static int cores_count(uint32_t board_rev) { static const int soc_cores_count[] = { - 0, BCM283X_NCPUS, BCM283X_NCPUS, + 1, BCM283X_NCPUS, BCM283X_NCPUS, }; int proc_id = board_processor_id(board_rev); @@ -330,6 +330,11 @@ static void raspi_machine_class_init(ObjectClass *oc, void *data) static const TypeInfo raspi_machine_types[] = { { + .name = MACHINE_TYPE_NAME("raspi0"), + .parent = TYPE_RASPI_MACHINE, + .class_init = raspi_machine_class_init, + .class_data = (void *)0x9000c1, + }, { .name = MACHINE_TYPE_NAME("raspi2"), .parent = TYPE_RASPI_MACHINE, .class_init = raspi_machine_class_init, From patchwork Thu Feb 6 01:17:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Nye+nc8j; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CgvQ2rgxz9sRK for ; Thu, 6 Feb 2020 12:34:10 +1100 (AEDT) Received: from localhost ([::1]:59380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW3U-0003pr-85 for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:34:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54379) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVod-0001BW-KS for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoc-00049N-AB for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:47 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:37402) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoc-00041K-3A; Wed, 05 Feb 2020 20:18:46 -0500 Received: by mail-wm1-x343.google.com with SMTP id f129so5041247wmf.2; Wed, 05 Feb 2020 17:18:46 -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=bj2pLjmxnon+yHpt+3WlsQNgSCFWtNKV2Jq/oi6zYzc=; b=Nye+nc8ji+LUoD+HqHEh898XZcqoaNdY5bQe5q2jNmG6KWO/OLLNAL0Mq6UN8IWRef HSTiFX9YHmG3prS6i6FPzypakPBA2Io13Sa1AnLVn4Cd/mrjcKmPmePyeBT1AeEBt+AO 3lvg0H5lpxAQ8LOSoBfJu6rZY0yg7uN9z/9tUfwvpK0NKMIwqcDoznEMWEIdgPFcrzTu 32rs7if1Avykot7/SS59R/EP4Nu5tQzBj2VlIZNkgYDZax5tO90n++DAXNLQtrlmTenu cb1SscE1nxv9ShTPYD+8DnE0uYJfzyYP3ekE7DGBewoMgAx1ldKy6XPhOYlSSjpzVdMZ nqZA== 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=bj2pLjmxnon+yHpt+3WlsQNgSCFWtNKV2Jq/oi6zYzc=; b=b51GVn0jIaSj0igmTclU+8Tqr70csH6kWkXaHHl/iMUSdZBjB4WcuBv9zXyOconJJQ OMxfMYW0hjJ99K990M8ub4Hfmrxhw1Tara3YYJfwhb9SVKgY9hHDuPjoyzWmPat+dMy3 LNJ/5u9igZgL5KnmVjie5NFMAuEdDKzZ3/5NfG7cWmv2o4lEbyHge9JdkA3ynQCGbrGl cDA2g7UhltY2Zi56nrOf7izsE5Hgm3U3UEWLzyacmyvWKppPXcOkfRGtQQDBSzSqZ6P6 U+0A+Opn/ASLkMFppEBWsufIAzeUWu0mHNSv4nxO9C5bdrS+aFtQ/gN6EELJcmAJ0rks 8wuw== X-Gm-Message-State: APjAAAXobJIpujuei9/x1GAkH9nPn8iEafEnIOdfVLM6vokq1f4IoX2O kxku9K7pmgi8kVS1beipu7cpU+0y X-Google-Smtp-Source: APXvYqy/CqQ+dxAfLGKYZYGHBE6RkjTGxFlQlv+FOFh1m5/0j2Iiv1yzlkg6kn8gxpdHJq2sWxtEJw== X-Received: by 2002:a7b:c1d0:: with SMTP id a16mr582193wmj.175.1580951923906; Wed, 05 Feb 2020 17:18:43 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:43 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 21/30] hw/arm/raspi: Add the Raspberry Pi B+ machine Date: Thu, 6 Feb 2020 02:17:47 +0100 Message-Id: <20200206011756.2413-22-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" $ qemu-system-arm -M raspi1 -serial stdio \ -kernel raspberrypi/firmware/boot/kernel.img \ -dtb raspberrypi/firmware/boot/bcm2708-rpi-b.dtb \ -append 'printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0' [ 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 (ARMv7), cr=00c5387d [ 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/0x49c with crng_init=0 [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113680 [ 0.000000] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0 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é --- hw/arm/raspi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 0d1f15e08c..47cc250883 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -334,6 +334,11 @@ static const TypeInfo raspi_machine_types[] = { .parent = TYPE_RASPI_MACHINE, .class_init = raspi_machine_class_init, .class_data = (void *)0x9000c1, + }, { + .name = MACHINE_TYPE_NAME("raspi1"), + .parent = TYPE_RASPI_MACHINE, + .class_init = raspi_machine_class_init, + .class_data = (void *)0x900032, }, { .name = MACHINE_TYPE_NAME("raspi2"), .parent = TYPE_RASPI_MACHINE, From patchwork Thu Feb 6 01:17:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234092 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=g2E12OKa; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgyk36G9z9sRK for ; Thu, 6 Feb 2020 12:37:02 +1100 (AEDT) Received: from localhost ([::1]:59430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW6G-0008P0-Ak for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:37:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54414) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVof-0001Ea-I1 for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVod-0004Dp-7L for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:49 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:38252) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVod-00049t-0b; Wed, 05 Feb 2020 20:18:47 -0500 Received: by mail-wr1-x42f.google.com with SMTP id y17so5137540wrh.5; Wed, 05 Feb 2020 17:18:46 -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=yUSBUp9gdan6yP5vOjp1HSLcVgTCg5pBVo6PRPW8Pj0=; b=g2E12OKam7A8Mb9Y1AW9/62RhZ4sGt2ctKZdAyLuBT8yU+eB4qDZ++cb5UrtYprsrd HTKDsTuEa98f72e1fonm6ybRdVYg2tjWjwsSC0WKDyP9eZ4WWJeNf3AlktPVCOlP8Qyv uL0o2vDIJZP6G+ywreBoM0eyk6NeSsO2w12lKBzMqvwB3as50OSc9Ik+G8m/ptNj6qb7 hVkluHGGcOv+6DJqAC5UpLmoJlqmEvD9Co7OJJY4oLYBrpNJUCPOuB7Zu148Mja9ov3+ WlQZPagvGHPgmWO6iI+XhQWw7jW+PLQrPWcf52yjvgJlcvYG6Ou7s+XWBIUdxNpUT24j N6Ng== 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=yUSBUp9gdan6yP5vOjp1HSLcVgTCg5pBVo6PRPW8Pj0=; b=MlQqq0pxVGmdhnduSbZ4BVBsvq3guIxgm8N1XqB3Sf6tapz2m7xNUCrOwy5e2W+a/K QKeyuRtYpKRItQ3DXgFEJOeRKOKcqoRzS2IFGHmkMaifNyaUlO32oSN4KscipGvhgLWW rkgdnQP/Bpw6/OzMuVSCXjqk5b6TuDNP4ZaXhQJSqYvBahtFQiuxgqrasL6N5oCMKkG7 ClqaX6zMnODO8/2oCFvSQvCAs8W4+aLdyOHLK1CrKIvl4gKoJk831nfl/QrEw1CNZI7W WQfe1GqBfwRWjo1yHfN58OKI+lSmSCkBZeTDdMKkWg3ExHBe7X0+TDF+TYXIPXOoyyfT PW/g== X-Gm-Message-State: APjAAAWVfiGMlxgi+cXfSuzgbJ4gMrIFu+26ap8lBO3glEeRkCAqz4+Y ZBJeqYEdF+CY67ZpCQ5e+dLCQQ6Y X-Google-Smtp-Source: APXvYqxcITg750MynsqOgs/tnRGTTfCDpKkxeVtlxREL6XUis75GIsjiCX8CRrSGTtA7HL8VpEovuA== X-Received: by 2002:a5d:6191:: with SMTP id j17mr296382wru.427.1580951925784; Wed, 05 Feb 2020 17:18:45 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 22/30] tests/acceptance/boot_linux_console: Use raspi console model as key Date: Thu, 6 Feb 2020 02:17:48 +0100 Message-Id: <20200206011756.2413-23-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42f 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Python dictionary are not that expensive. Use a key makes the code easier to review. Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index e40b84651b..5fba46a9d1 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -325,14 +325,14 @@ class BootLinuxConsole(Test): self.vm.launch() self.wait_for_console_pattern('init started: BusyBox') - def do_test_arm_raspi2(self, uart_id): + def do_test_arm_raspi2(self, uart_model): """ The kernel can be rebuilt using the kernel source referenced and following the instructions on the on: https://www.raspberrypi.org/documentation/linux/kernel/building.md """ serial_kernel_cmdline = { - 0: 'earlycon=pl011,0x3f201000 console=ttyAMA0', + 'pl011': 'earlycon=pl011,0x3f201000 console=ttyAMA0', } deb_url = ('http://archive.raspberrypi.org/debian/' 'pool/main/r/raspberrypi-firmware/' @@ -344,7 +344,7 @@ class BootLinuxConsole(Test): self.vm.set_console() kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + - serial_kernel_cmdline[uart_id]) + serial_kernel_cmdline[uart_model]) self.vm.add_args('-kernel', kernel_path, '-dtb', dtb_path, '-append', kernel_command_line) @@ -358,7 +358,7 @@ class BootLinuxConsole(Test): :avocado: tags=machine:raspi2 :avocado: tags=device:pl011 """ - self.do_test_arm_raspi2(0) + self.do_test_arm_raspi2('pl011') def test_arm_exynos4210_initrd(self): """ From patchwork Thu Feb 6 01:17:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Ik1SwQvx; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CgyC2RLdz9sRK for ; Thu, 6 Feb 2020 12:36:35 +1100 (AEDT) Received: from localhost ([::1]:59420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW5p-0007Ow-86 for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:36:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54447) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoh-0001Hf-Cc for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVog-0004Q6-34 for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:51 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:38856) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVof-0004Kf-Ss; Wed, 05 Feb 2020 20:18:50 -0500 Received: by mail-wm1-x343.google.com with SMTP id a9so5040167wmj.3; Wed, 05 Feb 2020 17:18: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=O6bajScUJ4xgmQhfXtPoiQXddmANh1kvtsMps+VVVb4=; b=Ik1SwQvxolLdkQ37I3pqyoWqpzyZcVfBezc8UkfEDLG/Qkdrpauwd8GJj0u/XP/O6X heIlusf3u2YPKKKRu4vw8rVQNPMvE0KHOcjDVwNw4L1Q7tIW6Auv2zmZFbzy4DWn/aZX W9yekDYMRsJ2tU6q+nqHlMAF9zsGTzhjDSXjsdrpzGoOHcDdGKjy8OE/PsSL8Ar/9J5o uR83ShF3a4gmVeqrpNDzVybpbzT1TjwCEeAAkfR0x7VVm52eRhMuJpfevgpSHP0KRZE7 5Tdwdmy/zxF0M3iZdpGw2lW05zrsR5tn9omT5qKgfiX6hUACfhM3fC/0u+WVivZzuhCQ ZauQ== 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=O6bajScUJ4xgmQhfXtPoiQXddmANh1kvtsMps+VVVb4=; b=Q/SfRuLLNS6iDYAg8A6hUU2/xlNn4S4gHhH3SR9hkXm7/DvhqRwrIgpxuC7elFu2Sh OPtHtpz+KBwf+CB0zWOL4mPforzi82GVsLZhDzsO63ecMmw1eZstYhmBkBZw7T+JZ7R3 fwy3bM85lq4LbpEuW5HoL9VU5WgBExh+7HWwhGnudC1Eq87y41XfXylO82vgi7PzNM88 oQxPdB/10Ai1PYm1z5kRuBM9wjK4QsIasJ/33zvgg1kRpAwU3xZoXLrqahCUWerg3DDn Ek7xRFHC/EqH/7bjRMqrTLDr1axyFL5PXugcVyn5CTzd9c1yKehe//GVG9TXdR1Iq7Pe VRiw== X-Gm-Message-State: APjAAAVAHcFmLyDjgxDlNx0ZrQaDQ5cfIFhRBYvCJ5hupXy4EqkE78xd eOw/BkJPa9NLmkqq9xU9EpGgBLeT X-Google-Smtp-Source: APXvYqxq+/+fPNnLL1CF27cEFxTwSHUB0i6eFDqGe9IAGgmK0pTf6GU4HHH/eRUt6mSL1Ll5T5Lp/g== X-Received: by 2002:a7b:cd8e:: with SMTP id y14mr629858wmj.150.1580951927679; Wed, 05 Feb 2020 17:18:47 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 23/30] tests/acceptance/boot_linux_console: Add raspi version=2 parameter Date: Thu, 6 Feb 2020 02:17:49 +0100 Message-Id: <20200206011756.2413-24-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We want to tests different Raspberry Pi machines. Refactor to take the board version as argument. Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 5fba46a9d1..56c8d54ca6 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -325,26 +325,34 @@ class BootLinuxConsole(Test): self.vm.launch() self.wait_for_console_pattern('init started: BusyBox') - def do_test_arm_raspi2(self, uart_model): + def do_test_arm_raspi(self, version, uart_model): """ The kernel can be rebuilt using the kernel source referenced and following the instructions on the on: https://www.raspberrypi.org/documentation/linux/kernel/building.md """ serial_kernel_cmdline = { - 'pl011': 'earlycon=pl011,0x3f201000 console=ttyAMA0', + 'pl011': { + 2: 'earlycon=pl011,0x3f201000 console=ttyAMA0', + }, + } + kernel = { + 2: '/boot/kernel7.img', + } + dtb = { + 2: '/boot/bcm2709-rpi-2-b.dtb', } deb_url = ('http://archive.raspberrypi.org/debian/' 'pool/main/r/raspberrypi-firmware/' 'raspberrypi-kernel_1.20190215-1_armhf.deb') deb_hash = 'cd284220b32128c5084037553db3c482426f3972' deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) - kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img') - dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb') + kernel_path = self.extract_from_deb(deb_path, kernel[version]) + dtb_path = self.extract_from_deb(deb_path, dtb[version]) self.vm.set_console() kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + - serial_kernel_cmdline[uart_model]) + serial_kernel_cmdline[uart_model][version]) self.vm.add_args('-kernel', kernel_path, '-dtb', dtb_path, '-append', kernel_command_line) @@ -356,9 +364,10 @@ class BootLinuxConsole(Test): """ :avocado: tags=arch:arm :avocado: tags=machine:raspi2 + :avocado: tags=cpu:cortex-a7 :avocado: tags=device:pl011 """ - self.do_test_arm_raspi2('pl011') + self.do_test_arm_raspi(2, 'pl011') def test_arm_exynos4210_initrd(self): """ From patchwork Thu Feb 6 01:17:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=vRv7Hdgz; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgwn5Fyxz9sRK for ; Thu, 6 Feb 2020 12:35:21 +1100 (AEDT) Received: from localhost ([::1]:59400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW4d-0005nR-Fv for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:35:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54462) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVoj-0001IA-Ep for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVoh-0004RX-44 for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:52 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:50279) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVog-0004QE-Tg; Wed, 05 Feb 2020 20:18:51 -0500 Received: by mail-wm1-x336.google.com with SMTP id a5so4493498wmb.0; Wed, 05 Feb 2020 17:18:50 -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=NSPhdi5z/EOyie7EhJsj1BFgQSU+1IYII+hor8QwjfU=; b=vRv7Hdgz6zYpj2SU+KOMpOIFzW6X70Hl3kB29WZyRUxG8Wx/vombLNI8u1pFR/MonE Ugzd6s3/Op8ozR05toTzf567oQzHu4Jr22be631matWlaiMX0sK455SsdW+Ttjrk43O1 dayjXmoiKXqbMfMkg/fzjVsauQXsmNWvvrUefXx5YTCTmJCZqgYErgPemneGA/0K5m5u mrk1tZhXrHVxLgbJY7a6MJp9hewwGo3AzV93UvIomPomixy8Sw45WqQYlItHX4IPFBm+ ptbzFz7elBxqSxr5TES5VCNS0NRyRnrjLNKwwpUL/7bd2MYrDE6qhzA46mt3UmRkdbxu 452Q== 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=NSPhdi5z/EOyie7EhJsj1BFgQSU+1IYII+hor8QwjfU=; b=t6fRrtjti0XAT+EkBdSqp66WnmDz5H1UyFJFvbsD3xkMu9zVHyeD63e5Ha06xnviHc 0yZYmuv8k88wG8gcgz6mIC94FcO3ovvqkt+koj5RfG6n436eCS8faTGTD6SsyJvh87fR PCXF+UQLu2EU+YZtnX8miy9yCt7oNK+oYo9sLf5yCLs/sSKLpApjucFILTb8gi9cvsD1 25LqVcjCl8DC4xznwYF7BwDBR7DpqLyXRhGMQ7w24syB1AeKhMLCpXVCubleqriGnKuh 4oD42SVxyh/UDtE5uGucCEtl4IOyDoYfGM0aUzG7gh+Sjnj2TeL0QfFuewRROPKtTN5D zg6A== X-Gm-Message-State: APjAAAUhmtxheldZKdnrdhjOisUZ3bfwcJ0buO3XH6gPo2fEjZ6yzxPf eoGSD/U/1gji1UcxKliq/rrvbReI X-Google-Smtp-Source: APXvYqxdc1/2Gd96I/P4yo3rTh8jKIcZbfB6jgZrzurB/XTZClb8yBDmwl6JKdosI1ivQN9TH2n7fw== X-Received: by 2002:a1c:38c7:: with SMTP id f190mr621872wma.94.1580951929737; Wed, 05 Feb 2020 17:18:49 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:49 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 24/30] tests/acceptance/boot_linux_console: Test the raspi1 console Date: Thu, 6 Feb 2020 02:17:50 +0100 Message-Id: <20200206011756.2413-25-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" $ avocado --show=app,console run -t machine:raspi1 tests/acceptance/ JOB ID : c49310d4a21444f03789cd2c443d8c54a29ffd0a JOB LOG : avocado/job-results/job-2020-02-05T23.52-c49310d/job.log (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi1_uart0: console: [ 0.000000] Booting Linux on physical CPU 0x0 console: [ 0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019 console: [ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d console: [ 0.000000] CPU: VIPT aliasing data cache, unknown instruction cache console: [ 0.000000] OF: fdt: Machine model: Raspberry Pi Model B console: [ 0.000000] earlycon: pl11 at MMIO 0x20201000 (options '') console: [ 0.000000] bootconsole [pl11] enabled console: [ 0.000000] Memory policy: Data cache writeback console: [ 0.000000] cma: Reserved 8 MiB at 0x1b800000 console: [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113680 console: [ 0.000000] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0 PASS (12.93 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 13.18 s Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 56c8d54ca6..0371828326 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -333,13 +333,16 @@ class BootLinuxConsole(Test): """ serial_kernel_cmdline = { 'pl011': { + 1: 'earlycon=pl011,0x20201000 console=ttyAMA0', 2: 'earlycon=pl011,0x3f201000 console=ttyAMA0', }, } kernel = { + 1: '/boot/kernel.img', 2: '/boot/kernel7.img', } dtb = { + 1: '/boot/bcm2708-rpi-b.dtb', 2: '/boot/bcm2709-rpi-2-b.dtb', } deb_url = ('http://archive.raspberrypi.org/debian/' @@ -360,6 +363,15 @@ class BootLinuxConsole(Test): console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + def test_arm_raspi1_uart0(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:raspi1 + :avocado: tags=cpu:arm1176 + :avocado: tags=device:pl011 + """ + self.do_test_arm_raspi(1, 'pl011') + def test_arm_raspi2_uart0(self): """ :avocado: tags=arch:arm From patchwork Thu Feb 6 01:17:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234094 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=PMOg8rHn; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Ch0j2cN5z9sRK for ; Thu, 6 Feb 2020 12:38:45 +1100 (AEDT) Received: from localhost ([::1]:59468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW7v-00035x-8p for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:38:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54540) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVom-0001Nj-CX for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVok-0004a5-4M for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:56 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:39007) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVoj-0004UP-TD; Wed, 05 Feb 2020 20:18:54 -0500 Received: by mail-wm1-x32f.google.com with SMTP id c84so5046868wme.4; Wed, 05 Feb 2020 17:18:53 -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=QGRmYJ7L9YDtOUA7ryXiSMK9rx2JaMJd+CVAQCLIvks=; b=PMOg8rHnQB/j/VuMexCkZorSUToLiuCmrsy1V6sIgEtC8pzofMAvtEugUOX4o876aB lVJdm9+P+ka7/y1RnBr8c175VpBZSnNt4zCSC+6MyZMRTADPD/ybJ5KGj6AJX4gDLB0a qq2rnPmYCasmAMaCCDj+ODsyTL/l+vSTSck3UEKs5AdCip7wlW6uQLT2YXOcOol0EYkr DhqHd0OZ9WYN6iSy2xnuTR9sdFXzCwxT9DfSNnw8xQGmAv78Yh0NpBs8IxqcK2rZXvwz ay22rzQjuAwoWx86S9Z/JflJ8hlThUUrJRyivuBkv4uc4lp7UYOeA0meGkWJVy3j9nlO SNVg== 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=QGRmYJ7L9YDtOUA7ryXiSMK9rx2JaMJd+CVAQCLIvks=; b=YCiFsvR90HrzxNqmxMedaQdI49UKhqPaLCW5tC710+K3wc6p5Ya0IaATKcMUL3cv1J k4Q7PSwHRfgi5tRs8MigRQsLcBCinntCxzurLAPbZtlxpjwZfofVtiVqjDJ6IMaRub0u tnS+MjlhQwGr5ag4TOERCou2Ak+E5qaFbNlGRaiRj5Er4rFsyyc7o1ZHL0Nw9Ni9DYxN 8aoD7N0ARr34dpMgjdTCLGAe5l58LNPZNucCbDW1lpRVblb+vESQ3plxUDh/jGyO4d7A TMh0kyedv5i3wdQVFG1z6KbXkNpMczLTh4L04QtuWtBkkcSAkkGCx6DwWu8VQsOaeoBT KAxA== X-Gm-Message-State: APjAAAU8obgjEc1yq52WY/cpmDQPIDpF90MOytrgFvblDzjhxQGh+2Ll eGbdDdJDeoHlWz82JyC34EIrcW2N X-Google-Smtp-Source: APXvYqye/wQYwnrcgZcrArguvRbSI4az43d5rwoDw6rBWm6nW1ai0ATYCxNg1/U64diJCzrxZ1/E8A== X-Received: by 2002:a05:600c:214a:: with SMTP id v10mr654711wml.182.1580951931642; Wed, 05 Feb 2020 17:18:51 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 25/30] tests/acceptance/boot_linux_console: Test the raspi0 console Date: Thu, 6 Feb 2020 02:17:51 +0100 Message-Id: <20200206011756.2413-26-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32f 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" $ avocado --show=app,console run -t machine:raspi0 tests/acceptance/ JOB ID : af8e017486290758bff39c986934134199af3556 JOB LOG : avocado/job-results/job-2020-02-05T23.53-af8e017/job.log (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi0_uart0: console: [ 0.000000] Booting Linux on physical CPU 0x0 console: [ 0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019 console: [ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d console: [ 0.000000] CPU: VIPT aliasing data cache, unknown instruction cache console: [ 0.000000] OF: fdt: Machine model: Raspberry Pi Zero W console: [ 0.000000] earlycon: pl11 at MMIO 0x20201000 (options '') console: [ 0.000000] bootconsole [pl11] enabled console: [ 0.000000] Memory policy: Data cache writeback console: [ 0.000000] cma: Reserved 8 MiB at 0x1b800000 console: [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113680 console: [ 0.000000] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0 PASS (12.59 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 12.88 s Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 0371828326..df6600ab2f 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -333,15 +333,18 @@ class BootLinuxConsole(Test): """ serial_kernel_cmdline = { 'pl011': { + 0: 'earlycon=pl011,0x20201000 console=ttyAMA0', 1: 'earlycon=pl011,0x20201000 console=ttyAMA0', 2: 'earlycon=pl011,0x3f201000 console=ttyAMA0', }, } kernel = { + 0: '/boot/kernel.img', 1: '/boot/kernel.img', 2: '/boot/kernel7.img', } dtb = { + 0: '/boot/bcm2708-rpi-0-w.dtb', 1: '/boot/bcm2708-rpi-b.dtb', 2: '/boot/bcm2709-rpi-2-b.dtb', } @@ -363,6 +366,15 @@ class BootLinuxConsole(Test): console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) + def test_arm_raspi0_uart0(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:raspi0 + :avocado: tags=cpu:arm1176 + :avocado: tags=device:pl011 + """ + self.do_test_arm_raspi(0, 'pl011') + def test_arm_raspi1_uart0(self): """ :avocado: tags=arch:arm From patchwork Thu Feb 6 01:17:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=vOH8o6MT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Ch2y48f1z9sRK for ; Thu, 6 Feb 2020 12:40:42 +1100 (AEDT) Received: from localhost ([::1]:59508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW9o-0005hi-Fh for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:40:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54573) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVon-0001PY-91 for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVol-0004ha-Ua for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:18:57 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:38250) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVol-0004eV-Jk; Wed, 05 Feb 2020 20:18:55 -0500 Received: by mail-wr1-x42c.google.com with SMTP id y17so5137762wrh.5; Wed, 05 Feb 2020 17:18:55 -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=bfg/bz0k7eHq+lcueYwbpEz5J1xmofDzQUqOznNEtbg=; b=vOH8o6MTTe7aft2X2dofYaixmx9ope/7cW9LvscNzyG1Mk/0ipVmKCsUjnGDgavPPt pqyxLC88jZjd4jh6YySdL45JGTyG1NmjkoHZPagayZrpjyi8V8w3Lic1e6154eSbEUPW spfhuXGns2UYDk+swzu+SuJNycP/GhFwR+h3H8O+kx/jtEPfptbvMKX26bBzvsipjqxV oZJmhsKgvI6nLmTamyyhUQNsRZPI3VJI49mr9h6Ybm43UgHH1kLdagIVgwJIIHZPtBHO +OgY3OaVzDQCWc4qChbNr7o4F4VZsITT3qxG4kqCcRceUZqGwEAqMfC94unKOEG12iAw sTnw== 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=bfg/bz0k7eHq+lcueYwbpEz5J1xmofDzQUqOznNEtbg=; b=NQlPctfyqqcPUO6eiq5Obkdb7vmtHocTa8R4DpU5jm4zzeszEzoFlqhJR5la66ryW+ flEalq6FDuvJ9kbXSWtH/bV4fjFpjM87+maX6G1raxHj9odQSXsAj/ZtLTyIZl+eIMRq xcwDWULUnLhqu4HA5ub9gfFB12zTl4qs4GtoU39d+Airzp5au6Q7ySib5eyXVsDUcjec nY3bVCfxJ/lbvJiEpNmJN2980rJbIvyGgyrEYEYOnIwp40xVoZvJPm21J6rFE5qBmrBT 5Rl7W2OFPCPVvzNmwkqChWPPeTU++kBp5rfBsOpPSfFgmyx/tau+50ppdmVKhPOmIAXu 814w== X-Gm-Message-State: APjAAAW9UNaoVALkqAPxigXRw/WVgFeWjAPpGqjWrxF7qbGNxm/TVZ0L imPQB3BbWPL1TPwwcOlwXZKifjZs X-Google-Smtp-Source: APXvYqy4WAVZ9VPTwE3eiu0WAFqNiDWJb1E8HH2oI0sZ9HZZoHIcpnNRbtSKx47Q3yFB4/jlLmSKvw== X-Received: by 2002:adf:f3cd:: with SMTP id g13mr411443wrp.54.1580951934397; Wed, 05 Feb 2020 17:18:54 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 26/30] python/qemu/machine: Allow to use other serial consoles than default Date: Thu, 6 Feb 2020 02:17:52 +0100 Message-Id: <20200206011756.2413-27-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c 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 , Eduardo Habkost , Joaquin de Andres , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, Wainer dos Santos Moschetta , Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Currently the QEMU Python module limits the QEMUMachine class to use the first serial console. Some machines/guest might use another console than the first one as the 'boot console'. For example the Raspberry Pi uses the second (AUX) console. To be able to use the Nth console as default, we simply need to connect all the N - 1 consoles to the null chardev. Add an index argument, so we can use a specific serial console as default. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Liam Merwick Tested-by: Liam Merwick Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200120235159.18510-5-f4bug@amsat.org> [PMD: zero-initialize _console_index in __init__()] Signed-off-by: Philippe Mathieu-Daudé --- python/qemu/machine.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python/qemu/machine.py b/python/qemu/machine.py index 734efd8536..183d8f3d38 100644 --- a/python/qemu/machine.py +++ b/python/qemu/machine.py @@ -112,6 +112,7 @@ class QEMUMachine(object): self._sock_dir = sock_dir self._launched = False self._machine = None + self._console_index = 0 self._console_set = False self._console_device_type = None self._console_address = None @@ -241,6 +242,8 @@ class QEMUMachine(object): 'chardev=mon,mode=control']) if self._machine is not None: args.extend(['-machine', self._machine]) + for i in range(self._console_index): + args.extend(['-serial', 'null']) if self._console_set: self._console_address = os.path.join(self._sock_dir, self._name + "-console.sock") @@ -527,7 +530,7 @@ class QEMUMachine(object): """ self._machine = machine_type - def set_console(self, device_type=None): + def set_console(self, device_type=None, console_index=0): """ Sets the device type for a console device @@ -548,9 +551,14 @@ class QEMUMachine(object): chardev:console" command line argument will be used instead, resorting to the machine's default device type. + @param console_index: the index of the console device to use. + If not zero, the command line will create + 'index - 1' consoles and connect them to + the 'null' backing character device. """ self._console_set = True self._console_device_type = device_type + self._console_index = console_index @property def console_socket(self): From patchwork Thu Feb 6 01:17:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=XGEGvDsk; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Cgzm1y4pz9sRK for ; Thu, 6 Feb 2020 12:37:56 +1100 (AEDT) Received: from localhost ([::1]:59456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW78-0001nP-41 for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:37:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54630) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVos-0001Vo-Dv for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:19:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVon-0004wB-W9 for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:19:02 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:33624) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVon-0004qS-O3; Wed, 05 Feb 2020 20:18:57 -0500 Received: by mail-wm1-x341.google.com with SMTP id m10so5693957wmc.0; Wed, 05 Feb 2020 17:18:57 -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=8gSk/HX2AdgIZvykLb4KtPojBa3jZM1avH6O2vAh72A=; b=XGEGvDskFUrx/HYh4AyvduBZcy8cDpjIN1SPITFYSUscQAibtLFiDSe7y2OanqbV2m sZCboCt+09eVHwIJq4VhY4kmJIk/NS2nfMliLlSTu7m3AF7TvSD1FRRROWKzBAekPOoP qEfxTDCeknqLW1MiUrCzayELqzoKKwPT2Erp4DkwQUhorWsT1cvkcZty+nsS/ZMLrsS/ eID4jYhRwZwmi5Z/XhS7Xa+ULr4rX6ok9W48M0rkd++jcor+Q03ab4f9GrGMHAj0HF8/ UBc2ArZP1mnLePMLafR5+IjXwics80Aff9tkzsv/JHY3TUe6hmxfshgy2Ljt9OrTDioB EMRQ== 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=8gSk/HX2AdgIZvykLb4KtPojBa3jZM1avH6O2vAh72A=; b=SKogVlyTyy4Y9MaMKBNVHf2/3pnr8wHE3LE/fwC7I7ged0FoDCH2jXcbArB55eU48D KHimTy/KlPxAaJy+hmw/CFDFsKdk9mHRlaCJusVcMmKUS2a9XPlDJt+iyjNCHf2IHrlw /bggRQPfZgiTd96Gm1QKXcVeJ3ay5tBvC2D8gDC4+E3RMaeHDHqsfNzqk0uIQzh16dtS HMN9D4AWtUJwZubWGSlJSZ3v038W26cuA0iZvNEE2HdhgHAROz8dBHxSNCNmgijmiNrU BCQCgUGww+W179B2w1bEIViLtYUTMsJPAOLZstxdgp7V+1Ko5Ednw5nUcKJCyAUlLUKB yTCA== X-Gm-Message-State: APjAAAVbNy1uuA2BonRk5FarxRi0A5dWXlKh9csXA/A7fp6h1bhISaFp KMv9M4j7FX4vNQY1C7X9i0MpNsSQ X-Google-Smtp-Source: APXvYqy8ORakeweCaezBp+XyQfV1y0ubQIWvhLiNIznIFWEU7/sItLAW9prkTlUldWsL6G0fX7oRAQ== X-Received: by 2002:a7b:c318:: with SMTP id k24mr689639wmj.54.1580951936299; Wed, 05 Feb 2020 17:18:56 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:55 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 27/30] tests/acceptance/boot_linux_console: Test the raspi1 AUX console Date: Thu, 6 Feb 2020 02:17:53 +0100 Message-Id: <20200206011756.2413-28-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" $ avocado --show=app,console run -t device:bcm2835_aux tests/acceptance/ JOB ID : a8846d69d52da701681b1d17f80ef299009fd078 JOB LOG : avocado/job-results/job-2020-02-05T23.44-a8846d6/job.log (1/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi0_uart1: console: [ 0.000000] Booting Linux on physical CPU 0x0 console: [ 0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019 console: [ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d console: [ 0.000000] CPU: VIPT aliasing data cache, unknown instruction cache console: [ 0.000000] OF: fdt: Machine model: Raspberry Pi Zero W console: [ 0.000000] earlycon: uart8250 at MMIO32 0x20215040 (options '') console: [ 0.000000] bootconsole [uart8250] enabled console: [ 0.000000] Memory policy: Data cache writeback console: [ 0.000000] cma: Reserved 8 MiB at 0x1b800000 console: [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113680 console: [ 0.000000] Kernel command line: printk.time=0 earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200 PASS (13.31 s) (2/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi1_uart1: console: [ 0.000000] Booting Linux on physical CPU 0x0 console: [ 0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019 console: [ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d console: [ 0.000000] CPU: VIPT aliasing data cache, unknown instruction cache console: [ 0.000000] OF: fdt: Machine model: Raspberry Pi Model B console: [ 0.000000] earlycon: uart8250 at MMIO32 0x20215040 (options '') console: [ 0.000000] bootconsole [uart8250] enabled console: [ 0.000000] Memory policy: Data cache writeback console: [ 0.000000] cma: Reserved 8 MiB at 0x1b800000 console: [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 113680 console: [ 0.000000] Kernel command line: printk.time=0 earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200 PASS (13.39 s) (3/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uart1: console: [ 0.000000] Booting Linux on physical CPU 0xf00 console: [ 0.000000] Linux version 4.14.98-v7+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 SMP Tue Feb 12 20:27:48 GMT 2019 console: [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d console: [ 0.000000] CPU: div instructions available: patching division code console: [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache console: [ 0.000000] OF: fdt: Machine model: Raspberry Pi 2 Model B console: [ 0.000000] earlycon: uart8250 at MMIO32 0x3f215040 (options '') console: [ 0.000000] bootconsole [uart8250] enabled console: [ 0.000000] Memory policy: Data cache writealloc console: [ 0.000000] cma: Reserved 8 MiB at 0x3b800000 console: [ 0.000000] percpu: Embedded 17 pages/cpu @baf2e000 s38720 r8192 d22720 u69632 console: [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 243600 console: [ 0.000000] Kernel command line: printk.time=0 earlycon=uart8250,mmio32,0x3f215040 console=ttyS1,115200 PASS (12.46 s) RESULTS : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 39.60 s Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/boot_linux_console.py | 37 +++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index df6600ab2f..7210acd977 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -337,6 +337,14 @@ class BootLinuxConsole(Test): 1: 'earlycon=pl011,0x20201000 console=ttyAMA0', 2: 'earlycon=pl011,0x3f201000 console=ttyAMA0', }, + 'bcm2835_aux': { + 0: 'earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200', + 1: 'earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200', + 2: 'earlycon=uart8250,mmio32,0x3f215040 console=ttyS1,115200', + }, + } + uart_id = { + 'pl011': 0, 'bcm2835_aux': 1, } kernel = { 0: '/boot/kernel.img', @@ -356,7 +364,7 @@ class BootLinuxConsole(Test): kernel_path = self.extract_from_deb(deb_path, kernel[version]) dtb_path = self.extract_from_deb(deb_path, dtb[version]) - self.vm.set_console() + self.vm.set_console(console_index=uart_id[uart_model]) kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + serial_kernel_cmdline[uart_model][version]) self.vm.add_args('-kernel', kernel_path, @@ -375,6 +383,15 @@ class BootLinuxConsole(Test): """ self.do_test_arm_raspi(0, 'pl011') + def test_arm_raspi0_uart1(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:raspi0 + :avocado: tags=cpu:arm1176 + :avocado: tags=device:bcm2835_aux + """ + self.do_test_arm_raspi(0, 'bcm2835_aux') + def test_arm_raspi1_uart0(self): """ :avocado: tags=arch:arm @@ -384,6 +401,15 @@ class BootLinuxConsole(Test): """ self.do_test_arm_raspi(1, 'pl011') + def test_arm_raspi1_uart1(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:raspi1 + :avocado: tags=cpu:arm1176 + :avocado: tags=device:bcm2835_aux + """ + self.do_test_arm_raspi(1, 'bcm2835_aux') + def test_arm_raspi2_uart0(self): """ :avocado: tags=arch:arm @@ -393,6 +419,15 @@ class BootLinuxConsole(Test): """ self.do_test_arm_raspi(2, 'pl011') + def test_arm_raspi2_uart1(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:raspi2 + :avocado: tags=cpu:cortex-a7 + :avocado: tags=device:bcm2835_aux + """ + self.do_test_arm_raspi(2, 'bcm2835_aux') + def test_arm_exynos4210_initrd(self): """ :avocado: tags=arch:arm From patchwork Thu Feb 6 01:17:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234097 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=e+LOuK1D; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Ch5v6H2sz9sRK for ; Thu, 6 Feb 2020 12:43:15 +1100 (AEDT) Received: from localhost ([::1]:59548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izWCG-000146-CJ for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:43:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54702) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVou-0001aH-TC for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:19:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVot-00055W-8i for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:19:04 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:35870) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVos-0004z4-W4; Wed, 05 Feb 2020 20:19:03 -0500 Received: by mail-wr1-x444.google.com with SMTP id z3so5154269wru.3; Wed, 05 Feb 2020 17:19:02 -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=wAehENzQCmMVkW/YJV6bnroThHw1HaqNAVBKJsfbRgw=; b=e+LOuK1DWEq4Xvc/DBRCvTuT1Z3/F4+qqvLoIdlO5OYwW+1qexs47Xj1rhj4WR+YFe av6EFp8eEZqLQLGMW7BJPbaT8QYwCZOxsOHh+8DbEuw4aYFYU/4spN7cs1O+IVyQWUy8 dbgNrz1XCm9pNae/8J95iFMy+b4mjsKzOXmM7yNyAT+T/Ys+T2LXZH91G0sh5z33rh+v hTGzgX7Tys7XzcScRjvpV2GiFs1IxYtpdAIJztfsfh5n6n+qk8FXn6dT2nfxR26X49CH UGXa4V/67BZHajmcxw8mDCuzfbAmoMW4uSrRd4kuUqnEeMvXuRMAnrNIhJ+u5+kEGDLM 1AkQ== 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=wAehENzQCmMVkW/YJV6bnroThHw1HaqNAVBKJsfbRgw=; b=on8gIf67d3nSHKOlMHH2foiWLv5dUCmCxGtUphOORXCMG3XGU02zVDEJvjrsmY37ZS NQQBQDfQBjLW4PAlnhj3AonATSgSnmnFMVaqXHA3TSCfDCvuhmXrMaDWTihtRTN+HE3D I15CZyQsklHnSy5oDa7+8u3mXXW5OJcCOqz2BzhB5dJlOXqZIc2q+niW0Yzunigy1uV3 Lg5ygpFUGwoPPNDWHpYz+APfW6i3gu+ylPCo/cmyqTM7vHQvIOKZOUuJIyzcOyfbBE6e Uezvnz4/m8VJET2tkcvZ9zZdPztIJqBH/pZ2mED/ab6jWAosE0ny+b7WwnbUutiv3pDQ xIew== X-Gm-Message-State: APjAAAXVnn4B5kczsyzLoggjGKpEyaEytleaPgZ/7H+E2kqMSpp37dAu MQscBQXlbgwbtCc2ELbg5urA+ifn X-Google-Smtp-Source: APXvYqyeeZphCWO+llRbh7t0B/o+eJm6cczBsIZGaBRwSOpfkwBeeA93R4j8QDBdS7YTiOlRGCyECQ== X-Received: by 2002:adf:de0b:: with SMTP id b11mr335378wrm.89.1580951938635; Wed, 05 Feb 2020 17:18:58 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:18:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 28/30] tests/acceptance: Count Raspberry Pi logos displayed on framebuffer Date: Thu, 6 Feb 2020 02:17:54 +0100 Message-Id: <20200206011756.2413-29-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, kraxel@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add a test that verifies that each core properly displays the Raspberry Pi logo on the framebuffer device. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by a raspberrry: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ avocado --show=app,framebuffer run -t device:bcm2835-fb tests/acceptance/ JOB ID : 9bbbc54c0a6fa180348d0b5305507f76852b4da2 JOB LOG : avocado/job-results/job-2020-01-31T23.48-9bbbc54/job.log (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_framebuffer_logo: framebuffer: found raspberry at position (x, y) = (0, 0) framebuffer: found raspberry at position (x, y) = (71, 0) framebuffer: found raspberry at position (x, y) = (142, 0) framebuffer: found raspberry at position (x, y) = (213, 0) PASS (11.06 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 11.39 s Signed-off-by: Philippe Mathieu-Daudé --- The resulting match can be visualised at https://pasteboard.co/ISzNHtx.png Cc: kraxel@redhat.com --- tests/acceptance/boot_linux_console.py | 62 ++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 7210acd977..33d39d8292 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -12,6 +12,7 @@ import os import lzma import gzip import shutil +import logging from avocado import skipUnless from avocado_qemu import Test @@ -21,6 +22,19 @@ from avocado.utils import process from avocado.utils import archive +NUMPY_AVAILABLE = True +try: + import numpy as np +except ImportError: + NUMPY_AVAILABLE = False + +CV2_AVAILABLE = True +try: + import cv2 +except ImportError: + CV2_AVAILABLE = False + + class BootLinuxConsole(Test): """ Boots a Linux kernel and checks that the console is operational and the @@ -428,6 +442,54 @@ class BootLinuxConsole(Test): """ self.do_test_arm_raspi(2, 'bcm2835_aux') + @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed') + @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed') + def test_arm_raspi2_framebuffer_logo(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:raspi2 + :avocado: tags=device:bcm2835-fb + """ + screendump_path = os.path.join(self.workdir, 'screendump.pbm') + rpilogo_url = ('https://github.com/raspberrypi/linux/raw/' + 'raspberrypi-kernel_1.20190517-1/' + 'drivers/video/logo/logo_linux_clut224.ppm') + rpilogo_hash = 'fff3cc20c6030acce0953147f9baac43f44ed6b0' + rpilogo_path = self.fetch_asset(rpilogo_url, asset_hash=rpilogo_hash) + deb_url = ('http://archive.raspberrypi.org/debian/' + 'pool/main/r/raspberrypi-firmware/' + 'raspberrypi-kernel_1.20190215-1_armhf.deb') + deb_hash = 'cd284220b32128c5084037553db3c482426f3972' + deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) + kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img') + dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb') + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=pl011,0x3f201000 console=ttyAMA0') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-append', kernel_command_line) + self.vm.launch() + framebuffer_ready = 'Console: switching to colour frame buffer device' + wait_for_console_pattern(self, framebuffer_ready) + self.vm.command('human-monitor-command', command_line='stop') + self.vm.command('human-monitor-command', + command_line='screendump %s' % screendump_path) + logger = logging.getLogger('framebuffer') + + cpu_cores_count = 4 + match_threshold = 0.95 + screendump_bgr = cv2.imread(screendump_path, cv2.IMREAD_COLOR) + rpilogo_bgr = cv2.imread(rpilogo_path, cv2.IMREAD_COLOR) + result = cv2.matchTemplate(screendump_bgr, rpilogo_bgr, + cv2.TM_CCOEFF_NORMED) + loc = np.where(result >= match_threshold) + rpilogo_count = 0 + for rpilogo_count, pt in enumerate(zip(*loc[::-1]), start=1): + logger.debug('found raspberry at position (x, y) = %s', pt) + self.assertGreaterEqual(rpilogo_count, cpu_cores_count) + def test_arm_exynos4210_initrd(self): """ :avocado: tags=arch:arm From patchwork Thu Feb 6 01:17:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234095 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=oi+qusW0; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Ch1S1nzBz9sRK for ; Thu, 6 Feb 2020 12:39:24 +1100 (AEDT) Received: from localhost ([::1]:59480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW8Y-0003zo-6N for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:39:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54754) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVox-0001bw-8o for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:19:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVou-00058R-De for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:19:07 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:37975) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVot-0004zb-59; Wed, 05 Feb 2020 20:19:04 -0500 Received: by mail-wr1-x444.google.com with SMTP id y17so5137963wrh.5; Wed, 05 Feb 2020 17:19:03 -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=YKntEz0YWqvXEnpxZehSJURd2wV0yMHHN+VgGwbeMbQ=; b=oi+qusW0M9ReYlUYlgK0Tx/WRBFwFBdJ3G492nLXQLtnq6cGlfgg6IhU+8Q1KX6NzW teDpuwygyQFRiAY1Bzhvjk0EGqbVz9KYTaTxwGhK/j+amIwnTRpxU2SIJvMuV4HGjAaW uEp3GKynLjsBGBbR9XhcYJZWrJqckktTU7lOW+LXYjrnoVa122Niz0U/9OoMMri6G0Nh 9B5mbOdkBEhkSkewOp3IWx5a9VezotBoyF2DpZCYJrccs4O3bi5UT+RacKHELvRxujR9 A2XK/Kp2QYYkb77vhJVlyXqGX55cUQB7+fpwlg7JccbeTvKPyBU0o5SLoLVlrBY+qob/ 0Ebg== 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=YKntEz0YWqvXEnpxZehSJURd2wV0yMHHN+VgGwbeMbQ=; b=RVX/foTZTBlE5I0PLAHyswFbCCyW957lSZTMwNL7RXOLHQUXCgYZfqP1yBiYlu9l82 MsG8uk5SHa4n+wHRqE7sR5UATxTy5q63MwYdbWX8ZtTgkJC0brUwEQRD/dOfMX+lafsA 6Lnj3cKjWqk3eaDlPTXIljabH7TDeBFlru592ugUrGrnutDHpl5wd2bp/X/KXf4/YfGv 5W2/3An59btzT92rzqy29GERysDhWs0rJqWU1ZqaK5Xnup/T4/kKGvKdqfPxpV9eT9m3 jkmckUfty90ATeG+CYzqFjGrjFjPFo0uS95qxn/ycigRl7olyPAcrvuL19DV1+56w8Z0 7+lw== X-Gm-Message-State: APjAAAVXL1JxyqoKN98Nvz+XVL3WWrlk5IqnfOrBBtqbdSBs2Ejqcknd WaLepIB2ImJ4Isjx/oxlUdkh9Oz+ X-Google-Smtp-Source: APXvYqzjzkRkWsdkmEJArnKRTQ/9c7Y4rLTb8y9Vil6zbtoT1OUHB54512MrBgRxHGvWpNWdlMFJ0g== X-Received: by 2002:adf:f1c6:: with SMTP id z6mr303703wro.279.1580951940799; Wed, 05 Feb 2020 17:19:00 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.18.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:19:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [NOTFORMERGE PATCH v2 29/30] hw/arm/bcm2836: Add the BCM2838 (ARMv8) Date: Thu, 6 Feb 2020 02:17:55 +0100 Message-Id: <20200206011756.2413-30-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Setup the GICv2. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/arm/bcm2836.h | 3 + hw/arm/bcm2836.c | 206 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 209 insertions(+) diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h index 3d46469a73..7c1f79911c 100644 --- a/include/hw/arm/bcm2836.h +++ b/include/hw/arm/bcm2836.h @@ -13,6 +13,7 @@ #include "hw/arm/bcm2835_peripherals.h" #include "hw/intc/bcm2836_control.h" +#include "hw/intc/arm_gic.h" #include "target/arm/cpu.h" #define TYPE_BCM283X "bcm283x" @@ -27,6 +28,7 @@ #define TYPE_BCM2835 "bcm2835" #define TYPE_BCM2836 "bcm2836" #define TYPE_BCM2837 "bcm2837" +#define TYPE_BCM2838 "bcm2838" typedef struct BCM283XState { /*< private >*/ @@ -39,6 +41,7 @@ typedef struct BCM283XState { struct { ARMCPU core; } cpu[BCM283X_NCPUS]; + GICState gic; BCM2836ControlState control; BCM2835PeripheralState peripherals; } BCM283XState; diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index bce5f8a866..f09cd25caf 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -24,6 +24,7 @@ typedef struct BCM283XClass { int core_count; hwaddr peri_base; /* Peripheral base address seen by the CPU */ hwaddr ctrl_base; /* Interrupt controller and mailboxes etc. */ + hwaddr gic_base; int clusterid; } BCM283XClass; @@ -51,6 +52,11 @@ static void bcm2836_init(Object *obj) qdev_prop_set_uint32(DEVICE(obj), "enabled-cpus", bc->core_count); } + if (bc->gic_base) { + sysbus_init_child_obj(obj, "gic", &s->gic, sizeof(s->gic), + TYPE_ARM_GIC); + } + if (bc->ctrl_base) { sysbus_init_child_obj(obj, "control", &s->control, sizeof(s->control), TYPE_BCM2836_CONTROL); @@ -201,6 +207,188 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) } } +#ifdef TARGET_AARCH64 + +#define GIC400_MAINTAINANCE_IRQ 9 +#define GIC400_TIMER_NS_EL2_IRQ 10 +#define GIC400_TIMER_VIRT_IRQ 11 +#define GIC400_LEGACY_FIQ 12 +#define GIC400_TIMER_S_EL1_IRQ 13 +#define GIC400_TIMER_NS_EL1_IRQ 14 +#define GIC400_LEGACY_IRQ 15 + +/* Number of external interrupt lines to configure the GIC with */ +#define GIC_NUM_IRQS 128 + +#define PPI(cpu, irq) (GIC_NUM_IRQS + (cpu) * GIC_INTERNAL + GIC_NR_SGIS + irq) + +#define GIC_BASE_OFS 0x0000 +#define GIC_DIST_OFS 0x1000 +#define GIC_CPU_OFS 0x2000 +#define GIC_VIFACE_THIS_OFS 0x4000 +#define GIC_VIFACE_OTHER_OFS(cpu) (0x5000 + (cpu) * 0x200) +#define GIC_VCPU_OFS 0x6000 + +#define NUM_GICV2M_SPIS 64 + +#define VIRTUAL_PMU_IRQ 7 + +static void bcm2838_gic_set_irq(void *opaque, int irq, int level) +{ + BCM283XState *s = (BCM283XState *)opaque; + + printf("bcm2838_gic_set_irq irq:%d lvl:%d\n", irq, level); + qemu_set_irq(qdev_get_gpio_in(DEVICE(&s->gic), irq), level); +} + +static void bcm2838_realize(DeviceState *dev, Error **errp) +{ + BCM283XState *s = BCM283X(dev); + BCM283XClass *bc = BCM283X_GET_CLASS(dev); + Error *err = NULL; + int n; + + bcm283x_common_realize(dev, &err); + if (err) { + error_propagate(errp, err); + return; + } + + sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->peripherals), 0, + bc->peri_base, 1); + + /* bcm2836 interrupt controller (and mailboxes, etc.) */ + object_property_set_bool(OBJECT(&s->control), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + + sysbus_mmio_map(SYS_BUS_DEVICE(&s->control), 0, bc->ctrl_base); + + /* Create cores */ + for (n = 0; n < bc->core_count; n++) { + /* TODO: this should be converted to a property of ARM_CPU */ + s->cpu[n].core.mp_affinity = (bc->clusterid << 8) | n; + + /* set periphbase/CBAR value for CPU-local registers */ + object_property_set_int(OBJECT(&s->cpu[n]), + bc->peri_base, + "reset-cbar", &err); + if (err) { + error_propagate(errp, err); + return; + } + + /* start powered off if not enabled */ + object_property_set_bool(OBJECT(&s->cpu[n]), n >= s->enabled_cpus, + "start-powered-off", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_bool(OBJECT(&s->cpu[n]), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + } + + object_property_set_uint(OBJECT(&s->gic), 2, "revision", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_uint(OBJECT(&s->gic), + BCM283X_NCPUS, "num-cpu", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_uint(OBJECT(&s->gic), + GIC_NUM_IRQS + GIC_INTERNAL, "num-irq", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_bool(OBJECT(&s->gic), + true, "has-virtualization-extensions", &err); + if (err) { + error_propagate(errp, err); + return; + } + + object_property_set_bool(OBJECT(&s->gic), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 0, + bc->ctrl_base + bc->gic_base + GIC_DIST_OFS); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 1, + bc->ctrl_base + bc->gic_base + GIC_CPU_OFS); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 2, + bc->ctrl_base + bc->gic_base + GIC_VIFACE_THIS_OFS); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 3, + bc->ctrl_base + bc->gic_base + GIC_VCPU_OFS); + + for (n = 0; n < BCM283X_NCPUS; n++) { + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 4 + n, + bc->ctrl_base + bc->gic_base + + GIC_VIFACE_OTHER_OFS(n)); + } + + for (n = 0; n < BCM283X_NCPUS; n++) { + DeviceState *cpudev = DEVICE(&s->cpu[n]); + DeviceState *gicdev = DEVICE(&s->gic); + + /* Connect the GICv2 outputs to the CPU */ + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), n, + qdev_get_gpio_in(cpudev, ARM_CPU_IRQ)); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), n + BCM283X_NCPUS, + qdev_get_gpio_in(cpudev, ARM_CPU_FIQ)); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), n + 2 * BCM283X_NCPUS, + qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ)); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), n + 3 * BCM283X_NCPUS, + qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ)); + + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), n + 4 * BCM283X_NCPUS, + qdev_get_gpio_in(gicdev, + PPI(n, GIC400_MAINTAINANCE_IRQ))); + + /* Connect timers from the CPU to the interrupt controller */ + qdev_connect_gpio_out(cpudev, GTIMER_PHYS, + qdev_get_gpio_in(gicdev, PPI(n, GIC400_TIMER_NS_EL1_IRQ))); + qdev_connect_gpio_out(cpudev, GTIMER_VIRT, + qdev_get_gpio_in(gicdev, PPI(n, GIC400_TIMER_VIRT_IRQ))); + qdev_connect_gpio_out(cpudev, GTIMER_HYP, + qdev_get_gpio_in(gicdev, PPI(n, GIC400_TIMER_NS_EL2_IRQ))); + qdev_connect_gpio_out(cpudev, GTIMER_SEC, + qdev_get_gpio_in(gicdev, PPI(n, GIC400_TIMER_S_EL1_IRQ))); + /* PMU interrupt */ + qdev_connect_gpio_out_named(cpudev, "pmu-interrupt", 0, + qdev_get_gpio_in(gicdev, PPI(n, VIRTUAL_PMU_IRQ))); + } + + /* Pass through inbound GPIO lines to the GIC */ + qdev_init_gpio_in(dev, bcm2838_gic_set_irq, GIC_NUM_IRQS); + + /* Pass through outbound IRQ lines from the GIC */ + qdev_pass_gpios(DEVICE(&s->gic), DEVICE(&s->peripherals), NULL); + + object_property_set_bool(OBJECT(&s->peripherals), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } +} +#endif /* TARGET_AARCH64 */ + static void bcm283x_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); @@ -246,6 +434,20 @@ static void bcm2837_class_init(ObjectClass *oc, void *data) bc->clusterid = 0x0; dc->realize = bcm2836_realize; }; + +static void bcm2838_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + BCM283XClass *bc = BCM283X_CLASS(oc); + + bc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a72"); + bc->core_count = BCM283X_NCPUS; + bc->peri_base = 0xfe000000; + bc->ctrl_base = 0xff800000; + bc->gic_base = 0x40000; + bc->clusterid = 0x0; + dc->realize = bcm2838_realize; +}; #endif static const TypeInfo bcm283x_types[] = { @@ -262,6 +464,10 @@ static const TypeInfo bcm283x_types[] = { .name = TYPE_BCM2837, .parent = TYPE_BCM283X, .class_init = bcm2837_class_init, + }, { + .name = TYPE_BCM2838, + .parent = TYPE_BCM283X, + .class_init = bcm2838_class_init, #endif }, { .name = TYPE_BCM283X, From patchwork Thu Feb 6 01:17:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1234089 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=rDYdY5YU; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CgwK1GSdz9sRK for ; Thu, 6 Feb 2020 12:34:57 +1100 (AEDT) Received: from localhost ([::1]:59396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izW4F-0005Ag-1C for incoming@patchwork.ozlabs.org; Wed, 05 Feb 2020 20:34:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54712) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izVov-0001b2-7a for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:19:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izVou-00056g-6k for qemu-devel@nongnu.org; Wed, 05 Feb 2020 20:19:05 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:43344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izVou-00055m-1G; Wed, 05 Feb 2020 20:19:04 -0500 Received: by mail-wr1-x442.google.com with SMTP id z9so5099072wrs.10; Wed, 05 Feb 2020 17:19:03 -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=7XPvv6jxd1oIoIhXDZTxZc8ANlESxt/CQMBwAqbZerI=; b=rDYdY5YU4skruCOuQJPEeYO2xrpqHD4ZasTyqGE/A1C3HT4xpWPqU0KTn+sxuyVwJk Du9ZvGiKs6Np/JptP5r2rcJiXlIpINVPp4HtHUkvsZakBfVPx28DBeeggCYv9HmbkQ8k MpKbIPLijGl95wA9SxgvQPP+8VYKFpvujqjpTTIoxSQL1Hkqe+j6jvgJBJNydr+DJnUm p7BrUb258ZmRQhEj8fClvcVeXIV7lOpYYjC578khTJ2PgGh5trewrB8WDH3aJ4SS9kPz hljmmweDkjkrt9l5pb4J6RwHi/Jmz4vEc4TH/OLAtIPYm0lrNouavwDPMEKTry3dLZAG 8AmA== 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=7XPvv6jxd1oIoIhXDZTxZc8ANlESxt/CQMBwAqbZerI=; b=TDAKsbInk3bXrgCKUe0/CcHTkqu8xRkXHvyRi4ZMZI58oO1VCaW3KZtvR+IbveEAcw Mk4ccRLohI4BGsNeUF4lV76Jfai9qLrzPjLbihB6WmT99fwiVmC94s8PY/hRxDYgfaUS E9/oIZeEBCQwFVKqnGmfZ5LioK+gZBC+Ot3DIVXK1V9FAJ93ySqLLLn6fVaUzY8no5Sb dt1jyusFgAFaO3DXmP2v7NCLoa8BEt9x7lr6isoxggIkiKqaqUUS4aGmxla6AVeJeQAV McBHhy7WpgjCcPmjrf2SSeqnLmHx9j+BELXPCC0fJMAAfazK/xUdRmM5uPDPZH+ocNBY 8oIQ== X-Gm-Message-State: APjAAAWbQ0S22QFq7feHWziovelOeOK5jJVagyJIincwBwrY8oQs1Plz CLDCFHqbi3iEjugNciVfrv+z3p// X-Google-Smtp-Source: APXvYqycPJexQ273or3yEIOqRHZozGJWCWlUcs2WMEsyfftDCaQMEom004YHVUaLJ+AdOd7L1hQ0+g== X-Received: by 2002:a5d:4687:: with SMTP id u7mr368672wrq.176.1580951942849; Wed, 05 Feb 2020 17:19:02 -0800 (PST) Received: from localhost.localdomain (2.red-95-127-156.staticip.rima-tde.net. [95.127.156.2]) by smtp.gmail.com with ESMTPSA id w13sm2053526wru.38.2020.02.05.17.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 17:19:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [NOTFORMERGE PATCH v2 30/30] hw/arm/raspi: Add the Raspberry Pi 4 Date: Thu, 6 Feb 2020 02:17:56 +0100 Message-Id: <20200206011756.2413-31-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200206011756.2413-1-f4bug@amsat.org> References: <20200206011756.2413-1-f4bug@amsat.org> MIME-Version: 1.0 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 , Joaquin de Andres , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Esteban Bosse , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/raspi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 47cc250883..8a0309933b 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -88,7 +88,7 @@ static int board_version(uint32_t board_rev) static const char *board_soc_type(uint32_t board_rev) { static const char *soc_types[] = { - TYPE_BCM2835, TYPE_BCM2836, TYPE_BCM2837, + TYPE_BCM2835, TYPE_BCM2836, TYPE_BCM2837, TYPE_BCM2838, }; int proc_id = board_processor_id(board_rev); @@ -103,7 +103,7 @@ static const char *board_soc_type(uint32_t board_rev) static int cores_count(uint32_t board_rev) { static const int soc_cores_count[] = { - 1, BCM283X_NCPUS, BCM283X_NCPUS, + 1, BCM283X_NCPUS, BCM283X_NCPUS, BCM283X_NCPUS, }; int proc_id = board_processor_id(board_rev); @@ -350,6 +350,11 @@ static const TypeInfo raspi_machine_types[] = { .parent = TYPE_RASPI_MACHINE, .class_init = raspi_machine_class_init, .class_data = (void *)0xa02082, + }, { + .name = MACHINE_TYPE_NAME("raspi4"), + .parent = TYPE_RASPI_MACHINE, + .class_init = raspi_machine_class_init, + .class_data = (void *)0xa03111, #endif }, { .name = TYPE_RASPI_MACHINE,