* [Qemu-devel] [PATCH 1/5] smbios: Move table build tools into an include file.
2016-02-24 18:59 [Qemu-devel] [PATCH 0/5] Add ACPI and SMBIOS table entries for IPMI minyard
@ 2016-02-24 18:59 ` minyard
2016-02-24 18:59 ` [Qemu-devel] [PATCH 2/5] pc: Postpone SMBIOS table installation to post machine init minyard
` (4 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: minyard @ 2016-02-24 18:59 UTC (permalink / raw)
To: Igor Mammedov, Michael S. Tsirkin, Paolo Bonzini, qemu-devel
Cc: Corey Minyard, minyard
From: Corey Minyard <cminyard@mvista.com>
This will let things in other files (like IPMI) build SMBIOS tables.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
hw/smbios/smbios.c | 70 ++++---------------------------------------
hw/smbios/smbios_build.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+), 64 deletions(-)
create mode 100644 hw/smbios/smbios_build.h
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 3b5f9bd..e1bc1ea 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -23,6 +23,7 @@
#include "hw/smbios/smbios.h"
#include "hw/loader.h"
#include "exec/cpu-common.h"
+#include "smbios_build.h"
/* legacy structures and constants for <= 2.0 machines */
struct smbios_header {
@@ -52,10 +53,10 @@ static bool smbios_uuid_encoded = true;
/* end: legacy structures & constants for <= 2.0 machines */
-static uint8_t *smbios_tables;
-static size_t smbios_tables_len;
-static unsigned smbios_table_max;
-static unsigned smbios_table_cnt;
+uint8_t *smbios_tables;
+size_t smbios_tables_len;
+unsigned smbios_table_max;
+unsigned smbios_table_cnt;
static SmbiosEntryPointType smbios_ep_type = SMBIOS_ENTRY_POINT_21;
static SmbiosEntryPoint ep;
@@ -428,7 +429,7 @@ uint8_t *smbios_get_table_legacy(size_t *length)
/* end: legacy setup functions for <= 2.0 machines */
-static bool smbios_skip_table(uint8_t type, bool required_table)
+bool smbios_skip_table(uint8_t type, bool required_table)
{
if (test_bit(type, have_binfile_bitmap)) {
return true; /* user provided their own binary blob(s) */
@@ -442,65 +443,6 @@ static bool smbios_skip_table(uint8_t type, bool required_table)
return true;
}
-#define SMBIOS_BUILD_TABLE_PRE(tbl_type, tbl_handle, tbl_required) \
- struct smbios_type_##tbl_type *t; \
- size_t t_off; /* table offset into smbios_tables */ \
- int str_index = 0; \
- do { \
- /* should we skip building this table ? */ \
- if (smbios_skip_table(tbl_type, tbl_required)) { \
- return; \
- } \
- \
- /* use offset of table t within smbios_tables */ \
- /* (pointer must be updated after each realloc) */ \
- t_off = smbios_tables_len; \
- smbios_tables_len += sizeof(*t); \
- smbios_tables = g_realloc(smbios_tables, smbios_tables_len); \
- t = (struct smbios_type_##tbl_type *)(smbios_tables + t_off); \
- \
- t->header.type = tbl_type; \
- t->header.length = sizeof(*t); \
- t->header.handle = cpu_to_le16(tbl_handle); \
- } while (0)
-
-#define SMBIOS_TABLE_SET_STR(tbl_type, field, value) \
- do { \
- int len = (value != NULL) ? strlen(value) + 1 : 0; \
- if (len > 1) { \
- smbios_tables = g_realloc(smbios_tables, \
- smbios_tables_len + len); \
- memcpy(smbios_tables + smbios_tables_len, value, len); \
- smbios_tables_len += len; \
- /* update pointer post-realloc */ \
- t = (struct smbios_type_##tbl_type *)(smbios_tables + t_off); \
- t->field = ++str_index; \
- } else { \
- t->field = 0; \
- } \
- } while (0)
-
-#define SMBIOS_BUILD_TABLE_POST \
- do { \
- size_t term_cnt, t_size; \
- \
- /* add '\0' terminator (add two if no strings defined) */ \
- term_cnt = (str_index == 0) ? 2 : 1; \
- smbios_tables = g_realloc(smbios_tables, \
- smbios_tables_len + term_cnt); \
- memset(smbios_tables + smbios_tables_len, 0, term_cnt); \
- smbios_tables_len += term_cnt; \
- \
- /* update smbios max. element size */ \
- t_size = smbios_tables_len - t_off; \
- if (t_size > smbios_table_max) { \
- smbios_table_max = t_size; \
- } \
- \
- /* update smbios element count */ \
- smbios_table_cnt++; \
- } while (0)
-
static void smbios_build_type_0_table(void)
{
SMBIOS_BUILD_TABLE_PRE(0, 0x000, false); /* optional, leave up to BIOS */
diff --git a/hw/smbios/smbios_build.h b/hw/smbios/smbios_build.h
new file mode 100644
index 0000000..2257721
--- /dev/null
+++ b/hw/smbios/smbios_build.h
@@ -0,0 +1,77 @@
+/*
+ * SMBIOS Support
+ *
+ * Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
+ * Copyright (C) 2013 Red Hat, Inc.
+ */
+
+#ifndef QEMU_SMBIOS_BUILD_H
+#define QEMU_SMBIOS_BUILD_H
+
+bool smbios_skip_table(uint8_t type, bool required_table);
+
+extern uint8_t *smbios_tables;
+extern size_t smbios_tables_len;
+extern unsigned smbios_table_max;
+extern unsigned smbios_table_cnt;
+
+#define SMBIOS_BUILD_TABLE_PRE(tbl_type, tbl_handle, tbl_required) \
+ struct smbios_type_##tbl_type *t; \
+ size_t t_off; /* table offset into smbios_tables */ \
+ int str_index = 0; \
+ do { \
+ /* should we skip building this table ? */ \
+ if (smbios_skip_table(tbl_type, tbl_required)) { \
+ return; \
+ } \
+ \
+ /* use offset of table t within smbios_tables */ \
+ /* (pointer must be updated after each realloc) */ \
+ t_off = smbios_tables_len; \
+ smbios_tables_len += sizeof(*t); \
+ smbios_tables = g_realloc(smbios_tables, smbios_tables_len); \
+ t = (struct smbios_type_##tbl_type *)(smbios_tables + t_off); \
+ \
+ t->header.type = tbl_type; \
+ t->header.length = sizeof(*t); \
+ t->header.handle = cpu_to_le16(tbl_handle); \
+ } while (0)
+
+#define SMBIOS_TABLE_SET_STR(tbl_type, field, value) \
+ do { \
+ int len = (value != NULL) ? strlen(value) + 1 : 0; \
+ if (len > 1) { \
+ smbios_tables = g_realloc(smbios_tables, \
+ smbios_tables_len + len); \
+ memcpy(smbios_tables + smbios_tables_len, value, len); \
+ smbios_tables_len += len; \
+ /* update pointer post-realloc */ \
+ t = (struct smbios_type_##tbl_type *)(smbios_tables + t_off); \
+ t->field = ++str_index; \
+ } else { \
+ t->field = 0; \
+ } \
+ } while (0)
+
+#define SMBIOS_BUILD_TABLE_POST \
+ do { \
+ size_t term_cnt, t_size; \
+ \
+ /* add '\0' terminator (add two if no strings defined) */ \
+ term_cnt = (str_index == 0) ? 2 : 1; \
+ smbios_tables = g_realloc(smbios_tables, \
+ smbios_tables_len + term_cnt); \
+ memset(smbios_tables + smbios_tables_len, 0, term_cnt); \
+ smbios_tables_len += term_cnt; \
+ \
+ /* update smbios max. element size */ \
+ t_size = smbios_tables_len - t_off; \
+ if (t_size > smbios_table_max) { \
+ smbios_table_max = t_size; \
+ } \
+ \
+ /* update smbios element count */ \
+ smbios_table_cnt++; \
+ } while (0)
+
+#endif /* QEMU_SMBIOS_BUILD_H */
--
2.5.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 2/5] pc: Postpone SMBIOS table installation to post machine init
2016-02-24 18:59 [Qemu-devel] [PATCH 0/5] Add ACPI and SMBIOS table entries for IPMI minyard
2016-02-24 18:59 ` [Qemu-devel] [PATCH 1/5] smbios: Move table build tools into an include file minyard
@ 2016-02-24 18:59 ` minyard
2016-03-13 14:03 ` Michael S. Tsirkin
2016-02-24 18:59 ` [Qemu-devel] [PATCH 3/5] ipmi: Add SMBIOS table entry minyard
` (3 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: minyard @ 2016-02-24 18:59 UTC (permalink / raw)
To: Igor Mammedov, Michael S. Tsirkin, Paolo Bonzini, qemu-devel
Cc: Corey Minyard, minyard
From: Corey Minyard <cminyard@mvista.com>
This is the same place that the ACPI SSDT table gets added, so that
devices can add themselves to the SMBIOS table.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
hw/i386/pc.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 0aeefd2..da8fc76 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -778,8 +778,6 @@ static FWCfgState *bochs_bios_init(AddressSpace *as)
acpi_tables, acpi_tables_len);
fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override());
- pc_build_smbios(fw_cfg);
-
fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
&e820_reserve, sizeof(e820_reserve));
fw_cfg_add_file(fw_cfg, "etc/e820", e820_table,
@@ -1161,6 +1159,7 @@ void pc_machine_done(Notifier *notifier, void *data)
{
PCMachineState *pcms = container_of(notifier,
PCMachineState, machine_done);
+ FWCfgState *fw_cfg = pcms->fw_cfg;
PCIBus *bus = pcms->bus;
if (bus) {
@@ -1172,15 +1171,17 @@ void pc_machine_done(Notifier *notifier, void *data)
extra_hosts++;
}
}
- if (extra_hosts && pcms->fw_cfg) {
+ if (extra_hosts && fw_cfg) {
uint64_t *val = g_malloc(sizeof(*val));
*val = cpu_to_le64(extra_hosts);
- fw_cfg_add_file(pcms->fw_cfg,
- "etc/extra-pci-roots", val, sizeof(*val));
+ fw_cfg_add_file(fw_cfg, "etc/extra-pci-roots", val, sizeof(*val));
}
}
acpi_setup();
+ if (fw_cfg) {
+ pc_build_smbios(fw_cfg);
+ }
}
void pc_guest_info_init(PCMachineState *pcms)
--
2.5.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 2/5] pc: Postpone SMBIOS table installation to post machine init
2016-02-24 18:59 ` [Qemu-devel] [PATCH 2/5] pc: Postpone SMBIOS table installation to post machine init minyard
@ 2016-03-13 14:03 ` Michael S. Tsirkin
2016-03-14 13:30 ` Corey Minyard
0 siblings, 1 reply; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-03-13 14:03 UTC (permalink / raw)
To: minyard; +Cc: Igor Mammedov, Corey Minyard, qemu-devel, Paolo Bonzini
On Wed, Feb 24, 2016 at 12:59:13PM -0600, minyard@acm.org wrote:
> From: Corey Minyard <cminyard@mvista.com>
>
> This is the same place that the ACPI SSDT table gets added, so that
> devices can add themselves to the SMBIOS table.
>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
This changes the order of fw cfg files, which
is guest visible.
Need to make it depend on either machine type
or the presence of ipmi somehow.
> ---
> hw/i386/pc.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 0aeefd2..da8fc76 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -778,8 +778,6 @@ static FWCfgState *bochs_bios_init(AddressSpace *as)
> acpi_tables, acpi_tables_len);
> fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override());
>
> - pc_build_smbios(fw_cfg);
> -
> fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
> &e820_reserve, sizeof(e820_reserve));
> fw_cfg_add_file(fw_cfg, "etc/e820", e820_table,
> @@ -1161,6 +1159,7 @@ void pc_machine_done(Notifier *notifier, void *data)
> {
> PCMachineState *pcms = container_of(notifier,
> PCMachineState, machine_done);
> + FWCfgState *fw_cfg = pcms->fw_cfg;
> PCIBus *bus = pcms->bus;
>
> if (bus) {
> @@ -1172,15 +1171,17 @@ void pc_machine_done(Notifier *notifier, void *data)
> extra_hosts++;
> }
> }
> - if (extra_hosts && pcms->fw_cfg) {
> + if (extra_hosts && fw_cfg) {
> uint64_t *val = g_malloc(sizeof(*val));
> *val = cpu_to_le64(extra_hosts);
> - fw_cfg_add_file(pcms->fw_cfg,
> - "etc/extra-pci-roots", val, sizeof(*val));
> + fw_cfg_add_file(fw_cfg, "etc/extra-pci-roots", val, sizeof(*val));
> }
> }
>
> acpi_setup();
> + if (fw_cfg) {
> + pc_build_smbios(fw_cfg);
> + }
> }
>
> void pc_guest_info_init(PCMachineState *pcms)
> --
> 2.5.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 2/5] pc: Postpone SMBIOS table installation to post machine init
2016-03-13 14:03 ` Michael S. Tsirkin
@ 2016-03-14 13:30 ` Corey Minyard
2016-03-14 14:16 ` Paolo Bonzini
0 siblings, 1 reply; 14+ messages in thread
From: Corey Minyard @ 2016-03-14 13:30 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Igor Mammedov, Corey Minyard, qemu-devel, Paolo Bonzini
On 03/13/2016 09:03 PM, Michael S. Tsirkin wrote:
> On Wed, Feb 24, 2016 at 12:59:13PM -0600, minyard@acm.org wrote:
>> From: Corey Minyard <cminyard@mvista.com>
>>
>> This is the same place that the ACPI SSDT table gets added, so that
>> devices can add themselves to the SMBIOS table.
>>
>> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> This changes the order of fw cfg files, which
> is guest visible.
> Need to make it depend on either machine type
Do you mean add a new machine type, like adding a
2.7 version of pc-i440fx and pc-q35?
> or the presence of ipmi somehow.
You could pre-scan for ipmi options from early in the
pc code. Kind of hackish.
One other option would be to just have ACPI support for
IPMI. Older OSes might not work; I'm not sure how
important that is.
Does anyone have a preference here? To me, adding a
new machine type looks easiest, but I'm not sure of the
effects on users.
-corey
>> ---
>> hw/i386/pc.c | 11 ++++++-----
>> 1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index 0aeefd2..da8fc76 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -778,8 +778,6 @@ static FWCfgState *bochs_bios_init(AddressSpace *as)
>> acpi_tables, acpi_tables_len);
>> fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override());
>>
>> - pc_build_smbios(fw_cfg);
>> -
>> fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE,
>> &e820_reserve, sizeof(e820_reserve));
>> fw_cfg_add_file(fw_cfg, "etc/e820", e820_table,
>> @@ -1161,6 +1159,7 @@ void pc_machine_done(Notifier *notifier, void *data)
>> {
>> PCMachineState *pcms = container_of(notifier,
>> PCMachineState, machine_done);
>> + FWCfgState *fw_cfg = pcms->fw_cfg;
>> PCIBus *bus = pcms->bus;
>>
>> if (bus) {
>> @@ -1172,15 +1171,17 @@ void pc_machine_done(Notifier *notifier, void *data)
>> extra_hosts++;
>> }
>> }
>> - if (extra_hosts && pcms->fw_cfg) {
>> + if (extra_hosts && fw_cfg) {
>> uint64_t *val = g_malloc(sizeof(*val));
>> *val = cpu_to_le64(extra_hosts);
>> - fw_cfg_add_file(pcms->fw_cfg,
>> - "etc/extra-pci-roots", val, sizeof(*val));
>> + fw_cfg_add_file(fw_cfg, "etc/extra-pci-roots", val, sizeof(*val));
>> }
>> }
>>
>> acpi_setup();
>> + if (fw_cfg) {
>> + pc_build_smbios(fw_cfg);
>> + }
>> }
>>
>> void pc_guest_info_init(PCMachineState *pcms)
>> --
>> 2.5.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 2/5] pc: Postpone SMBIOS table installation to post machine init
2016-03-14 13:30 ` Corey Minyard
@ 2016-03-14 14:16 ` Paolo Bonzini
2016-03-14 15:01 ` Corey Minyard
2016-03-15 5:05 ` Michael S. Tsirkin
0 siblings, 2 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-03-14 14:16 UTC (permalink / raw)
To: minyard, Michael S. Tsirkin; +Cc: Igor Mammedov, qemu-devel, Corey Minyard
On 14/03/2016 14:30, Corey Minyard wrote:
> On 03/13/2016 09:03 PM, Michael S. Tsirkin wrote:
>> On Wed, Feb 24, 2016 at 12:59:13PM -0600, minyard@acm.org wrote:
>>> From: Corey Minyard <cminyard@mvista.com>
>>>
>>> This is the same place that the ACPI SSDT table gets added, so that
>>> devices can add themselves to the SMBIOS table.
>>>
>>> Signed-off-by: Corey Minyard <cminyard@mvista.com>
>> This changes the order of fw cfg files, which
>> is guest visible.
>> Need to make it depend on either machine type
Didn't Gerd have a patch to sort fw_cfg files?
... yes, here it is:
https://lists.gnu.org/archive/html/qemu-devel/2015-06/msg05238.html
Paolo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 2/5] pc: Postpone SMBIOS table installation to post machine init
2016-03-14 14:16 ` Paolo Bonzini
@ 2016-03-14 15:01 ` Corey Minyard
2016-03-14 15:25 ` Gerd Hoffmann
2016-03-15 5:05 ` Michael S. Tsirkin
1 sibling, 1 reply; 14+ messages in thread
From: Corey Minyard @ 2016-03-14 15:01 UTC (permalink / raw)
To: Paolo Bonzini, minyard, Michael S. Tsirkin; +Cc: Igor Mammedov, qemu-devel
On 03/14/2016 09:16 PM, Paolo Bonzini wrote:
>
> On 14/03/2016 14:30, Corey Minyard wrote:
>> On 03/13/2016 09:03 PM, Michael S. Tsirkin wrote:
>>> On Wed, Feb 24, 2016 at 12:59:13PM -0600, minyard@acm.org wrote:
>>>> From: Corey Minyard <cminyard@mvista.com>
>>>>
>>>> This is the same place that the ACPI SSDT table gets added, so that
>>>> devices can add themselves to the SMBIOS table.
>>>>
>>>> Signed-off-by: Corey Minyard <cminyard@mvista.com>
>>> This changes the order of fw cfg files, which
>>> is guest visible.
>>> Need to make it depend on either machine type
> Didn't Gerd have a patch to sort fw_cfg files?
>
> ... yes, here it is:
> https://lists.gnu.org/archive/html/qemu-devel/2015-06/msg05238.html
I could take that patch and modify it to add a new machine type...
-corey
> Paolo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 2/5] pc: Postpone SMBIOS table installation to post machine init
2016-03-14 15:01 ` Corey Minyard
@ 2016-03-14 15:25 ` Gerd Hoffmann
0 siblings, 0 replies; 14+ messages in thread
From: Gerd Hoffmann @ 2016-03-14 15:25 UTC (permalink / raw)
To: Corey Minyard
Cc: Paolo Bonzini, Igor Mammedov, qemu-devel, minyard,
Michael S. Tsirkin
Hi,
> > Didn't Gerd have a patch to sort fw_cfg files?
> >
> > ... yes, here it is:
> > https://lists.gnu.org/archive/html/qemu-devel/2015-06/msg05238.html
>
> I could take that patch and modify it to add a new machine type...
Sure, go ahead. Didn't submit the patch because I wasn't sure it is
worth it, especially the compat stuff, do it on new machine types only
etc.
But if we now have to change the order _anyway_ for new machine types it
is a good opportunity to move to a sorted order at the same time, so we
will not have that problem (init order changes reorders fw_cfg file
directory) again.
cheers,
Gerd
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 2/5] pc: Postpone SMBIOS table installation to post machine init
2016-03-14 14:16 ` Paolo Bonzini
2016-03-14 15:01 ` Corey Minyard
@ 2016-03-15 5:05 ` Michael S. Tsirkin
1 sibling, 0 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-03-15 5:05 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Igor Mammedov, qemu-devel, minyard, Corey Minyard
On Mon, Mar 14, 2016 at 03:16:46PM +0100, Paolo Bonzini wrote:
>
>
> On 14/03/2016 14:30, Corey Minyard wrote:
> > On 03/13/2016 09:03 PM, Michael S. Tsirkin wrote:
> >> On Wed, Feb 24, 2016 at 12:59:13PM -0600, minyard@acm.org wrote:
> >>> From: Corey Minyard <cminyard@mvista.com>
> >>>
> >>> This is the same place that the ACPI SSDT table gets added, so that
> >>> devices can add themselves to the SMBIOS table.
> >>>
> >>> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> >> This changes the order of fw cfg files, which
> >> is guest visible.
> >> Need to make it depend on either machine type
>
> Didn't Gerd have a patch to sort fw_cfg files?
>
> ... yes, here it is:
> https://lists.gnu.org/archive/html/qemu-devel/2015-06/msg05238.html
>
> Paolo
Yes but the messy part is the compatibility.
Specifically we need to find out the current list
of fw cfg files, and their order, and use that
existing order with old machine types.
--
MST
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 3/5] ipmi: Add SMBIOS table entry
2016-02-24 18:59 [Qemu-devel] [PATCH 0/5] Add ACPI and SMBIOS table entries for IPMI minyard
2016-02-24 18:59 ` [Qemu-devel] [PATCH 1/5] smbios: Move table build tools into an include file minyard
2016-02-24 18:59 ` [Qemu-devel] [PATCH 2/5] pc: Postpone SMBIOS table installation to post machine init minyard
@ 2016-02-24 18:59 ` minyard
2016-03-13 14:04 ` Michael S. Tsirkin
2016-02-24 18:59 ` [Qemu-devel] [PATCH 4/5] acpi: Add IPMI table entries minyard
` (2 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: minyard @ 2016-02-24 18:59 UTC (permalink / raw)
To: Igor Mammedov, Michael S. Tsirkin, Paolo Bonzini, qemu-devel
Cc: Corey Minyard, minyard
From: Corey Minyard <cminyard@mvista.com>
Add an IPMI table entry to the SMBIOS.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
default-configs/i386-softmmu.mak | 1 +
default-configs/x86_64-softmmu.mak | 1 +
hw/smbios/Makefile.objs | 2 +
hw/smbios/ipmi.c | 76 ++++++++++++++++++++++++++++++++++++++
hw/smbios/noipmi.c | 14 +++++++
hw/smbios/smbios.c | 2 +
include/hw/smbios/ipmi.h | 15 ++++++++
7 files changed, 111 insertions(+)
create mode 100644 hw/smbios/ipmi.c
create mode 100644 hw/smbios/noipmi.c
create mode 100644 include/hw/smbios/ipmi.h
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index b177e52..c94431d 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -20,6 +20,7 @@ CONFIG_I8254=y
CONFIG_PCSPK=y
CONFIG_PCKBD=y
CONFIG_FDC=y
+CONFIG_SMBIOS=y
CONFIG_ACPI=y
CONFIG_ACPI_X86=y
CONFIG_ACPI_X86_ICH=y
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index 6e3b312..256294d 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -20,6 +20,7 @@ CONFIG_I8254=y
CONFIG_PCSPK=y
CONFIG_PCKBD=y
CONFIG_FDC=y
+CONFIG_SMBIOS=y
CONFIG_ACPI=y
CONFIG_ACPI_X86=y
CONFIG_ACPI_X86_ICH=y
diff --git a/hw/smbios/Makefile.objs b/hw/smbios/Makefile.objs
index f69a92f..5578f51 100644
--- a/hw/smbios/Makefile.objs
+++ b/hw/smbios/Makefile.objs
@@ -1 +1,3 @@
common-obj-$(CONFIG_SMBIOS) += smbios.o
+common-obj-$(call land,$(CONFIG_SMBIOS),$(CONFIG_IPMI)) += ipmi.o
+common-obj-$(call land,$(CONFIG_SMBIOS),$(call lnot,$(CONFIG_IPMI))) += noipmi.o
diff --git a/hw/smbios/ipmi.c b/hw/smbios/ipmi.c
new file mode 100644
index 0000000..3874431
--- /dev/null
+++ b/hw/smbios/ipmi.c
@@ -0,0 +1,76 @@
+/*
+ * IPMI SMBIOS firmware handling
+ *
+ * Copyright (c) 2015 Corey Minyard, MontaVista Software, LLC
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/ipmi/ipmi.h"
+#include "hw/smbios/ipmi.h"
+#include "hw/smbios/smbios.h"
+#include "qemu/error-report.h"
+#include "smbios_build.h"
+
+/* SMBIOS type 38 - IPMI */
+struct smbios_type_38 {
+ struct smbios_structure_header header;
+ uint8_t interface_type;
+ uint8_t ipmi_spec_revision;
+ uint8_t i2c_slave_address;
+ uint8_t nv_storage_device_address;
+ uint64_t base_address;
+ uint8_t base_address_modifier;
+ uint8_t interrupt_number;
+} QEMU_PACKED;
+
+static void ipmi_encode_one_smbios(IPMIFwInfo *info)
+{
+ uint64_t baseaddr = info->base_address;
+ SMBIOS_BUILD_TABLE_PRE(38, 0x3000, true);
+
+ t->interface_type = info->interface_type;
+ t->ipmi_spec_revision = ((info->ipmi_spec_major_revision << 4)
+ | info->ipmi_spec_minor_revision);
+ t->i2c_slave_address = info->i2c_slave_address;
+ t->nv_storage_device_address = 0;
+
+ /* or 1 to set it to I/O space */
+ switch (info->memspace) {
+ case IPMI_MEMSPACE_IO: baseaddr |= 1; break;
+ case IPMI_MEMSPACE_MEM32: break;
+ case IPMI_MEMSPACE_MEM64: break;
+ case IPMI_MEMSPACE_SMBUS: baseaddr <<= 1; break;
+ }
+
+ t->base_address = cpu_to_le64(baseaddr);
+
+ t->base_address_modifier = 0;
+ if (info->irq_type == IPMI_LEVEL_IRQ) {
+ t->base_address_modifier |= 1;
+ }
+ switch (info->register_spacing) {
+ case 1: break;
+ case 4: t->base_address_modifier |= 1 << 6; break;
+ case 16: t->base_address_modifier |= 2 << 6; break;
+ default:
+ error_report("IPMI register spacing %d is not compatible with"
+ " SMBIOS, ignoring this entry.", info->register_spacing);
+ return;
+ }
+ t->interrupt_number = info->interrupt_number;
+
+ SMBIOS_BUILD_TABLE_POST;
+}
+
+void smbios_build_type_38_table(void)
+{
+ IPMIFwInfo *info = ipmi_first_fwinfo();
+
+ while (info) {
+ ipmi_encode_one_smbios(info);
+ info = ipmi_next_fwinfo(info);
+ }
+}
diff --git a/hw/smbios/noipmi.c b/hw/smbios/noipmi.c
new file mode 100644
index 0000000..ad669a4
--- /dev/null
+++ b/hw/smbios/noipmi.c
@@ -0,0 +1,14 @@
+/*
+ * IPMI SMBIOS firmware handling
+ *
+ * Copyright (c) 2015 Corey Minyard, MontaVista Software, LLC
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "hw/smbios/ipmi.h"
+
+void smbios_build_type_38_table(void)
+{
+}
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index e1bc1ea..ef8acdd 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -24,6 +24,7 @@
#include "hw/loader.h"
#include "exec/cpu-common.h"
#include "smbios_build.h"
+#include "hw/smbios/ipmi.h"
/* legacy structures and constants for <= 2.0 machines */
struct smbios_header {
@@ -847,6 +848,7 @@ void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
}
smbios_build_type_32_table();
+ smbios_build_type_38_table();
smbios_build_type_127_table();
smbios_validate_table();
diff --git a/include/hw/smbios/ipmi.h b/include/hw/smbios/ipmi.h
new file mode 100644
index 0000000..fd53c96
--- /dev/null
+++ b/include/hw/smbios/ipmi.h
@@ -0,0 +1,15 @@
+/*
+ * IPMI SMBIOS firmware handling
+ *
+ * Copyright (c) 2015 Corey Minyard, MontaVista Software, LLC
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_SMBIOS_IPMI_H
+#define QEMU_SMBIOS_IPMI_H
+
+void smbios_build_type_38_table(void);
+
+#endif /* QEMU_SMBIOS_IPMI_H */
--
2.5.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 3/5] ipmi: Add SMBIOS table entry
2016-02-24 18:59 ` [Qemu-devel] [PATCH 3/5] ipmi: Add SMBIOS table entry minyard
@ 2016-03-13 14:04 ` Michael S. Tsirkin
0 siblings, 0 replies; 14+ messages in thread
From: Michael S. Tsirkin @ 2016-03-13 14:04 UTC (permalink / raw)
To: minyard; +Cc: Igor Mammedov, Corey Minyard, qemu-devel, Paolo Bonzini
On Wed, Feb 24, 2016 at 12:59:14PM -0600, minyard@acm.org wrote:
> From: Corey Minyard <cminyard@mvista.com>
>
> Add an IPMI table entry to the SMBIOS.
>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> default-configs/i386-softmmu.mak | 1 +
> default-configs/x86_64-softmmu.mak | 1 +
> hw/smbios/Makefile.objs | 2 +
> hw/smbios/ipmi.c | 76 ++++++++++++++++++++++++++++++++++++++
> hw/smbios/noipmi.c | 14 +++++++
> hw/smbios/smbios.c | 2 +
> include/hw/smbios/ipmi.h | 15 ++++++++
> 7 files changed, 111 insertions(+)
> create mode 100644 hw/smbios/ipmi.c
> create mode 100644 hw/smbios/noipmi.c
> create mode 100644 include/hw/smbios/ipmi.h
>
> diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
> index b177e52..c94431d 100644
> --- a/default-configs/i386-softmmu.mak
> +++ b/default-configs/i386-softmmu.mak
> @@ -20,6 +20,7 @@ CONFIG_I8254=y
> CONFIG_PCSPK=y
> CONFIG_PCKBD=y
> CONFIG_FDC=y
> +CONFIG_SMBIOS=y
> CONFIG_ACPI=y
> CONFIG_ACPI_X86=y
> CONFIG_ACPI_X86_ICH=y
> diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
> index 6e3b312..256294d 100644
> --- a/default-configs/x86_64-softmmu.mak
> +++ b/default-configs/x86_64-softmmu.mak
> @@ -20,6 +20,7 @@ CONFIG_I8254=y
> CONFIG_PCSPK=y
> CONFIG_PCKBD=y
> CONFIG_FDC=y
> +CONFIG_SMBIOS=y
> CONFIG_ACPI=y
> CONFIG_ACPI_X86=y
> CONFIG_ACPI_X86_ICH=y
> diff --git a/hw/smbios/Makefile.objs b/hw/smbios/Makefile.objs
> index f69a92f..5578f51 100644
> --- a/hw/smbios/Makefile.objs
> +++ b/hw/smbios/Makefile.objs
> @@ -1 +1,3 @@
> common-obj-$(CONFIG_SMBIOS) += smbios.o
> +common-obj-$(call land,$(CONFIG_SMBIOS),$(CONFIG_IPMI)) += ipmi.o
> +common-obj-$(call land,$(CONFIG_SMBIOS),$(call lnot,$(CONFIG_IPMI))) += noipmi.o
> diff --git a/hw/smbios/ipmi.c b/hw/smbios/ipmi.c
> new file mode 100644
> index 0000000..3874431
> --- /dev/null
> +++ b/hw/smbios/ipmi.c
> @@ -0,0 +1,76 @@
> +/*
> + * IPMI SMBIOS firmware handling
> + *
> + * Copyright (c) 2015 Corey Minyard, MontaVista Software, LLC
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#include "qemu/osdep.h"
> +#include "hw/ipmi/ipmi.h"
> +#include "hw/smbios/ipmi.h"
> +#include "hw/smbios/smbios.h"
> +#include "qemu/error-report.h"
> +#include "smbios_build.h"
> +
> +/* SMBIOS type 38 - IPMI */
> +struct smbios_type_38 {
> + struct smbios_structure_header header;
> + uint8_t interface_type;
> + uint8_t ipmi_spec_revision;
> + uint8_t i2c_slave_address;
> + uint8_t nv_storage_device_address;
> + uint64_t base_address;
> + uint8_t base_address_modifier;
> + uint8_t interrupt_number;
> +} QEMU_PACKED;
> +
> +static void ipmi_encode_one_smbios(IPMIFwInfo *info)
> +{
> + uint64_t baseaddr = info->base_address;
> + SMBIOS_BUILD_TABLE_PRE(38, 0x3000, true);
> +
> + t->interface_type = info->interface_type;
> + t->ipmi_spec_revision = ((info->ipmi_spec_major_revision << 4)
> + | info->ipmi_spec_minor_revision);
> + t->i2c_slave_address = info->i2c_slave_address;
> + t->nv_storage_device_address = 0;
> +
> + /* or 1 to set it to I/O space */
> + switch (info->memspace) {
> + case IPMI_MEMSPACE_IO: baseaddr |= 1; break;
> + case IPMI_MEMSPACE_MEM32: break;
> + case IPMI_MEMSPACE_MEM64: break;
> + case IPMI_MEMSPACE_SMBUS: baseaddr <<= 1; break;
> + }
> +
> + t->base_address = cpu_to_le64(baseaddr);
> +
trailing whitespace
> + t->base_address_modifier = 0;
> + if (info->irq_type == IPMI_LEVEL_IRQ) {
> + t->base_address_modifier |= 1;
> + }
> + switch (info->register_spacing) {
> + case 1: break;
> + case 4: t->base_address_modifier |= 1 << 6; break;
> + case 16: t->base_address_modifier |= 2 << 6; break;
> + default:
> + error_report("IPMI register spacing %d is not compatible with"
> + " SMBIOS, ignoring this entry.", info->register_spacing);
> + return;
> + }
> + t->interrupt_number = info->interrupt_number;
> +
> + SMBIOS_BUILD_TABLE_POST;
> +}
> +
> +void smbios_build_type_38_table(void)
> +{
> + IPMIFwInfo *info = ipmi_first_fwinfo();
> +
> + while (info) {
> + ipmi_encode_one_smbios(info);
> + info = ipmi_next_fwinfo(info);
> + }
> +}
> diff --git a/hw/smbios/noipmi.c b/hw/smbios/noipmi.c
> new file mode 100644
> index 0000000..ad669a4
> --- /dev/null
> +++ b/hw/smbios/noipmi.c
> @@ -0,0 +1,14 @@
> +/*
> + * IPMI SMBIOS firmware handling
> + *
> + * Copyright (c) 2015 Corey Minyard, MontaVista Software, LLC
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#include "hw/smbios/ipmi.h"
> +
> +void smbios_build_type_38_table(void)
> +{
> +}
> diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
> index e1bc1ea..ef8acdd 100644
> --- a/hw/smbios/smbios.c
> +++ b/hw/smbios/smbios.c
> @@ -24,6 +24,7 @@
> #include "hw/loader.h"
> #include "exec/cpu-common.h"
> #include "smbios_build.h"
> +#include "hw/smbios/ipmi.h"
>
> /* legacy structures and constants for <= 2.0 machines */
> struct smbios_header {
> @@ -847,6 +848,7 @@ void smbios_get_tables(const struct smbios_phys_mem_area *mem_array,
> }
>
> smbios_build_type_32_table();
> + smbios_build_type_38_table();
> smbios_build_type_127_table();
>
> smbios_validate_table();
> diff --git a/include/hw/smbios/ipmi.h b/include/hw/smbios/ipmi.h
> new file mode 100644
> index 0000000..fd53c96
> --- /dev/null
> +++ b/include/hw/smbios/ipmi.h
> @@ -0,0 +1,15 @@
> +/*
> + * IPMI SMBIOS firmware handling
> + *
> + * Copyright (c) 2015 Corey Minyard, MontaVista Software, LLC
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef QEMU_SMBIOS_IPMI_H
> +#define QEMU_SMBIOS_IPMI_H
> +
> +void smbios_build_type_38_table(void);
> +
> +#endif /* QEMU_SMBIOS_IPMI_H */
> --
> 2.5.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 4/5] acpi: Add IPMI table entries
2016-02-24 18:59 [Qemu-devel] [PATCH 0/5] Add ACPI and SMBIOS table entries for IPMI minyard
` (2 preceding siblings ...)
2016-02-24 18:59 ` [Qemu-devel] [PATCH 3/5] ipmi: Add SMBIOS table entry minyard
@ 2016-02-24 18:59 ` minyard
2016-02-24 18:59 ` [Qemu-devel] [PATCH 5/5] bios: Add tests for the IPMI ACPI and SMBIOS entries minyard
2016-03-12 1:30 ` [Qemu-devel] [PATCH 0/5] Add ACPI and SMBIOS table entries for IPMI Corey Minyard
5 siblings, 0 replies; 14+ messages in thread
From: minyard @ 2016-02-24 18:59 UTC (permalink / raw)
To: Igor Mammedov, Michael S. Tsirkin, Paolo Bonzini, qemu-devel
Cc: Corey Minyard, minyard
From: Corey Minyard <cminyard@mvista.com>
Use the new ACPI table construction tools to create an ACPI
entry for IPMI. This adds a function called from build_dsdt
to add an DSDT entry for IPMI if IPMI is compiled in and has
registered firmware. It also adds a dummy function if IPMI
is not compiled in.
This conforms to section "C3-2 Locating IPMI System Interfaces in
ACPI Name Space" in the IPMI 2.0 specification.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
hw/acpi/Makefile.objs | 2 +
hw/acpi/ipmi.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++
hw/acpi/noipmi.c | 14 ++++++
hw/i386/acpi-build.c | 4 ++
include/hw/acpi/ipmi.h | 16 +++++++
5 files changed, 153 insertions(+)
create mode 100644 hw/acpi/ipmi.c
create mode 100644 hw/acpi/noipmi.c
create mode 100644 include/hw/acpi/ipmi.h
diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
index f3ade9a..c44b24e 100644
--- a/hw/acpi/Makefile.objs
+++ b/hw/acpi/Makefile.objs
@@ -6,3 +6,5 @@ common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o
common-obj-$(CONFIG_ACPI) += acpi_interface.o
common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
common-obj-$(CONFIG_ACPI) += aml-build.o
+common-obj-$(call land,$(CONFIG_ACPI),$(CONFIG_IPMI)) += ipmi.o
+common-obj-$(call land,$(CONFIG_ACPI),$(call lnot,$(CONFIG_IPMI))) += noipmi.o
diff --git a/hw/acpi/ipmi.c b/hw/acpi/ipmi.c
new file mode 100644
index 0000000..731f4ad
--- /dev/null
+++ b/hw/acpi/ipmi.c
@@ -0,0 +1,117 @@
+/*
+ * IPMI ACPI firmware handling
+ *
+ * Copyright (c) 2015 Corey Minyard, MontaVista Software, LLC
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/ipmi/ipmi.h"
+#include "hw/acpi/aml-build.h"
+#include "hw/acpi/acpi.h"
+#include "hw/acpi/ipmi.h"
+
+static Aml *aml_ipmi_crs(IPMIFwInfo *info)
+{
+ Aml *crs = aml_resource_template();
+ uint8_t regspacing = info->register_spacing;
+
+ /*
+ * The base address is fixed and cannot change. That may be different
+ * if someone does PCI, but we aren't there yet.
+ */
+ switch (info->memspace) {
+ case IPMI_MEMSPACE_IO:
+ aml_append(crs, aml_io(AML_DECODE16, info->base_address,
+ info->base_address + info->register_length - 1,
+ regspacing, info->register_length));
+ break;
+ case IPMI_MEMSPACE_MEM32:
+ aml_append(crs,
+ aml_dword_memory(AML_POS_DECODE,
+ AML_MIN_FIXED, AML_MAX_FIXED,
+ AML_NON_CACHEABLE, AML_READ_WRITE,
+ 0xffffffff,
+ info->base_address,
+ info->base_address + info->register_length - 1,
+ regspacing, info->register_length));
+ break;
+ case IPMI_MEMSPACE_MEM64:
+ aml_append(crs,
+ aml_qword_memory(AML_POS_DECODE,
+ AML_MIN_FIXED, AML_MAX_FIXED,
+ AML_NON_CACHEABLE, AML_READ_WRITE,
+ 0xffffffffffffffffULL,
+ info->base_address,
+ info->base_address + info->register_length - 1,
+ regspacing, info->register_length));
+ break;
+ case IPMI_MEMSPACE_SMBUS:
+ aml_append(crs, aml_return(aml_int(info->base_address)));
+ break;
+ default:
+ abort();
+ }
+
+ if (info->interrupt_number) {
+ aml_append(crs, aml_irq_no_flags(info->interrupt_number));
+ }
+
+ return crs;
+}
+
+static void
+ipmi_encode_one_acpi(Aml *table, IPMIFwInfo *info)
+{
+ Aml *scope, *dev, *method;
+ uint16_t version = ((info->ipmi_spec_major_revision << 8)
+ | (info->ipmi_spec_minor_revision << 4));
+
+ /*
+ * The ACPI parent is a little bit of a pain. It could be in
+ * different places depending on the device. It could be an SMBus,
+ * it could be ISA, it could be PCI, etc. Only the device really
+ * knows, so it has to pass it in.
+ */
+ if (!info->acpi_parent) {
+ ipmi_debug("device %s not compatible with ACPI, no parent given.",
+ info->interface_name);
+ return;
+ }
+
+ scope = aml_scope("%s", info->acpi_parent);
+
+ dev = aml_device("MI0");
+ aml_append(dev, aml_name_decl("_HID", aml_eisaid("IPI0001")));
+ aml_append(dev, aml_name_decl("_STR", aml_string("ipmi_%s",
+ info->interface_name)));
+ aml_append(dev, aml_name_decl("_UID", aml_int(info->uuid)));
+ aml_append(dev, aml_name_decl("_CRS", aml_ipmi_crs(info)));
+
+ /*
+ * The spec seems to require these to be methods. All the examples
+ * show them this way and it doesn't seem to work if they are not.
+ */
+ method = aml_method("_IFT", 0, AML_NOTSERIALIZED);
+ aml_append(method, aml_return(aml_int(info->interface_type)));
+ aml_append(dev, method);
+ method = aml_method("_SRV", 0, AML_NOTSERIALIZED);
+ aml_append(method, aml_return(aml_int(version)));
+ aml_append(dev, method);
+
+ aml_append(scope, dev);
+
+ aml_append(table, scope);
+}
+
+void acpi_add_ipmi(Aml *table)
+{
+ IPMIFwInfo *info = ipmi_first_fwinfo();
+
+ while (info) {
+ ipmi_encode_one_acpi(table, info);
+ info = ipmi_next_fwinfo(info);
+ }
+}
diff --git a/hw/acpi/noipmi.c b/hw/acpi/noipmi.c
new file mode 100644
index 0000000..4aae336
--- /dev/null
+++ b/hw/acpi/noipmi.c
@@ -0,0 +1,14 @@
+/*
+ * IPMI ACPI firmware handling
+ *
+ * Copyright (c) 2015 Corey Minyard, MontaVista Software, LLC
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "hw/acpi/ipmi.h"
+
+void acpi_add_ipmi(Aml *ssdt)
+{
+}
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4554eb8..ca3d2a0 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -58,6 +58,8 @@
#include "qapi/qmp/qint.h"
#include "qom/qom-qobject.h"
+#include "hw/acpi/ipmi.h"
+
/* These are used to size the ACPI tables for -M pc-i440fx-1.7 and
* -M pc-i440fx-2.0. Even if the actual amount of AML generated grows
* a little bit, there should be plenty of free space since the DSDT
@@ -2283,6 +2285,8 @@ build_dsdt(GArray *table_data, GArray *linker,
aml_append(dsdt, sb_scope);
}
+ acpi_add_ipmi(dsdt);
+
/* copy AML table into ACPI tables blob and patch header there */
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
build_header(linker, table_data,
diff --git a/include/hw/acpi/ipmi.h b/include/hw/acpi/ipmi.h
new file mode 100644
index 0000000..313ce37
--- /dev/null
+++ b/include/hw/acpi/ipmi.h
@@ -0,0 +1,16 @@
+/*
+ * QEMU IPMI ACPI handling
+ *
+ * Copyright (c) 2015 Corey Minyard <cminyard@mvista.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef HW_ACPI_IPMI_H
+#define HW_ACPI_IPMI_H
+
+#include "hw/acpi/aml-build.h"
+
+void acpi_add_ipmi(Aml *ssdt);
+
+#endif /* HW_ACPI_IPMI_H */
--
2.5.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Qemu-devel] [PATCH 5/5] bios: Add tests for the IPMI ACPI and SMBIOS entries
2016-02-24 18:59 [Qemu-devel] [PATCH 0/5] Add ACPI and SMBIOS table entries for IPMI minyard
` (3 preceding siblings ...)
2016-02-24 18:59 ` [Qemu-devel] [PATCH 4/5] acpi: Add IPMI table entries minyard
@ 2016-02-24 18:59 ` minyard
2016-03-12 1:30 ` [Qemu-devel] [PATCH 0/5] Add ACPI and SMBIOS table entries for IPMI Corey Minyard
5 siblings, 0 replies; 14+ messages in thread
From: minyard @ 2016-02-24 18:59 UTC (permalink / raw)
To: Igor Mammedov, Michael S. Tsirkin, Paolo Bonzini, qemu-devel
Cc: Corey Minyard, minyard
From: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
tests/acpi-test-data/pc/DSDT.ipmikcs | Bin 0 -> 5574 bytes
tests/acpi-test-data/q35/DSDT.ipmibt | Bin 0 -> 8420 bytes
tests/bios-tables-test.c | 58 ++++++++++++++++++++++++++++++++---
3 files changed, 54 insertions(+), 4 deletions(-)
create mode 100644 tests/acpi-test-data/pc/DSDT.ipmikcs
create mode 100644 tests/acpi-test-data/q35/DSDT.ipmibt
diff --git a/tests/acpi-test-data/pc/DSDT.ipmikcs b/tests/acpi-test-data/pc/DSDT.ipmikcs
new file mode 100644
index 0000000000000000000000000000000000000000..b73ccc0ee985c5d0d3aa9d11715d1e7ea9e1e85a
GIT binary patch
literal 5574
zcmb7I-ER}w6+hQANygW9GERmNz7{L6(4__Z0Rg0{iaq1R4jyOlIEZRcXPgApX}e_<
zKw5}a3RyK|dE2^F?VF)~hCiWws`|Kp!uDU-s)Z-gb7p)UH!#vRQfBTs=XZbSew=ge
z9UHdM{QD6A=9HH8ik&Ilv2+7<3;?K2Z?!7l1!vnRExIfblbQ205w!79Qna5KrIkhY
zr?&S;&wKdHV=W(6U#TxvTmDyj-YO92(W=imHPl(xF1gOm2}`eL6}M6~lErViq_{<+
z0gAg)HJEBDA*QTUta4L;7=qA@!>CwI6OsVmzE6PcJXJ}ax?Qdt8LMHq8EwwBn?>+R
z<N2g&J@L5eb(7z8Jm`3d{rw(v$G_>c;18`N{PW)<J?QZX#nl^jI?cy-<2Yj^2N~co
zsGnY<(a><6onzLWTp<{1QUZoUv2q1H27F#V_9<*HqDLmVzF;jU!$82301_uMZo
z5exMMs9c7znpLhdxDJwDq=uxI@TDvm_*82rE=$5aaXLE}8%-Ul!-Y%WlF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~tRJ3ENd7oBNDWMf(BVlK=c-5!RK4<5G
zo$Cu2e=*Q-FLDMR71YR!Mu8g6&S!S+I(D>I>iy3~>>`0S8LSOmhsgn%37RKbg5qh8
zt`Le}6%kOuIwGJWQP6^5#YhNQM<bzvbxc6<3+dwnxFT2;0aYTQf;BFn@hIq3!O8`c
zM?wWFCSo|PL=<#RuqFjG83`4vDFIDIL9YqcaRD8VgbG%?r-x&mh=N`htg3*jkx;>!
z7SMDQ^oC%a6wt{?s9>EE(5WbBQLtj<httv`p@Q{@fF6m0mIUjxfKEq31?y1(JsJho
z1?!A}&O|~5>oEa676ml~>u~`+9tjn!Cj|6F6tpZ@PYUSCNT^^vC7`FGpbLWa69N4s
z5-M0v3+U;OLAA;W<959n>n69___44{wQeI2R1~n9g+hh|VVOq(D^h6LCV?!et#$%`
zdfK(Itn{TANdudV5*CNPjeK1l*vJ{Cc;80e<_0!$hl$#^k-uwXo7ie&b;VP4*T#es
zGM=j_AK3A9-L)}wgdM+zP(HA$Bx4c?dnS+%?DHgJI1BrBARpL+8Dn4yJ02#xwmxL1
zS!0L|>@;s<$WAlIU>VpmBoEo=QO0c_*tbbWyLOuHf%pp?{Q^T<h-cjj>o*K8smmin
zM{@X6UQITu6hZV`-nls7*S_6sq&ED|H{4&ZJqW+6P)WD9;7;@^`IjV%;YX<ARu}Mw
Pz%-5@oVTHufY^TlB<@;F
literal 0
HcmV?d00001
diff --git a/tests/acpi-test-data/q35/DSDT.ipmibt b/tests/acpi-test-data/q35/DSDT.ipmibt
new file mode 100644
index 0000000000000000000000000000000000000000..2e8f3e33137888ae7c050d396a42cf613f1656db
GIT binary patch
literal 8420
zcmb7J&u<&Y8J#65YBi*!rL>l1*^UUcNSd@xD9druq76*$@|Vq()+FtupaHJrxRslx
zStvG;#0X$3Kz{g8AYmP}H_FgC|3Y)@F}DWjsX)*}fnHJ+_9^Q7W;oK!Dgt61xbw}v
z_kHtbcjv8k{EpxKrpTD}pURro=oBljg`ST-i!nxRIy%kF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/bios-tables-test.c
index 0a80ddf..e681ced 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -50,6 +50,8 @@ typedef struct {
GArray *tables;
uint32_t smbios_ep_addr;
struct smbios_21_entry_point smbios_ep_table;
+ uint8_t *required_struct_types;
+ int required_struct_types_len;
} test_data;
#define ACPI_READ_FIELD(field, addr) \
@@ -335,7 +337,7 @@ static void test_acpi_tables(test_data *data)
for (i = 0; i < tables_nr; i++) {
AcpiSdtTable ssdt_table;
- memset(&ssdt_table, 0 , sizeof(ssdt_table));
+ memset(&ssdt_table, 0, sizeof(ssdt_table));
uint32_t addr = data->rsdt_tables_addr[i + 1]; /* fadt is first */
test_dst_table(&ssdt_table, addr);
g_array_append_val(data->tables, ssdt_table);
@@ -654,7 +656,6 @@ static void test_smbios_structs(test_data *data)
uint32_t addr = ep_table->structure_table_address;
int i, len, max_len = 0;
uint8_t type, prv, crt;
- uint8_t required_struct_types[] = {0, 1, 3, 4, 16, 17, 19, 32, 127};
/* walk the smbios tables */
for (i = 0; i < ep_table->number_of_structures; i++) {
@@ -694,8 +695,8 @@ static void test_smbios_structs(test_data *data)
g_assert_cmpuint(ep_table->max_structure_size, ==, max_len);
/* required struct types must all be present */
- for (i = 0; i < ARRAY_SIZE(required_struct_types); i++) {
- g_assert(test_bit(required_struct_types[i], struct_bitmap));
+ for (i = 0; i < data->required_struct_types_len; i++) {
+ g_assert(test_bit(data->required_struct_types[i], struct_bitmap));
}
}
@@ -735,6 +736,9 @@ static void test_acpi_one(const char *params, test_data *data)
g_free(args);
}
+static uint8_t base_required_struct_types[] =
+ {0, 1, 3, 4, 16, 17, 19, 32, 127};
+
static void test_acpi_piix4_tcg(void)
{
test_data data;
@@ -744,6 +748,8 @@ static void test_acpi_piix4_tcg(void)
*/
memset(&data, 0, sizeof(data));
data.machine = MACHINE_PC;
+ data.required_struct_types = base_required_struct_types;
+ data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
test_acpi_one("-machine accel=tcg", &data);
free_test_data(&data);
}
@@ -755,6 +761,8 @@ static void test_acpi_piix4_tcg_bridge(void)
memset(&data, 0, sizeof(data));
data.machine = MACHINE_PC;
data.variant = ".bridge";
+ data.required_struct_types = base_required_struct_types;
+ data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
test_acpi_one("-machine accel=tcg -device pci-bridge,chassis_nr=1", &data);
free_test_data(&data);
}
@@ -765,6 +773,8 @@ static void test_acpi_q35_tcg(void)
memset(&data, 0, sizeof(data));
data.machine = MACHINE_Q35;
+ data.required_struct_types = base_required_struct_types;
+ data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
test_acpi_one("-machine q35,accel=tcg", &data);
free_test_data(&data);
}
@@ -776,11 +786,49 @@ static void test_acpi_q35_tcg_bridge(void)
memset(&data, 0, sizeof(data));
data.machine = MACHINE_Q35;
data.variant = ".bridge";
+ data.required_struct_types = base_required_struct_types;
+ data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types);
test_acpi_one("-machine q35,accel=tcg -device pci-bridge,chassis_nr=1",
&data);
free_test_data(&data);
}
+static uint8_t ipmi_required_struct_types[] =
+ {0, 1, 3, 4, 16, 17, 19, 32, 38, 127};
+
+static void test_acpi_q35_tcg_ipmi(void)
+{
+ test_data data;
+
+ memset(&data, 0, sizeof(data));
+ data.machine = MACHINE_Q35;
+ data.variant = ".ipmibt";
+ data.required_struct_types = ipmi_required_struct_types;
+ data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
+ test_acpi_one("-machine q35,accel=tcg -device ipmi-bmc-sim,id=bmc0"
+ " -device isa-ipmi-bt,bmc=bmc0",
+ &data);
+ free_test_data(&data);
+}
+
+static void test_acpi_piix4_tcg_ipmi(void)
+{
+ test_data data;
+
+ /* Supplying -machine accel argument overrides the default (qtest).
+ * This is to make guest actually run.
+ */
+ memset(&data, 0, sizeof(data));
+ data.machine = MACHINE_PC;
+ data.variant = ".ipmikcs";
+ data.required_struct_types = ipmi_required_struct_types;
+ data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types);
+ test_acpi_one("-machine accel=tcg -device ipmi-bmc-sim,id=bmc0"
+ " -device isa-ipmi-kcs,irq=0,bmc=bmc0",
+ &data);
+ free_test_data(&data);
+}
+
int main(int argc, char *argv[])
{
const char *arch = qtest_get_arch();
@@ -797,6 +845,8 @@ int main(int argc, char *argv[])
qtest_add_func("acpi/piix4/tcg/bridge", test_acpi_piix4_tcg_bridge);
qtest_add_func("acpi/q35/tcg", test_acpi_q35_tcg);
qtest_add_func("acpi/q35/tcg/bridge", test_acpi_q35_tcg_bridge);
+ qtest_add_func("acpi/piix4/tcg/ipmi", test_acpi_piix4_tcg_ipmi);
+ qtest_add_func("acpi/q35/tcg/ipmi", test_acpi_q35_tcg_ipmi);
}
ret = g_test_run();
boot_sector_cleanup(disk);
--
2.5.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [Qemu-devel] [PATCH 0/5] Add ACPI and SMBIOS table entries for IPMI
2016-02-24 18:59 [Qemu-devel] [PATCH 0/5] Add ACPI and SMBIOS table entries for IPMI minyard
` (4 preceding siblings ...)
2016-02-24 18:59 ` [Qemu-devel] [PATCH 5/5] bios: Add tests for the IPMI ACPI and SMBIOS entries minyard
@ 2016-03-12 1:30 ` Corey Minyard
5 siblings, 0 replies; 14+ messages in thread
From: Corey Minyard @ 2016-03-12 1:30 UTC (permalink / raw)
To: Igor Mammedov, Michael S. Tsirkin, Paolo Bonzini, qemu-devel
I haven't seen any comments on this. Is it ok? I'd like to
get this in before the next release so it works automatically.
On 02/25/2016 01:59 AM, minyard@acm.org wrote:
> Now that Igor has reworked things to remove the SSDT, I've updated
> IPMI code to work with the new format. This is functionally the
> same as before, just for ACPI it adds the data to the DSDT now.
>
> This will avoid a lot of "Why doesn't IPMI work when I add it?"
> questions, which I have already gotten.
>
> -corey
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread