From nobody Sat May 18 06:50:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518764679949198.45387050798308; Thu, 15 Feb 2018 23:04:39 -0800 (PST) Received: from localhost ([::1]:45304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ema4U-0004sB-Vr for importer@patchew.org; Fri, 16 Feb 2018 02:04:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ema2E-0003QS-HF for qemu-devel@nongnu.org; Fri, 16 Feb 2018 02:02:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ema2A-0007jh-Bk for qemu-devel@nongnu.org; Fri, 16 Feb 2018 02:02:18 -0500 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:35988) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ema2A-0007ik-4E for qemu-devel@nongnu.org; Fri, 16 Feb 2018 02:02:14 -0500 Received: by mail-lf0-x242.google.com with SMTP id t79so2762371lfe.3 for ; Thu, 15 Feb 2018 23:02:13 -0800 (PST) Received: from localhost.localdomain (81-175-247-183.bb.dnainternet.fi. [81.175.247.183]) by smtp.gmail.com with ESMTPSA id r9sm3365313ljc.18.2018.02.15.23.02.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2018 23:02:11 -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; bh=zvJ9O42ZOhpexSNaXoJavDhfQJ8HJlHVstswYBh0L7Q=; b=ZFlG4khJT+Q0TjIzUjO1h8BFTN0NHwGfrLG+ex9VF9l5Zizij0U7wK54MH4PRf3KiQ Wr8DrFZaSxjMWkqvwcvMHiUIpkfyVRNwWJx5tmZX5V8cKI3BbJ0gPmQzkStAjF+dIYSX jD658SE9v4yPX3kKw95F5k3uOedDLPwNCEibngdLDs+2xPgmGUqHK10HEvp5MiDJbdr8 cdicmhHX7QBO8Ckf/Xq8acVJI5LAoW2wE5lH/0XZz7Iyyx0GNMTFEFAOXtASWsgH6brE hIwd2c35WQ3YaIl7v1PmzJcNFbq1I1+koDYSkOqVF5/7M2Z191HUZuacNZya0OfZC+sv +FeA== 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; bh=zvJ9O42ZOhpexSNaXoJavDhfQJ8HJlHVstswYBh0L7Q=; b=LVA8lFS/yVm4KuQ6kznCM97TeJ+xRcjjEWdZlowR0WukmxVApoFlBT7NaqpoqO94s2 S+BW9SMIqnUjIvHQv21IQiUgV989o6pH3ZTNT7v9By2RuM48MFjG/KHaI+o5Gu4KkpNI TBA2FTQ6B4ncuEwfzylMW/oww+rtzHiFt1+MPKgqfcSQG0drIegkKU8yZZtAsVS+TAGx GmK0Pa2J/x+uQMKj722xuczzXWH/mbTdQhf6vxUQD+2nDyX3DJc5D+1XNvi1g9A50Jbj UK1pyWrmUaan0vR2iozZwzK2Kd7hB8VZVgyp2hWGkY6+47fVREcuaIQIjA6wQkgNXxom kNfQ== X-Gm-Message-State: APf1xPA2XEW0qUQ7B+6Cu8qz3rfz5cT2RLGnMWIcdVrZYy8SRpEhrFJn U/cBnUed20qO5TdgVdMvoLnZOtzp X-Google-Smtp-Source: AH8x225FWz9cqQMqHlXqjFMMIQwixIIy3vvdyoNKSStc+1nH2ptewJpq2MuPmBjDQNWSK73ERdjFiQ== X-Received: by 10.46.93.207 with SMTP id v76mr3590643lje.134.1518764532515; Thu, 15 Feb 2018 23:02:12 -0800 (PST) From: Pekka Enberg To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 09:01:59 +0200 Message-Id: <20180216070201.4271-2-penberg@iki.fi> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180216070201.4271-1-penberg@iki.fi> References: <20180216070201.4271-1-penberg@iki.fi> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::242 Subject: [Qemu-devel] [PATCH v2 1/3] bcm2836: Make CPU type configurable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Pekka Enberg Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch adds a "cpu-type" property to BCM2836 SoC in preparation for reusing the code for the Raspberry Pi 3, which has a different processor model. Signed-off-by: Pekka Enberg --- hw/arm/bcm2836.c | 17 +++++++++-------- hw/arm/raspi.c | 3 +++ include/hw/arm/bcm2836.h | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 8c43291112..40e8b25a46 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -26,14 +26,6 @@ static void bcm2836_init(Object *obj) { BCM2836State *s =3D BCM2836(obj); - int n; - - for (n =3D 0; n < BCM2836_NCPUS; n++) { - object_initialize(&s->cpus[n], sizeof(s->cpus[n]), - "cortex-a15-" TYPE_ARM_CPU); - object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]), - &error_abort); - } =20 object_initialize(&s->control, sizeof(s->control), TYPE_BCM2836_CONTRO= L); object_property_add_child(obj, "control", OBJECT(&s->control), NULL); @@ -59,6 +51,14 @@ static void bcm2836_realize(DeviceState *dev, Error **er= rp) =20 /* common peripherals from bcm2835 */ =20 + obj =3D OBJECT(dev); + for (n =3D 0; n < BCM2836_NCPUS; n++) { + object_initialize(&s->cpus[n], sizeof(s->cpus[n]), + s->cpu_type); + object_property_add_child(obj, "cpu[*]", OBJECT(&s->cpus[n]), + &error_abort); + } + obj =3D object_property_get_link(OBJECT(dev), "ram", &err); if (obj =3D=3D NULL) { error_setg(errp, "%s: required ram link not found: %s", @@ -150,6 +150,7 @@ static void bcm2836_realize(DeviceState *dev, Error **e= rrp) } =20 static Property bcm2836_props[] =3D { + DEFINE_PROP_STRING("cpu-type", BCM2836State, cpu_type), DEFINE_PROP_UINT32("enabled-cpus", BCM2836State, enabled_cpus, BCM2836= _NCPUS), DEFINE_PROP_END_OF_LIST() }; diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index cd5fa8c3dc..c24a4a1b14 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -135,6 +135,8 @@ static void raspi2_init(MachineState *machine) /* Setup the SOC */ object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram), &error_abort); + object_property_set_str(OBJECT(&s->soc), machine->cpu_type, "cpu-type", + &error_abort); object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus", &error_abort); object_property_set_int(OBJECT(&s->soc), 0xa21041, "board-rev", @@ -166,6 +168,7 @@ static void raspi2_machine_init(MachineClass *mc) mc->no_parallel =3D 1; mc->no_floppy =3D 1; mc->no_cdrom =3D 1; + mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a15"); mc->max_cpus =3D BCM2836_NCPUS; mc->min_cpus =3D BCM2836_NCPUS; mc->default_cpus =3D BCM2836_NCPUS; diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h index 76de1996af..4758b4ae54 100644 --- a/include/hw/arm/bcm2836.h +++ b/include/hw/arm/bcm2836.h @@ -25,6 +25,7 @@ typedef struct BCM2836State { DeviceState parent_obj; /*< public >*/ =20 + char *cpu_type; uint32_t enabled_cpus; =20 ARMCPU cpus[BCM2836_NCPUS]; --=20 2.14.3 From nobody Sat May 18 06:50:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518764678686767.4591508090907; Thu, 15 Feb 2018 23:04:38 -0800 (PST) Received: from localhost ([::1]:45303 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ema4T-0004qd-Lc for importer@patchew.org; Fri, 16 Feb 2018 02:04:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ema2E-0003QT-HY for qemu-devel@nongnu.org; Fri, 16 Feb 2018 02:02:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ema2B-0007kw-KJ for qemu-devel@nongnu.org; Fri, 16 Feb 2018 02:02:18 -0500 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:35596) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ema2B-0007jn-9g for qemu-devel@nongnu.org; Fri, 16 Feb 2018 02:02:15 -0500 Received: by mail-lf0-x244.google.com with SMTP id a204so2767417lfa.2 for ; Thu, 15 Feb 2018 23:02:15 -0800 (PST) Received: from localhost.localdomain (81-175-247-183.bb.dnainternet.fi. [81.175.247.183]) by smtp.gmail.com with ESMTPSA id r9sm3365313ljc.18.2018.02.15.23.02.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2018 23:02: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=gsI41yUflBN/sQ70WetF37+jFA+IW07JvL0bXId/0rQ=; b=uZX5oQmTOVQpegUz9QEyvp87+BKq/x3LIEcvW5Cj+wJm3PS5h77JNtj5BoFActlqCM a/Dl8edKv+q4BaSikSNbbs5ai12OFvn9j5AZSeUKbNKV+87eBhyYyE3PCzog3hiEQUYq 2B2pRYbGPAIC8oi0PqtKMV1Xxmeh5SqQR0oOy3mctXpXjqHWgfitqnIKf8UqSddJ1syf tP6+d/qmsC08I5naeLKaZ0HvlfzbJcK5YPueMGyMrPvH0Oy1FQicYnfbGC/e/045fln9 1BddeZTMSZdHQSZj34awWGvX2j137/DcVztojtpb9o8ib2g0/rdWlWlp6s7OHSxnDL7G O4nQ== 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=gsI41yUflBN/sQ70WetF37+jFA+IW07JvL0bXId/0rQ=; b=NULfcyGgGsp/O+3tkrKfN/Q6zGUYGjO/2lctRQFYzAFRu1kZSX6vgzj9ANcOGR6DtC TRrL0vgX+PwRjh64X+SAj8pDaQYWFr7d5nVJkefYj7OMLe8L949sWcxG0/dLtVe1fE/1 r6Dd3z1Tb1sroJwvenRjRSB4iWFPSfaiPMVp5s/tpMzNiJGqeHlPpX3z37ZemwM+sJ52 9n6JQcfFOUHUTbzLwdnK4CDK014kNRFhwWkNqWTSv1ckudMY0H2sm9TcRWYuAkYIsibp NQZW4TSJ4pyjBz/sDhwNphugKGigEsWJlsJqa0wIXcoIDFXnI+5c0KFKvJ4XB83mgaIr Jl7Q== X-Gm-Message-State: APf1xPC3K91AzxikkTz1KFqYhmeCPodXjzTZuVbn2YyQrwO1eVSUaF8S LeTdNdEYbRCrZkZ8cdzWExEYUxhO X-Google-Smtp-Source: AH8x226OOPcNsDfOXfUyKQu68aCjeC2x5Slk5xU+pAUPylvdryhuwIYJYLPE4JqgpWueTizMhKvv/g== X-Received: by 10.46.4.10 with SMTP id 10mr3577965lje.64.1518764533630; Thu, 15 Feb 2018 23:02:13 -0800 (PST) From: Pekka Enberg To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 09:02:00 +0200 Message-Id: <20180216070201.4271-3-penberg@iki.fi> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180216070201.4271-1-penberg@iki.fi> References: <20180216070201.4271-1-penberg@iki.fi> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::244 Subject: [Qemu-devel] [PATCH v2 2/3] raspi: Raspberry Pi 3 support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Pekka Enberg Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 This patch adds Raspberry Pi 3 support to hw/arm/raspi.c. The differences to Pi 2 are: - Firmware address - Board ID - Board revision The CPU is different too, but that's going to be configured as part of the machine default CPU when we introduce a new machine type. The patch was written from scratch by me but the logic is similar to Zolt=C3=A1n Baldaszti's previous work, which I used as a reference (with permission from the author): https://github.com/bztsrc/qemu-raspi3 Signed-off-by: Pekka Enberg --- hw/arm/raspi.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index c24a4a1b14..66fe10e376 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -5,6 +5,9 @@ * Rasperry Pi 2 emulation Copyright (c) 2015, Microsoft * Written by Andrew Baumann * + * Raspberry Pi 3 emulation Copyright (c) 2018 Zolt=C3=A1n Baldaszti + * Upstream code cleanup (c) 2018 Pekka Enberg=20 + * * This code is licensed under the GNU GPLv2 and later. */ =20 @@ -22,10 +25,11 @@ #define SMPBOOT_ADDR 0x300 /* this should leave enough space for ATAGS = */ #define MVBAR_ADDR 0x400 /* secure vectors */ #define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */ -#define FIRMWARE_ADDR 0x8000 /* Pi loads kernel.img here by default */ +#define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default */ +#define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */ =20 /* Table of Linux board IDs for different Pi versions */ -static const int raspi_boardid[] =3D {[1] =3D 0xc42, [2] =3D 0xc43}; +static const int raspi_boardid[] =3D {[1] =3D 0xc42, [2] =3D 0xc43, [3] = =3D 0xc44}; =20 typedef struct RasPiState { BCM2836State soc; @@ -83,8 +87,8 @@ static void setup_boot(MachineState *machine, int version= , size_t ram_size) binfo.secure_board_setup =3D true; binfo.secure_boot =3D true; =20 - /* Pi2 requires SMP setup */ - if (version =3D=3D 2) { + /* Pi2 and Pi3 requires SMP setup */ + if (version >=3D 2) { binfo.smp_loader_start =3D SMPBOOT_ADDR; binfo.write_secondary_boot =3D write_smpboot; binfo.secondary_cpu_reset_hook =3D reset_secondary; @@ -94,15 +98,16 @@ static void setup_boot(MachineState *machine, int versi= on, size_t ram_size) * the normal Linux boot process */ if (machine->firmware) { + hwaddr firmware_addr =3D version =3D=3D 3 ? FIRMWARE_ADDR_3 : FIRM= WARE_ADDR_2; /* load the firmware image (typically kernel.img) */ - r =3D load_image_targphys(machine->firmware, FIRMWARE_ADDR, - ram_size - FIRMWARE_ADDR); + r =3D load_image_targphys(machine->firmware, firmware_addr, + ram_size - firmware_addr); if (r < 0) { error_report("Failed to load firmware from %s", machine->firmw= are); exit(1); } =20 - binfo.entry =3D FIRMWARE_ADDR; + binfo.entry =3D firmware_addr; binfo.firmware_loaded =3D true; } else { binfo.kernel_filename =3D machine->kernel_filename; @@ -113,7 +118,7 @@ static void setup_boot(MachineState *machine, int versi= on, size_t ram_size) arm_load_kernel(ARM_CPU(first_cpu), &binfo); } =20 -static void raspi2_init(MachineState *machine) +static void raspi_init(MachineState *machine, int version) { RasPiState *s =3D g_new0(RasPiState, 1); uint32_t vcram_size; @@ -139,7 +144,8 @@ static void raspi2_init(MachineState *machine) &error_abort); object_property_set_int(OBJECT(&s->soc), smp_cpus, "enabled-cpus", &error_abort); - object_property_set_int(OBJECT(&s->soc), 0xa21041, "board-rev", + int board_rev =3D version =3D=3D 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_abo= rt); =20 @@ -157,7 +163,12 @@ static void raspi2_init(MachineState *machine) =20 vcram_size =3D object_property_get_uint(OBJECT(&s->soc), "vcram-size", &error_abort); - setup_boot(machine, 2, machine->ram_size - vcram_size); + setup_boot(machine, version, machine->ram_size - vcram_size); +} + +static void raspi2_init(MachineState *machine) +{ + raspi_init(machine, 2); } =20 static void raspi2_machine_init(MachineClass *mc) --=20 2.14.3 From nobody Sat May 18 06:50:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518764675896551.0792566283133; Thu, 15 Feb 2018 23:04:35 -0800 (PST) Received: from localhost ([::1]:45301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ema4O-0004mH-Lu for importer@patchew.org; Fri, 16 Feb 2018 02:04:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ema2E-0003QU-I1 for qemu-devel@nongnu.org; Fri, 16 Feb 2018 02:02:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ema2C-0007lJ-Db for qemu-devel@nongnu.org; Fri, 16 Feb 2018 02:02:18 -0500 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:42854) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ema2C-0007ko-6I for qemu-devel@nongnu.org; Fri, 16 Feb 2018 02:02:16 -0500 Received: by mail-lf0-x244.google.com with SMTP id t204so96559lff.9 for ; Thu, 15 Feb 2018 23:02:15 -0800 (PST) Received: from localhost.localdomain (81-175-247-183.bb.dnainternet.fi. [81.175.247.183]) by smtp.gmail.com with ESMTPSA id r9sm3365313ljc.18.2018.02.15.23.02.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2018 23:02: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; bh=09xzsb++gDC2RMazuMhKUx69oipOdxYr7PztYT45Kek=; b=JfMIamXsz5Rncp4uAfeItUDMS89zGYigdi3OTqUZiUs4PkL8yC1mFhXOhZ4sZYPZM/ puKPvD/UYB+mp7zBLwLLKwFi5M3I3GQRDs24WE7FYTWioc1qUj6Ki+glLKe1lHHVKdJC XDUKZbVQQc+AjfckkOZOYybzh8lFn4EC/m7RUsTxztJZsJPIqM7NPTFInwNZLMmwsOea 60ObWg4TMMdRPbc2brhKzMFoDWfmcWmZwO6BxNDxjUonvn8aoo8a4Z7eYmETqeX7TaC1 VGmMoULRtIZNthLANqckpC3UKaY994Qf6xOm/ROSKpraRgutg0RvFWGQlHfALGIDAIc1 Qqog== 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; bh=09xzsb++gDC2RMazuMhKUx69oipOdxYr7PztYT45Kek=; b=lrNGL5cH5QNZVPsBsK3+tmw1nSe8Wsa9Mq94s4nFytJn0C8I28o7j/dolYaIwqwJvv bJc7HLD4zjhmaDG211+NK9rpFvRKNYRi1J7ZlsjSWDZZX06IG2GzWOkCGVcySjMH3wSx NSKrRn4SIBVjKGyUuRcJC3yZHxDY+42heKq2LVU6gvKtUkGcoE8JfWfAtEjjXpMVTC1r b955GS3rWG+dxfpI56qmd0cGvmmpKGgrbtpXhMtVtMsA0Zd/UgBhFku1Ymm9iklUony8 FcYUF/i7LyCvw2I36m5P2aKiDTE1CL113vX9kcU6LuxsF/xjJEQ3zlDzawa4fnx0kx00 5dSA== X-Gm-Message-State: APf1xPA+ZzqZrAPaOGPnDcTOB278PL00d3H6f1gTfgLiOZXN1/Vg4lwb SOdoqnILnXVVT74JXRdp63psirEG X-Google-Smtp-Source: AH8x227iP7k54sqhFG0ZFQ2yIsaZHLz4i4xKhoQoJ2qOohpno70C8qjdw+3FrgC6+hr6uXW1FASc/A== X-Received: by 10.46.89.20 with SMTP id n20mr3334009ljb.50.1518764534710; Thu, 15 Feb 2018 23:02:14 -0800 (PST) From: Pekka Enberg To: qemu-devel@nongnu.org Date: Fri, 16 Feb 2018 09:02:01 +0200 Message-Id: <20180216070201.4271-4-penberg@iki.fi> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180216070201.4271-1-penberg@iki.fi> References: <20180216070201.4271-1-penberg@iki.fi> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::244 Subject: [Qemu-devel] [PATCH v2 3/3] raspi: Add "raspi3" machine type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Pekka Enberg Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch adds a "raspi3" machine type, which can now be selected as the machine to run on by users via the "-M" command line option to QEMU. The machine type does *not* ignore memory transaction failures so we likely need to add some dummy devices later when people run something more complicated than what I'm using for testing. Signed-off-by: Pekka Enberg --- hw/arm/raspi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 66fe10e376..ff54f45e3e 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -187,3 +187,26 @@ static void raspi2_machine_init(MachineClass *mc) mc->ignore_memory_transaction_failures =3D true; }; DEFINE_MACHINE("raspi2", raspi2_machine_init) + +#ifdef TARGET_AARCH64 +static void raspi3_init(MachineState *machine) +{ + raspi_init(machine, 3); +} + +static void raspi3_machine_init(MachineClass *mc) +{ + mc->desc =3D "Raspberry Pi 3"; + mc->init =3D raspi3_init; + mc->block_default_type =3D IF_SD; + mc->no_parallel =3D 1; + mc->no_floppy =3D 1; + mc->no_cdrom =3D 1; + mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a53"); + mc->max_cpus =3D BCM2836_NCPUS; + mc->min_cpus =3D BCM2836_NCPUS; + mc->default_cpus =3D BCM2836_NCPUS; + mc->default_ram_size =3D 1024 * 1024 * 1024; +} +DEFINE_MACHINE("raspi3", raspi3_machine_init) +#endif --=20 2.14.3