From nobody Fri Apr 28 10:40:25 2023 X-Original-To: dev-commits-src-all@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 4Q78JT4cNfz48JvS; Fri, 28 Apr 2023 10:40:25 +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 4Q78JT1yLvz3H4b; Fri, 28 Apr 2023 10:40:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682678425; 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=N0O2XWjZRhVPlD0y9EomjlJebK517zPqMQW3P1g6eUA=; b=UpjBXAF47HgQZIn3G6QHxgcHUC0/VgKrK7x06qoomutfZqSOYoggBT1BRqhhRMIz0WVkZs lOIzTB+cUC+/VZD2EI9dxBf8piaDcpWsqeIROiK6EldkGKWx41wz/EXc6VYwQSj1yuHv+h NUAXiCxQAp3aeP/hzjShw7fZ6Sa6frpSP17aqMRWag4tTfxvUzWWQDrK4AM5Q+86kQXDPq zGt1UzSgWWMfRFsxSN0U2widykNHlOvWNKgCDsrONhGn1i01D50vC1pnxc2+TIgg56Pce7 FiTyIkZJpF1qmeAQomjInK1NP7brBMINe1kcDbxs3O+h8CI6//KmNFXfMH8BJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682678425; 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=N0O2XWjZRhVPlD0y9EomjlJebK517zPqMQW3P1g6eUA=; b=bicIGz/hkyoS5i6M1BifBDrejyzvMqztHHqBxDkGzEt1NEPIF52r7VK2FFldHinSedlIng nZmvYNcKb7cV9gGFHNZSn/a7xr3gzCqK4uyZSx/NoZJ3RswrXCalPtxKKOdmdPN5eqHJzD 4pHmR4SoSDKZ3ZncU4jJ8B9mIyiXrKu8Ndg0of9712sobCWBwqUkjzPHBvIA+h1pecH5Uk fD7SCkzyZfwga8iG0Raa0MJ3xKuDn5FYjDHmuH3Ku3nyMk/X2Ht1pBNhMC+tZhL6xAwPrd nW1lteoTNqgsoIHx8aNmLEiYuzj4IQeJPiI5E6eCemNG8bHJbLhnpfMfVxvPAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682678425; a=rsa-sha256; cv=none; b=KvIr8JqVp3IYsREWmwjLTJ7qyIUmjHJ5bewoVuGfV1b40SoMvz3ebX0zqBtp+ilevMFjBn QuTpsridjk7xyhPg1p1zB/Q4Y/hwsopX1+8h+rUaDDlc0Q9njSaDsbGC2qYSjUyKWvAaEs SC0DOdCSAMfgmOzg13sD/zM+81upoJJ9paVQUxLrTy4lRP4CLxiuLopOOpHfvMur2P5TLF SrYzLLtSwT1bBSPOfWbiRlBXPYlr6TKe+MCh7yiuQMw6EFMWzPVyOYvqUnC7NNEvHqM2kL 8OKJVFSI3HX7ZgSpNOhw3B5uH8/lQwNg+n2vnxtfueKvfrqc8niLnhEIHk3E6g== 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 4Q78JT145Zzwrg; Fri, 28 Apr 2023 10:40:25 +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 33SAePrD092655; Fri, 28 Apr 2023 10:40:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33SAePFN092654; Fri, 28 Apr 2023 10:40:25 GMT (envelope-from git) Date: Fri, 28 Apr 2023 10:40:25 GMT Message-Id: <202304281040.33SAePFN092654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: 82622189fe02 - stable/13 - bhyve: add QEMU_FWCFG_INDEX_MAX_CPUS item List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 82622189fe022281dd9188ff0795303c95b5b0cf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=82622189fe022281dd9188ff0795303c95b5b0cf commit 82622189fe022281dd9188ff0795303c95b5b0cf Author: Corvin Köhne AuthorDate: 2022-06-21 08:35:40 +0000 Commit: Corvin Köhne CommitDate: 2023-04-28 07:28:34 +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 (cherry picked from commit 305edaa47918a559de46a5d72060644009f1875c) --- 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 e76ff3620586..2c5324dffdaa 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) { @@ -431,6 +450,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;