From nobody Sun Nov 24 12:34:48 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=starfivetech.com) ARC-Seal: i=2; a=rsa-sha256; t=1723526740; cv=pass; d=zohomail.com; s=zohoarc; b=hLDn8i2xSk+Z39sqgJqkaBQ9a7bSgvVfEXO0iIIbSvKMxdltgcQD02fsy3YnpPJigJMj8PtcB5WS+vZeyj8lE6L85ZR42ZnvwdqS6rWcY7F9YesyB6M46qON8LI8DhXzTufN66EOeBtqS/vYBbD2Vpek5cigF+xnlkO8of3BBe8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723526740; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HJmqaOfHU2UZFFr1RMmErXlPOwQc+KWCaLdFoV1GKx4=; b=PeHgalhuxU7gTf1HEk04mCvwNqnTXbv7IFV7kj/f6x77hmo7mf3JuqC1wZ5VdwG6rlb0sQBUwSn+oVOMPX9Q0n5FX9O/VPmbjwWjGuOQ0t0Z2JXzLiQJLpkTDqq++LLIss2nM3RHCIqnAAnkLPQY4mZPXMSk0ZGR3Gii5OMIZ3w= ARC-Authentication-Results: i=2; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=starfivetech.com) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1723526740070652.2372130341869; Mon, 12 Aug 2024 22:25:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdk1U-0008Ds-VR; Tue, 13 Aug 2024 01:24:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdk0Q-0006q1-QK; Tue, 13 Aug 2024 01:23:44 -0400 Received: from mail-sh0chn02on20701.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::701] helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sdk0M-0001ZA-VL; Tue, 13 Aug 2024 01:23:38 -0400 Received: from NT0PR01MB1278.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:12::10) by NT0PR01MB0976.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.27; Tue, 13 Aug 2024 05:22:54 +0000 Received: from NT0PR01MB1278.CHNPR01.prod.partner.outlook.cn ([fe80::f2b4:577:ed05:9abc]) by NT0PR01MB1278.CHNPR01.prod.partner.outlook.cn ([fe80::f2b4:577:ed05:9abc%6]) with mapi id 15.20.7828.031; Tue, 13 Aug 2024 05:22:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B5wkxou57FI5DvZ/bk+n5ifTC2QFySabVTt/LYknkrqOe1UBS0db/4WGGYpVzEyJNJl2atSD5BELyN5rAEvrJtzcVKTknglj1NyvL19kRB56117Tb1Ett8bClD+4r8ouOHNX5zT1kE8ORkrwEv1tzgN61bo9rcVGlEGXiDMYkmIpDyhXAf18XNndAEc3PsBZnVRGGYcJ5EQbdaMmyJoApw15k0BFOcDou945jYsZofx5DTRs3jWUhIG+0T1/GhyREqJ2289t4xigNVIsF25tVLAfY2Vpmoobb0LLuRR2eOGdldA/1MBfJXS9kO0gJtzhFwMBkQLFw6LNcSV85JgTHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HJmqaOfHU2UZFFr1RMmErXlPOwQc+KWCaLdFoV1GKx4=; b=msMccxmeRWCpu3c3Cogayr0DmHZIAMODyTF1swQfLvjHk0kynSKsF7dU9UjHd4yVhf3/YLtBbCo4yyu7x1o2l2MDKwu3wIR8hxKWsjwQz/oflbdeE0a6eqC3yzc7+Q2syTS6apjDmm5vsOl1YctMMkdkaIw98jNRjK2UlE4yRneNjxC7rBPrJa0Fhewfh5GhDy1y2Q1A0UmQCmrTNgbhabFRrBCTqFovbVeaAYgzTe9qyKh6OOUrXF+aolPuYqyl7F9GO5HyPoIPIJftxCdNS0qq16n59dczC9l7UHZi3QlUmVRycG52oWquotqKBHVCFw5sNJ4HzLJiinUhIYulgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; From: Sia Jee Heng To: qemu-arm@nongnu.org, qemu-devel@nongnu.org, qemu-riscv@nongnu.org Cc: mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, peter.maydell@linaro.org, jeeheng.sia@starfivetech.com, shannon.zhaosl@gmail.com, sunilvl@ventanamicro.com, palmer@dabbelt.com, alistair.francis@wdc.com, bin.meng@windriver.com, liwei1518@gmail.com, dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com Subject: [PATCH v3 2/3] hw/acpi: Upgrade ACPI SPCR table to support SPCR table version 4 format Date: Mon, 12 Aug 2024 22:22:22 -0700 Message-Id: <20240813052223.1033420-3-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240813052223.1033420-1-jeeheng.sia@starfivetech.com> References: <20240813052223.1033420-1-jeeheng.sia@starfivetech.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: ZQ0PR01CA0022.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:2::23) To NT0PR01MB1278.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:12::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: NT0PR01MB1278:EE_|NT0PR01MB0976:EE_ X-MS-Office365-Filtering-Correlation-Id: e7854b25-1734-49c1-0e15-08dcbb57fc2f X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|41320700013|1800799024|52116014|7416014|38350700014; X-Microsoft-Antispam-Message-Info: 5NW6YyoEDBtQ+3TcWO9zYBXsdqBVoWVjBzpVKp4lk/RwjrBoITdCJMyyWi7o7LsOvWD4HW11M34TPsLqoInu/aWSIHCz9X7HNe23oTpMK1s0KZIpYz9ldPulXSiIFE0T2xpFSn2LKrp8FSjI0BDHphn5NFx1znLgDmSBb8enxK481XmT0BAUXRxWgYhkO6AM7YFom7SDdv4t9P9EPWsnf4As86bZhN6cCJBaIXx+zZzKK1Aav2XVrQpVGG9vxzLPC/MWQJy53tA0V4YMPtfit6IdWPEWi/1RoNayUUzky3jWEbxhTY9LaNtCmBXqb0dHtmXzKnnkieR63suSmcW44FuUzjanVbuInsll8w/n9sN5+nKiflCKb46Ng3NvCC+ptDWnCtrPCC9im20WlSmJmiJfsnVsd2WhytX6KZbaYx2BsXQSFhe5hP84tJ6bnFsKps0DeUYtW/0byJtDUm90cbtnjqYigCwHjiKgmGeQUco2Yfa700dwylSnTUFwRyoBOU12Osyyh88VHdjqBcOiqVGtsqapjM/9YXvbVCL2RMfjq1T2FA8ZDvxfKN9KJlEzafUIlxmTgGTK84abHAnJba24i1/kbNwUnLaenYN4z+zvDMnWTBiqsOmWPx+HEwGu X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:NT0PR01MB1278.CHNPR01.prod.partner.outlook.cn; PTR:; CAT:NONE; SFS:(13230040)(366016)(41320700013)(1800799024)(52116014)(7416014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?zvXjM1vZwsYX52a/uSgt8jWebRRz23zpY5IXIKs6f884kxW8EI4Xtn4q5eJz?= =?us-ascii?Q?qOSTF/ru/5No0YPzt/i0HW5pfAbhfl1Ii8CXXIVw6DXDb1qvFdma8lHqbeIx?= =?us-ascii?Q?igLj1TGxibCmShbBa9Fzyh9iAjEwK8+9ALQghiZun0zHpqVp29jqtbsmmTDY?= =?us-ascii?Q?d2HPwWuyKFX+IQ51hmFnSC9WqwpjufpS2+8T7hpCx0PpJCAhUkh44/mAPmYn?= =?us-ascii?Q?mu3TibxMzZK8B9CugqhTVsRjtmD2YyxOcZNkXJMd1VI3vtoAKNtqv7jGaZlY?= =?us-ascii?Q?jBdXJSq1yYW5TXdHWypZ6ovVQNZ2S9rqK8oPlDxJDjX4zxwCtdDOQJv0bBPk?= =?us-ascii?Q?XsRVXQB2x5wPEb2dnSRStyMYNpKs4ZJZGpVAGj4i/7GSt41Mun1YJp4hchOW?= =?us-ascii?Q?46POBvwS7cAQhUt840/PFiu+lJc5GWNeV/JyDupaLGsVq0/Ovlsa7S3nnKQx?= =?us-ascii?Q?izu81ljgm9WCypJdT/cqttEht0iNwKTmBHsIdKBv2bcyuqN5FhciW8PLMv3c?= =?us-ascii?Q?an1Qm147esFy+ItvPsngqrbNdOMnhJn6SrQCPmNgRxMVCwbS7ezTaTpQe1KU?= =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AVI0yLjNNBpfY?= =?us-ascii?Q?WMQSC6+BY2gsMl0eu24cI4qCR4DCkv0L7UsaaRQywAXGatQcB624rcW8WyUV?= =?us-ascii?Q?gqUz08OZYdfZh7sO8GIjRxBSYSvk1WWQQC2sgEqINkqMMOyIeB9GuU4hJPpG?= =?us-ascii?Q?6w=3D=3D?= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7854b25-1734-49c1-0e15-08dcbb57fc2f X-MS-Exchange-CrossTenant-AuthSource: NT0PR01MB1278.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 05:22:54.8926 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kiS14ypSL1dJPB6ddbYNT5mwGnH+vfj5WPZxGuXMlTLYcmzCm6CkF6cLVjBnbqQJ2Jc8C2B0D1FkT1p8/oJ4xyy3mLcIFuK6r13DKBN/wsQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: NT0PR01MB0976 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2406:e500:4420:2::701; envelope-from=jeeheng.sia@starfivetech.com; helo=CHN02-SH0-obe.outbound.protection.partner.outlook.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1723526741882116600 Content-Type: text/plain; charset="utf-8" Update the SPCR table to accommodate the SPCR Table version 4 [1]. The SPCR table has been modified to adhere to the version 4 format [2]. [1]: https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/se= rial-port-console-redirection-table [2]: https://github.com/acpica/acpica/pull/931 Signed-off-by: Sia Jee Heng Acked-by: Alistair Francis --- hw/acpi/aml-build.c | 14 +++++++++++--- hw/arm/virt-acpi-build.c | 10 ++++++++-- hw/riscv/virt-acpi-build.c | 12 +++++++++--- include/hw/acpi/acpi-defs.h | 7 +++++-- include/hw/acpi/aml-build.h | 2 +- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 6d4517cfbe..7c43573eef 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1996,7 +1996,7 @@ static void build_processor_hierarchy_node(GArray *tb= l, uint32_t flags, =20 void build_spcr(GArray *table_data, BIOSLinker *linker, const AcpiSpcrData *f, const uint8_t rev, - const char *oem_id, const char *oem_table_id) + const char *oem_id, const char *oem_table_id, const char *= name) { AcpiTable table =3D { .sig =3D "SPCR", .rev =3D rev, .oem_id =3D oem_i= d, .oem_table_id =3D oem_table_id }; @@ -2042,8 +2042,16 @@ void build_spcr(GArray *table_data, BIOSLinker *link= er, build_append_int_noprefix(table_data, f->pci_flags, 4); /* PCI Segment */ build_append_int_noprefix(table_data, f->pci_segment, 1); - /* Reserved */ - build_append_int_noprefix(table_data, 0, 4); + /* UartClkFreq */ + build_append_int_noprefix(table_data, f->uart_clk_freq, 4); + /* PreciseBaudrate */ + build_append_int_noprefix(table_data, f->precise_baudrate, 4); + /* NameSpaceStringLength */ + build_append_int_noprefix(table_data, f->namespace_string_length, 2); + /* NameSpaceStringOffset */ + build_append_int_noprefix(table_data, f->namespace_string_offset, 2); + /* NamespaceString[] */ + g_array_append_vals(table_data, name, f->namespace_string_length); =20 acpi_table_end(linker, &table); } diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index e10cad86dd..ae075dc9fd 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -435,11 +435,12 @@ build_iort(GArray *table_data, BIOSLinker *linker, Vi= rtMachineState *vms) =20 /* * Serial Port Console Redirection Table (SPCR) - * Rev: 1.07 + * Rev: 1.10 */ static void spcr_setup(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) { + const char name[] =3D "."; AcpiSpcrData serial =3D { .interface_type =3D 3, /* ARM PL011 UART */ .base_addr.id =3D AML_AS_SYSTEM_MEMORY, @@ -463,9 +464,14 @@ spcr_setup(GArray *table_data, BIOSLinker *linker, Vir= tMachineState *vms) .pci_function =3D 0, .pci_flags =3D 0, .pci_segment =3D 0, + .uart_clk_freq =3D 0, + .precise_baudrate =3D 0, + .namespace_string_length =3D sizeof(name), + .namespace_string_offset =3D 88, }; =20 - build_spcr(table_data, linker, &serial, 2, vms->oem_id, vms->oem_table= _id); + build_spcr(table_data, linker, &serial, 4, vms->oem_id, vms->oem_table= _id, + name); } =20 /* diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c index 36d6a3a412..68ef15acac 100644 --- a/hw/riscv/virt-acpi-build.c +++ b/hw/riscv/virt-acpi-build.c @@ -200,14 +200,15 @@ acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uar= t_memmap, =20 /* * Serial Port Console Redirection Table (SPCR) - * Rev: 1.07 + * Rev: 1.10 */ =20 static void spcr_setup(GArray *table_data, BIOSLinker *linker, RISCVVirtState *s) { + const char name[] =3D "."; AcpiSpcrData serial =3D { - .interface_type =3D 0, /* 16550 compatible */ + .interface_type =3D 0x12, /* 16550 compatible */ .base_addr.id =3D AML_AS_SYSTEM_MEMORY, .base_addr.width =3D 32, .base_addr.offset =3D 0, @@ -229,9 +230,14 @@ spcr_setup(GArray *table_data, BIOSLinker *linker, RIS= CVVirtState *s) .pci_function =3D 0, .pci_flags =3D 0, .pci_segment =3D 0, + .uart_clk_freq =3D 0, + .precise_baudrate =3D 0, + .namespace_string_length =3D sizeof(name), + .namespace_string_offset =3D 88, }; =20 - build_spcr(table_data, linker, &serial, 2, s->oem_id, s->oem_table_id); + build_spcr(table_data, linker, &serial, 4, s->oem_id, s->oem_table_id, + name); } =20 /* RHCT Node[N] starts at offset 56 */ diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index 0e6e82b339..2e6e341998 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -112,7 +112,6 @@ typedef struct AcpiSpcrData { uint8_t flow_control; uint8_t terminal_type; uint8_t language; - uint8_t reserved1; uint16_t pci_device_id; /* Must be 0xffff if not PCI device */ uint16_t pci_vendor_id; /* Must be 0xffff if not PCI device */ uint8_t pci_bus; @@ -120,7 +119,11 @@ typedef struct AcpiSpcrData { uint8_t pci_function; uint32_t pci_flags; uint8_t pci_segment; - uint32_t reserved2; + uint32_t uart_clk_freq; + uint32_t precise_baudrate; + uint32_t namespace_string_length; + uint32_t namespace_string_offset; + char namespace_string[]; } AcpiSpcrData; =20 #define ACPI_FADT_ARM_PSCI_COMPLIANT (1 << 0) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index a3784155cb..68c0f2dbee 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -500,5 +500,5 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker,= GArray *tcpalog, =20 void build_spcr(GArray *table_data, BIOSLinker *linker, const AcpiSpcrData *f, const uint8_t rev, - const char *oem_id, const char *oem_table_id); + const char *oem_id, const char *oem_table_id, const char *= name); #endif --=20 2.34.1