Skip to contentSkip to conversation

smbios: Fixes for SVVP tests

PATCH In review Eduardo Habkost 3 participants 7 messages Jan 7, 2015 – Jan 26, 2015

lore
Share & tools
lore
#0 lore raw

cover smbios: Fixes for SVVP tests

Some changed introduced by the new QEMU smbios table generation code broke SVVP. This series fixes those issues.

Eduardo Habkost (2):
smbios: Fix dimm size calculation when RAM is multiple of 16GB
smbios: Don't report unknown CPU speed (fix SVVP regression)

 hw/i386/smbios.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/2 smbios: Fix dimm size calculation when RAM is multiple of 16GB

The Memory Device size calculation logic is broken when the RAM size is a multiple of 16GB, making the size of the last entry be 0 instead of 16GB. Fix the logic to handle that case correctly.

---
 hw/i386/smbios.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/i386/smbios.c +2 -1
index 024e594..ae7032a 100644
@@ -850,7 +850,8 @@ void smbios_get_tables(uint8_t **tables, size_t *tables_len,
         }
 
 #define MAX_DIMM_SZ (16ll * ONE_GB)
-#define GET_DIMM_SZ ((i < dimm_cnt - 1) ? MAX_DIMM_SZ : ram_size % MAX_DIMM_SZ)
+#define GET_DIMM_SZ ((i < dimm_cnt - 1) ? MAX_DIMM_SZ \
+                                        : ((ram_size - 1) % MAX_DIMM_SZ) + 1)
 
         dimm_cnt = QEMU_ALIGN_UP(ram_size, MAX_DIMM_SZ) / MAX_DIMM_SZ;
 
Signature · 1 line
1.9.3
#3 lore raw

PATCH 2/2 smbios: Don't report unknown CPU speed (fix SVVP regression)

In reply to Eduardo Habkost

SVVP requires processor speed on Type 4 structures to not be unknown. This was fixed in SeaBIOS 0.5.0 (in 2009), but the bug was reintroduced in QEMU 2.1.

Revert to old behavior and report CPU speed as 2000 MHz instead of unknown.

---
 hw/i386/smbios.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/i386/smbios.c +3 -2
index ae7032a..12d2137 100644
@@ -618,8 +618,9 @@ static void smbios_build_type_4_table(unsigned instance)
     SMBIOS_TABLE_SET_STR(4, processor_version_str, type4.version);
     t->voltage = 0;
     t->external_clock = cpu_to_le16(0); /* Unknown */
-    t->max_speed = cpu_to_le16(0); /* Unknown */
-    t->current_speed = cpu_to_le16(0); /* Unknown */
+    /* SVVP requires max_speed and current_speed to not be unknown. */
+    t->max_speed = cpu_to_le16(2000); /* 2000 MHz */
+    t->current_speed = cpu_to_le16(2000); /* 2000 MHz */
     t->status = 0x41; /* Socket populated, CPU enabled */
     t->processor_upgrade = 0x01; /* Other */
     t->l1_cache_handle = cpu_to_le16(0xFFFF); /* N/A */
Signature · 1 line
1.9.3
Reviewed-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] smbios: Fix dimm size calculation when RAM is multiple of 16GB

In reply to Eduardo Habkost
Quoted 14 lines · Eduardo Habkost

The Memory Device size calculation logic is broken when the RAM size is a multiple of 16GB, making the size of the last entry be 0 instead of 16GB. Fix the logic to handle that case correctly.

---
 hw/i386/smbios.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/i386/smbios.c +0 -0
index 024e594..ae7032a 100644

hw/i386/smbios.c void smbios_get_tables(uint8_t **tables, size_t *tables_len, · line 856

Quoted 8 lines
hw/i386/smbios.c +2 -1
@@ -850,7 +850,8 @@ void smbios_get_tables(uint8_t **tables, size_t *tables_len,
         }
 
 #define MAX_DIMM_SZ (16ll * ONE_GB)
-#define GET_DIMM_SZ ((i < dimm_cnt - 1) ? MAX_DIMM_SZ : ram_size % MAX_DIMM_SZ)
+#define GET_DIMM_SZ ((i < dimm_cnt - 1) ? MAX_DIMM_SZ \
+                                        : ((ram_size - 1) % MAX_DIMM_SZ) + 1)
 
         dimm_cnt = QEMU_ALIGN_UP(ram_size, MAX_DIMM_SZ) / MAX_DIMM_SZ;

Using "dimm_size = MAX(ram_size, MAX_DIMM_SZ); ram_size -= dimm_size" would have been less weird, but the whole code here is interesting so your patch is just keeping with the style. We all do that. :)

Reviewed-by on v1 2/2
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] smbios: Don't report unknown CPU speed (fix SVVP regression)

In reply to Eduardo Habkost
Quoted 19 lines · Eduardo Habkost

SVVP requires processor speed on Type 4 structures to not be unknown. This was fixed in SeaBIOS 0.5.0 (in 2009), but the bug was reintroduced in QEMU 2.1.

Revert to old behavior and report CPU speed as 2000 MHz instead of unknown.

---
 hw/i386/smbios.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/i386/smbios.c +0 -0
index ae7032a..12d2137 100644
@@ -618,8 +618,9 @@ static void smbios_build_type_4_table(unsigned instance)
     SMBIOS_TABLE_SET_STR(4, processor_version_str, type4.version);

hw/i386/smbios.c static void smbios_build_type_4_table(unsigned instance) · line 626

Quoted 10 lines
hw/i386/smbios.c +3 -2
     t->voltage = 0;
     t->external_clock = cpu_to_le16(0); /* Unknown */
-    t->max_speed = cpu_to_le16(0); /* Unknown */
-    t->current_speed = cpu_to_le16(0); /* Unknown */
+    /* SVVP requires max_speed and current_speed to not be unknown. */
+    t->max_speed = cpu_to_le16(2000); /* 2000 MHz */
+    t->current_speed = cpu_to_le16(2000); /* 2000 MHz */
     t->status = 0x41; /* Socket populated, CPU enabled */
     t->processor_upgrade = 0x01; /* Other */
     t->l1_cache_handle = cpu_to_le16(0xFFFF); /* N/A */
#5 lore raw
In reply to Eduardo Habkost
Quoted 2 lines · Eduardo Habkost

Some changed introduced by the new QEMU smbios table generation code broke SVVP. This series fixes those issues.

Ping? Through which tree can this go in?

Quoted 7 lines

Eduardo Habkost (2):
smbios: Fix dimm size calculation when RAM is multiple of 16GB
smbios: Don't report unknown CPU speed (fix SVVP regression)

 hw/i386/smbios.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
Eduardo
#6 lore raw
Quoted 5 lines · Eduardo Habkost
Quoted 2 lines · Eduardo Habkost

Some changed introduced by the new QEMU smbios table generation code broke SVVP. This series fixes those issues.

Ping? Through which tree can this go in?

I can merge them I guess - will review shortly.
Pls Cc me in the future if you want my attention.

Quoted 10 lines
Quoted 7 lines

Eduardo Habkost (2):
smbios: Fix dimm size calculation when RAM is multiple of 16GB
smbios: Don't report unknown CPU speed (fix SVVP regression)

 hw/i386/smbios.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
Eduardo