From patchwork Tue Jan 21 08:43:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 11343193 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AAE8B6C1 for ; Tue, 21 Jan 2020 08:45:27 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 91ACB22522 for ; Tue, 21 Jan 2020 08:45:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91ACB22522 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1itp8d-0004Xg-RA; Tue, 21 Jan 2020 08:43:55 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1itp8c-0004Wt-5y for xen-devel@lists.xenproject.org; Tue, 21 Jan 2020 08:43:54 +0000 X-Inumbo-ID: 1f295b70-3c2a-11ea-ba47-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1f295b70-3c2a-11ea-ba47-12813bfff9fa; Tue, 21 Jan 2020 08:43:40 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3B514B2CA; Tue, 21 Jan 2020 08:43:35 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Tue, 21 Jan 2020 09:43:29 +0100 Message-Id: <20200121084330.18309-9-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200121084330.18309-1-jgross@suse.com> References: <20200121084330.18309-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v3 8/9] xen: add /buildinfo/config entry to hypervisor filesystem X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Jan Beulich MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Add the /buildinfo/config entry to the hypervisor filesystem. This entry contains the .config file used to build the hypervisor. Signed-off-by: Juergen Gross --- V3: - store data in gzip format - use binfile mechanism to create data file - move code to kernel.c --- .gitignore | 2 ++ docs/misc/hypfs-paths.pandoc | 4 ++++ xen/common/Makefile | 12 ++++++++++++ xen/common/kernel.c | 10 ++++++++++ xen/include/xen/kernel.h | 3 +++ 5 files changed, 31 insertions(+) diff --git a/.gitignore b/.gitignore index fd5610718d..bc8e053ccb 100644 --- a/.gitignore +++ b/.gitignore @@ -297,6 +297,8 @@ xen/arch/*/efi/boot.c xen/arch/*/efi/compat.c xen/arch/*/efi/efi.h xen/arch/*/efi/runtime.c +xen/common/config_data.S +xen/common/config.gz xen/include/headers*.chk xen/include/asm xen/include/asm-*/asm-offsets.h diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc index 1f63c5c13e..e8ae52ea45 100644 --- a/docs/misc/hypfs-paths.pandoc +++ b/docs/misc/hypfs-paths.pandoc @@ -123,6 +123,10 @@ Information about the compile domain. The compiler used to build Xen. +#### /buildinfo/config = STRING + +The contents of the `xen/.config` file at the time of the hypervisor build. + #### /buildinfo/version/ A directory containing version information of the hypervisor. diff --git a/xen/common/Makefile b/xen/common/Makefile index a3f66aa0c0..64017dd130 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -1,6 +1,7 @@ obj-$(CONFIG_ARGO) += argo.o obj-y += bitmap.o obj-y += bsearch.o +obj-y += config_data.o obj-$(CONFIG_CORE_PARKING) += core_parking.o obj-y += cpu.o obj-y += cpupool.o @@ -79,3 +80,14 @@ subdir-$(CONFIG_UBSAN) += ubsan subdir-$(CONFIG_NEEDS_LIBELF) += libelf subdir-$(CONFIG_HAS_DEVICE_TREE) += libfdt + +config.gz: ../.config + gzip -c $< >$@ + +config_data.o: config.gz + +config_data.S: $(XEN_ROOT)/xen/tools/binfile + $(XEN_ROOT)/xen/tools/binfile $@ config.gz xen_config_data + +clean:: + rm config_data.S config.gz 2>/dev/null || true diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 3186fd59c2..b5ee3011f5 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -388,6 +388,13 @@ static HYPFS_STRING_INIT(compile_by, "compile_by"); static HYPFS_STRING_INIT(compile_date, "compile_date"); static HYPFS_STRING_INIT(compile_domain, "compile_domain"); static HYPFS_STRING_INIT(extra, "extra"); +static struct hypfs_entry_leaf config = { + .e.type = XEN_HYPFS_TYPE_STRING, + .e.encoding = XEN_HYPFS_ENC_GZIP, + .e.name = "config", + .e.read = hypfs_read_leaf, + .content = &xen_config_data +}; static int __init buildinfo_init(void) { @@ -414,6 +421,9 @@ static int __init buildinfo_init(void) hypfs_add_leaf(&version, &major, true); hypfs_add_leaf(&version, &minor, true); + config.e.size = xen_config_data_size; + hypfs_add_leaf(&buildinfo, &config, true); + return 0; } __initcall(buildinfo_init); diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h index 548b64da9f..2f883031f9 100644 --- a/xen/include/xen/kernel.h +++ b/xen/include/xen/kernel.h @@ -100,5 +100,8 @@ extern enum system_state { bool_t is_active_kernel_text(unsigned long addr); +extern char xen_config_data; +extern unsigned int xen_config_data_size; + #endif /* _LINUX_KERNEL_H */