Skip to contentSkip to conversation

x86/amd: Misc setup for Fam1Ah processors

PATCH Superseded Andrew Cooper 2 participants 7 messages Jan 6, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/amd: Misc setup for Fam1Ah processors

Fam1Ah is similar to Fam19h in these regards.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

With this patch, I think we're in an ok position to declare support on Zen5 CPUs. I'm very disappointed that AMD don't have any documetation about ERAPS, but to the best of my (backchannel) knowledge, Xen should behave safely.

---
 xen/arch/x86/acpi/cpu_idle.c     | 1 +
 xen/arch/x86/cpu/microcode/amd.c | 4 ++++
 xen/arch/x86/cpu/vpmu_amd.c      | 1 +
 3 files changed, 6 insertions(+)
xen/arch/x86/acpi/cpu_idle.c +1 -0
index 876317fad059..420198406def 100644
@@ -1417,6 +1417,7 @@ static void amd_cpuidle_init(struct acpi_processor_power *power)
 
     switch ( c->x86 )
     {
+    case 0x1a:
     case 0x19:
     case 0x18:
         if ( boot_cpu_data.x86_vendor != X86_VENDOR_HYGON )
xen/arch/x86/cpu/microcode/amd.c +4 -0
index ba7668a94670..58568f9aa024 100644
@@ -114,6 +114,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
 #define F19H_MPB_MAX_SIZE 5568
+#define F1AH_MPB_MAX_SIZE 14368
 
     switch ( boot_cpu_data.x86 )
     {
@@ -132,6 +133,9 @@ static bool verify_patch_size(uint32_t patch_size)
     case 0x19:
         max_size = F19H_MPB_MAX_SIZE;
         break;
+    case 0x1a:
+        max_size = F1AH_MPB_MAX_SIZE;
+        break;
     default:
         max_size = F1XH_MPB_MAX_SIZE;
         break;
xen/arch/x86/cpu/vpmu_amd.c +1 -0
index a082450e923a..a6117dfebf2a 100644
@@ -568,6 +568,7 @@ const struct arch_vpmu_ops *__init amd_vpmu_init(void)
     case 0x15:
     case 0x17:
     case 0x19:
+    case 0x1a:
         num_counters = F15H_NUM_COUNTERS;
         counters = AMD_F15H_COUNTERS;
         ctrls = AMD_F15H_CTRLS;
Signature · 1 line
2.39.5
#1 lore raw
Quoted 9 lines · Andrew Cooper

Fam1Ah is similar to Fam19h in these regards.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

With this patch, I think we're in an ok position to declare support on Zen5 CPUs.

What about amd_log_freq(), where the 0x19 upper bound may need bumping?

xen/arch/x86/cpu/microcode/amd.c static bool verify_patch_size(uint32_t patch_size) · line 117

Quoted 7 lines
xen/arch/x86/cpu/microcode/amd.c +1 -0
@@ -114,6 +114,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
 #define F19H_MPB_MAX_SIZE 5568
+#define F1AH_MPB_MAX_SIZE 14368

Yet another pretty odd number. Are these actually documented anywhere? And what has come of their plan to make ucode size available via CPUID (for which I even sent a patch quite a long while ago)?

Jan

#2 lore raw
Quoted 11 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper

Fam1Ah is similar to Fam19h in these regards.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

With this patch, I think we're in an ok position to declare support on Zen5 CPUs.

What about amd_log_freq(), where the 0x19 upper bound may need bumping?

Ah, that's new since I did Fam19.  I'll adjust.

Quoted 9 lines

xen/arch/x86/cpu/microcode/amd.c static bool verify_patch_size(uint32_t patch_size) · line 117

Quoted 8 lines
xen/arch/x86/cpu/microcode/amd.c +1 -0
@@ -114,6 +114,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
 #define F19H_MPB_MAX_SIZE 5568
+#define F1AH_MPB_MAX_SIZE 14368

Yet another pretty odd number. Are these actually documented anywhere?

In the PPRs.

Quoted 2 lines

And what has come of their plan to make ucode size available via CPUID (for which I even sent a patch quite a long while ago)?

This check in this function need to work for any microcode we find in the container.  Knowing the size of the current CPU doesn't help parsing others.

And talking of, I've just found another Fam1Ah processor with an even larger patch size.  This limit needs bumping to 15296.

~Andrew

#3 lore raw
Quoted 11 lines · Andrew Cooper
Quoted 9 lines · Jan Beulich

xen/arch/x86/cpu/microcode/amd.c static bool verify_patch_size(uint32_t patch_size) · line 117

Quoted 7 lines · Andrew Cooper
xen/arch/x86/cpu/microcode/amd.c +1 -0
@@ -114,6 +114,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
 #define F19H_MPB_MAX_SIZE 5568
+#define F1AH_MPB_MAX_SIZE 14368

Yet another pretty odd number. Are these actually documented anywhere?

Quoted 1 line

In the PPRs.

So to find the number to use it's really ...

Quoted 9 lines
Quoted 2 lines

And what has come of their plan to make ucode size available via CPUID (for which I even sent a patch quite a long while ago)?

This check in this function need to work for any microcode we find in the container.  Knowing the size of the current CPU doesn't help parsing others.

And talking of, I've just found another Fam1Ah processor with an even larger patch size.  This limit needs bumping to 15296.

... digging through the PPRs (and hoping no later model will have yet larger size).

Jan

#4 lore raw
Quoted 16 lines · Jan Beulich
Quoted 11 lines · Andrew Cooper
Quoted 9 lines · Jan Beulich

xen/arch/x86/cpu/microcode/amd.c static bool verify_patch_size(uint32_t patch_size) · line 117

Quoted 7 lines · Andrew Cooper
xen/arch/x86/cpu/microcode/amd.c +1 -0
@@ -114,6 +114,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
 #define F19H_MPB_MAX_SIZE 5568
+#define F1AH_MPB_MAX_SIZE 14368

Yet another pretty odd number. Are these actually documented anywhere?

In the PPRs.

So to find the number to use it's really ...

Quoted 2 lines
Quoted 2 lines

And what has come of their plan to make ucode size available via CPUID (for which I even sent a patch quite a long while ago)?

Quoted 8 lines
Quoted 6 lines

This check in this function need to work for any microcode we find in the container.  Knowing the size of the current CPU doesn't help parsing others.

And talking of, I've just found another Fam1Ah processor with an even larger patch size.  This limit needs bumping to 15296.

... digging through the PPRs (and hoping no later model will have yet larger size).

Correct.  I'd prefer a better approach, but alas.

~Andrew

#5 lore raw
In reply to Jan Beulich
Quoted 11 lines · Jan Beulich
Quoted 9 lines · Andrew Cooper

Fam1Ah is similar to Fam19h in these regards.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

With this patch, I think we're in an ok position to declare support on Zen5 CPUs.

What about amd_log_freq(), where the 0x19 upper bound may need bumping?

The Pstate MSRs are still there, but their layout is quite different. FID is 12 bits, and Vid is 9 bits in two split fields.

As this is only informational for now, I think I'll leave it.  This needs a bigger rework to make the code tractable.

~Andrew

Acked-by
#6 lore raw
Quoted 9 lines · Andrew Cooper
Quoted 8 lines · Jan Beulich
Quoted 7 lines · Andrew Cooper

Fam1Ah is similar to Fam19h in these regards.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

With this patch, I think we're in an ok position to declare support on Zen5 CPUs.

What about amd_log_freq(), where the 0x19 upper bound may need bumping?

The Pstate MSRs are still there, but their layout is quite different. FID is 12 bits, and Vid is 9 bits in two split fields.

Oh, okay.

Quoted 2 lines

As this is only informational for now, I think I'll leave it.  This needs a bigger rework to make the code tractable.

Fair enough then. And with the adjusted ucode size:

Jan