From nobody Wed Apr 26 07:59:36 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 4Q5rqr63Dtz47PQJ; Wed, 26 Apr 2023 07:59:36 +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 4Q5rqr5Y4Pz4bPJ; Wed, 26 Apr 2023 07:59:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682495976; 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=6g2F9X4csX0wHBkfmbL1wPWn+QKqb79Clzq9FBBtS/I=; b=mBMB8EVrg80B+quMqiIF6OxnAN6RJUd4VjiIB0yLZwzOCBX1lLLd8eIKkooyMBpjAC3NHE GkqrCE3ai9vxfn9CY3uUxiRxYH95kl1bIGrZbWPkkBdw90buQ0Y2wI97Wp36d45xrynkFQ s096ZPIqb/BO2Xc74K/DUO6IVh7TbEPG9XRyepkDnOUNRd3e3WOVWpeBKgp8KNgBQVUWWi dhxSzkHOG90TMsRX4SqJRx0H+qopTkn3Myd6B7jZ+GhW9+hYfNn+hmKMfV5HLnldML1Y4n r/d0hELrnjM/bmNjYNN1t5WuuVGDt24R63u0InhOSvwKaE4BHs5Lj7P9ydOJow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682495976; 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=6g2F9X4csX0wHBkfmbL1wPWn+QKqb79Clzq9FBBtS/I=; b=L/6puMI10nuJHCLgDeTgVC9SHhU/ozp84wae7++gQqIqc+ofqxNN6Pocx2vP7RnJyyd8z1 5++IaZ1CrWeE/xU6Q4JYRKfyyX/tee8/pMzVHn937StDtusyUBeSzeb8qyltO1XHlby9pF HH9XX1lQ8ffDDP5L+3oWc3b8XwvtHHbIJwPJZHLWWGg08hMFghnfPOWvoMgE4+ELR0ZE7Q oG3pn4xkBJMbR7QPg1ltLRhwX4812Dg3cpdsUTFcBq3/AN73LAyUQawc9dx/NobMWzweBT 68fa9XfpME5dUbDnj4KFHjNDbDh9TjlxKZi5Vm9/H2xrmAtNmQDMrPdgflEutQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682495976; a=rsa-sha256; cv=none; b=ehc2ya6OAGkcfHWFfRbAyrDiLpvz8ACjez2vb3JxaujHh8NUYDVrvYGgNartK7JcUQGBB4 N1TZWwyqtuCBaVkf1zUbzwzrNnlOqQVWzBv8cv0HSlDAHTePmKQqQ01cc/+YgzLvEpMxRE oXwF1asI6OJMz5tzmmAl+HrceS57/KgVEhMdZD604Uxz0Z/OCbWVp5+FBTAxmsWwjnldZj Y4ia84N/eDV2vfsWetOAWgjXZdDAHAeb+aMXD5XmguhVqMWc0tWtP1dqaghCgXT1OW9FkN tTo95njj7ReFkx5X3FnhQ9EHhEwz+Z9iW72NgLBRJUGuX6eFb4m/bVMwquf3ig== 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 4Q5rqr4fDHzRKM; Wed, 26 Apr 2023 07:59:36 +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 33Q7xaCi059764; Wed, 26 Apr 2023 07:59:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33Q7xaoB059763; Wed, 26 Apr 2023 07:59:36 GMT (envelope-from git) Date: Wed, 26 Apr 2023 07:59:36 GMT Message-Id: <202304260759.33Q7xaoB059763@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: a8a8e9af574c - main - bhyve: add E820 dump function 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/main X-Git-Reftype: branch X-Git-Commit: a8a8e9af574c63fbecf4719e3bf184795dc98c51 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=a8a8e9af574c63fbecf4719e3bf184795dc98c51 commit a8a8e9af574c63fbecf4719e3bf184795dc98c51 Author: Corvin Köhne AuthorDate: 2021-09-09 09:37:03 +0000 Commit: Corvin Köhne CommitDate: 2023-04-26 07:58:35 +0000 bhyve: add E820 dump function For debugging purposes it is helpful to dump the E820 table. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D39549 --- usr.sbin/bhyve/e820.c | 35 +++++++++++++++++++++++++++++++++++ usr.sbin/bhyve/e820.h | 1 + 2 files changed, 36 insertions(+) diff --git a/usr.sbin/bhyve/e820.c b/usr.sbin/bhyve/e820.c index 922381d032ce..6c43e6eda3a5 100644 --- a/usr.sbin/bhyve/e820.c +++ b/usr.sbin/bhyve/e820.c @@ -70,6 +70,41 @@ e820_element_alloc(uint64_t base, uint64_t end, enum e820_memory_type type) return (element); } +static const char * +e820_get_type_name(const enum e820_memory_type type) +{ + switch (type) { + case E820_TYPE_MEMORY: + return ("RAM"); + case E820_TYPE_RESERVED: + return ("Reserved"); + case E820_TYPE_ACPI: + return ("ACPI"); + case E820_TYPE_NVS: + return ("NVS"); + default: + return ("Unknown"); + } +} + +void +e820_dump_table(void) +{ + struct e820_element *element; + uint64_t i; + + fprintf(stderr, "E820 map:\n"); + + i = 0; + TAILQ_FOREACH(element, &e820_table, chain) { + fprintf(stderr, " (%4lu) [%16lx, %16lx] %s\n", i, + element->base, element->end, + e820_get_type_name(element->type)); + + ++i; + } +} + struct qemu_fwcfg_item * e820_get_fwcfg_item(void) { diff --git a/usr.sbin/bhyve/e820.h b/usr.sbin/bhyve/e820.h index 8b8e23422e1f..8703a55115cd 100644 --- a/usr.sbin/bhyve/e820.h +++ b/usr.sbin/bhyve/e820.h @@ -40,5 +40,6 @@ struct e820_entry { uint64_t e820_alloc(const uint64_t address, const uint64_t length, const uint64_t alignment, const enum e820_memory_type type, const enum e820_allocation_strategy strategy); +void e820_dump_table(void); struct qemu_fwcfg_item *e820_get_fwcfg_item(void); int e820_init(struct vmctx *const ctx);