From nobody Wed Apr 26 07:59:37 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 4Q5rqs6YJVz47PQK; Wed, 26 Apr 2023 07:59:37 +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 4Q5rqs6598z4bgJ; Wed, 26 Apr 2023 07:59:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682495977; 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=XJrp9zi10wmt1aniICjFzoGUIBGQOMiIkAdlbbKpz7U=; b=FJAOEAfgPF4x752v2hPr8p4RF/DTqZNuigsft6GYhoGe5h6AZ9zGwZIMXwlbvk+Q/izI9Q OUMut6kNYdyLrac1knDmCGw5IOIwqWxxuzXdVlD2c1/iPtaMjPd8krYlSrHd9TCpLXmrRB U1ERJ72GjtfDfPyqYZBWDj9tj3UtLPtGAPMgr3VbHlThK9At+b3lvKx9HszhYmrJf3y9qi N/y8shC37oIBEl0DgN23nmH2ysSiJeKPhfW6rbDG2kYZxDzcN6qf0Fn3kJ6n8y1RauSCNr zY79Uj/PJNkpne0uCznZzxxyVVCQSybKRZ3ZFou6uFG1GzSoFv70hejuXP3rkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682495977; 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=XJrp9zi10wmt1aniICjFzoGUIBGQOMiIkAdlbbKpz7U=; b=sOjAzoJx3I4N1DAdn9LW5VRY3nj/c2nLAHLrO5uS+3AWRKcaiKUl7o2dcAr8JG1x9r2S+j u4r6kpKqKFNIo3dRWnpXO0Q8p7Qk8UHJVLlHuubV6dWWb1w5QiiU6xxjFQ710MZeci5Ybu BrUPF4UaitEsa5n5Y2GdEqZ7cxoabz2rlEbcusfuQtY+5hZBJNvVPCDLsFXQnzX55tk8zY 2KW+Ob/vrt/14hlfxiTcRptVXS/kEiX2f8+EdAuzRstJUu25g9w/fBbBzjA33lCWagczGU gvYQgsJ4mj4AnpkzGD7KKMDITU8WjlFoG8NglIUZ9KMBwRr4Kqf0yXYlOBfxIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682495977; a=rsa-sha256; cv=none; b=qEjq9wrqvCXArWpm+SfS3hbaPKlpwoZy6JUhXnwaFO3AlZqQS6G4E3/p0HnnEYP4wrUWFE Walh+kwPPHtRD7qBSb0UCi2vtBJ+mm3fNHOZPFD/IBjTsfSdf3z/AF7WKmAoXdlf+jXwST MUgweyqZ/SInanDuntC8q+/INPRHgQjPeZo2viElo6M1I+Twy1377/mzKZsrZStO01rojp PFg5pX9UlaBsBZA+WtMejxtQQ7R1BAv+DAcNM15c8zU6yvquEKi5mpL7q0HIm2C8mKW/Nu Nzv4qFdj8pjyPt0gClenSm3GNVcPhsuNmkHYUP28o3NiOvNg1pk7KbFTbZNLkw== 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 4Q5rqs596PzRXG; Wed, 26 Apr 2023 07:59:37 +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 33Q7xbxq059788; Wed, 26 Apr 2023 07:59:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33Q7xbTJ059787; Wed, 26 Apr 2023 07:59:37 GMT (envelope-from git) Date: Wed, 26 Apr 2023 07:59:37 GMT Message-Id: <202304260759.33Q7xbTJ059787@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: 16f23f754329 - main - bhyve: pass E820 table to guest 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: 16f23f75432915e64a34357e7d5f26bca82f8219 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=16f23f75432915e64a34357e7d5f26bca82f8219 commit 16f23f75432915e64a34357e7d5f26bca82f8219 Author: Corvin Köhne AuthorDate: 2021-09-09 09:37:04 +0000 Commit: Corvin Köhne CommitDate: 2023-04-26 07:58:37 +0000 bhyve: pass E820 table to guest E820 table will be used to report valid RAM ranges and reserve special memory areas like graphics memory for GPU passthrough. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D39550 --- usr.sbin/bhyve/Makefile | 1 + usr.sbin/bhyve/bhyverun.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index 7f67c5bf0489..02a1f67d66eb 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -29,6 +29,7 @@ SRCS= \ crc16.c \ ctl_util.c \ ctl_scsi_all.c \ + e820.c \ fwctl.c \ gdb.c \ hda_codec.c \ diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index d447a9ee60e4..627a86d71e0e 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #include "config.h" #include "inout.h" #include "debug.h" +#include "e820.h" #include "fwctl.h" #include "gdb.h" #include "ioapic.h" @@ -1242,6 +1243,7 @@ main(int argc, char *argv[]) int max_vcpus, memflags; struct vcpu *bsp; struct vmctx *ctx; + struct qemu_fwcfg_item *e820_fwcfg_item; uint64_t rip; size_t memsize; const char *optstr, *value, *vmname; @@ -1486,6 +1488,11 @@ main(int argc, char *argv[]) exit(4); } + if (e820_init(ctx) != 0) { + fprintf(stderr, "Unable to setup E820"); + exit(4); + } + /* * Exit if a device emulation finds an error in its initilization */ @@ -1576,6 +1583,18 @@ main(int argc, char *argv[]) assert(error == 0); } + e820_fwcfg_item = e820_get_fwcfg_item(); + if (e820_fwcfg_item == NULL) { + fprintf(stderr, "invalid e820 table"); + exit(4); + } + if (qemu_fwcfg_add_file("etc/e820", e820_fwcfg_item->size, + e820_fwcfg_item->data) != 0) { + fprintf(stderr, "could not add qemu fwcfg etc/e820"); + exit(4); + } + free(e820_fwcfg_item); + if (lpc_bootrom() && strcmp(lpc_fwcfg(), "bhyve") == 0) { fwctl_init(); }