From nobody Fri Aug 18 07:28:41 2023 X-Original-To: dev-commits-src-branches@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 4RRtlZ13X6z4qqbT; Fri, 18 Aug 2023 07:28:42 +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 4RRtlY6dR2z3DNK; Fri, 18 Aug 2023 07:28:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692343721; 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=2xtYrA0BUl/eRSezIINUreKkNMlByNb5CjQBq2QdaEw=; b=GwXgu58DOsY1QKzxuZ/G+QTxhbJnUJLH6eyAMHG6Dc1OZWJdEIoom9gJ5cORtug0W0/Z/y tcRPXQPGLd+8iOJfMx/fur8RTbjiQOSLyYESl2gbq0lytKYaRkb97bEl41LOPp120AyvmY tQxeA7Rcj69hLytbnajsRcg+Ezd6cArHiz/ARPpfEhw0kTW0A6vO4hoBXOI4cAvQaTJoWr owBpULGX1vwsSX3DzbirZnM674TmBNqZRLKe58mORESXG1c3yYKk96KCC13C5c3ag4c0+y 7TYgZ9HwjkZDvi4ZubpioUJTXT2z61REqDa0spQSh84Lvsn5WsqAwnYFLnJDEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692343721; 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=2xtYrA0BUl/eRSezIINUreKkNMlByNb5CjQBq2QdaEw=; b=S7tPOolnF7/+yh9jZoXBn2OigOjSRWGje3BsxlJehwH02C0ljUVqCabJ7/yXrpMwGOR3Hu MSpszdSR2BS8mh3EBkwd87l65AUMgB/pI4S6mOyjwTy3U92HTh5MeX+4GdsMzLbROgHYVl HOGpgIVUInPjdD0Re8jp7Pq00VNXF9uA6O1ev9J8uzEta3Rakz3P4wtWARqtFv9HOFszqT e4DrY8mmOG/p2+icYcXe+9+1LwmcEJzPe9eoL0MH7xQjg4ousPkrj9/EOQmkdt0vcwaSTR kV4sOdvBw/ydJzYo4lyYgpj6L3dRCU6SFXwc0UonNGfJNJUIlwX2OXJT2+SNlw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692343721; a=rsa-sha256; cv=none; b=cfjWEhDLhb6+o2kjH0NdcNdNB+G4BGXt8AJnNIXDQUE5wdIL9P0b8gn19kN+8FWvrYvv17 JzIAfm4ciEzizgt+iBF2ieMENRbGQUY6zArUZCZHiTWto9e7sHegDjHZUFdzb/scPCT00d i3pIUHznsuOQO2fYskMTZwBZuL0nweSAof6S9zs1BB+MtR+Wjy4YXYWNCHLLxxQWom2wFo l8WblQLAWi87arWAmXD0Jif1XO7IkbvY840DyhCu69MRvC+uLZw3rEkD4ooJTN3Ij7eopL asgjCOtMMkDmqLY6m2wwKgO06jpalFmyi0uPdeIemVLgKTWVjb5lFim5xCMwYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RRtlY5Kp7z16RQ; Fri, 18 Aug 2023 07:28:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37I7SfN5034293; Fri, 18 Aug 2023 07:28:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37I7Sf7h034290; Fri, 18 Aug 2023 07:28:41 GMT (envelope-from git) Date: Fri, 18 Aug 2023 07:28:41 GMT Message-Id: <202308180728.37I7Sf7h034290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Corvin =?utf-8?Q?K=C3=B6hne?= Subject: git: b3f053b4f46e - stable/13 - bhyve: allow adding FwCfg items to ACPI tables List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: b3f053b4f46ef1b1c64b2e2870f7cd172941946b Auto-Submitted: auto-generated The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=b3f053b4f46ef1b1c64b2e2870f7cd172941946b commit b3f053b4f46ef1b1c64b2e2870f7cd172941946b Author: Corvin Köhne AuthorDate: 2022-07-22 08:58:01 +0000 Commit: Corvin Köhne CommitDate: 2023-08-18 07:25:06 +0000 bhyve: allow adding FwCfg items to ACPI tables A TPM has an event log. Therefore, qemu adds a FwCfg item and adds it to an ACPI table. We like to use the same OVMF driver as qemu, so we should do the same. This commit adds the ability to basl to do it. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D40451 (cherry picked from commit 4e46ab0ebe96b56d4fa7ea7df4a81cd533109f07) --- usr.sbin/bhyve/basl.c | 17 +++++++++++++++++ usr.sbin/bhyve/basl.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c index 348174c6520d..90cb608aecc6 100644 --- a/usr.sbin/bhyve/basl.c +++ b/usr.sbin/bhyve/basl.c @@ -490,6 +490,23 @@ basl_table_append_content(struct basl_table *table, void *data, uint32_t len) len - sizeof(ACPI_TABLE_HEADER))); } +int +basl_table_append_fwcfg(struct basl_table *const table, + const uint8_t *fwcfg_name, const uint32_t alignment, const uint8_t size) +{ + assert(table != NULL); + assert(fwcfg_name != NULL); + assert(size <= sizeof(uint64_t)); + + BASL_EXEC(qemu_loader_alloc(basl_loader, fwcfg_name, alignment, + QEMU_LOADER_ALLOC_HIGH)); + BASL_EXEC(qemu_loader_add_pointer(basl_loader, table->fwcfg_name, + fwcfg_name, table->len, size)); + BASL_EXEC(basl_table_append_int(table, 0, size)); + + return (0); +} + int basl_table_append_gas(struct basl_table *const table, const uint8_t space_id, const uint8_t bit_width, const uint8_t bit_offset, diff --git a/usr.sbin/bhyve/basl.h b/usr.sbin/bhyve/basl.h index 4d9ab4c589a8..e12173b701a2 100644 --- a/usr.sbin/bhyve/basl.h +++ b/usr.sbin/bhyve/basl.h @@ -82,6 +82,9 @@ int basl_table_append_checksum(struct basl_table *table, uint32_t start, /* Add an ACPI_TABLE_* to basl without its header. */ int basl_table_append_content(struct basl_table *table, void *data, uint32_t len); +int basl_table_append_fwcfg(struct basl_table *table, + const uint8_t *fwcfg_name, uint32_t alignment, + uint8_t size); int basl_table_append_gas(struct basl_table *table, uint8_t space_id, uint8_t bit_width, uint8_t bit_offset, uint8_t access_width, uint64_t address);