hw/smbios/smbios: Use MachineState::ram_size instead of global one
PATCH 1/1 hw/smbios/smbios: Use MachineState::ram_size instead of global one
The smbios_get_tables() function has access the a machine state. Use the field instead of accessing the global ram_size variable.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
--- hw/smbios/smbios.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/smbios/smbios.c +3 -2
@@ -630,7 +630,7 @@ static void smbios_build_type_11_table(void)#define MAX_T16_STD_SZ 0x80000000/* 2T in Kilobytes */ -static void smbios_build_type_16_table (unsigned dimm_cnt) +static void smbios_build_type_16_table (ram_addr_t ram_size,unsigned dimm_cnt) {uint64_t size_kb;
@@ -847,6 +847,7 @@ void smbios_get_tables(MachineState *ms, uint8_t **anchor, size_t *anchor_len) { unsigned i, dimm_cnt; +ram_addr_t ram_size = ms->ram_size;if (smbios_legacy) { *tables = *anchor =NULL ;
@@ -876,7 +877,7 @@ void smbios_get_tables(MachineState *ms, dimm_cnt =QEMU_ALIGN_UP (ram_size,MAX_DIMM_SZ ) /MAX_DIMM_SZ ; -smbios_build_type_16_table (dimm_cnt); +smbios_build_type_16_table (ram_size, dimm_cnt);for (i =0 ; i < dimm_cnt; i++) {smbios_build_type_17_table (i,GET_DIMM_SZ );
Signature · 1 line
2.21.1
Quoted 4 lines · On Thu, 9 Jan 2020 00:31:38 +0100 Philippe Mathieu-Daudé <[email protected]>…
The
smbios_get_tables()function has access the a machine state. Use the field instead of accessing the globalram_sizevariable.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Reviewed-by Igor Mammedov <[email protected]>
Quoted 34 lines
--- hw/smbios/smbios.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)hw/smbios/smbios.c +3
-2@@ -630,7 +630,7 @@ static void smbios_build_type_11_table(void)#define MAX_T16_STD_SZ 0x80000000/* 2T in Kilobytes */ -static void smbios_build_type_16_table (unsigned dimm_cnt) +static void smbios_build_type_16_table (ram_addr_t ram_size,unsigned dimm_cnt) {uint64_t size_kb;@@ -847,6 +847,7 @@ void smbios_get_tables(MachineState *ms, uint8_t **anchor, size_t *anchor_len) { unsigned i, dimm_cnt; +ram_addr_t ram_size = ms->ram_size;if (smbios_legacy) { *tables = *anchor =NULL ;@@ -876,7 +877,7 @@ void smbios_get_tables(MachineState *ms, dimm_cnt =QEMU_ALIGN_UP (ram_size,MAX_DIMM_SZ ) /MAX_DIMM_SZ ; -smbios_build_type_16_table (dimm_cnt); +smbios_build_type_16_table (ram_size, dimm_cnt);for (i =0 ; i < dimm_cnt; i++) {smbios_build_type_17_table (i,GET_DIMM_SZ );
Quoted 1 line · Philippe Mathieu-Daudé
The
smbios_get_tables()function has access the a machine state.
the a -> the
Quoted 1 line
Use the field
the field -> the machine state field
Quoted 3 lines
instead of accessing the global
ram_sizevariable.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Reviewed-by Michael S. Tsirkin <[email protected]>
Quoted 36 lines
--- hw/smbios/smbios.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)hw/smbios/smbios.c +3
-2@@ -630,7 +630,7 @@ static void smbios_build_type_11_table(void)#define MAX_T16_STD_SZ 0x80000000/* 2T in Kilobytes */ -static void smbios_build_type_16_table (unsigned dimm_cnt) +static void smbios_build_type_16_table (ram_addr_t ram_size,unsigned dimm_cnt) {uint64_t size_kb;@@ -847,6 +847,7 @@ void smbios_get_tables(MachineState *ms, uint8_t **anchor, size_t *anchor_len) { unsigned i, dimm_cnt; +ram_addr_t ram_size = ms->ram_size;if (smbios_legacy) { *tables = *anchor =NULL ;@@ -876,7 +877,7 @@ void smbios_get_tables(MachineState *ms, dimm_cnt =QEMU_ALIGN_UP (ram_size,MAX_DIMM_SZ ) /MAX_DIMM_SZ ; -smbios_build_type_16_table (dimm_cnt); +smbios_build_type_16_table (ram_size, dimm_cnt);for (i =0 ; i < dimm_cnt; i++) {smbios_build_type_17_table (i,GET_DIMM_SZ );Signature · 1 line
2.21.1