Fix SMBios table regressions in HVM guests
cover Fix SMBios table regressions in HVM guests
The series "HVM firmware passthrough" series in Jan 2013 from Ross Philipson cause two regressions for HVM guests which sadly found their way into the Xen 4.3 release.
The first regression causes an incorrect count of tables to be placed in the main header, and can be seen by running dmidecode in any applicable HVM domain.
The second regression found its way into the public ABI, making it harder to fix. However, I believe (and have argued) that the correct fix is to change the ABI. I would appreciate thoughts/comments.
Signature · 1 line
1.7.10.4
PATCH 1/2 hvmloader/smbios: Correctly count the number of tables written.
Fixes regression indirectly introduced by c/s 4d23036e709627
That changeset added some smbios tables which were option based on the toolstack providing appropriate xenstore keys. The do_struct() macro would unconditionally increment nr_structs, even if a table was not actually written.
--- tools/firmware/hvmloader/smbios.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/firmware/hvmloader/smbios.c +2 -1
@@ -192,7 +192,8 @@ write_smbios_tables(void *ep, void *start,#define do_struct (fn) do { \ q = (fn); \ - (*nr_structs)++; \ + if ( q != p ) \ + (*nr_structs)++; \ if ( (q - p) > *max_struct_size ) \ *max_struct_size = q - p; \ p = q; \
Signature · 1 line
1.7.10.4
PATCH 2/2 public/hvm_xs_strings.h: Fix ABI regression for OEM SMBios strings
In reply to Andrew CooperThe old code for OEM SMBios strings was:
char path[20] = "bios-strings/oem-XX";
path[(sizeof path) - 3] = '0' + ((i < 10) ? i : i / 10);
path[(sizeof path) - 2] = (i < 10) ? '\0' : '0' + (i % 10);Where oem-1 thru 9 specifically had no leading 0.
However, the definition of HVM_XS_OEM_STRINGS specifically requires leading 0s.
This regression was introduced by the combination of c/s 4d23036e709627 and e64c3f71ceb662
I realise that this patch causes a change to the public headers. However I feel it is justified as:
* All toolstacks used to have to embed the magic string (and almost certainly still do)
* If by some miriacle a new toolstack has started using the new define will continue to work.
* The only intree consumer of the define is hvmloader itself.
--- xen/include/public/hvm/hvm_xs_strings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/public/hvm/hvm_xs_strings.h +1 -1
@@ -75,6 +75,6 @@/* 1 to 99 OEM strings can be set in xenstore using values of the form * below. These strings will be loaded into the SMBIOS type 11 structure. */ -#define HVM_XS_OEM_STRINGS "bios-strings/oem-%02d" +#define HVM_XS_OEM_STRINGS "bios-strings/oem-%d"#endif /* __XEN_PUBLIC_HVM_HVM_XS_STRINGS_H__ */
Signature · 1 line
1.7.10.4
Quoted 12 lines · Andrew Cooper
The series "HVM firmware passthrough" series in Jan 2013 from Ross Philipson cause two regressions for HVM guests which sadly found their way into the Xen 4.3 release.
The first regression causes an incorrect count of tables to be placed in the main header, and can be seen by running dmidecode in any applicable HVM domain.
The second regression found its way into the public ABI, making it harder to fix. However, I believe (and have argued) that the correct fix is to change the ABI. I would appreciate thoughts/comments.
Quoted 6 lines
Signed-off-by Andrew Cooper <[email protected]>CC Keir Fraser <[email protected]>CC Jan Beulich <[email protected]>CC Ian Campbell <[email protected]>CC Ian Jackson <[email protected]>CC Ross Philipson <[email protected]>