Skip to contentSkip to conversation

Support newer microcode

PATCH New Kurt Garloff 1 participant 1 message Jan 15, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Support newer microcode

Hi,

intel docs say that default microcode size is 2000+48 bytes; however shorter sizes are legal. Actually, with microcode_ctl-1.15, such shorter u-codes are actually out there in the wild. The Linux kernel rejected this until 2.6.19rc; Xen still does. Here's the port to Xen.

Best,

Signature · 1 line
Kurt Garloff, Head Architect and acting VP SUSE R&D, Novell Inc.

# HG changeset patch
# User Kurt Garloff <[email protected]>
# Node ID b1752c878a7845d812c9b15e721f401d786394b2
# Parent 469478194aef6e987f9281efbc0756749be6eb80 Microcode does not need to have the default size of 2000+48 bytes. A corresponding patch has gone into Linux 2.6.19; this is the port to Xen.

Reference: Patch to linux kernel from Sep 27 2006

Quoted 11 lines

# User Shaohua Li <[email protected]>
# Node ID 45898b908138b5d93c2cc7353f061ce54af145dc # Parent f962eab7b82c9bf1a6da69571046e764f5128395 [PATCH] x86 microcode: don't check the size

IA32 manual says if micorcode update's size is 0, then the size is default size (2048 bytes). But this doesn't suggest all microcode update's size should be above 2048 bytes to me. We actually had a microcode update whose size is 1024 bytes. The patch just removed the check.

Quoted 6 lines

committer: Linus Torvalds <[email protected]> 1159370778 -0700

xen/arch/x86/microcode.c +2 -7
diff -r 469478194aef -r b1752c878a78 xen/arch/x86/microcode.c
@@ -249,14 +249,14 @@ static int find_matching_ucodes (void)
 		}
 
 		total_size = get_totalsize(&mc_header);
-		if ((cursor + total_size > user_buffer_size) || (total_size < DEFAULT_UCODE_TOTALSIZE)) {
+		if (cursor + total_size > user_buffer_size) {
 			printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
 			error = -EINVAL;
 			goto out;
 		}
 
 		data_size = get_datasize(&mc_header);
-		if ((data_size + MC_HEADER_SIZE > total_size) || (data_size < DEFAULT_UCODE_DATASIZE)) {
+		if (data_size + MC_HEADER_SIZE > total_size) {
 			printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
 			error = -EINVAL;
 			goto out;
@@ -459,11 +459,6 @@ int microcode_update(XEN_GUEST_HANDLE(vo
 {
 	int ret;
 
-	if (len < DEFAULT_UCODE_TOTALSIZE) {
-		printk(KERN_ERR "microcode: not enough data\n");
-		return -EINVAL;
-	}
-
 	if (len != (typeof(user_buffer_size))len) {
 		printk(KERN_ERR "microcode: too much data\n");
 		return -E2BIG;

From: Kurt Garloff <[email protected]>
Subject: The microcode may be smaller than the default size.
Patch-mainline: Never (but patch to non-xen microcode in 2.6.19rc)

This is the needed piece to the dom0 xen kernel to allow microcode updates of non default size (2000+48 bytes); a patch is needed to the Xen hypervisor itself as well.

This corresponds to a patch to the microcode driver in 2.6.19rc from Sep 27 2006:

Quoted 11 lines

# User Shaohua Li <[email protected]>
# Node ID 45898b908138b5d93c2cc7353f061ce54af145dc # Parent f962eab7b82c9bf1a6da69571046e764f5128395 [PATCH] x86 microcode: don't check the size

IA32 manual says if micorcode update's size is 0, then the size is default size (2048 bytes). But this doesn't suggest all microcode update's size should be above 2048 bytes to me. We actually had a microcode update whose size is 1024 bytes. The patch just removed the check.

Quoted 6 lines

committer: Linus Torvalds <[email protected]> 1159370778 -0700

arch/i386/kernel/microcode-xen.c renamed from arch/i386/kernel/microcode-xen.c.orig +1 -1
@@ -85,7 +85,7 @@
 {
 	ssize_t ret;
 
-	if (len < DEFAULT_UCODE_TOTALSIZE) {
+	if (len < MC_HEADER_SIZE) {
 		printk(KERN_ERR "microcode: not enough data\n"); 
 		return -EINVAL;
 	}

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel