* [PATCH] hw/smbios/smbios: Use MachineState::ram_size instead of global one
@ 2020-01-08 23:31 Philippe Mathieu-Daudé
2020-01-09 10:21 ` Igor Mammedov
2020-01-09 11:35 ` Michael S. Tsirkin
0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-01-08 23:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Igor Mammedov, Philippe Mathieu-Daudé, Michael S. Tsirkin
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é <philmd@redhat.com>
---
hw/smbios/smbios.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 11d476c4a2..ded5f1f4e2 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -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);
--
2.21.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/smbios/smbios: Use MachineState::ram_size instead of global one
2020-01-08 23:31 [PATCH] hw/smbios/smbios: Use MachineState::ram_size instead of global one Philippe Mathieu-Daudé
@ 2020-01-09 10:21 ` Igor Mammedov
2020-01-09 11:35 ` Michael S. Tsirkin
1 sibling, 0 replies; 3+ messages in thread
From: Igor Mammedov @ 2020-01-09 10:21 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Michael S. Tsirkin
On Thu, 9 Jan 2020 00:31:38 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> 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é <philmd@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> ---
> hw/smbios/smbios.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> index 11d476c4a2..ded5f1f4e2 100644
> --- a/hw/smbios/smbios.c
> +++ b/hw/smbios/smbios.c
> @@ -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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/smbios/smbios: Use MachineState::ram_size instead of global one
2020-01-08 23:31 [PATCH] hw/smbios/smbios: Use MachineState::ram_size instead of global one Philippe Mathieu-Daudé
2020-01-09 10:21 ` Igor Mammedov
@ 2020-01-09 11:35 ` Michael S. Tsirkin
1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2020-01-09 11:35 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: Igor Mammedov, qemu-devel
On Thu, Jan 09, 2020 at 12:31:38AM +0100, Philippe Mathieu-Daudé wrote:
> The smbios_get_tables() function has access the a machine state.
the a -> the
> Use the field
the field -> the machine state field
> instead of accessing the global ram_size variable.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/smbios/smbios.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> index 11d476c4a2..ded5f1f4e2 100644
> --- a/hw/smbios/smbios.c
> +++ b/hw/smbios/smbios.c
> @@ -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);
> --
> 2.21.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-09 11:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 23:31 [PATCH] hw/smbios/smbios: Use MachineState::ram_size instead of global one Philippe Mathieu-Daudé
2020-01-09 10:21 ` Igor Mammedov
2020-01-09 11:35 ` Michael S. Tsirkin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.