diff options
author | Corvin Köhne <corvink@FreeBSD.org> | 2022-06-27 09:05:42 +0000 |
---|---|---|
committer | Corvin Köhne <corvink@FreeBSD.org> | 2023-04-11 07:29:54 +0000 |
commit | b0efaef285d6f154a3994aebdc722c81b8aab7c1 (patch) | |
tree | 30eab4167f76a6dd63dab8dff05f8a8294168f94 | |
parent | 1412836cbd5bd9e6e828bb6e4dedb51aaa1c512c (diff) | |
download | src-b0efaef285d6f154a3994aebdc722c81b8aab7c1.tar.gz src-b0efaef285d6f154a3994aebdc722c81b8aab7c1.zip |
bhyve: add QEMU_FWCFG_INDEX_NB_CPUS item
Requested-by: OVMF (qemu)
Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39316
(cherry picked from commit e46be58cca6bd180dadfb36e98a673ae6d8d2cd1)
bhyve: add missing include to qemu_fwcfg.c
Fixes: e46be58cca6bd180dadfb36e98a673ae6d8d2cd1 ("bhyve: add QEMU_FWCFG_INDEX_NB_CPUS item")
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 76fa62b5232e67ef10476cf1329aaceb9cbc2ff5)
-rw-r--r-- | usr.sbin/bhyve/qemu_fwcfg.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/qemu_fwcfg.c b/usr.sbin/bhyve/qemu_fwcfg.c index bb86d0371985..a93b37027142 100644 --- a/usr.sbin/bhyve/qemu_fwcfg.c +++ b/usr.sbin/bhyve/qemu_fwcfg.c @@ -16,6 +16,7 @@ #include <string.h> #include "acpi_device.h" +#include "bhyverun.h" #include "inout.h" #include "pci_lpc.h" #include "qemu_fwcfg.h" @@ -42,6 +43,7 @@ #define QEMU_FWCFG_INDEX_SIGNATURE 0x00 #define QEMU_FWCFG_INDEX_ID 0x01 +#define QEMU_FWCFG_INDEX_NB_CPUS 0x05 #define QEMU_FWCFG_INDEX_FILE_DIR 0x19 #define QEMU_FWCFG_FIRST_FILE_INDEX 0x20 @@ -226,6 +228,20 @@ qemu_fwcfg_add_item_id(void) } static int +qemu_fwcfg_add_item_nb_cpus(void) +{ + uint16_t *fwcfg_max_cpus = calloc(1, sizeof(uint16_t)); + if (fwcfg_max_cpus == NULL) { + return (ENOMEM); + } + + *fwcfg_max_cpus = htole16(guest_ncpus); + + return (qemu_fwcfg_add_item(QEMU_FWCFG_ARCHITECTURE_GENERIC, + QEMU_FWCFG_INDEX_NB_CPUS, sizeof(uint16_t), fwcfg_max_cpus)); +} + +static int qemu_fwcfg_add_item_signature(void) { struct qemu_fwcfg_signature *const fwcfg_signature = calloc(1, @@ -406,6 +422,10 @@ qemu_fwcfg_init(struct vmctx *const ctx) warnx("%s: Unable to add id item", __func__); goto done; } + if ((error = qemu_fwcfg_add_item_nb_cpus()) != 0) { + warnx("%s: Unable to add nb_cpus item", __func__); + goto done; + } if ((error = qemu_fwcfg_add_item_file_dir()) != 0) { warnx("%s: Unable to add file_dir item", __func__); goto done; |