From nobody Mon May 08 08:25:32 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 4QFDrD5fRzz49YyJ; Mon, 8 May 2023 08:25:32 +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 4QFDrD572Dz3lQk; Mon, 8 May 2023 08:25:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683534332; 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=l6rEFtcsRF+nrdrduRw6ojGB1ilJk+Ydo8HbkrNNgfU=; b=JGkQ+/Tju/ke4D5teUI9/CO6O1eS+eUhSUMzfdb21ZpAkNzdYC/nGZRF0XP37dfBCqJXZh qRSxPQzXT8BOAiACFmD35nF3I+/dDezW7OrbcOYRH0fHlbamJdP0gp8BsjKHZac4sUTNB2 5MFD0xTM2D+hHaScjY3ke15Y7taNA7WoItMaF6gM7DoRnRDzmHVZ+2WL4Ht1BN+xeE+K1H yggst61XgO9zyLKiqKM2L0CmqIDMfPVzZzsilpz8YaXVy+A4+lbd3uYhnF2i+yhdQ4SuMQ 6ZazSFW/ruGPPAKeFSH/QapmzY3VjG5K8yQDNJHM5RmJwi2/LNS3yiBnuHClng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683534332; 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=l6rEFtcsRF+nrdrduRw6ojGB1ilJk+Ydo8HbkrNNgfU=; b=J11Z2bzq/WZmCSdaF42taEyUQG+VeDjvKJ1N+NaT1JH4qMUO0yOo5fHdSVhOSClvAirqxf uglITbs0MXHbiPYhfg390Tpdy54siQaf4CSEzVd5CS8Ik7ss0zxmdAaxBZT4Iw/JRzaYNX Yza/IoT1KSfl4bCsc+MopC/h23mzSiU5F1ZyNvxJrZQQ3uhWyks8kjdyRnhI6o/RNQFXBj XPmznJNIZZ0u0AO0AI+3gXc0Js9rzoB83PfXwRNrjKuzcj78pGb6qefMHgWMo9kDhHvw2/ ECsgqGf7y54mlxktp1BfmAk8WeFQ8CONfsmtN7BjKULMqyktXS3P10TG2R9TWQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683534332; a=rsa-sha256; cv=none; b=ZcQRtTM2YXPulo8Mz/Id0jzB9LnSI6juz8qJn007p7y1+0ASUIN1+D1ZkkNUYR40XC/YRF z0t6HdGXnfJL991teE6QrdEf1v22+cIenqjTx1nKIPUJHxM7/4NiYPPDxWk+9sqK326XKZ 9QJKN2LDzrqPVSY2n/4SVTUe3xeUuPkVUc8RlsBj5Wu2LB7GfgZMdJ7/SefBP8YfXVDM+r HRE+PjkOH3lKj5f905v6VsBrM/iNL/3QbWEI3zwQcQIxLaxbCi6BoK7jthcHU3/A/x8qBz /+fVouMJxXxIPp9yq7wXsepaTHfCTqktgcdiFMOR9zhFdmaDvTOLyIK81HphGg== 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 4QFDrD3jmqztJ2; Mon, 8 May 2023 08:25:32 +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 3488PWpV050459; Mon, 8 May 2023 08:25:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3488PWLK050458; Mon, 8 May 2023 08:25:32 GMT (envelope-from git) Date: Mon, 8 May 2023 08:25:32 GMT Message-Id: <202305080825.3488PWLK050458@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: 03d8264dcaf4 - stable/13 - bhyve: pass E820 table to guest 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: 03d8264dcaf4c529011d2a4577a540ae4eb9c11f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=03d8264dcaf4c529011d2a4577a540ae4eb9c11f commit 03d8264dcaf4c529011d2a4577a540ae4eb9c11f Author: Corvin Köhne AuthorDate: 2021-09-09 09:37:04 +0000 Commit: Corvin Köhne CommitDate: 2023-05-08 08:21:32 +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 (cherry picked from commit 16f23f75432915e64a34357e7d5f26bca82f8219) --- 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 f5031a5bae07..c2b426359c22 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -28,6 +28,7 @@ SRCS= \ console.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 dd30eb4405ef..fbc1fd99ea59 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" @@ -1246,6 +1247,7 @@ main(int argc, char *argv[]) int c, error; int max_vcpus, memflags; struct vmctx *ctx; + struct qemu_fwcfg_item *e820_fwcfg_item; uint64_t rip; size_t memsize; const char *optstr, *value, *vmname; @@ -1478,6 +1480,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 */ @@ -1572,6 +1579,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(); }