Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Aug 2023 07:28:41 GMT
From:      Corvin =?utf-8?Q?K=C3=B6hne?= <corvink@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b3f053b4f46e - stable/13 - bhyve: allow adding FwCfg items to ACPI tables
Message-ID:  <202308180728.37I7Sf7h034290@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=b3f053b4f46ef1b1c64b2e2870f7cd172941946b

commit b3f053b4f46ef1b1c64b2e2870f7cd172941946b
Author:     Corvin Köhne <corvink@FreeBSD.org>
AuthorDate: 2022-07-22 08:58:01 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
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);



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