Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit 5a1741f

Browse files
authored
PMU changes: Read PMU PMDEVARCH reg to query cs complaint (#466)
- The SBSA PMU test relies on the CoreSight PMU architecture for register memory layout. - Read the PMDEVARCH register to check the same and skip if PMU node not following CS register layout. Signed-off-by: Sujana M <sujana.murali@arm.com>
1 parent e92cebf commit 5a1741f

8 files changed

Lines changed: 56 additions & 7 deletions

File tree

pal/baremetal/sbsa/include/pal_sbsa_common_support.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @file
2-
* Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved.
2+
* Copyright (c) 2024-2025, Arm Limited or its affiliates. All rights reserved.
33
* SPDX-License-Identifier : Apache-2.0
44
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -35,6 +35,7 @@ typedef struct {
3535
uint64_t base0; /* Base address of Page 0 of the PMU*/
3636
uint64_t base1; /* Base address of Page 1 of the PMU,
3737
valid only if dual_page_extension is 1*/
38+
uint32_t coresight_compliant; /* node coresight compliant or not */
3839
} PMU_INFO_BLOCK;
3940

4041
typedef struct {
@@ -380,4 +381,4 @@ typedef struct {
380381

381382
void pal_pcc_create_info_table(PCC_INFO_TABLE *PccInfoTable);
382383

383-
#endif
384+
#endif

pal/baremetal/target/RDN2/sbsa/include/platform_override_sbsa_struct.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @file
2-
* Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved.
2+
* Copyright (c) 2024-2025, Arm Limited or its affiliates. All rights reserved.
33
* SPDX-License-Identifier : Apache-2.0
44
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -102,6 +102,7 @@ typedef struct {
102102
uint64_t base0; /* Base address of Page 0 of the PMU */
103103
uint64_t base1; /* Base address of Page 1 of the PMU,
104104
valid only if dual_page_extension is 1 */
105+
uint32_t coresight_compliant; /* node CS arch complaint */
105106
} PLATFORM_OVERRIDE_PMU_INFO_BLOCK;
106107

107108
typedef struct {

pal/uefi_acpi/sbsa/include/pal_sbsa_uefi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @file
2-
* Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved.
2+
* Copyright (c) 2024-2025, Arm Limited or its affiliates. All rights reserved.
33
* SPDX-License-Identifier : Apache-2.0
44
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -38,6 +38,7 @@ typedef struct {
3838
UINT64 base0; /* Base address of Page 0 of the PMU*/
3939
UINT64 base1; /* Base address of Page 1 of the PMU,
4040
valid only if dual_page_extension is 1*/
41+
UINT32 coresight_compliant; /* node is CS arch complaint or not */
4142
} PMU_INFO_BLOCK;
4243

4344
typedef struct {

val/sbsa/include/sbsa_acs_pmu.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @file
2-
* Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved.
2+
* Copyright (c) 2024-2025, Arm Limited or its affiliates. All rights reserved.
33
* SPDX-License-Identifier : Apache-2.0
44
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,6 +41,7 @@ uint32_t val_generate_traffic(uint64_t interface_acpiid, uint32_t pmu_node_index
4141
uint32_t mon_index, uint32_t eventid);
4242
uint32_t val_pmu_check_monitor_count_value(uint64_t interface_acpiid, uint32_t count_value,
4343
uint32_t eventid);
44+
void val_pmu_set_node_coresight_complaint(uint32_t flag, uint32_t node_index);
4445

4546
uint32_t pmu001_entry(uint32_t num_pe);
4647
uint32_t pmu002_entry(uint32_t num_pe);

val/sbsa/include/sbsa_acs_pmu_reg.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @file
2-
* Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved.
2+
* Copyright (c) 2024-2025, Arm Limited or its affiliates. All rights reserved.
33
* SPDX-License-Identifier : Apache-2.0
44
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -127,4 +127,7 @@ BITFIELD_DECL(uint32_t, PMSCR_MSI_MPAM_NS, 3, 3)
127127
BITFIELD_DECL(uint32_t, PMSCR_NAO, 4, 4)
128128
BITFIELD_DECL(uint32_t, PMSCR_IMPL, 31, 31)
129129

130+
/* PMDEVARCH bit configuration */
131+
BITFIELD_DECL(uint32_t, PMDEVARCH_ARCHITECT, 31, 21)
132+
130133
#endif /*__PMU_REG_H__ */

val/sbsa/include/sbsa_pal_interface.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @file
2-
* Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved.
2+
* Copyright (c) 2024-2025, Arm Limited or its affiliates. All rights reserved.
33
* SPDX-License-Identifier : Apache-2.0
44
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -53,6 +53,7 @@ typedef struct {
5353
uint64_t base0; /* Base address of Page 0 of the PMU*/
5454
uint64_t base1; /* Base address of Page 1 of the PMU,
5555
valid only if dual_page_extension is 1*/
56+
uint32_t coresight_compliant; /* node is CS complaint or not */
5657
} PMU_INFO_BLOCK;
5758

5859
typedef struct {

val/sbsa/include/sbsa_val_interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ typedef enum {
161161
PMU_NODE_SEC_INST, /* Secondary instance */
162162
PMU_NODE_COUNT, /* PMU Node count */
163163
PMU_NODE_DP_EXTN, /* Dual page extension support */
164+
PMU_NODE_CS_COM, /* Node is Coresight arch complaint */
164165
} PMU_INFO_e;
165166

166167
uint32_t val_sbsa_pe_execute_tests(uint32_t level, uint32_t num_pe);

val/sbsa/src/sbsa_acs_pmu.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ PMU_INFO_TABLE *g_pmu_info_table;
3434
void
3535
val_pmu_create_info_table(uint64_t *pmu_info_table)
3636
{
37+
uint32_t node_index;
38+
addr_t base;
39+
uint32_t reg_value;
40+
3741
if (pmu_info_table == NULL) {
3842
val_print(ACS_PRINT_ERR, "\nInput for Create PMU Info table cannot be NULL", 0);
3943
return;
@@ -46,9 +50,43 @@ val_pmu_create_info_table(uint64_t *pmu_info_table)
4650
val_print(ACS_PRINT_TEST, " PMU_INFO: Number of PMU units : %4d\n",
4751
g_pmu_info_table->pmu_count);
4852

53+
for (node_index = 0; node_index < g_pmu_info_table->pmu_count; node_index++) {
54+
base = val_pmu_get_info(PMU_NODE_BASE0, node_index);
55+
reg_value = BITFIELD_READ(PMDEVARCH_ARCHITECT, val_mmio_read(base + REG_PMDEVARCH));
56+
/* 0x23B is value for Arm Limited */
57+
if (reg_value == 0x23B)
58+
val_pmu_set_node_coresight_complaint(0x1, node_index);
59+
else {
60+
val_pmu_set_node_coresight_complaint(0x0, node_index);
61+
val_print(ACS_PRINT_ERR, "\n PMU node index %d is not CS complaint", node_index);
62+
}
63+
}
64+
4965
return;
5066
}
5167

68+
/**
69+
@brief Set if PMU node coresight architecture complaint or not
70+
**/
71+
void
72+
val_pmu_set_node_coresight_complaint(uint32_t flag, uint32_t node_index)
73+
{
74+
PMU_INFO_BLOCK *entry;
75+
76+
if (g_pmu_info_table == NULL) {
77+
val_print(ACS_PRINT_WARN, "\n APMT info table not found", 0);
78+
return;
79+
}
80+
81+
if (node_index > g_pmu_info_table->pmu_count) {
82+
val_print(ACS_PRINT_WARN, "\n Invalid Node index ", 0);
83+
return;
84+
}
85+
86+
entry = &g_pmu_info_table->info[node_index];
87+
entry->coresight_compliant = flag;
88+
}
89+
5290
/**
5391
@brief Free the memory allocated for the PMU information table
5492
**/
@@ -100,6 +138,8 @@ val_pmu_get_info(PMU_INFO_e type, uint32_t node_index)
100138
return g_pmu_info_table->pmu_count;
101139
case PMU_NODE_DP_EXTN:
102140
return entry->dual_page_extension;
141+
case PMU_NODE_CS_COM:
142+
return entry->coresight_compliant;
103143
default:
104144
val_print(ACS_PRINT_ERR, "\n This PMU info option is not supported : %d ", type);
105145
return 0;

0 commit comments

Comments
 (0)