Re: git: 305edaa47918 - main - bhyve: add QEMU_FWCFG_INDEX_MAX_CPUS item
- In reply to: Corvin Köhne : "git: 305edaa47918 - main - bhyve: add QEMU_FWCFG_INDEX_MAX_CPUS item"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 12 Apr 2023 07:37:30 UTC
On Wed, 2023-04-12 at 07:35 +0000, Corvin Köhne wrote:
> The branch main has been updated by corvink:
>
> URL:
> https://cgit.FreeBSD.org/src/commit/?id=305edaa47918a559de46a5d72060644009f1875c
>
> commit 305edaa47918a559de46a5d72060644009f1875c
> Author:    Corvin Köhne <corvink@FreeBSD.org>
> AuthorDate: 2022-06-21 08:35:40 +0000
> Commit:    Corvin Köhne <corvink@FreeBSD.org>
> CommitDate: 2023-04-12 07:35:33 +0000
>
> Â Â Â bhyve: add QEMU_FWCFG_INDEX_MAX_CPUS item
> Â Â Â
> Â Â Â Requested-by:Â Â Â Â Â Â Â Â Â Â coreboot
> Â Â Â Reviewed by:Â Â Â Â Â Â Â Â Â Â Â <If someone else reviewed your
> modification.>
> Â Â Â MFC after:Â Â Â Â Â Â Â Â Â Â Â Â Â 1 week
> Â Â Â Sponsored by:Â Â Â Â Â Â Â Â Â Â Beckhoff Automation GmbH & Co. KG
> Â Â Â Differential Revision:Â https://reviews.freebsd.org/D39315
> ---
> Â usr.sbin/bhyve/qemu_fwcfg.c | 23 +++++++++++++++++++++++
> Â 1 file changed, 23 insertions(+)
>
> diff --git a/usr.sbin/bhyve/qemu_fwcfg.c
> b/usr.sbin/bhyve/qemu_fwcfg.c
> index 3c7cd0f33224..ddd73d06d34d 100644
> --- a/usr.sbin/bhyve/qemu_fwcfg.c
> +++ b/usr.sbin/bhyve/qemu_fwcfg.c
> @@ -44,6 +44,7 @@
> Â #define QEMU_FWCFG_INDEX_SIGNATURE 0x00
> Â #define QEMU_FWCFG_INDEX_ID 0x01
> Â #define QEMU_FWCFG_INDEX_NB_CPUS 0x05
> +#define QEMU_FWCFG_INDEX_MAX_CPUS 0x0F
> Â #define QEMU_FWCFG_INDEX_FILE_DIR 0x19
> Â
> Â #define QEMU_FWCFG_FIRST_FILE_INDEX 0x20
> @@ -227,6 +228,24 @@ qemu_fwcfg_add_item_id(void)
> Â Â Â Â Â Â Â Â Â Â Â (uint8_t *)fwcfg_id));
> Â }
> Â
> +static int
> +qemu_fwcfg_add_item_max_cpus(void)
> +{
> +Â Â Â Â Â Â Â uint16_t *fwcfg_max_cpus = calloc(1, sizeof(uint16_t));
> +Â Â Â Â Â Â Â if (fwcfg_max_cpus == NULL) {
> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â return (ENOMEM);
> +Â Â Â Â Â Â Â }
> +
> +Â Â Â Â Â Â Â /*
> +Â Â Â Â Â Â Â * We don't support cpu hotplug yet. For that reason, use
> guest_ncpus instead
> +Â Â Â Â Â Â Â * of maxcpus.
> +Â Â Â Â Â Â Â */
> +Â Â Â Â Â Â Â *fwcfg_max_cpus = htole16(guest_ncpus);
> +
> +Â Â Â Â Â Â Â return (qemu_fwcfg_add_item(QEMU_FWCFG_ARCHITECTURE_GENERIC,
> +Â Â Â Â Â Â Â Â Â Â QEMU_FWCFG_INDEX_MAX_CPUS, sizeof(uint16_t),
> fwcfg_max_cpus));
> +}
> +
> Â static int
> Â qemu_fwcfg_add_item_nb_cpus(void)
> Â {
> @@ -433,6 +452,10 @@ qemu_fwcfg_init(struct vmctx *const ctx)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â warnx("%s: Unable to add nb_cpus item", __func__);
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â goto done;
> Â Â Â Â Â Â Â Â }
> +Â Â Â Â Â Â Â if ((error = qemu_fwcfg_add_item_max_cpus()) != 0) {
> +Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â warnx("%s: Unable to add max_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;
Reviewed by: markj
--
Kind regards,
Corvin