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 1199EAC11AE for ; Thu, 14 Mar 2024 15:16:09 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=u5wom3M1EkKyY5PFUhM1pYsaIqrxziQGn/Oh/PUegpE=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240206; t=1710429368; v=1; b=WbMvMyNFi+96XDP55GoDde2mYGMor/FexXORM2MYfT8HxylHGSq0A/1cw5u1DOtxWhklO+fQ VgbtnNk7E3sFJvHhZK9sDH3vlLRb+FOOYRpUnSIhkZHmXNxVuqT7HGItNIBAKBOC34Jivobhihz Zu/IO4Ah+iuSVRLbdSfh9a/Ldo7Dd4iMjow0HWnE+vWj7M1tH23If1cfFwgYtXmR2TO8whG1k7p BBBY56YWp2a7lAHDrUjt8bIfYQI6D4ZfxPKbZAWyJU0+Vk7Rm8bCj+xQJmTUy0qPF4zG09ddqSN TOSjEMuKTyw0SUzXvP47RlETCYHwAvjvNGlpW92XwlZvg== X-Received: by 127.0.0.2 with SMTP id mOwEYY7687511xGknjf40Hiw; Thu, 14 Mar 2024 08:16:08 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.15324.1710429368180942743 for ; Thu, 14 Mar 2024 08:16:08 -0700 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B07FC614F7 for ; Thu, 14 Mar 2024 15:16:07 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EB38C433C7 for ; Thu, 14 Mar 2024 15:16:07 +0000 (UTC) X-Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-512e4f4e463so1230387e87.1 for ; Thu, 14 Mar 2024 08:16:07 -0700 (PDT) X-Gm-Message-State: Px8Uzub3TAsJJcrQPfKnCCdox7686176AA= X-Google-Smtp-Source: AGHT+IFNhIr669E7OWh1tzh2XKT0qH3MUimVaRTXvYYd5NK2NkbujL73IDsY5m4MpuXeopDQAJkLvbKvPQMkg1wbqQc= X-Received: by 2002:a19:3802:0:b0:512:cc50:c3e0 with SMTP id f2-20020a193802000000b00512cc50c3e0mr1476068lfa.52.1710429365703; Thu, 14 Mar 2024 08:16:05 -0700 (PDT) MIME-Version: 1.0 References: <20240306-no-dt-for-cpu-v6-0-acd8727a1b59@linaro.org> <20240306-no-dt-for-cpu-v6-3-acd8727a1b59@linaro.org> In-Reply-To: <20240306-no-dt-for-cpu-v6-3-acd8727a1b59@linaro.org> From: "Ard Biesheuvel" Date: Thu, 14 Mar 2024 16:15:54 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH edk2-platforms v6 3/7] Platform/SbsaQemu: use PcdCoreCount directly To: Marcin Juszkiewicz Cc: devel@edk2.groups.io, Leif Lindholm , Ard Biesheuvel , Graeme Gregory , Xiong Yining , Chen Baozi 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 Resent-Date: Thu, 14 Mar 2024 08:16:08 -0700 Reply-To: devel@edk2.groups.io,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=WbMvMyNF; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=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 On Wed, 6 Mar 2024 at 12:42, Marcin Juszkiewicz wrote: > > During platform initialization we read amount of cpu cores and set > PcdCoreCount so there is no need to call FdtHandler. > How can you be sure that that code executes first? > Signed-off-by: Marcin Juszkiewicz > --- > Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf | 6 ++---- > Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c | 10 ++++------ > .../Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c | 11 ++--------- > 3 files changed, 8 insertions(+), 19 deletions(-) > > diff --git a/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf b/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf > index a34f54d431d4..8e2bf8c512f1 100644 > --- a/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf > +++ b/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf > @@ -3,7 +3,7 @@ > # > # Copyright (c) 2021, NUVIA Inc. All rights reserved. > # Copyright (c) 2018, Hisilicon Limited. All rights reserved. > -# Copyright (c) 2018, Linaro Limited. All rights reserved. > +# Copyright (c) 2023, Linaro Ltd. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -29,8 +29,6 @@ [Packages] > > [LibraryClasses] > BaseMemoryLib > - FdtLib > - FdtHelperLib > IoLib > PcdLib > > @@ -40,7 +38,6 @@ [Guids] > [Pcd] > gArmTokenSpaceGuid.PcdEmbeddedControllerFirmwareRelease > gArmTokenSpaceGuid.PcdSystemBiosRelease > - gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdDeviceTreeBaseAddress > > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdSystemManufacturer > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdSystemSerialNumber > @@ -56,3 +53,4 @@ [Pcd] > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisManufacturer > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag > gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU > + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdCoreCount > diff --git a/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c b/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c > index c38f2851904f..ab97768b5ddc 100644 > --- a/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c > +++ b/Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.c > @@ -2,7 +2,7 @@ > * OemMiscLib.c > * > * Copyright (c) 2021, NUVIA Inc. All rights reserved. > -* Copyright (c) 2020, Linaro Ltd. All rights reserved. > +* Copyright (c) Linaro Ltd. All rights reserved. > * > * SPDX-License-Identifier: BSD-2-Clause-Patent > * > @@ -12,14 +12,12 @@ > #include > #include > #include > -#include > #include > #include > #include > #include > #include > #include > -#include > > /** Returns whether the specified processor is present or not. > > @@ -33,7 +31,7 @@ OemIsProcessorPresent ( > UINTN ProcessorIndex > ) > { > - if (ProcessorIndex < FdtHelperCountCpus ()) { > + if (ProcessorIndex < PcdGet32 (PcdCoreCount)) { > return TRUE; > } > > @@ -76,7 +74,7 @@ OemGetProcessorInformation ( > { > UINT16 ProcessorCount; > > - ProcessorCount = FdtHelperCountCpus (); > + ProcessorCount = PcdGet32 (PcdCoreCount); > > if (ProcessorIndex < ProcessorCount) { > ProcessorStatus->Bits.CpuStatus = 1; // CPU enabled > @@ -121,7 +119,7 @@ OemGetMaxProcessors ( > VOID > ) > { > - return FdtHelperCountCpus (); > + return PcdGet32 (PcdCoreCount); > } > > /** Gets information about the cache at the specified cache level. > diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c > index 9fb17151d7b8..59536ea9575e 100644 > --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c > +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuAcpiDxe/SbsaQemuAcpiDxe.c > @@ -1,7 +1,7 @@ > /** @file > * This file is an ACPI driver for the Qemu SBSA platform. > * > -* Copyright (c) 2020, Linaro Ltd. All rights reserved. > +* Copyright (c) Linaro Ltd. All rights reserved. > * > * SPDX-License-Identifier: BSD-2-Clause-Patent > * > @@ -255,7 +255,6 @@ AddMadtTable ( > // Initialize GIC Redistributor Structure > EFI_ACPI_6_0_GICR_STRUCTURE Gicr = SBSAQEMU_MADT_GICR_INIT(); > > - // Get CoreCount which was determined eariler after parsing device tree > NumCores = PcdGet32 (PcdCoreCount); > > // Calculate the new table size based on the number of cores > @@ -291,7 +290,7 @@ AddMadtTable ( > New += sizeof (EFI_ACPI_6_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER); > > // Add new GICC structures for the Cores > - for (CoreIndex = 0; CoreIndex < PcdGet32 (PcdCoreCount); CoreIndex++) { > + for (CoreIndex = 0; CoreIndex < NumCores; CoreIndex++) { > EFI_ACPI_6_0_GIC_STRUCTURE *GiccPtr; > > CopyMem (New, &Gicc, sizeof (EFI_ACPI_6_0_GIC_STRUCTURE)); > @@ -758,12 +757,6 @@ InitializeSbsaQemuAcpiDxe ( > { > EFI_STATUS Status; > EFI_ACPI_TABLE_PROTOCOL *AcpiTable; > - UINT32 NumCores; > - > - // Parse the device tree and get the number of CPUs > - NumCores = FdtHelperCountCpus (); > - Status = PcdSet32S (PcdCoreCount, NumCores); > - ASSERT_RETURN_ERROR (Status); > > // Check if ACPI Table Protocol has been installed > Status = gBS->LocateProtocol ( > > -- > 2.44.0 > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116768): https://edk2.groups.io/g/devel/message/116768 Mute This Topic: https://groups.io/mt/104763765/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-