From patchwork Wed Jul 20 16:10:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 72440 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp66378qga; Wed, 20 Jul 2016 09:14:03 -0700 (PDT) X-Received: by 10.107.14.4 with SMTP id 4mr5506160ioo.160.1469031240482; Wed, 20 Jul 2016 09:14:00 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id v1si2542487iof.143.2016.07.20.09.14.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jul 2016 09:14:00 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPu66-0007mG-5q; Wed, 20 Jul 2016 16:11:46 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPu64-0007kN-Mo for xen-devel@lists.xen.org; Wed, 20 Jul 2016 16:11:44 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 04/98-12614-FB2AF875; Wed, 20 Jul 2016 16:11:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXf/ov5 wg5UvJC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oz581wL9gtWXHp8iqmBcQFfFyMXh5DAJkaJ TVsfMXYxcgI5pxklTrz2B7HZBDQl7nz+xARiiwhIS1z7fJkRpIFZoJ1RYvnGfywgCWGBIIkTa 7awgtgsAqoSs85cBRvEK+Aq0X/gJ1hcQkBO4uSxyWA2J1D8/MmfUMtcJDa9/cY8gZF7ASPDKk aN4tSistQiXSMTvaSizPSMktzEzBxdQwNTvdzU4uLE9NScxKRiveT83E2MQP/WMzAw7mC8Odn vEKMkB5OSKK+qaG+4EF9SfkplRmJxRnxRaU5q8SFGGQ4OJQnexQv7w4UEi1LTUyvSMnOAgQaT luDgURLh/QWS5i0uSMwtzkyHSJ1iVJQS590GkhAASWSU5sG1wYL7EqOslDAvIwMDgxBPQWpRb mYJqvwrRnEORiVh3laQKTyZeSVw018BLWYCWjxHAGxxSSJCSqqBkXeZbkRa+sPs3fXKS6+kvh Uxj/ZM1t3zhdnVLriGua1HIjeH6UX268pZbK8e1u9uObhE853+ixVNOU9nxnCxR8U0PcvslD9 1Ym/++g/OmZJ2IZ3bl5YrNCgkmVtZmOnZJoc6XXJXs0+JOjDf7NSq1ozDhkLr1p368Dx+hl/E iV9LnV628rAqsRRnJBpqMRcVJwIAtXrxHGkCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-8.tower-206.messagelabs.com!1469031102!50413615!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15923 invoked from network); 20 Jul 2016 16:11:43 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-8.tower-206.messagelabs.com with SMTP; 20 Jul 2016 16:11:43 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 42126BFB; Wed, 20 Jul 2016 09:12:53 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.218.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 951E23F387; Wed, 20 Jul 2016 09:11:41 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 20 Jul 2016 17:10:57 +0100 Message-Id: <1469031064-23344-16-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469031064-23344-1-git-send-email-julien.grall@arm.com> References: <1469031064-23344-1-git-send-email-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org, wei.chen@linaro.org, steve.capper@arm.com Subject: [Xen-devel] [PATCH 15/22] xen/arm: Don't call p2m_alloc_table from arch_domain_create 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" The p2m root table does not need to be allocate separately. Also remove unnecessary fields initialization as the structure is already memset to 0 and the fields will be override by p2m_alloc_table. Signed-off-by: Julien Grall --- xen/arch/arm/domain.c | 3 --- xen/arch/arm/p2m.c | 8 +++----- xen/include/asm-arm/p2m.h | 7 ------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 61fc08e..688adec 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -572,9 +572,6 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, if ( (rc = domain_io_init(d)) != 0 ) goto fail; - if ( (rc = p2m_alloc_table(d)) != 0 ) - goto fail; - switch ( config->gic_version ) { case XEN_DOMCTL_CONFIG_GIC_NATIVE: diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 6136767..c407e6a 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1282,7 +1282,7 @@ void guest_physmap_remove_page(struct domain *d, p2m_remove_mapping(d, gfn, (1 << page_order), mfn); } -int p2m_alloc_table(struct domain *d) +static int p2m_alloc_table(struct domain *d) { struct p2m_domain *p2m = &d->arch.p2m; struct page_info *page; @@ -1398,10 +1398,6 @@ int p2m_init(struct domain *d) if ( rc != 0 ) return rc; - d->arch.vttbr = 0; - - p2m->root = NULL; - p2m->max_mapped_gfn = _gfn(0); p2m->lowest_mapped_gfn = _gfn(ULONG_MAX); @@ -1409,6 +1405,8 @@ int p2m_init(struct domain *d) p2m->mem_access_enabled = false; radix_tree_init(&p2m->mem_access_settings); + rc = p2m_alloc_table(d); + return rc; } diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index abda70c..ce28e8a 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -149,13 +149,6 @@ void p2m_teardown(struct domain *d); */ int relinquish_p2m_mapping(struct domain *d); -/* - * Allocate a new p2m table for a domain. - * - * Returns 0 for success or -errno. - */ -int p2m_alloc_table(struct domain *d); - /* Context switch */ void p2m_save_state(struct vcpu *p); void p2m_restore_state(struct vcpu *n);