From 75b181365f3b41f61d730f2cfd204523000de60c Mon Sep 17 00:00:00 2001 From: CyrIng Date: Mon, 11 Mar 2024 15:31:45 +0100 Subject: [PATCH] [AArch64][DynamIQ] Query the product revision --- aarch64/arm_reg.h | 14 ++++++++++++++ aarch64/corefreq-api.h | 3 +++ aarch64/corefreqd.c | 3 ++- aarch64/corefreqk.c | 4 ++-- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/aarch64/arm_reg.h b/aarch64/arm_reg.h index fafcc1bc..868f7c17 100644 --- a/aarch64/arm_reg.h +++ b/aarch64/arm_reg.h @@ -21,6 +21,7 @@ #define MRS_SVCR sys_reg(0b11, 0b011, 0b0100, 0b0010, 0b010) #define AMCGCR_EL0 sys_reg(0b11, 0b011, 0b1101, 0b0010, 0b010) #define CLUSTERCFR_EL1 sys_reg(0b11, 0b000, 0b1111, 0b0011, 0b000) +#define CLUSTERIDR_EL1 sys_reg(0b11, 0b000, 0b1111, 0b0011, 0b001) typedef union { @@ -780,6 +781,19 @@ typedef union } DSU; } CLUSTERCFR; +typedef union +{ + unsigned long long value; /* Pkg:0x0000000000000041 */ + struct + { + unsigned long long + Revision : 4-0, + Variant : 8-4, + RAZ : 32-8, + RSVD : 64-32; + }; +} CLUSTERIDR; + typedef union { unsigned long long value; diff --git a/aarch64/corefreq-api.h b/aarch64/corefreq-api.h index 72edcce3..24e48297 100644 --- a/aarch64/corefreq-api.h +++ b/aarch64/corefreq-api.h @@ -328,6 +328,9 @@ typedef struct signed int ArchID; struct { + CLUSTERCFR ClusterCfg; + CLUSTERIDR ClusterRev; + unsigned int Boost[UNCORE_BOOST(SIZE)]; BUS_REGISTERS Bus; MC_REGISTERS MC[MC_MAX_CTRL]; diff --git a/aarch64/corefreqd.c b/aarch64/corefreqd.c index 70603850..531ebef1 100644 --- a/aarch64/corefreqd.c +++ b/aarch64/corefreqd.c @@ -712,7 +712,8 @@ void Uncore_Update( RO(SHM_STRUCT) *RO(Shm), RO(PROC) *RO(Proc), RO(Shm)->Uncore.CtrlCount = RO(Proc)->Uncore.CtrlCount; /* Decode the Memory Controller for each found vendor:device */ Chipset[IC_CHIPSET] = RO(Proc)->Features.Info.Vendor.ID; - RO(Shm)->Uncore.ChipID = 0x0; + RO(Shm)->Uncore.ChipID = RO(Proc)->Uncore.ClusterRev.Revision + | (RO(Proc)->Uncore.ClusterRev.Variant << 4); RO(Shm)->Uncore.Chipset.ArchID = IC_CHIPSET; /* Copy the chipset codename. */ StrCopy(RO(Shm)->Uncore.Chipset.CodeName, diff --git a/aarch64/corefreqk.c b/aarch64/corefreqk.c index 103e5557..ba595437 100644 --- a/aarch64/corefreqk.c +++ b/aarch64/corefreqk.c @@ -2349,8 +2349,8 @@ static void Query_DynamIQ(unsigned int cpu) if (PUBLIC(RO(Proc))->HypervisorID == BARE_METAL) { /* Query the Cluster Configuration on Bare Metal only */ - volatile CLUSTERCFR clusterCfg = {.value = SysRegRead(CLUSTERCFR_EL1)}; - UNUSED(clusterCfg); + PUBLIC(RO(Proc))->Uncore.ClusterCfg.value = SysRegRead(CLUSTERCFR_EL1); + PUBLIC(RO(Proc))->Uncore.ClusterRev.value = SysRegRead(CLUSTERIDR_EL1); } }