From nobody Wed Apr 12 07:35:39 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PxDyh0cZ5z44DS4; Wed, 12 Apr 2023 07:35:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PxDyg6xGgz3RFQ; Wed, 12 Apr 2023 07:35:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681284940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AsvXD3yc9TNVbh7DcB+qavSTmaFz/IiMXDYF86LxrHw=; b=iGR4LdlyMcT88QFBbezaE+JMnJw6QgQ7S40fEJG7zuqadqIURqB5c2KOjJr6A7yqPQ1Ooh h0/tm3pkrcQKKbA+IKj6AN53eSgEQVTuFlbrzOF9foUAW+a7Xt1M1A7VqhEe8C3Rjbr8tr QSgzGsd3qxX5WqR68HRfv9T//T4ACARey8SZ50j4PnTBJGTH5I5FNlWecjHFN/Q0oDhPQW S/TlvX7lvxnzcLEfAw+VSfvv4CKhdWrnSiPD8OeOnmSJ2LJV1UJ844GDJ8vastru6TcLSS Sh0KnEH0U15dOkJGuRF5nu2pkzaYMalM8z6sZW3PPiT0SQ+489c9uAHcMYY43A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681284940; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=AsvXD3yc9TNVbh7DcB+qavSTmaFz/IiMXDYF86LxrHw=; b=ISgTolba1p42Ex77rnkpXiTtmSJKFCg52xXsl6K7Bc0JLOrp+wJ3NCx2+/VCVHmK8mBIfL ZoR+ZCpgqn4zYPP+cbZDe0iU7dtjqnPHloTYVJi6pJXXNB+CdAQ3EQjzAwB9sG+gpi4fz6 BN334KDrrXNpogzklSh++NUeU/2AzMEYoEkyojnP4KZ6Zxh3YeOg2RwbGwt8IG2EtnM5lj R7NsbJBsNQUVpqKcuoxXVOjxoNhGhd1s/sgy/GxJg55Uy/YayiclAA3VzcMpskxTZcXO9y DdUwdC2Qdti5uqkSam7qOca3cZIvyOa8ONjXGff3ILoSNgVueknCTPjuIRSd4g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681284940; a=rsa-sha256; cv=none; b=rzw9cGIaXv4iJJ/T53IZLbdSliPF0g+4CpX2EoDwpWjoW0a3luXcji5J7PPVu5YTvUgqud WuNcmuzaTyU+gP3n3rT9CNL5sfd4ynw7MyopHMrkCo5USdpLzNNOytjRFF+Zo1GewwquKA CxQ5W9prv9igBl8o4pwpVpnhYsibqizRKjnnWVQGTwrdIrF35eoTV9P9sq4ikqP1xw6phi ZX8aPwczSfoeSpoufbj4DGxoMcJinMo631T8P7g7s8Lyuw/EPs3PCoWPbRLSDrWbznIsBI uM+7SvsC6VTvR3En13YrX2yh5tPmOmzMsgDZRSY5n92fqG4KSbI1//rCvOODsg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PxDyg62VvzrLl; Wed, 12 Apr 2023 07:35:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33C7Zdlh011582; Wed, 12 Apr 2023 07:35:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33C7Zd9c011581; Wed, 12 Apr 2023 07:35:39 GMT (envelope-from git) Date: Wed, 12 Apr 2023 07:35:39 GMT Message-Id: <202304120735.33C7Zd9c011581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: 305edaa47918 - main - bhyve: add QEMU_FWCFG_INDEX_MAX_CPUS item List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: corvink X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 305edaa47918a559de46a5d72060644009f1875c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=305edaa47918a559de46a5d72060644009f1875c commit 305edaa47918a559de46a5d72060644009f1875c Author: Corvin Köhne AuthorDate: 2022-06-21 08:35:40 +0000 Commit: Corvin Köhne CommitDate: 2023-04-12 07:35:33 +0000 bhyve: add QEMU_FWCFG_INDEX_MAX_CPUS item Requested-by: coreboot Reviewed by: 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;