[PATCH v3 2/3] hw/smbios: Use qapi for SmbiosEntryPointType

Eduardo Habkost posted 3 patches 4 years, 3 months ago
[PATCH v3 2/3] hw/smbios: Use qapi for SmbiosEntryPointType
Posted by Eduardo Habkost 4 years, 3 months ago
This prepares for exposing the SMBIOS entry point type as a
machine property on x86.

Based on a patch from Daniel P. Berrangé.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
First version of this code was submitted at:
https://lore.kernel.org/qemu-devel/20200908165438.1008942-5-berrange@redhat.com

Changes from v2:
* Rename "2_0"/"3_1" to "32"/"64", to
  make the names more QAPI-friendly (as underscores and dots are
  not allowed by QAPI)
* Move definition from smbios.json back to machine.json
  (no need for a separate file just for one enum)

Changes from v1:
* Patch was split in two
* Moved definition to smbios.json
---
 include/hw/firmware/smbios.h | 10 ++--------
 qapi/machine.json            | 12 ++++++++++++
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h
index d916baed6a9..4b7ad77a44f 100644
--- a/include/hw/firmware/smbios.h
+++ b/include/hw/firmware/smbios.h
@@ -1,6 +1,8 @@
 #ifndef QEMU_SMBIOS_H
 #define QEMU_SMBIOS_H
 
+#include "qapi/qapi-types-machine.h"
+
 /*
  * SMBIOS Support
  *
@@ -23,14 +25,6 @@ struct smbios_phys_mem_area {
     uint64_t length;
 };
 
-/*
- * SMBIOS spec defined tables
- */
-typedef enum SmbiosEntryPointType {
-    SMBIOS_ENTRY_POINT_TYPE_32,
-    SMBIOS_ENTRY_POINT_TYPE_64,
-} SmbiosEntryPointType;
-
 /* SMBIOS Entry Point
  * There are two types of entry points defined in the SMBIOS specification
  * (see below). BIOS must place the entry point(s) at a 16-byte-aligned
diff --git a/qapi/machine.json b/qapi/machine.json
index 5db54df298f..0a13579275f 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -1411,3 +1411,15 @@
      '*cores': 'int',
      '*threads': 'int',
      '*maxcpus': 'int' } }
+
+##
+# @SmbiosEntryPointType:
+#
+# @32: SMBIOS version 2.1 (32-bit) Entry Point
+#
+# @64: SMBIOS version 3.0 (64-bit) Entry Point
+#
+# Since: 6.1
+##
+{ 'enum': 'SmbiosEntryPointType',
+  'data': [ '32', '64' ] }
-- 
2.32.0


Re: [PATCH v3 2/3] hw/smbios: Use qapi for SmbiosEntryPointType
Posted by Philippe Mathieu-Daudé 4 years, 3 months ago
On 10/26/21 17:10, Eduardo Habkost wrote:
> This prepares for exposing the SMBIOS entry point type as a
> machine property on x86.
> 
> Based on a patch from Daniel P. Berrangé.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> First version of this code was submitted at:
> https://lore.kernel.org/qemu-devel/20200908165438.1008942-5-berrange@redhat.com
> 
> Changes from v2:
> * Rename "2_0"/"3_1" to "32"/"64", to
>   make the names more QAPI-friendly (as underscores and dots are
>   not allowed by QAPI)
> * Move definition from smbios.json back to machine.json
>   (no need for a separate file just for one enum)
> 
> Changes from v1:
> * Patch was split in two
> * Moved definition to smbios.json
> ---
>  include/hw/firmware/smbios.h | 10 ++--------
>  qapi/machine.json            | 12 ++++++++++++
>  2 files changed, 14 insertions(+), 8 deletions(-)

> +##
> +# @SmbiosEntryPointType:
> +#
> +# @32: SMBIOS version 2.1 (32-bit) Entry Point
> +#
> +# @64: SMBIOS version 3.0 (64-bit) Entry Point
> +#
> +# Since: 6.1

6.2, otherwise:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> +##
> +{ 'enum': 'SmbiosEntryPointType',
> +  'data': [ '32', '64' ] }
> 


Re: [PATCH v3 2/3] hw/smbios: Use qapi for SmbiosEntryPointType
Posted by Markus Armbruster 4 years, 3 months ago
Eduardo Habkost <ehabkost@redhat.com> writes:

> This prepares for exposing the SMBIOS entry point type as a
> machine property on x86.
>
> Based on a patch from Daniel P. Berrangé.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---

[...]

> diff --git a/qapi/machine.json b/qapi/machine.json
> index 5db54df298f..0a13579275f 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -1411,3 +1411,15 @@
>       '*cores': 'int',
>       '*threads': 'int',
>       '*maxcpus': 'int' } }
> +
> +##
> +# @SmbiosEntryPointType:
> +#
> +# @32: SMBIOS version 2.1 (32-bit) Entry Point
> +#
> +# @64: SMBIOS version 3.0 (64-bit) Entry Point
> +#
> +# Since: 6.1
> +##
> +{ 'enum': 'SmbiosEntryPointType',
> +  'data': [ '32', '64' ] }

QAPI schema
Acked-by: Markus Armbruster <armbru@redhat.com>