From nobody Tue Nov 26 20:36:09 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=1705367445; cv=pass; d=zohomail.com; s=zohoarc; b=OF/a2FrW6EgZg2LHtnTm1zK0KEW6CuAdq9gqdMZPIbd3P0Jm9RZydDUcw+966b3ZHX0RwGJwnCGrYF4QWUizye8m7j5sZUS+aWOgJo+JJV8fINGBKkko0xfNxJuY22nFBH2EDjljaJcq0NCiY3L9b83tyrgFOq/Nx8OK+PZKnLQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705367445; 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=SWgcDjUyZMtL9DFUEv4cj7M9P0hs02oxETW145rxLtg=; b=ZKeTUPwsyFO4xl1kYR4mbtMgxAXoesflVJe0lXizWcMjyFk7wO9IgUvIU88eGyeoU2YXJsWXtAIWlUMxbktl0GkP5zaEujVQiCPCvNYq452NISsbkOGGXQ3eV6esgWoFOgNaWZSFoMNe3oFfzpX9osl6NNvmq50ZqEtqZz2M25c= 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 1705367445153441.955336832174; Mon, 15 Jan 2024 17:10:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPXy7-0007Uu-2c; Mon, 15 Jan 2024 20:10:19 -0500 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 1rPXy1-0007Qv-8G; Mon, 15 Jan 2024 20:10:13 -0500 Received: from mail-sh0chn02on2062c.outbound.protection.partner.outlook.cn ([2406:e500:4420:2::62c] 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 1rPXxy-0005hs-CI; Mon, 15 Jan 2024 20:10:12 -0500 Received: from SHXPR01MB0574.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1c::14) by SHXPR01MB0527.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Tue, 16 Jan 2024 01:09:54 +0000 Received: from SHXPR01MB0574.CHNPR01.prod.partner.outlook.cn ([fe80::535d:fb55:ed0:334f]) by SHXPR01MB0574.CHNPR01.prod.partner.outlook.cn ([fe80::535d:fb55:ed0:334f%3]) with mapi id 15.20.7135.033; Tue, 16 Jan 2024 01:09:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=acSE9P1sV/s6dLrdtU8S2HL3hSh8wSg20Hk9fQId1BI8zzZN/QeCZwg/JaUYbQpG90zuX/2v1V1O3xLUW2MJGF6KMsRyWPxIlI9hB4dMX7bhi2UDoeK7/V/xjnfaNR6KuuYrhHHkHMa7AkchMTvtpNtEaOjmBlMUILE2igWutneKBrZJkzMDiFftQpbmcsFvj1EomQMO8DBjG4a4QP46z4/uOuVirx2ZdkMsvHymxTDqdNkcr4s83AyrgUxVMSSXSTwY7Z6GtxcI7Om3TEthDLs4EamIDZexQt7SLlvEtbpcnD7maAChxw8SZ4ZqiNn5jnK4I1TzH7KcIsbFK2saog== 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=SWgcDjUyZMtL9DFUEv4cj7M9P0hs02oxETW145rxLtg=; b=Z2Euo63BQEau+fJKZJp+lW+qKM3uQ1+KOTcSLsKo4SYQiarNM3WcVt+iInnqEDau1DsNjs7jxSWPpaX77J1wn6ocAMLZ4+6kf3JoOHYlvz08BJhgqot0hhdJ+aesi54r5uWxUMWlykPScVNJ88HIPYXWTIiyZ5Dcf/M/LePXv7KU82GDuHqL7Z+H05hpzS5X3DPb6p3b/qME2P8Y/UVBJPfVOjV+QVbucBbvR0jSeiDtYuxdgjudahezNSoUogHf7YKxKxNa6CsxUFKEf2qIn/zu5VWS0lGUXMgZBO3VP8H0KPzdpOcuVKrf3xiX5CHts8PgUsXMWpfCTQr9mkzsFA== 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 v2 2/2] hw/riscv/virt-acpi-build.c: Generate SPCR table Date: Mon, 15 Jan 2024 17:09:30 -0800 Message-Id: <20240116010930.43433-3-jeeheng.sia@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240116010930.43433-1-jeeheng.sia@starfivetech.com> References: <20240116010930.43433-1-jeeheng.sia@starfivetech.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: ZQ0PR01CA0031.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:2::16) To SHXPR01MB0574.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1c::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SHXPR01MB0574:EE_|SHXPR01MB0527:EE_ X-MS-Office365-Filtering-Correlation-Id: 412dbab7-e065-439f-0158-08dc162fd972 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0JjhB5pgBW1FYD/xKugSCMLI5rDVGN+bFi48BPsJcVHnAqo254KrtajXerlRJtoMHehVhF/0ZkRfZAFr2N7gIUvkSVSV0dsN+AYmahXj+TG5Mv7Ih0tBSskUsH2/DCL+uJ0n3QJ9o8sGpWciZDxagY7PINm31vjGlwA8Fwfc2vyDoEJDL5/Zh/PTIGV8huD9x3Q09HJeJW7FM4PWs2ALPWEAM1WOLebivU4yJyN6kWt6keBfpxfJbqWtv7KDI9bOSeDTo8iymZz7WgDEGVhd6wa+GmM3VdF5DYmTH/WKJ6I+FPGhqM415eu2i2JGCAQ8bTZl69KK4Hq2O4cpdEaPK6osk0hbqJLWU3x9STlngJgXbyauLHUOYmchWr9YASIDkH9jX1cCGJyiAhafgNS7NA/uxg7Pi2PnRryX3unHaAMY7tn0OghUMypwgm88scbFlzjwd9X7ZKeJoZSiXqj3chZImi67ic7/DIVC6Ea3lQTJmL8KDndD499ElBYQ42Dq5q3NStKGUKlGGUGSzngdajJqhGsLc0bnn3wE2rGghk/x8sgMmSdIPvxjRgKRdgKV X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SHXPR01MB0574.CHNPR01.prod.partner.outlook.cn; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(346002)(39830400003)(396003)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(1076003)(26005)(41320700001)(8936002)(41300700001)(66556008)(66476007)(8676002)(66946007)(508600001)(86362001)(6666004)(2616005)(36756003)(2906002)(38100700002)(38350700005)(5660300002)(40160700002)(52116002)(7416002)(4326008)(40180700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3FQ/UbsVzUX/+3Usmq5fVxDns7Q6qn+Gww6Lzrb0fAQVqYBOEj5BgTGLDOc4?= =?us-ascii?Q?/wEg+d1hYYlkVD0Kxny+/YOofFHT0iXOIAEFzO/lUVrTmUB7997g3OPeP3vp?= =?us-ascii?Q?CNKST69t8tuSQplnFr6F7VtrdJ0HrzVf9ROim2UGVv1OawbS4RtXK1ssSwF9?= =?us-ascii?Q?XhGS+K5xzyS5Ms5KIvtLvzv171wVphGLL44abAjVlSIGXTINmIou2dSyKKKN?= =?us-ascii?Q?sHJmWckFGo+7lF30WwY84TvER3DriHxDvlSwvbR23dAmR55vXFUgndopoVVt?= =?us-ascii?Q?Hj2tDd0IIviXjOgqYDA35d/k36x6nBDXoepNlFIYLe0BdTzhRcbDPfgz4rLd?= =?us-ascii?Q?RvyLLOrg6bbE4uLrPzbYkMBsKyQYEI1ylmCoBf4yHaqNpwTxQ/qL2xEls5cH?= =?us-ascii?Q?x4m3G3Cm/f1Lxc1TxPcr4CpuPDWpi31z/SaF3vz1NX56spwbuE47RQu2ZbNe?= =?us-ascii?Q?VtgrXsnZuFQOVLyYdfPL1+WEhObxU+/BVBZ8z+8AkmbBeOGVOc1z3U/vxQdW?= =?us-ascii?Q?/pQais6KnEW7ciy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VAFfjfoeWyokSV?= =?us-ascii?Q?/bC34HggG3spwwZCF0Ltv+XCUBryL8tFzMz+X6WP1xaY+VhYFuc8QtOkqUHT?= =?us-ascii?Q?8B6Naf6RP67t0gVQ+KlSUlPhgIoj/4f/t17fxBApCiyLbFGTvuBNwbjwf9eX?= =?us-ascii?Q?aqJNKsL6MH2pvYXgw4mp1AQwyFJxNL1RrBKhObQ8FgXspzSHKfICCNkRj9fE?= =?us-ascii?Q?2A=3D=3D?= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 412dbab7-e065-439f-0158-08dc162fd972 X-MS-Exchange-CrossTenant-AuthSource: SHXPR01MB0574.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2024 01:09:54.9501 (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: 7Z+006pjy77HiNUa2wgDMBAb+9MW4XkGkhsp7KUqBOiJuqjLZ4qbRWOjE+heWpQ3nmsNI48l19gdA3L7H4NdZcAMpSMP4VPCB0Mzira1G8Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SHXPR01MB0527 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::62c; 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: 1705367446893100005 Content-Type: text/plain; charset="utf-8" Generate Serial Port Console Redirection Table (SPCR) for RISC-V virtual machine. Signed-off-by: Sia Jee Heng Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- hw/riscv/virt-acpi-build.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c index 26c7e4482d..7fc5071c84 100644 --- a/hw/riscv/virt-acpi-build.c +++ b/hw/riscv/virt-acpi-build.c @@ -174,6 +174,42 @@ acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart= _memmap, aml_append(scope, dev); } =20 +/* + * Serial Port Console Redirection Table (SPCR) + * Rev: 1.07 + */ + +static void +spcr_setup(GArray *table_data, BIOSLinker *linker, RISCVVirtState *s) +{ + AcpiSpcrData serial =3D { + .interface_type =3D 0, /* 16550 compatible */ + .base_addr.id =3D AML_AS_SYSTEM_MEMORY, + .base_addr.width =3D 32, + .base_addr.offset =3D 0, + .base_addr.size =3D 1, + .base_addr.addr =3D s->memmap[VIRT_UART0].base, + .interrupt_type =3D (1 << 4),/* Bit[4] RISC-V PLIC/APLIC */ + .pc_interrupt =3D 0, + .interrupt =3D UART0_IRQ, + .baud_rate =3D 7, /* 15200 */ + .parity =3D 0, + .stop_bits =3D 1, + .flow_control =3D 0, + .terminal_type =3D 3, /* ANSI */ + .language =3D 0, /* Language */ + .pci_device_id =3D 0xffff, /* not a PCI device*/ + .pci_vendor_id =3D 0xffff, /* not a PCI device*/ + .pci_bus =3D 0, + .pci_device =3D 0, + .pci_function =3D 0, + .pci_flags =3D 0, + .pci_segment =3D 0, + }; + + build_spcr(table_data, linker, &serial, 2, s->oem_id, s->oem_table_id); +} + /* RHCT Node[N] starts at offset 56 */ #define RHCT_NODE_ARRAY_OFFSET 56 =20 @@ -555,6 +591,9 @@ static void virt_acpi_build(RISCVVirtState *s, AcpiBuil= dTables *tables) acpi_add_table(table_offsets, tables_blob); build_rhct(tables_blob, tables->linker, s); =20 + acpi_add_table(table_offsets, tables_blob); + spcr_setup(tables_blob, tables->linker, s); + acpi_add_table(table_offsets, tables_blob); { AcpiMcfgInfo mcfg =3D { --=20 2.34.1