From patchwork Mon Jul 4 11:45:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergej Proskurin X-Patchwork-Id: 9212421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2CFBD60572 for ; Mon, 4 Jul 2016 11:49:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EA93286DE for ; Mon, 4 Jul 2016 11:49:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13487286E2; Mon, 4 Jul 2016 11:49:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ABD31286DE for ; Mon, 4 Jul 2016 11:49:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bK2LL-0008Mx-Nf; Mon, 04 Jul 2016 11:47:15 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bK2Ke-00080o-7t for xen-devel@lists.xenproject.org; Mon, 04 Jul 2016 11:46:32 +0000 Received: from [193.109.254.147] by server-10.bemta-14.messagelabs.com id 7C/C2-10191-79C4A775; Mon, 04 Jul 2016 11:46:31 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsXSPJ+BQ3e6T1W 4wbFvTBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8b050cZC15IVfQcamVqYNwk0sXIxSEksJFR YuPp68wQznJGif+N34EcTg42AQOJKa9XsoLYIgJKEvdWTWYCsZkFKiSWPt4LZgsL+EjcP7ucH cRmEVCVuPLxFhuIzStgK/H4wRywuISAnMTkxZcYQWxOoHhDxyewXiEBG4nuu4/ZJjByL2BkWM WoXpxaVJZapGuol1SUmZ5RkpuYmaNraGiil5taXJyYnpqTmFSsl5yfu4kR6F8GINjBeLTT+RC jJAeTkihvuntVuBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3v3eQDnBotT01Iq0zBxgoMGkJTh4 lER414CkeYsLEnOLM9MhUqcYFaXEef1AEgIgiYzSPLg2WHBfYpSVEuZlBDpEiKcgtSg3swRV/ hWjOAejkjDvBJApPJl5JXDTXwEtZgJazBpbDrK4JBEhJdXAyBjya6rkx4OfxfMaJJ8dvsqv0L kxbtopz1/Sk7PyQw7/cFALc/6gJLBK3Ej+hmtRMtsUzWmaLXfO8Ty+Y3lrxSJ5h80vvaolfoZ YmPzg51O/sPEcE/tFyauS4QcXT1Y5f/nSvAOT+9dJHEm3/rHTfcG0h/w7bnGxsasULZuwyFP0 /FuR+oWdHEosxRmJhlrMRcWJAIAPQyJpAgAA X-Env-Sender: proskurin@sec.in.tum.de X-Msg-Ref: server-15.tower-27.messagelabs.com!1467632790!51755963!1 X-Originating-IP: [131.159.0.8] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57026 invoked from network); 4 Jul 2016 11:46:30 -0000 Received: from mail-out1.informatik.tu-muenchen.de (HELO mail-out1.informatik.tu-muenchen.de) (131.159.0.8) by server-15.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 4 Jul 2016 11:46:30 -0000 Received: from files.sec.in.tum.de (files.sec.in.tum.de [131.159.50.1]) by services.sec.in.tum.de (Postfix) with ESMTP id 7A8D9100D1FAF; Mon, 4 Jul 2016 13:46:30 +0200 (CEST) Received: from ker.sec.in.tum.de (ker.sec.in.tum.de [131.159.50.36]) by files.sec.in.tum.de (Postfix) with ESMTP id 6ECC62EEF; Mon, 4 Jul 2016 13:46:30 +0200 (CEST) From: Sergej Proskurin To: xen-devel@lists.xenproject.org Date: Mon, 4 Jul 2016 13:45:45 +0200 Message-Id: <20160704114605.10086-17-proskurin@sec.in.tum.de> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160704114605.10086-1-proskurin@sec.in.tum.de> References: <20160704114605.10086-1-proskurin@sec.in.tum.de> X-Mailman-Approved-At: Mon, 04 Jul 2016 11:47:11 +0000 Cc: Sergej Proskurin , Ian Jackson , Wei Liu Subject: [Xen-devel] [PATCH 16/18] arm/altp2m: Extended libxl to activate altp2m on ARM. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The current implementation allows to set the parameter HVM_PARAM_ALTP2M. This parameter allows further usage of altp2m on ARM. For this, we define an additional altp2m field for PV domains as part of the libxl_domain_type struct. This field can be set only on ARM systems through the "altp2m" switch in the domain's configuration file (i.e. set altp2m=1). Signed-off-by: Sergej Proskurin --- Cc: Ian Jackson Cc: Wei Liu --- tools/libxl/libxl_create.c | 1 + tools/libxl/libxl_dom.c | 14 ++++++++++++++ tools/libxl/libxl_types.idl | 1 + tools/libxl/xl_cmdimpl.c | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 1b99472..40b5f61 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -400,6 +400,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, b_info->cmdline = b_info->u.pv.cmdline; b_info->u.pv.cmdline = NULL; } + libxl_defbool_setdefault(&b_info->u.pv.altp2m, false); break; default: LOG(ERROR, "invalid domain type %s in create info", diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c index ec29060..ab023a2 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -277,6 +277,16 @@ err: } #endif +#if defined(__arm__) || defined(__aarch64__) +static void pv_set_conf_params(xc_interface *handle, uint32_t domid, + libxl_domain_build_info *const info) +{ + if ( libxl_defbool_val(info->u.pv.altp2m) ) + xc_hvm_param_set(handle, domid, HVM_PARAM_ALTP2M, + libxl_defbool_val(info->u.pv.altp2m)); +} +#endif + static void hvm_set_conf_params(xc_interface *handle, uint32_t domid, libxl_domain_build_info *const info) { @@ -433,6 +443,10 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid, return rc; #endif } +#if defined(__arm__) || defined(__aarch64__) + else /* info->type == LIBXL_DOMAIN_TYPE_PV */ + pv_set_conf_params(ctx->xch, domid, info); +#endif rc = libxl__arch_domain_create(gc, d_config, domid); diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index ef614be..0a164f9 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -554,6 +554,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("features", string, {'const': True}), # Use host's E820 for PCI passthrough. ("e820_host", libxl_defbool), + ("altp2m", libxl_defbool), ])), ("invalid", None), ], keyvar_init_val = "LIBXL_DOMAIN_TYPE_INVALID")), diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 6459eec..12c6e48 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1718,6 +1718,11 @@ static void parse_config_data(const char *config_source, exit(1); } +#if defined(__arm__) || defined(__aarch64__) + /* Enable altp2m for PV guests solely on ARM */ + xlu_cfg_get_defbool(config, "altp2m", &b_info->u.pv.altp2m, 0); +#endif + break; } default: