Skip to contentSkip to conversation

x86/ucode: Fix microcode payload size for Fam19 processors

PATCH In review Andrew Cooper 3 participants 7 messages Feb 9, 2021 – Feb 10, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/ucode: Fix microcode payload size for Fam19 processors

The original limit provided wasn't accurate. Blobs are in fact rather larger.

Fixes fe36a173d1 ("x86/amd: Initial support for Fam19h processors")

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Ian Jackson <[email protected]>

For 4.15. This is a very targetted fix at AMD Zen3 processors. Without it, microcode loading doesn't function.

---
 xen/arch/x86/cpu/microcode/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/cpu/microcode/amd.c +1 -1
index 5255028af7..c4ab395799 100644
@@ -111,7 +111,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F15H_MPB_MAX_SIZE 4096
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
-#define F19H_MPB_MAX_SIZE 4800
+#define F19H_MPB_MAX_SIZE 5568
 
     switch ( boot_cpu_data.x86 )
     {
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andrew Cooper

The original limit provided wasn't accurate. Blobs are in fact rather larger.

Fixes fe36a173d1 ("x86/amd: Initial support for Fam19h processors")

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

Quoted 8 lines
xen/arch/x86/cpu/microcode/amd.c +1 -1
@@ -111,7 +111,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F15H_MPB_MAX_SIZE 4096
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
-#define F19H_MPB_MAX_SIZE 4800
+#define F19H_MPB_MAX_SIZE 5568

How certain is it that there's not going to be another increase? And in comparison, how bad would it be if we pulled this upper limit to something that's at least slightly less of an "odd" number, e.g. 0x1800, and thus provide some headroom?

Jan

#2 lore raw

Jan Beulich writes ("Re: [PATCH for-4.15] x86/ucode: Fix microcode payload size for Fam19 processors"):

Quoted 8 lines · Andrew Cooper
Quoted 4 lines

The original limit provided wasn't accurate. Blobs are in fact rather larger.

Fixes fe36a173d1 ("x86/amd: Initial support for Fam19h processors")
Quoted 13 lines

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

Quoted 8 lines
xen/arch/x86/cpu/microcode/amd.c +1 -1
@@ -111,7 +111,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F15H_MPB_MAX_SIZE 4096
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
-#define F19H_MPB_MAX_SIZE 4800
+#define F19H_MPB_MAX_SIZE 5568

How certain is it that there's not going to be another increase? And in comparison, how bad would it be if we pulled this upper limit to something that's at least slightly less of an "odd" number, e.g. 0x1800, and thus provide some headroom?

5568 does seem really an excessively magic number...

Ian.

#3 lore raw
Quoted 20 lines · Ian Jackson

Jan Beulich writes ("Re: [PATCH for-4.15] x86/ucode: Fix microcode payload size for Fam19 processors"):

Quoted 7 lines · Andrew Cooper
Quoted 4 lines

The original limit provided wasn't accurate. Blobs are in fact rather larger.

Fixes fe36a173d1 ("x86/amd: Initial support for Fam19h processors")
Quoted 12 lines

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

Quoted 8 lines
xen/arch/x86/cpu/microcode/amd.c +1 -1
@@ -111,7 +111,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F15H_MPB_MAX_SIZE 4096
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
-#define F19H_MPB_MAX_SIZE 4800
+#define F19H_MPB_MAX_SIZE 5568

How certain is it that there's not going to be another increase? And in comparison, how bad would it be if we pulled this upper limit to something that's at least slightly less of an "odd" number, e.g. 0x1800, and thus provide some headroom?

Quoted 1 line

5568 does seem really an excessively magic number...

It reads better in hex - 0x15c0.  It is exactly the header, match/patch-ram, and the digital signature of a fixed algorithm.

Its far simpler than Intel's format which contains multiple embedded blobs, and support for minor platform variations within the same blob.

There are a lot of problems with how we do patch verification on AMD right now, but its all a consequence of the header not containing a length field.

This number wont change now.  Zen3 processors are out in the world.

~Andrew

#4 lore raw

Andrew Cooper writes ("Re: [PATCH for-4.15] x86/ucode: Fix microcode payload size for Fam19 processors"):

Quoted 2 lines · Ian Jackson
Quoted 1 line

Jan Beulich writes ("Re: [PATCH for-4.15] x86/ucode: Fix microcode payload size for Fam19 processors"):

...

Quoted 9 lines
Quoted 5 lines
Quoted 4 lines

How certain is it that there's not going to be another increase? And in comparison, how bad would it be if we pulled this upper limit to something that's at least slightly less of an "odd" number, e.g. 0x1800, and thus provide some headroom?

5568 does seem really an excessively magic number...

It reads better in hex - 0x15c0.  It is exactly the header, match/patch-ram, and the digital signature of a fixed algorithm.

Quoted 8 lines

Its far simpler than Intel's format which contains multiple embedded blobs, and support for minor platform variations within the same blob.

There are a lot of problems with how we do patch verification on AMD right now, but its all a consequence of the header not containing a length field.

This number wont change now.  Zen3 processors are out in the world.

Err. This Is Fine.

#5 lore raw
In reply to Andrew Cooper
Quoted 21 lines · Andrew Cooper
Quoted 20 lines · Ian Jackson

Jan Beulich writes ("Re: [PATCH for-4.15] x86/ucode: Fix microcode payload size for Fam19 processors"):

Quoted 19 lines · Andrew Cooper
Quoted 4 lines

The original limit provided wasn't accurate. Blobs are in fact rather larger.

Fixes fe36a173d1 ("x86/amd: Initial support for Fam19h processors")

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

Quoted 8 lines
xen/arch/x86/cpu/microcode/amd.c +1 -1
@@ -111,7 +111,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F15H_MPB_MAX_SIZE 4096
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
-#define F19H_MPB_MAX_SIZE 4800
+#define F19H_MPB_MAX_SIZE 5568

How certain is it that there's not going to be another increase? And in comparison, how bad would it be if we pulled this upper limit to something that's at least slightly less of an "odd" number, e.g. 0x1800, and thus provide some headroom?

Quoted 4 lines
Quoted 1 line

5568 does seem really an excessively magic number...

It reads better in hex - 0x15c0.  It is exactly the header, match/patch-ram, and the digital signature of a fixed algorithm.

And I realize it's less odd than Fam16's 3458 (0xd82).

Quoted 8 lines

Its far simpler than Intel's format which contains multiple embedded blobs, and support for minor platform variations within the same blob.

There are a lot of problems with how we do patch verification on AMD right now, but its all a consequence of the header not containing a length field.

This number wont change now.  Zen3 processors are out in the world.

Given history on earlier families, where in some cases sizes also vary by model, how can this fact guarantee anything?

Jan

#6 lore raw
Quoted 22 lines · Jan Beulich
Quoted 21 lines · Andrew Cooper
Quoted 20 lines · Ian Jackson

Jan Beulich writes ("Re: [PATCH for-4.15] x86/ucode: Fix microcode payload size for Fam19 processors"):

Quoted 19 lines · Andrew Cooper
Quoted 4 lines

The original limit provided wasn't accurate. Blobs are in fact rather larger.

Fixes fe36a173d1 ("x86/amd: Initial support for Fam19h processors")

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

Quoted 8 lines
xen/arch/x86/cpu/microcode/amd.c +1 -1
@@ -111,7 +111,7 @@ static bool verify_patch_size(uint32_t patch_size)
 #define F15H_MPB_MAX_SIZE 4096
 #define F16H_MPB_MAX_SIZE 3458
 #define F17H_MPB_MAX_SIZE 3200
-#define F19H_MPB_MAX_SIZE 4800
+#define F19H_MPB_MAX_SIZE 5568

How certain is it that there's not going to be another increase? And in comparison, how bad would it be if we pulled this upper limit to something that's at least slightly less of an "odd" number, e.g. 0x1800, and thus provide some headroom?

Quoted 4 lines
Quoted 3 lines
Quoted 1 line

5568 does seem really an excessively magic number...

It reads better in hex - 0x15c0.  It is exactly the header, match/patch-ram, and the digital signature of a fixed algorithm.

And I realize it's less odd than Fam16's 3458 (0xd82).

This particular value is under investigation.  Firmware packages for Fam16's have the blob size at 0xd60.

Quoted 10 lines
Quoted 8 lines

Its far simpler than Intel's format which contains multiple embedded blobs, and support for minor platform variations within the same blob.

There are a lot of problems with how we do patch verification on AMD right now, but its all a consequence of the header not containing a length field.

This number wont change now.  Zen3 processors are out in the world.

Given history on earlier families, where in some cases sizes also vary by model, how can this fact guarantee anything?

There is one example where it changed, and it got shorter.  Making it larger would involve someone re-laying out the core so more silicon area could be used for patch ram space, which is increasingly unlikely with newer models in the same family.

When 4.16 comes, I do have plans to try and make us more robust to changes in debug builds, particularly given the lack of suitable documentation on the matter.

~Andrew