From nobody Mon May 6 15:43:01 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508761728205148.69881939652953; Mon, 23 Oct 2017 05:28:48 -0700 (PDT) Received: from localhost ([::1]:38536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e6bqM-00006D-Fi for importer@patchew.org; Mon, 23 Oct 2017 08:28:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e6bpT-0008CA-4B for qemu-devel@nongnu.org; Mon, 23 Oct 2017 08:27:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e6bpS-00032M-2S for qemu-devel@nongnu.org; Mon, 23 Oct 2017 08:27:39 -0400 Received: from frisell.zx2c4.com ([192.95.5.64]:40523) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e6bpL-0002zg-0E; Mon, 23 Oct 2017 08:27:31 -0400 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 4ed954d0; Mon, 23 Oct 2017 12:26:08 +0000 (UTC) Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id c958ba46 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Mon, 23 Oct 2017 12:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id; s=mail; bh=LFgrPqAv97hGU7DYYw5Z2kYz9Z8 =; b=0sMyKQA+LwGk5UmY7wpGPvDzYSEl9b3NVsm55ZSr80Pj3AXvwGyaVKPD3X+ SQ6NPd4xoMOU8YJGJuGyQTCeYi2lmqkVSGUwaALafwKon5qd/o4pv/F1K53domyD Yl5p8ea1KAG2SML1+FkuNPCm1nu5tAvs4uDCZCJ7zv0TY3iDPHxPk86tky0xBdKf 1eanTUToX7OS7wUyxMT7Jm8LHCzlJeqjHf1g30obHJ0u/8YsimvXRgXd8NQaaiIv lmGisy2WxxR1DeBzXHPAv4LKZjSfHEbQLlS+7J67DGKh+SUJ0nYvYXQuCVxZxSkr VfGDzqvi0acdZMxHScEdbpfKL8w== From: "Jason A. Donenfeld" To: qemu-arm@nongnu.org, qemu-devel@nongnu.org, qemu-trivial@nongnu.org Date: Mon, 23 Oct 2017 14:27:19 +0200 Message-Id: <20171023122719.17199-1-Jason@zx2c4.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.95.5.64 Subject: [Qemu-devel] [PATCH] hw/arm/virt: support 4 serial ports 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: "Jason A. Donenfeld" 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" The QEMU man page says: -serial dev This option can be used several times to simulate up to 4 serial ports. However, the ARM virt machine erroneously only provides 1 serial port. This patch fixes it by populating 4 of them. But, unfortunately, this patch doesn't actually work. Sending it to the list as inspiration for somebody on the ARM team who might be able to do this more properly. Signed-off-by: Jason A. Donenfeld --- hw/arm/virt.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 9e18b410d7..12b73dfd1e 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -134,11 +134,14 @@ static const MemMapEntry a15memmap[] =3D { [VIRT_GIC_ITS] =3D { 0x08080000, 0x00020000 }, /* This redistributor space allows up to 2*64kB*123 CPUs */ [VIRT_GIC_REDIST] =3D { 0x080A0000, 0x00F60000 }, - [VIRT_UART] =3D { 0x09000000, 0x00001000 }, - [VIRT_RTC] =3D { 0x09010000, 0x00001000 }, - [VIRT_FW_CFG] =3D { 0x09020000, 0x00000018 }, - [VIRT_GPIO] =3D { 0x09030000, 0x00001000 }, - [VIRT_SECURE_UART] =3D { 0x09040000, 0x00001000 }, + [VIRT_UART + 0] =3D { 0x09000000, 0x00001000 }, + [VIRT_UART + 1] =3D { 0x09010000, 0x00001000 }, + [VIRT_UART + 2] =3D { 0x09020000, 0x00001000 }, + [VIRT_UART + 3] =3D { 0x09030000, 0x00001000 }, + [VIRT_RTC] =3D { 0x09040000, 0x00001000 }, + [VIRT_FW_CFG] =3D { 0x09050000, 0x00000018 }, + [VIRT_GPIO] =3D { 0x09060000, 0x00001000 }, + [VIRT_SECURE_UART] =3D { 0x09070000, 0x00001000 }, [VIRT_MMIO] =3D { 0x0a000000, 0x00000200 }, /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that siz= e */ [VIRT_PLATFORM_BUS] =3D { 0x0c000000, 0x02000000 }, @@ -152,14 +155,17 @@ static const MemMapEntry a15memmap[] =3D { }; =20 static const int a15irqmap[] =3D { - [VIRT_UART] =3D 1, - [VIRT_RTC] =3D 2, - [VIRT_PCIE] =3D 3, /* ... to 6 */ - [VIRT_GPIO] =3D 7, - [VIRT_SECURE_UART] =3D 8, - [VIRT_MMIO] =3D 16, /* ...to 16 + NUM_VIRTIO_TRANSPORTS - 1 */ - [VIRT_GIC_V2M] =3D 48, /* ...to 48 + NUM_GICV2M_SPIS - 1 */ - [VIRT_PLATFORM_BUS] =3D 112, /* ...to 112 + PLATFORM_BUS_NUM_IRQS -1 */ + [VIRT_UART + 0] =3D 1, + [VIRT_UART + 1] =3D 2, + [VIRT_UART + 2] =3D 3, + [VIRT_UART + 3] =3D 4, + [VIRT_RTC] =3D 5, + [VIRT_PCIE] =3D 6, /* ... to 9 */ + [VIRT_GPIO] =3D 10, + [VIRT_SECURE_UART] =3D 11, + [VIRT_MMIO] =3D 19, /* ...to 19 + NUM_VIRTIO_TRANSPORTS - 1 */ + [VIRT_GIC_V2M] =3D 51, /* ...to 51 + NUM_GICV2M_SPIS - 1 */ + [VIRT_PLATFORM_BUS] =3D 115, /* ...to 115 + PLATFORM_BUS_NUM_IRQS -1 */ }; =20 static const char *valid_cpus[] =3D { @@ -674,12 +680,12 @@ static void create_uart(const VirtMachineState *vms, = qemu_irq *pic, int uart, qemu_fdt_setprop(vms->fdt, nodename, "clock-names", clocknames, sizeof(clocknames)); =20 - if (uart =3D=3D VIRT_UART) { - qemu_fdt_setprop_string(vms->fdt, "/chosen", "stdout-path", nodena= me); - } else { + if (uart =3D=3D VIRT_SECURE_UART) { /* Mark as not usable by the normal world */ qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disabled"); qemu_fdt_setprop_string(vms->fdt, nodename, "secure-status", "okay= "); + } else { + qemu_fdt_setprop_string(vms->fdt, "/chosen", "stdout-path", nodena= me); } =20 g_free(nodename); @@ -1419,11 +1425,14 @@ static void machvirt_init(MachineState *machine) =20 fdt_add_pmu_nodes(vms); =20 - create_uart(vms, pic, VIRT_UART, sysmem, serial_hds[0]); + create_uart(vms, pic, VIRT_UART + 0, sysmem, serial_hds[0]); + create_uart(vms, pic, VIRT_UART + 1, sysmem, serial_hds[1]); + create_uart(vms, pic, VIRT_UART + 2, sysmem, serial_hds[2]); + create_uart(vms, pic, VIRT_UART + 3, sysmem, serial_hds[3]); =20 if (vms->secure) { create_secure_ram(vms, secure_sysmem); - create_uart(vms, pic, VIRT_SECURE_UART, secure_sysmem, serial_hds[= 1]); + create_uart(vms, pic, VIRT_SECURE_UART, secure_sysmem, serial_hds[= 4]); } =20 create_rtc(vms, pic); --=20 2.14.2