Skip to contentSkip to conversation

MTRR+SMBIOS Bochs patches

PATCH In review Marcelo Tosatti 3 participants 3 messages Jan 20, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MTRR+SMBIOS Bochs patches

Attached patch adds a series of patches against Bochs, from KVM tree:
- SMBIOS updates
- MTRR support
- unconditional mptable

Alex Williamson (4):
kvm: bios: extend MTRRs to above 4G
kvm: bios: cleanup/consolidate above 4G memory parsing
kvm: bios: update SMBIOS table to report memory above 4G
kvm: bios: switch MTRRs to cover only the PCI range and default to WB

Avi Kivity (3):
kvm: bios: generate mptable unconditionally
kvm: bios: add mtrr support
kvm: bios: smp mtrr support

Bill Rieske (2):
kvm: bios: resolve memory device roll over reporting issues with >32 guests
kvm: bios: fix smbios memory device length boundary condition

bios-pq/0002_smbios_report_4g.patch +32 -0
diff -Nur pc-bios.orig/bios-pq/0002_smbios_report_4g.patch pc-bios/bios-pq/0002_smbios_report_4g.patch
@@ -0,0 +1,32 @@
+kvm: bios: update SMBIOS table to report memory above 4G
+
+Signed-off-by: Alex Williamson <[email protected]>
+Signed-off-by: Avi Kivity <[email protected]>
+
+From: Alex Williamson <[email protected]>
+
+Index: bochs/bios/rombios32.c
+===================================================================
+--- bochs.orig/bios/rombios32.c
++++ bochs/bios/rombios32.c
+@@ -2081,7 +2081,8 @@ void smbios_init(void)
+ {
+     unsigned cpu_num, nr_structs = 0, max_struct_size = 0;
+     char *start, *p, *q;
+-    int memsize = ram_size / (1024 * 1024);
++    int memsize = (ram_end == ram_size) ? ram_size / (1024 * 1024) :
++                  (ram_end - (1ull << 32) + ram_size) / (1024 * 1024);
+ 
+ #ifdef BX_USE_EBDA_TABLES
+     ebda_cur_addr = align(ebda_cur_addr, 16);
+@@ -2108,8 +2109,8 @@ void smbios_init(void)
+         add_struct(smbios_type_4_init(p, cpu_num));
+     add_struct(smbios_type_16_init(p, memsize));
+     add_struct(smbios_type_17_init(p, memsize));
+-    add_struct(smbios_type_19_init(p, memsize));
+-    add_struct(smbios_type_20_init(p, memsize));
++    add_struct(smbios_type_19_init(p, ram_end / (1024 * 1024)));
++    add_struct(smbios_type_20_init(p, ram_end / (1024 * 1024)));
+     add_struct(smbios_type_32_init(p));
+     add_struct(smbios_type_127_init(p));
+ 
bios-pq/0003_mptable_unconditional.patch +23 -0
diff -Nur pc-bios.orig/bios-pq/0003_mptable_unconditional.patch pc-bios/bios-pq/0003_mptable_unconditional.patch
@@ -0,0 +1,23 @@
+kvm: bios: generate mptable unconditionally
+
+VMware ESX requires an mptable even for uniprocessor guests.
+
+Signed-off-by: Avi Kivity <[email protected]>
+From: Avi Kivity <[email protected]>
+
+Index: bochs/bios/rombios32.c
+===================================================================
+--- bochs.orig/bios/rombios32.c
++++ bochs/bios/rombios32.c
+@@ -970,11 +970,6 @@ static void mptable_init(void)
+     int ioapic_id, i, len;
+     int mp_config_table_size;
+ 
+-#ifdef BX_QEMU
+-    if (smp_cpus <= 1)
+-        return;
+-#endif
+-
+ #ifdef BX_USE_EBDA_TABLES
+     mp_config_table = (uint8_t *)(ram_size - ACPI_DATA_SIZE - MPTABLE_MAX_SIZE);
+ #else
bios-pq/0004_mtrr_up.patch +119 -0

119 lines not on this page · raw message

bios-pq/0005_mtrr_smp.patch +125 -0

125 lines not on this page · raw message

bios-pq/0006_mtrr_above_4g.patch +61 -0

61 lines not on this page · raw message

bios-pq/0007_mtrr_above_4g_clean.patch +57 -0

57 lines not on this page · raw message

bios-pq/0008_mtrr_default.patch +52 -0

52 lines not on this page · raw message

bios-pq/0009_smbios_16gb.patch +183 -0

183 lines not on this page · raw message

bios-pq/0010_smbios_16g_boundary.patch +22 -0
diff -Nur pc-bios.orig/bios-pq/0010_smbios_16g_boundary.patch pc-bios/bios-pq/0010_smbios_16g_boundary.patch
@@ -0,0 +1,22 @@
+kvm: bios: fix smbios memory device length boundary condition
+   
+dev_memsize ends up 0 when it shouldn't be on 16G boundary conditions.
+    
+Signed-off-by: Bill Rieske <[email protected]>
+Signed-off-by: Avi Kivity <[email protected]>
+
+From: Bill Rieske <[email protected]>
+
+Index: bochs/bios/rombios32.c
+===================================================================
+--- bochs.orig/bios/rombios32.c
++++ bochs/bios/rombios32.c
+@@ -2218,7 +2218,7 @@ void smbios_init(void)
+     for ( i = 0; i < nr_mem_devs; i++ )
+     {
+         uint32_t dev_memsize = ((i == (nr_mem_devs - 1))
+-                                ? (memsize & 0x3fff) : 0x4000);
++                                ? (((memsize-1) & 0x3fff)+1) : 0x4000);
+         add_struct(smbios_type_17_init(p, dev_memsize, i));
+         add_struct(smbios_type_19_init(p, dev_memsize, i));
+         add_struct(smbios_type_20_init(p, dev_memsize, i));
bios-pq/series +9 -0
diff -Nur pc-bios.orig/bios-pq/series pc-bios/bios-pq/series
@@ -1 +1,10 @@
 0001_bx-qemu.patch
+0002_smbios_report_4g.patch
+0003_mptable_unconditional.patch
+0004_mtrr_up.patch
+0005_mtrr_smp.patch
+0006_mtrr_above_4g.patch
+0007_mtrr_above_4g_clean.patch
+0008_mtrr_default.patch
+0009_smbios_16gb.patch
+0010_smbios_16g_boundary.patch
#1 lore raw
Quoted 11 lines · Marcelo Tosatti

Attached patch adds a series of patches against Bochs, from KVM tree:
- SMBIOS updates
- MTRR support
- unconditional mptable

Alex Williamson (4):
kvm: bios: extend MTRRs to above 4G
kvm: bios: cleanup/consolidate above 4G memory parsing
kvm: bios: update SMBIOS table to report memory above 4G
kvm: bios: switch MTRRs to cover only the PCI range and default to WB

Quoted 10 lines

Avi Kivity (3):
kvm: bios: generate mptable unconditionally
kvm: bios: add mtrr support
kvm: bios: smp mtrr support

Bill Rieske (2):
kvm: bios: resolve memory device roll over reporting issues with >32 guests
kvm: bios: fix smbios memory device length boundary condition

Wow, awesome!

Can you send each patch as a member of a patch series so they can be reviewed individually? Please CC bochs-devel. I'll take care of putting them in the right place in SVN.

Regards,

Anthony Liguori

#2 lore raw
Quoted 21 lines · Anthony Liguori
Quoted 20 lines · Marcelo Tosatti

Attached patch adds a series of patches against Bochs, from KVM tree:
- SMBIOS updates
- MTRR support
- unconditional mptable

Alex Williamson (4):
kvm: bios: extend MTRRs to above 4G
kvm: bios: cleanup/consolidate above 4G memory parsing
kvm: bios: update SMBIOS table to report memory above 4G
kvm: bios: switch MTRRs to cover only the PCI range and default
to WB

Avi Kivity (3):
kvm: bios: generate mptable unconditionally
kvm: bios: add mtrr support
kvm: bios: smp mtrr support

Bill Rieske (2):
kvm: bios: resolve memory device roll over reporting issues with

Quoted 1 line

32 guests

Quoted 8 lines
Quoted 3 lines

kvm: bios: fix smbios memory device length boundary condition

Wow, awesome!

Can you send each patch as a member of a patch series so they can be reviewed individually? Please CC bochs-devel. I'll take care of putting them in the right place in SVN.

All MTRR settings will be completely ignored by Qemu (writes will be discarded, reads will be zero) unless you also apply my Qemu MTRR support patch.

Subject: Re: [Qemu-devel] [PATCH] MTRR support on x86, part 1
Date: Thu, 11 Dec 2008 23:37:05 +0100

Should I resend that patch? It still applies to Qemu svn HEAD.

Regards,
Carl-Daniel

Signature · 1 line
http://www.hailfinger.org/