Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Apr 2023 09:37:30 +0200
From:      Corvin =?ISO-8859-1?Q?K=F6hne?= <corvink@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,  dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 305edaa47918 - main - bhyve: add QEMU_FWCFG_INDEX_MAX_CPUS item
Message-ID:  <d7684b119c431d16286c851e904311ab0a14f8ac.camel@FreeBSD.org>
In-Reply-To: <202304120735.33C7Zd9c011581@gitrepo.freebsd.org>
References:  <202304120735.33C7Zd9c011581@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEgvRSla3m2t/H2U9G2FTaVjFeAmoFAmQ2X7oACgkQ2FTaVjFe
AmqYKhAAo1ft19L/6GnTQorU2r7p3auNLnVT64FWGCtSNYO/ZtEr6snW6UuZSyqg
YByLuL0bD837bCtQo9uMduXdcB4Ou5YMnkkznxEpYCUGW2T6WJ3D8ow3Vhea2jxF
5pwFNgSeoGbHTYrbXZKbYya+gmumRsxNtT63DaIhCNki5BLSmVRB2y64xG3aYmHE
5mQ9hqNDjboLsdIhJy+eCu8G50X0H5FkoxM04a2U+kBgx1ErPt46p/qjaib/F9qh
oWQh4T0od2GNVT/8qaTRBIVEGGMaFPhwnqUZpdWNaKbe0isxlgRctEJOSY7n4wzN
OHf3FKLYnGLEfsqCOSpGSWSggeKhXFKL7OHY7T/MeyVD8dnGs+iaaabvuTUYGXsL
ZhmmGoJngCAQfrlFym1tyUKdVcgnwRLI+Po/yPv1QKCwHuMQ8ysJe2i0GbIqEImp
+Rh+oMdyTmR4cmK8Z9BKDqcTeSSTb51SJqjNhVBVA2n/xmMbXjmbrsi6M1VYqa9d
3IME49Xjdv5m/ooL/Jdl7cSAIVNXOM028ufjrYozxYjD/VDqku5UfwsNIO7erIl6
6urjXlOARytF31ATxJjSuuZ9ZXdkW7h+g+PSmAqC1Y2XkwawmiH1JxBxBP0kw+ae
zbDKLLtXf8yVrQ9Qd6qRqec1Ad9PsQf47wwBN1vgY3FcFpijTdc=
=R1dg
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d7684b119c431d16286c851e904311ab0a14f8ac.camel>