From nobody Thu Nov 21 20:06:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1730569092; cv=pass; d=zohomail.com; s=zohoarc; b=B4JW4sABEwIJwN2CCWvSgBk1x4CbFKbmZ1dPrrIaJr1k5bSdsNPMvxr8RPEl+ZEZw8ASjivGRO9GmcQT/tHr8JC9s3xPjU1iLuygL8sx/fYOopvI7Oa7q1d6b4QMIYV+OhISWsje3MTlblY/l4GnoCAZHB9a4G5MDmKyzVqEPXM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730569092; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=D+Ero9Cx9cs2ogNCswgWtWOJ14E6rK5H6+adO3A9JUc=; b=Oj340/FQC0kJlooAMhtVDzMHjHlmZyBXtt6d3cZphWdn9M6bxDocnGSywrn4geYetX4SfSgiXzTwgSC6mgoo1TTOsHmb7OAu2UGLAMRXOx0AN3x+w6tQFIQyjWDzoAFZj9BNwwW4njlA7FKFwu3NdM5vNDXdAiJ7bV0IEHVI8qw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1730569092631429.09224906167776; Sat, 2 Nov 2024 10:38:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.829624.1244658 (Exim 4.92) (envelope-from ) id 1t7I4S-000400-0p; Sat, 02 Nov 2024 17:37:56 +0000 Received: by outflank-mailman (output) from mailman id 829624.1244658; Sat, 02 Nov 2024 17:37:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t7I4R-0003yy-Qw; Sat, 02 Nov 2024 17:37:55 +0000 Received: by outflank-mailman (input) for mailman id 829624; Sat, 02 Nov 2024 17:37:54 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t7Hux-0004r4-No for xen-devel@lists.xenproject.org; Sat, 02 Nov 2024 17:28:07 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d062b535-993f-11ef-99a3-01e77a169b0f; Sat, 02 Nov 2024 18:28:04 +0100 (CET) Received: by mx.zohomail.com with SMTPS id 1730568376554254.352253814322; Sat, 2 Nov 2024 10:26:16 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d062b535-993f-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjEzNi4xNDMuMTg4LjUxIiwiaGVsbyI6InNlbmRlcjQtb2YtbzUxLnpvaG8uY29tIn0= X-Custom-Transaction: eyJpZCI6ImQwNjJiNTM1LTk5M2YtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMwNTY4NDg0LjgwMDUzMiwic2VuZGVyIjoiZHBzbWl0aEBhcGVydHVzc29sdXRpb25zLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 ARC-Seal: i=1; a=rsa-sha256; t=1730568385; cv=none; d=zohomail.com; s=zohoarc; b=DaE1msTh9OL/UMNeyEU+I+slUVIkmCcBLTOkiP4IeAh0AFi0/le5UTAY2mPxrvmSFKIax7cucpovfwpc6qUvdMAy76Ak6ZYVS3fLy/a5JmP2URQwX7pJVW65yfp0FuiGWoAfxRs3R92xHYz1/89WXYl+YRcK1pSD/cDgUyotk/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730568385; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=D+Ero9Cx9cs2ogNCswgWtWOJ14E6rK5H6+adO3A9JUc=; b=cz5B2xs55xJa3cNJI30LvbySktK7yR3NFJn38I5WZq+Z9irgJN+KntUaa/Bc+WxOWl2mbX+4wRLGn7JYfsI2eAGUUzfPii+t1LHFfJ0JhDqA1IXZ1luND/pYufhlxSBZB7otSUDnh2CbPuiMsbY4YRrgcijLpiUym4spH+8Z4Pg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1730568385; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=D+Ero9Cx9cs2ogNCswgWtWOJ14E6rK5H6+adO3A9JUc=; b=ebpNRVEcdLj7MAIUFRuaw3inmi9D37/O6u5vIVXXw/L86ZiXaNzV+opQt23bJGD4 yrso92wIMRz+DnfIOPyh91WTJnLqBhqk6e4yMQkBlJJ2R0KLb53dEht4VjUnerXcW+O YYZoAj58haXpOymqXpqtXjGJjVWfww7ZiayQbX3A= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , jason.andryuk@amd.com, christopher.w.clark@gmail.com, stefano.stabellini@amd.com, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 12/12] x86/boot: add cmdline to struct boot_domain Date: Sat, 2 Nov 2024 13:25:51 -0400 Message-Id: <20241102172551.17233-13-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241102172551.17233-1-dpsmith@apertussolutions.com> References: <20241102172551.17233-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1730569093423116600 Content-Type: text/plain; charset="utf-8" Add a container for the "cooked" command line for a domain. This provides f= or the backing memory to be directly associated with the domain being construc= ted. This is done in anticipation that the domain construction path may need to = be invoked multiple times, thus ensuring each instance had a distinct memory allocation. Signed-off-by: Daniel P. Smith --- Changes since v7: - updated commit message to expand on intent and purpose --- xen/arch/x86/include/asm/bootdomain.h | 4 ++++ xen/arch/x86/include/asm/dom0_build.h | 1 + xen/arch/x86/pv/dom0_build.c | 4 ++-- xen/arch/x86/setup.c | 18 ++++++++---------- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/include/asm/bootdomain.h b/xen/arch/x86/include/a= sm/bootdomain.h index 3873f916f854..bc51f04a1df6 100644 --- a/xen/arch/x86/include/asm/bootdomain.h +++ b/xen/arch/x86/include/asm/bootdomain.h @@ -8,10 +8,14 @@ #ifndef __XEN_X86_BOOTDOMAIN_H__ #define __XEN_X86_BOOTDOMAIN_H__ =20 +#include + struct boot_module; struct domain; =20 struct boot_domain { + char cmdline[MAX_GUEST_CMDLINE]; + domid_t domid; =20 struct boot_module *kernel; diff --git a/xen/arch/x86/include/asm/dom0_build.h b/xen/arch/x86/include/a= sm/dom0_build.h index 4a75fb25a801..982bc1fa9e6b 100644 --- a/xen/arch/x86/include/asm/dom0_build.h +++ b/xen/arch/x86/include/asm/dom0_build.h @@ -4,6 +4,7 @@ #include #include =20 +#include #include =20 extern unsigned int dom0_memflags; diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index 28257bf13127..2c84af52de3e 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -960,8 +960,8 @@ static int __init dom0_construct(struct boot_domain *bd) } =20 memset(si->cmd_line, 0, sizeof(si->cmd_line)); - if ( cmdline !=3D NULL ) - strlcpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line)); + if ( cmdline[0] !=3D '\0' ) + strlcpy((char *)si->cmd_line, bd->cmdline, sizeof(si->cmd_line)); =20 #ifdef CONFIG_VIDEO if ( !pv_shim && fill_console_start_info((void *)(si + 1)) ) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 7b78bd9c7c8d..9db8a650ecc2 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -980,8 +980,6 @@ static unsigned int __init copy_bios_e820(struct e820en= try *map, unsigned int li =20 static struct domain *__init create_dom0(struct boot_info *bi) { - static char __initdata cmdline[MAX_GUEST_CMDLINE]; - struct xen_domctl_createdomain dom0_cfg =3D { .flags =3D IS_ENABLED(CONFIG_TBOOT) ? XEN_DOMCTL_CDF_s3_integrity = : 0, .max_evtchn_port =3D -1, @@ -1024,16 +1022,16 @@ static struct domain *__init create_dom0(struct boo= t_info *bi) if ( bd->kernel->cmdline_pa || bi->kextra ) { if ( bd->kernel->cmdline_pa ) - safe_strcpy(cmdline, cmdline_cook(__va(bd->kernel->cmdline_pa), + safe_strcpy(bd->cmdline, cmdline_cook(__va(bd->kernel->cmdline= _pa), bi->loader)); =20 if ( bi->kextra ) /* kextra always includes exactly one leading space. */ - safe_strcat(cmdline, bi->kextra); + safe_strcat(bd->cmdline, bi->kextra); =20 /* Append any extra parameters. */ - if ( skip_ioapic_setup && !strstr(cmdline, "noapic") ) - safe_strcat(cmdline, " noapic"); + if ( skip_ioapic_setup && !strstr(bd->cmdline, "noapic") ) + safe_strcat(bd->cmdline, " noapic"); =20 if ( (strlen(acpi_param) =3D=3D 0) && acpi_disabled ) { @@ -1041,13 +1039,13 @@ static struct domain *__init create_dom0(struct boo= t_info *bi) safe_strcpy(acpi_param, "off"); } =20 - if ( (strlen(acpi_param) !=3D 0) && !strstr(cmdline, "acpi=3D") ) + if ( (strlen(acpi_param) !=3D 0) && !strstr(bd->cmdline, "acpi=3D"= ) ) { - safe_strcat(cmdline, " acpi=3D"); - safe_strcat(cmdline, acpi_param); + safe_strcat(bd->cmdline, " acpi=3D"); + safe_strcat(bd->cmdline, acpi_param); } =20 - bd->kernel->cmdline_pa =3D __pa(cmdline); + bd->kernel->cmdline_pa =3D __pa(bd->cmdline); } =20 bd->d =3D d; --=20 2.30.2