From patchwork Fri Sep 27 09:00:48 2019 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: 11164101 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 04B0014DB for ; Fri, 27 Sep 2019 09:02:28 +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 DEDAE2146E for ; Fri, 27 Sep 2019 09:02:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEDAE2146E 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 1iDm7X-0005Oc-TF; Fri, 27 Sep 2019 09:00:59 +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 1iDm7W-0005Nu-Vd for xen-devel@lists.xenproject.org; Fri, 27 Sep 2019 09:00:59 +0000 X-Inumbo-ID: 4e3d9b85-e105-11e9-9670-12813bfff9fa Received: from mx1.suse.de (unknown [195.135.220.15]) by localhost (Halon) with ESMTPS id 4e3d9b85-e105-11e9-9670-12813bfff9fa; Fri, 27 Sep 2019 09:00:52 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2CC5AAFF1; Fri, 27 Sep 2019 09:00:52 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Fri, 27 Sep 2019 11:00:48 +0200 Message-Id: <20190927090048.28872-7-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190927090048.28872-1-jgross@suse.com> References: <20190927090048.28872-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v1 6/6] xen: add runtime parameter reading support to hypfs 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 , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Add support to read values of hypervisor runtime parameters via the hypervisor file system for all unsigned integer type runtime parameters. Signed-off-by: Juergen Gross --- docs/misc/hypfs-paths.pandoc | 6 ++++++ xen/common/kernel.c | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc index 56ebdcd8be..d710b83185 100644 --- a/docs/misc/hypfs-paths.pandoc +++ b/docs/misc/hypfs-paths.pandoc @@ -62,3 +62,9 @@ hypervisor. #### /buildinfo/config = STRING The contents of the `xen/.config` file at the time of the hypervisor build. + +#### /params/ + +A directory of runtime parameters (those can be set via xl set-parameters). +The description of the different parameters can be found in +`docs/misc/xen-command-line.pandoc`. diff --git a/xen/common/kernel.c b/xen/common/kernel.c index 760917dab5..09787b5a34 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -320,6 +321,32 @@ int cmdline_strcmp(const char *frag, const char *name) } } +static struct hypfs_dir hypfs_params = { + .list = LIST_HEAD_INIT(hypfs_params.list), +}; + +static int __init runtime_param_hypfs_add(void) +{ + const struct kernel_param *param; + int ret; + + ret = hypfs_new_dir(&hypfs_root, "params", &hypfs_params); + BUG_ON(ret); + + for ( param = __param_start; param < __param_end; param++ ) + { + if ( param->type == OPT_UINT && param->len == sizeof(unsigned int) ) + { + ret = hypfs_new_entry_uint(&hypfs_params, param->name, + (unsigned int *)(param->par.var)); + BUG_ON(ret); + } + } + + return 0; +} +__initcall(runtime_param_hypfs_add); + unsigned int tainted; /**