From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=tWLmM+2h; spf=pass (domain: linaro.org, ip: 209.85.221.66, mailfrom: leif.lindholm@linaro.org) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by groups.io with SMTP; Mon, 17 Jun 2019 04:40:07 -0700 Received: by mail-wr1-f66.google.com with SMTP id n4so1487480wrs.3 for ; Mon, 17 Jun 2019 04:40:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=s+d0XLeKlDjDJgDB11WAS1ijFUXCLb7fCtxxhgcyl7M=; b=tWLmM+2hPZkYUP2YojWWmuiRDRNGeR90iE4BoKpkumQxQ9AoIvrDNGXeNhu//QugF/ ln44uiVu5pIHsbB90ccKDDqVTSU3YMuwVzR1/bcT2Njm7odZU+gFtge9W7QHABiBMayI NWoyjQ1rzsCjoRROIjHjRtD32ilcZsTDrL+NXF306PNSCxN+QxYCpnpCGFNjCHYITmgK sEe7OGFQ9uZs+Mt3PfFg+uxRBX91BZasE7HZnupFaeRZ1Txg9wHLA7ToFb+rvAdVUMDK 1q1kGowh2ejEu3XwwvDAOIfIlFzZeW8k6ymdXMTI8gUA2fQnia8i3Xve7p5yP7+MBmPh bIMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=s+d0XLeKlDjDJgDB11WAS1ijFUXCLb7fCtxxhgcyl7M=; b=Dv7MMzhFuvyXxhtf7IsZkXNhtnyfyKbWQudsnftkBjHGY9HN7WUWFplbluGWvBMyJK 6tTQ/3RbniBN+7PngwaEzKKC1kesQLdNHu4fcWRsyjAIJANEpTSG9ooKIFCjMxcW64ZG KfD9OWD0gUxGDtNVC55GaLFzAE7UWPY/frfm0zO6Vpxn7i4Px7RaEK9B4AINNPZmP3Kf XWiNpojvZZkZ55PlYXLLRuG12Y4xSVBKXtu4KCQxnaOQpLLAu8dABHelRgOOKaPyk3od pcSULpyLJW0Ej2DBmOIIPGIcDrjqCdB7phjkRVMpMDkCltwW/RKxMeqcMzITiYxo87T+ BX7Q== X-Gm-Message-State: APjAAAXsSAwsbWiigThgINKYdWZ4bG0ntSAetg3/eEXWgbrKe/LJ8BMb E1Wq6etoIczhaMd+Sg4AlEXVZA== X-Google-Smtp-Source: APXvYqzTO0GSoZ5R11iQ1BNcKb5qy9i77/L8uLd5ogXnZbhh1485D1NI754zFMjNuOhlVbVbEnfzhA== X-Received: by 2002:a05:6000:12cd:: with SMTP id l13mr9427155wrx.196.1560771605424; Mon, 17 Jun 2019 04:40:05 -0700 (PDT) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id d18sm13264742wrb.90.2019.06.17.04.40.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Jun 2019 04:40:04 -0700 (PDT) Date: Mon, 17 Jun 2019 12:40:03 +0100 From: "Leif Lindholm" To: Krzysztof Koch Cc: devel@edk2.groups.io, Ard Biesheuvel , Michael D Kinney , Sami.Mujawar@arm.com, Matteo.Carlini@arm.com, Stephanie.Hughes-Fitt@arm.com, nd@arm.com Subject: Re: [edk2-platforms PATCH v1 1/1 -resend] Platform/ARM/JunoPkg: Add support for PPTT dynamic generation Message-ID: <20190617114003.cywead6w4exf4yjm@bivouac.eciton.net> References: <20190612093158.36624-1-krzysztof.koch@arm.com> MIME-Version: 1.0 In-Reply-To: <20190612093158.36624-1-krzysztof.koch@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jun 12, 2019 at 10:31:58AM +0100, Krzysztof Koch wrote: > Update the Platform Respository for the Juno platform > to include support for generation of the Processor Properties > Topology Table (PPTT) using the Dynamic Tables Framework. > > The Platform Repository now also describes the cache and > processor topology in Juno (all revisions). > > Signed-off-by: Krzysztof Koch > --- > > Changes can be seen at: https://github.com/KrzysztofKoch1/edk2-platforms/tree/392_dynamic_pptt_juno_v1 > > Notes: > v1: > - add support for dynamic generation of PPTT [Krzysztof] > > Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 443 +++++++++++++++++++- > Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 136 +++++- > 2 files changed, 575 insertions(+), 4 deletions(-) > > diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c > index 78b906ddb8bbd35c32b4be98b1ee8bd973b6b818..2ef79ba5df750e869d241fcba98fdd44b1f26002 100644 > --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c > +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c > @@ -329,6 +630,121 @@ GetGTBlockTimerFrameInfo ( > return EFI_SUCCESS; > } > > +/** Return GIC CPU Interface Info. > + > + @param [in] This Pointer to the Configuration Manager Protocol. > + @param [in] CmObjectId The Object ID of the CM object requested > + @param [in] SearchToken A unique token for identifying the requested > + CM_ARM_GICC_INFO object. > + @param [in, out] CmObject Pointer to the Configuration Manager Object > + descriptor describing the requested Object. > + > + @retval EFI_SUCCESS Success. > + @retval EFI_INVALID_PARAMETER A parameter is invalid. > + @retval EFI_NOT_FOUND The required object information is not found. > +**/ > +EFI_STATUS > +EFIAPI > +GetGicCInfo ( > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This, > + IN CONST CM_OBJECT_ID CmObjectId, > + IN CONST CM_OBJECT_TOKEN SearchToken, > + IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject > + ) > +{ > + EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo; > + UINT32 TotalObjCount; > + UINT32 ObjIndex; > + > + if ((This == NULL) || (CmObject == NULL)) { > + ASSERT (This != NULL); > + ASSERT (CmObject != NULL); > + return EFI_INVALID_PARAMETER; > + } > + > + PlatformRepo = This->PlatRepoInfo; > + > + TotalObjCount = sizeof (PlatformRepo->GicCInfo) / > + sizeof (PlatformRepo->GicCInfo[0]); Please replace this pattern with the ARRAY_SIZE macro from Base.h, throughout (in new or modified code, including partials). / Leif > + > + for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) { > + if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->GicCInfo[ObjIndex]) { > + CmObject->ObjectId = CmObjectId; > + CmObject->Size = sizeof (PlatformRepo->GicCInfo[ObjIndex]); > + CmObject->Data = (VOID*)&PlatformRepo->GicCInfo[ObjIndex]; > + CmObject->Count = 1; > + return EFI_SUCCESS; > + } > + } > + > + return EFI_NOT_FOUND; > +} > + > +/** Return a list of Configuration Manager object references pointed to by the > + given input token. > + > + @param [in] This Pointer to the Configuration Manager Protocol. > + @param [in] CmObjectId The Object ID of the CM object requested > + @param [in] SearchToken A unique token for identifying the requested > + CM_ARM_OBJ_REF list. > + @param [in, out] CmObject Pointer to the Configuration Manager Object > + descriptor describing the requested Object. > + > + @retval EFI_SUCCESS Success. > + @retval EFI_INVALID_PARAMETER A parameter is invalid. > + @retval EFI_NOT_FOUND The required object information is not found. > +**/ > +EFI_STATUS > +EFIAPI > +GetCmObjRefs ( > + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This, > + IN CONST CM_OBJECT_ID CmObjectId, > + IN CONST CM_OBJECT_TOKEN SearchToken, > + IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject > + ) > +{ > + EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo; > + > + if ((This == NULL) || (CmObject == NULL)) { > + ASSERT (This != NULL); > + ASSERT (CmObject != NULL); > + return EFI_INVALID_PARAMETER; > + } > + > + PlatformRepo = This->PlatRepoInfo; > + > + if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->BigClusterResources) { > + CmObject->Size = sizeof (PlatformRepo->BigClusterResources); > + CmObject->Data = (VOID*)&PlatformRepo->BigClusterResources; > + CmObject->Count = sizeof (PlatformRepo->BigClusterResources) / > + sizeof (PlatformRepo->BigClusterResources[0]); > + return EFI_SUCCESS; > + } > + if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->BigCoreResources) { > + CmObject->Size = sizeof (PlatformRepo->BigCoreResources); > + CmObject->Data = (VOID*)&PlatformRepo->BigCoreResources; > + CmObject->Count = sizeof (PlatformRepo->BigCoreResources) / > + sizeof (PlatformRepo->BigCoreResources[0]); > + return EFI_SUCCESS; > + } > + if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->LittleClusterResources) { > + CmObject->Size = sizeof (PlatformRepo->LittleClusterResources); > + CmObject->Data = (VOID*)&PlatformRepo->LittleClusterResources; > + CmObject->Count = sizeof (PlatformRepo->LittleClusterResources) / > + sizeof (PlatformRepo->LittleClusterResources[0]); > + return EFI_SUCCESS; > + } > + if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->LittleCoreResources) { > + CmObject->Size = sizeof (PlatformRepo->LittleCoreResources); > + CmObject->Data = (VOID*)&PlatformRepo->LittleCoreResources; > + CmObject->Count = sizeof (PlatformRepo->LittleCoreResources) / > + sizeof (PlatformRepo->LittleCoreResources[0]); > + return EFI_SUCCESS; > + } > + > + return EFI_NOT_FOUND; > +} > + > /** Return a standard namespace object. > > @param [in] This Pointer to the Configuration Manager Protocol. > @@ -486,12 +902,14 @@ GetArmNameSpaceObject ( > Token, > GetGTBlockTimerFrameInfo > ); > - HANDLE_CM_OBJECT ( > + HANDLE_CM_OBJECT_REF_BY_TOKEN ( > EArmObjGicCInfo, > CmObjectId, > PlatformRepo->GicCInfo, > (sizeof (PlatformRepo->GicCInfo) / > - sizeof (PlatformRepo->GicCInfo[0])) > + sizeof (PlatformRepo->GicCInfo[0])), > + Token, > + GetGicCInfo > ); > HANDLE_CM_OBJECT ( > EArmObjGicDInfo, > @@ -518,6 +936,25 @@ GetArmNameSpaceObject ( > PlatformRepo->GicMsiFrameInfo, > 1 > ); > + HANDLE_CM_OBJECT ( > + EArmObjProcHierarchyInfo, > + CmObjectId, > + PlatformRepo->ProcHierarchyInfo, > + (sizeof (PlatformRepo->ProcHierarchyInfo) / > + sizeof (PlatformRepo->ProcHierarchyInfo[0])) > + ); > + HANDLE_CM_OBJECT ( > + EArmObjCacheInfo, > + CmObjectId, > + PlatformRepo->CacheInfo, > + sizeof (PlatformRepo->CacheInfo) / sizeof (PlatformRepo->CacheInfo[0]) > + ); > + HANDLE_CM_OBJECT_SEARCH_PLAT_REPO ( > + EArmObjCmRef, > + CmObjectId, > + Token, > + GetCmObjRefs > + ); > > case EArmObjPciConfigSpaceInfo: > if (PlatformRepo->JunoRevision != JUNO_REVISION_R0) { > diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h > index 060817430fe75fdf79196f8a9d31561028fb0f50..7fdf663fc6d2ad80da26ff1f1635c858d5be4e93 100644 > --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h > +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h > @@ -20,6 +20,12 @@ > */ > #define CFG_MGR_OEM_ID { 'A', 'R', 'M', 'L', 'T', 'D' } > > +/** A helper macro for mapping a reference token > +*/ > +#define REFERENCE_TOKEN(Field) \ > + (CM_OBJECT_TOKEN)((UINT8*)&ArmJunoPlatformRepositoryInfo + \ > + OFFSET_OF (EDKII_PLATFORM_REPOSITORY_INFO, Field)) > + > /** A helper macro for populating the GIC CPU information > */ > #define GICC_ENTRY( \ > @@ -46,6 +52,36 @@ > EnergyEfficiency /* UINT8 ProcessorPowerEfficiencyClass*/ \ > } > > +/** A helper macro for populating the Processor Hierarchy Node flags > +*/ > +#define PROC_NODE_FLAGS( \ > + PhysicalPackage, \ > + AcpiProcessorIdValid, \ > + ProcessorIsThread, \ > + NodeIsLeaf, \ > + IdenticalImplementation \ > + ) \ > + ( \ > + PhysicalPackage | \ > + (AcpiProcessorIdValid << 1) | \ > + (ProcessorIsThread << 2) | \ > + (NodeIsLeaf << 3) | \ > + (IdenticalImplementation << 4) \ > + ) > + > +/** A helper macro for populating the Cache Type Structure's attributes > +*/ > +#define CACHE_ATTRIBUTES( \ > + AllocationType, \ > + CacheType, \ > + WritePolicy \ > + ) \ > + ( \ > + AllocationType | \ > + (CacheType << 2) | \ > + (WritePolicy << 4) \ > + ) > + > /** A helper macro for returning configuration manager objects > */ > #define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount) \ > @@ -102,13 +138,46 @@ > break; \ > } > > +/** A helper macro for returning configuration manager objects referenced > + by token when the entire platform repository is in scope and the > + CM_NULL_TOKEN value is not allowed. > +*/ > +#define HANDLE_CM_OBJECT_SEARCH_PLAT_REPO( \ > + ObjId, \ > + CmObjectId, \ > + Token, \ > + HandlerProc \ > + ) \ > + case ObjId: { \ > + CmObject->ObjectId = CmObjectId; \ > + if (Token == CM_NULL_TOKEN) { \ > + Status = EFI_INVALID_PARAMETER; \ > + DEBUG (( \ > + DEBUG_ERROR, \ > + #ObjId ": CM_NULL_TOKEN value is not allowed when searching" \ > + " the entire platform repository.\n" \ > + )); \ > + } else { \ > + Status = HandlerProc (This, CmObjectId, Token, CmObject); \ > + DEBUG (( \ > + DEBUG_INFO, \ > + #ObjId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n", \ > + (VOID*)Token, \ > + CmObject->Data, \ > + CmObject->Size, \ > + CmObject->Count \ > + )); \ > + } \ > + break; \ > + } > + > /** The number of CPUs > */ > #define PLAT_CPU_COUNT 6 > > /** The number of ACPI tables to install > */ > -#define PLAT_ACPI_TABLE_COUNT 10 > +#define PLAT_ACPI_TABLE_COUNT 11 > > /** The number of platform generic timer blocks > */ > @@ -118,6 +187,53 @@ > */ > #define PLAT_GTFRAME_COUNT 2 > > +/** For all Juno revisions, the cache and processor topology is identical. > + > + Terms 'big' and 'LITTLE' are used in favour of A72, A57 or A53 to take into > + account that Juno r2 uses Cortex-A72 as 'big' cores, whereas Juno r0 and r1 > + have Cortex-A57 as 'big' cores. > +*/ > + > +/** The number of Processor Hierarchy Nodes > + - one package node > + - two cluster nodes ('big' + 'LITTLE') > + - two 'big' cores > + - four 'LITTLE' cores > +*/ > +#define PLAT_PROC_HIERARCHY_NODE_COUNT 9 > + > +/** The number of unique cache structures: > + - 'big' core L1 instruction cache > + - 'big' core L1 data cache > + - 'big' core L2 cache > + - 'LITTLE' core L1 instruction cache > + - 'LITTLE' core L1 data cache > + - 'LITTLE' core L2 cache > +*/ > +#define PLAT_CACHE_COUNT 6 > + > +/** The number of resources private to the entire 'big' cluster > + - L2 cache > +*/ > +#define BIG_CLUSTER_RESOURCE_COUNT 1 > + > +/** The number of resources private to 'big' core instance > + - L1 data cache > + - L1 instruction cache > +*/ > +#define BIG_CORE_RESOURCE_COUNT 2 > + > +/** The number of resources private to the entire 'LITTLE' cluster > + - L2 cache > +*/ > +#define LITTLE_CLUSTER_RESOURCE_COUNT 1 > + > +/** The number of resources private to each 'LITTLE' core instance > + - L1 data cache > + - L1 instruction cache > +*/ > +#define LITTLE_CORE_RESOURCE_COUNT 2 > + > /** A structure describing the platform configuration > manager repository information > */ > @@ -166,6 +282,24 @@ typedef struct PlatformRepositoryInfo { > /// GIC MSI Frame information > CM_ARM_GIC_MSI_FRAME_INFO GicMsiFrameInfo; > > + // Processor topology information > + CM_ARM_PROC_HIERARCHY_INFO ProcHierarchyInfo[PLAT_PROC_HIERARCHY_NODE_COUNT]; > + > + // Cache information > + CM_ARM_CACHE_INFO CacheInfo[PLAT_CACHE_COUNT]; > + > + // 'big' cluster private resources > + CM_ARM_OBJ_REF BigClusterResources[BIG_CLUSTER_RESOURCE_COUNT]; > + > + // 'big' core private resources > + CM_ARM_OBJ_REF BigCoreResources[BIG_CORE_RESOURCE_COUNT]; > + > + // 'LITTLE' cluster private resources > + CM_ARM_OBJ_REF LittleClusterResources[LITTLE_CLUSTER_RESOURCE_COUNT]; > + > + // 'LITTLE' core private resources > + CM_ARM_OBJ_REF LittleCoreResources[LITTLE_CORE_RESOURCE_COUNT]; > + > /// Juno Board Revision > UINT32 JunoRevision; > } EDKII_PLATFORM_REPOSITORY_INFO; > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' > >