From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 8A2D7941D70 for ; Tue, 9 Jan 2024 16:29:57 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=hrXMI48OU1rrNzlf3N3QmUcFJjtdXkdfs3gsY51x6JI=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1704817796; v=1; b=sDNQyKbE7on45OOtbgNk4mQLCRGHe+717YXocuBW09UpbUgVvO2Aj4c6ljflSxWA+w4WItBW NwZEp2spl6RCmMtTvihpvWwHv92tnup0fn234fH71ZCngGz2RrbnbCth7XA89k0gLd7bT4upydk TnNVl0hkbsQMfbSRqB9ceeqU= X-Received: by 127.0.0.2 with SMTP id pzqkYY7687511xgLIo2qQP20; Tue, 09 Jan 2024 08:29:56 -0800 X-Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by mx.groups.io with SMTP id smtpd.web11.21023.1704817795667230767 for ; Tue, 09 Jan 2024 08:29:55 -0800 X-Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d480c6342dso25387305ad.2 for ; Tue, 09 Jan 2024 08:29:55 -0800 (PST) X-Gm-Message-State: TnyJbuqy11jlad7cN877vyuzx7686176AA= X-Google-Smtp-Source: AGHT+IGF1NScJHDRd5nKdm8fJEfbBapxp7HXQ2AikE+r0XWjd3BLXwXhJCnbzteeC+jN4/M5NaGXLw== X-Received: by 2002:a17:902:9a4c:b0:1d4:dddc:d38d with SMTP id x12-20020a1709029a4c00b001d4dddcd38dmr5473097plv.57.1704817794591; Tue, 09 Jan 2024 08:29:54 -0800 (PST) X-Received: from localhost.localdomain ([106.51.188.200]) by smtp.gmail.com with ESMTPSA id c12-20020a170902b68c00b001d457090851sm1983596pls.289.2024.01.09.08.29.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 08:29:54 -0800 (PST) From: "Sunil V L" To: devel@edk2.groups.io Cc: Sunil V L , Ard Biesheuvel , Leif Lindholm , Pierre Gondois , Sami Mujawar , Andrei Warkentin , Laszlo Ersek , AbdulLateef Attar , Jeff Brasen Subject: [edk2-devel] [RFC PATCH v1 00/20] DynamicTablesPkg: Prepare to add RISC-V support Date: Tue, 9 Jan 2024 21:59:24 +0530 Message-Id: <20240109162944.528006-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sunilvl@ventanamicro.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=sDNQyKbE; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io DynamicTablesPkg can be used by RISC-V platforms to generate ACPI tables from FDT passed from previous stage FW. However, DynamicTablesPkg currently is ARM specific even though several parsers and ACPI generators can be used across architectures. For ex: SSDT (PCIe), SSDT (CPU), MCFG, SPCR, DBG2, FADT, SRAT, Raw (DSDT) are mostly common across architectures. Only MADT, IORT and GTDT are ARM specific. This series tries to refactor the DynamicTablesPkg so that RISC-V support can be added fairly easily later. While the approach taken in this series reduces the code duplication as much as possible, it has the side effect of large changes and impacts platforms that support DynamicTablesPkg today (ex: JunoPkg, ArmKvmTool etc). Other approach I tried initially was to duplicate most of the things from Arm to RISC-V. But it was too much of code duplication which is bad in my opinion. To help the review, the series is also available at https://github.com/vlsunil/edk2/tree/dyn_tables_refactor_rfc_v1 Corresponding changes in edk2-platforms are at https://github.com/vlsunil/edk2-platforms/tree/dyn_tables_approach2_v1 I have built tested the changes for following platforms enabling DYNAMIC_TABLES_FRAMEWORK. - ArmJuno.dsc - ArmVExpress-FVP-AArch64.dsc - ArmVirtKvmTool.dsc But due to the nature of the changes, if the approach is fine, I will need some help to test those platforms which support DynamicTables. The series passes CI tests. Looking forward for your feedback!. I am happy to try if there are any better methods to add support for other architectures. Addition of RISC-V support PoC code (on top of this series) is available at https://github.com/vlsunil/edk2/tree/dyn_tables_riscv_rfc_v1 PS: PoC code for the code duplication approach is available at https://github.com/vlsunil/edk2/commits/dyn_tables_approch1_v1/. This was just quick work. It has the advantage of lesser impact on existing ARM platforms. But looks too bad to me because of code duplication. Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Pierre Gondois Cc: Sami Mujawar Cc: Andrei Warkentin Cc: Laszlo Ersek Cc: AbdulLateef Attar (Abdul Lateef) Cc: Jeff Brasen Sunil V L (20): DynamicTablesPkg: FdtHwInfoParserLib: Move ARM parsers to Arm directory DynamicTablesPkg: Move common ACPI libraries from folder DynamicTablesPkg: Update ACPI common libraries BASE_NAME DynamicTablesPkg: Rename ArmNameSpaceObjects to ArchNameSpaceObjects DynamicTablesPkg: DynamicPlatRepoLib: Rename ArmObjList as ArchObjList DynamicTablesPkg: Rename EObjNameSpaceArm to EObjNameSpaceArch DynamicTablesPkg: FdtHwInfoParserLib: Separate ARM specific code DynamicTablesPkg: FdtHwInfoParserLib: Pci: Make it common for architectures DynamicTablesPkg: FdtHwInfoParserLib: Make Serial parser arch neutral DynamicTablesPkg: FdtHwInfoParserLib: Move ArmLib.h to ArmGicCParser.c DynamicTablesPkg: TableHelperLib: Populate OemTableId using ConfigManager DynamicTablesPkg: Add CreatorId in CM_STD_OBJ_CONFIGURATION_MANAGER_INFO DynamicTablesPkg: FdtHwInfoParserLib: Move ARM utilities to separate file DynamicTablesPkg/FdtHwInfoParserLib: Add function for INTC address cells DynamicTablesPkg: AcpiSsdtCpuTopologyLib: Move GICC from common code DynamicTablesPkg: AcpiFadtLib: Move ArmBootArch to ARM specific file DynamicTablesPkg: DynamicTableManagerDxe: Refactor to allow other archs DynamicTablesPkg: X86: Add interfaces to succeed CI tests DynamicTablesPkg/AmlLib: Fix typo DynamicTablesPkg.ci.yaml: Update exception and ignore list DynamicTablesPkg/DynamicTables.dsc.inc | 45 +- .../DynamicTableManagerDxe.inf | 9 +- .../AcpiDbg2Lib/AcpiDbg2Lib.inf} | 15 +- .../AcpiFadtLib/AcpiFadtLib.inf} | 13 +- .../AcpiMcfgLib/AcpiMcfgLib.inf} | 9 +- .../AcpiPcctLib/AcpiPcctLib.inf} | 2 +- .../AcpiPpttLib/AcpiPpttLib.inf} | 2 +- .../AcpiRawLib/AcpiRawLib.inf} | 9 +- .../AcpiSpcrLib/AcpiSpcrLib.inf} | 9 +- .../AcpiSratLib/AcpiSratLib.inf} | 2 +- .../SsdtCpuTopologyLib.inf} | 9 +- .../AcpiSsdtPcieLib/SsdtPcieLib.inf} | 2 +- .../SsdtSerialPortLib.inf} | 6 +- .../FdtHwInfoParserLib/FdtHwInfoParserLib.inf | 48 +- .../KvmtoolCfgMgrDxe/ConfigurationManager.h | 10 +- .../DynamicTableManagerDxe.h | 65 +++ ...eSpaceObjects.h => ArchNameSpaceObjects.h} | 428 ++++++++-------- .../Include/ConfigurationManagerObject.h | 8 +- .../Include/Library/AmlLib/AmlLib.h | 1 + .../Include/Library/SsdtPcieSupportLib.h | 12 +- .../Include/Library/SsdtSerialPortFixupLib.h | 8 +- .../Include/StandardNameSpaceObjects.h | 1 + .../Acpi/Common/AcpiFadtLib/FadtGenerator.h | 32 ++ .../AcpiPcctLib}/PcctGenerator.h | 4 +- .../AcpiPpttLib}/PpttGenerator.h | 0 .../SsdtCpuTopologyGenerator.h | 78 ++- .../AcpiSsdtPcieLib}/SsdtPcieGenerator.h | 0 .../DynamicPlatRepoInternal.h | 4 +- .../{ => Arm}/BootArch/ArmBootArchParser.h | 6 +- .../GenericTimer/ArmGenericTimerParser.h | 6 +- .../{ => Arm}/Gic/ArmGicCParser.h | 6 +- .../{ => Arm}/Gic/ArmGicDParser.h | 6 +- .../{ => Arm}/Gic/ArmGicDispatcher.h | 6 +- .../{ => Arm}/Gic/ArmGicItsParser.h | 6 +- .../{ => Arm}/Gic/ArmGicMsiFrameParser.h | 6 +- .../{ => Arm}/Gic/ArmGicRParser.h | 6 +- .../FdtHwInfoParserLib/CmObjectDescUtility.h | 6 +- .../FdtHwInfoParserLib/FdtHwInfoParser.h | 27 + .../FdtHwInfoParserInclude.h | 1 - .../Library/FdtHwInfoParserLib/FdtUtility.h | 9 + ...igSpaceParser.h => PciConfigSpaceParser.h} | 30 +- ...mSerialPortParser.h => SerialPortParser.h} | 16 +- .../KvmtoolCfgMgrDxe/ConfigurationManager.c | 20 +- .../ArmDynamicTableManagerDxe.c | 154 ++++++ .../DynamicTableManagerDxe.c | 145 +----- .../X86DynamicTableManagerDxe.c | 44 ++ .../Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c | 62 +-- .../Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 182 +++---- .../Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c | 124 ++--- .../SsdtCmn600Generator.c | 34 +- .../AcpiDbg2Lib}/Dbg2Generator.c | 14 +- .../Common/AcpiFadtLib/ArmFadtGenerator.c | 80 +++ .../AcpiFadtLib}/FadtGenerator.c | 115 +---- .../AcpiMcfgLib}/McfgGenerator.c | 22 +- .../AcpiPcctLib}/PcctGenerator.c | 148 +++--- .../AcpiPpttLib}/PpttGenerator.c | 86 ++-- .../AcpiRawLib}/RawGenerator.c | 0 .../AcpiSpcrLib}/SpcrGenerator.c | 12 +- .../AcpiSratLib}/SratGenerator.c | 82 ++-- .../ArmSsdtCpuTopologyGenerator.c | 179 +++++++ .../SsdtCpuTopologyGenerator.c | 282 ++++------- .../AcpiSsdtPcieLib}/SsdtPcieGenerator.c | 112 ++--- .../SsdtSerialPortGenerator.c | 12 +- .../Common/AmlLib/CodeGen/AmlCodeGen.c | 3 +- .../Library/Common/AmlLib/Parser/AmlParser.c | 2 +- .../Library/Common/AmlLib/Tree/AmlNode.c | 2 +- .../DynamicPlatRepoLib/CmObjectTokenFixer.c | 22 +- .../DynamicPlatRepoLib/DynamicPlatRepo.c | 54 +- .../Common/DynamicPlatRepoLib/TokenMapper.c | 8 +- .../SsdtPcieSupportLib/SsdtPcieSupportLib.c | 12 +- .../SsdtSerialPortFixupLib.c | 38 +- .../ConfigurationManagerObjectParser.c | 460 +++++++++--------- .../Common/TableHelperLib/TableHelper.c | 32 +- .../Arm/ArmFdtHwInfoParser.c | 83 ++++ .../FdtHwInfoParserLib/Arm/ArmFdtUtility.c | 114 +++++ .../{ => Arm}/BootArch/ArmBootArchParser.c | 28 +- .../GenericTimer/ArmGenericTimerParser.c | 36 +- .../{ => Arm}/Gic/ArmGicCParser.c | 121 ++--- .../{ => Arm}/Gic/ArmGicDParser.c | 30 +- .../{ => Arm}/Gic/ArmGicDispatcher.c | 18 +- .../{ => Arm}/Gic/ArmGicItsParser.c | 40 +- .../{ => Arm}/Gic/ArmGicMsiFrameParser.c | 32 +- .../{ => Arm}/Gic/ArmGicRParser.c | 36 +- .../FdtHwInfoParserLib/CmObjectDescUtility.c | 10 +- .../FdtHwInfoParserLib/FdtHwInfoParser.c | 78 +-- .../Library/FdtHwInfoParserLib/FdtUtility.c | 71 --- ...igSpaceParser.c => PciConfigSpaceParser.c} | 71 ++- ...mSerialPortParser.c => SerialPortParser.c} | 94 ++-- DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 7 +- 89 files changed, 2382 insertions(+), 1997 deletions(-) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiDbg2LibArm/AcpiDbg2LibArm.inf => Common/AcpiDbg2Lib/AcpiDbg2Lib.inf} (85%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiFadtLibArm/AcpiFadtLibArm.inf => Common/AcpiFadtLib/AcpiFadtLib.inf} (82%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiMcfgLibArm/AcpiMcfgLibArm.inf => Common/AcpiMcfgLib/AcpiMcfgLib.inf} (85%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiPcctLibArm/AcpiPcctLibArm.inf => Common/AcpiPcctLib/AcpiPcctLib.inf} (90%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiPpttLibArm/AcpiPpttLibArm.inf => Common/AcpiPpttLib/AcpiPpttLib.inf} (90%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiRawLibArm/AcpiRawLibArm.inf => Common/AcpiRawLib/AcpiRawLib.inf} (85%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf => Common/AcpiSpcrLib/AcpiSpcrLib.inf} (86%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSratLibArm/AcpiSratLibArm.inf => Common/AcpiSratLib/AcpiSratLib.inf} (90%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyLibArm.inf => Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyLib.inf} (81%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf => Common/AcpiSsdtPcieLib/SsdtPcieLib.inf} (91%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf => Common/AcpiSsdtSerialPortLib/SsdtSerialPortLib.inf} (87%) create mode 100644 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.h rename DynamicTablesPkg/Include/{ArmNameSpaceObjects.h => ArchNameSpaceObjects.h} (72%) create mode 100644 DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/FadtGenerator.h rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiPcctLibArm => Common/AcpiPcctLib}/PcctGenerator.h (81%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiPpttLibArm => Common/AcpiPpttLib}/PpttGenerator.h (100%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSsdtCpuTopologyLibArm => Common/AcpiSsdtCpuTopologyLib}/SsdtCpuTopologyGenerator.h (60%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSsdtPcieLibArm => Common/AcpiSsdtPcieLib}/SsdtPcieGenerator.h (100%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/BootArch/ArmBootArchParser.h (90%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/GenericTimer/ArmGenericTimerParser.h (93%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicCParser.h (94%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicDParser.h (92%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicDispatcher.h (93%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicItsParser.h (91%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicMsiFrameParser.h (90%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicRParser.h (90%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/{ArmPciConfigSpaceParser.h => PciConfigSpaceParser.h} (84%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/{ArmSerialPortParser.h => SerialPortParser.h} (79%) create mode 100644 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/ArmDynamicTableManagerDxe.c create mode 100644 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/X86DynamicTableManagerDxe.c rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiDbg2LibArm => Common/AcpiDbg2Lib}/Dbg2Generator.c (95%) create mode 100644 DynamicTablesPkg/Library/Acpi/Common/AcpiFadtLib/ArmFadtGenerator.c rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiFadtLibArm => Common/AcpiFadtLib}/FadtGenerator.c (84%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiMcfgLibArm => Common/AcpiMcfgLib}/McfgGenerator.c (92%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiPcctLibArm => Common/AcpiPcctLib}/PcctGenerator.c (87%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiPpttLibArm => Common/AcpiPpttLib}/PpttGenerator.c (93%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiRawLibArm => Common/AcpiRawLib}/RawGenerator.c (100%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSpcrLibArm => Common/AcpiSpcrLib}/SpcrGenerator.c (95%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSratLibArm => Common/AcpiSratLib}/SratGenerator.c (91%) create mode 100644 DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/ArmSsdtCpuTopologyGenerator.c rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSsdtCpuTopologyLibArm => Common/AcpiSsdtCpuTopologyLib}/SsdtCpuTopologyGenerator.c (82%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSsdtPcieLibArm => Common/AcpiSsdtPcieLib}/SsdtPcieGenerator.c (90%) rename DynamicTablesPkg/Library/Acpi/{Arm/AcpiSsdtSerialPortLibArm => Common/AcpiSsdtSerialPortLib}/SsdtSerialPortGenerator.c (95%) create mode 100644 DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtHwInfoParser.c create mode 100644 DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtUtility.c rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/BootArch/ArmBootArchParser.c (82%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/GenericTimer/ArmGenericTimerParser.c (86%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicCParser.c (86%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicDParser.c (85%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicDispatcher.c (91%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicItsParser.c (83%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicMsiFrameParser.c (84%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/{ => Arm}/Gic/ArmGicRParser.c (86%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/{ArmPciConfigSpaceParser.c => PciConfigSpaceParser.c} (89%) rename DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/{ArmSerialPortParser.c => SerialPortParser.c} (85%) -- 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113462): https://edk2.groups.io/g/devel/message/113462 Mute This Topic: https://groups.io/mt/103622702/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-