From nobody Wed May 11 18:56:07 2022 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 3F4711ACE56C; Wed, 11 May 2022 18:56:08 +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 4Kz3yw0tL5z4dRS; Wed, 11 May 2022 18:56:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652295368; 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=S1fJRJOc8fRw4Evy4be0NRqeKHKLDaHauAhidC6i/N0=; b=tvlCQDv0/1SESMFz13Qrd+1nh+XkTT7/UqUErWx+272pYQRq1joqXcf3RUJcicKvbetG3y bzrXubDATswIB8zmMIBnQoftS80zh7NQbKUmPnv319Ot3DKIzzERfAO5YWSnKWaiB9WsbY 0AjOwjh5MnMF7QCJcivBNCnWmqA4F1AR7QFHNxoVvLSS/sWIZFjl+j7DsApdx/srRz4DTU wFWTzH0q8u5Ya95EU0SSQ7MNBdjxqr+CeRHSLu3RabDJEJ4NIL8vgSRxsf+ljzOWlMfLbi BSMK31MHFLdNX88FTSoKR0MGHrMRXsE9F2eaO3nbdagUPnUpHXOCEFwSR6L0Vg== 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 C6E5F1EFD8; Wed, 11 May 2022 18:56:07 +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 24BIu7eT049046; Wed, 11 May 2022 18:56:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24BIu7Ao049045; Wed, 11 May 2022 18:56:07 GMT (envelope-from git) Date: Wed, 11 May 2022 18:56:07 GMT Message-Id: <202205111856.24BIu7Ao049045@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: cc16e0f79dbf - stable/13 - bhyve: Make the MADT dynamically sized. 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cc16e0f79dbfdd3e3584a408d358a0b0475606b0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652295368; 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=S1fJRJOc8fRw4Evy4be0NRqeKHKLDaHauAhidC6i/N0=; b=XR6E7JqatMMr05sHVFMGNnR3Ur61hyf+HjpnKOCxxFcQi/603fh92KxnIE3KNvRuToieca FqSg9P0wJ3d4d/IbreCypYdV5YvOddUOVVdsy85WTqtPSmBTxLV1KCsQhD8vimjl/W3lKw QlxbMtSs5LWEnoakGSIqlE48LYq4LCjkHHIiAi+LfohyiUL8H1zSQlIWCdrVP2IGd8vs3t FxFzKfhGofv5zc6UfSYi0BYKRA30JnYM5u6MZ8HPCT47yO74sN/GEJdKn8WpuFHi+yNOC2 RnEsaNo3G35XdU/fWc/J1O5epov89dpHzuaUArI5YazBLHRVCuVOEK8JAMq6Jg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652295368; a=rsa-sha256; cv=none; b=cKdFpzRgdp0W3P+zpg91O5P9hTFoFxnNJdVTJq7mPJn/PNoOrd07k7F5nbYM6/9mJyMY/A Bzylu8O+6VHUPT0ToS3y7ec8vhiv9ubwWCFSK9f3MQ3woc5z97cuo3lCOc3gK1veiUk0nM zUtj2CZH7S3Ql7i/95WTZwAvgcIYNaCNyi0z4B9Ccsbqajavg3vatPtY/R76qVGKH1udFq VLXlhyck2GPDzg8aoljhdQni/OBB59A7oKEGti7yflDur1Jf04H/jzPujHTaP9E3LLElCU fY3uSp4pLpR+G5tRJ3/smdaCuP0egoM/pJupCA41LRB2VZgz51dwOL4jbmMrwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=cc16e0f79dbfdd3e3584a408d358a0b0475606b0 commit cc16e0f79dbfdd3e3584a408d358a0b0475606b0 Author: John Baldwin AuthorDate: 2022-03-09 23:38:58 +0000 Commit: John Baldwin CommitDate: 2022-05-11 18:48:17 +0000 bhyve: Make the MADT dynamically sized. Use basl_ncpu instead of VM_MAXCPU in MADT_SIZE. Since several of the offsets are no longer compile time constants, unroll the loop generating ACPI tables. Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D34490 (cherry picked from commit 340a293f9147a37bb71c80a767e37794ca277a28) --- usr.sbin/bhyve/acpi.c | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c index 580bb900dd43..360191ac6c4d 100644 --- a/usr.sbin/bhyve/acpi.c +++ b/usr.sbin/bhyve/acpi.c @@ -89,10 +89,10 @@ __FBSDID("$FreeBSD$"); * 44 Fixed Header * 8 * maxcpu Processor Local APIC entries * 12 I/O APIC entry - * 2 * 10 Interrupt Source Override entires + * 2 * 10 Interrupt Source Override entries * 6 Local APIC NMI entry */ -#define MADT_SIZE (44 + VM_MAXCPU*8 + 12 + 2*10 + 6) +#define MADT_SIZE roundup2((44 + basl_ncpu*8 + 12 + 2*10 + 6), 0x100) #define FADT_OFFSET (MADT_OFFSET + MADT_SIZE) #define FADT_SIZE 0x140 #define HPET_OFFSET (FADT_OFFSET + FADT_SIZE) @@ -943,28 +943,10 @@ basl_make_templates(void) return (err); } -static struct { - int (*wsect)(FILE *fp); - uint64_t offset; -} basl_ftables[] = -{ - { basl_fwrite_rsdp, 0}, - { basl_fwrite_rsdt, RSDT_OFFSET }, - { basl_fwrite_xsdt, XSDT_OFFSET }, - { basl_fwrite_madt, MADT_OFFSET }, - { basl_fwrite_fadt, FADT_OFFSET }, - { basl_fwrite_hpet, HPET_OFFSET }, - { basl_fwrite_mcfg, MCFG_OFFSET }, - { basl_fwrite_facs, FACS_OFFSET }, - { basl_fwrite_dsdt, DSDT_OFFSET }, - { NULL } -}; - int acpi_build(struct vmctx *ctx, int ncpu) { int err; - int i; basl_ncpu = ncpu; @@ -986,18 +968,30 @@ acpi_build(struct vmctx *ctx, int ncpu) if (getenv("BHYVE_ACPI_KEEPTMPS")) basl_keep_temps = 1; - i = 0; err = basl_make_templates(); /* * Run through all the ASL files, compiling them and * copying them into guest memory */ - while (!err && basl_ftables[i].wsect != NULL) { - err = basl_compile(ctx, basl_ftables[i].wsect, - basl_ftables[i].offset); - i++; - } + if (err == 0) + err = basl_compile(ctx, basl_fwrite_rsdp, 0); + if (err == 0) + err = basl_compile(ctx, basl_fwrite_rsdt, RSDT_OFFSET); + if (err == 0) + err = basl_compile(ctx, basl_fwrite_xsdt, XSDT_OFFSET); + if (err == 0) + err = basl_compile(ctx, basl_fwrite_madt, MADT_OFFSET); + if (err == 0) + err = basl_compile(ctx, basl_fwrite_fadt, FADT_OFFSET); + if (err == 0) + err = basl_compile(ctx, basl_fwrite_hpet, HPET_OFFSET); + if (err == 0) + err = basl_compile(ctx, basl_fwrite_mcfg, MCFG_OFFSET); + if (err == 0) + err = basl_compile(ctx, basl_fwrite_facs, FACS_OFFSET); + if (err == 0) + err = basl_compile(ctx, basl_fwrite_dsdt, DSDT_OFFSET); return (err); }