From patchwork Thu Jul 28 14:20:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 72954 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp880301qga; Thu, 28 Jul 2016 07:24:10 -0700 (PDT) X-Received: by 10.107.149.16 with SMTP id x16mr37245374iod.141.1469715850563; Thu, 28 Jul 2016 07:24:10 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id r76si33437662itr.92.2016.07.28.07.24.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jul 2016 07:24:10 -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 1bSmAy-0007Fg-O3; Thu, 28 Jul 2016 14:20:40 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSmAw-0007DM-Og for xen-devel@lists.xen.org; Thu, 28 Jul 2016 14:20:38 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 57/CD-17152-5B41A975; Thu, 28 Jul 2016 14:20:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRWlGSWpSXmKPExsVysyfVTXeryKx wg9d/xC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1owbc+awFywTrrh79Tx7A+N1/i5GLg4hgU2M Eque9rBAOKcZJZo6f7B2MXJysAloStz5/IkJxBYRkJa49vkyI0gRs0A7o8Ta/l5mkISwQKjE1 runwIpYBFQllk+ZDNbMK+As8bRjBiOILSEgJ3HyGEScU8BF4l7bdzBbCKjm9N3t7BMYuRcwMq xi1ChOLSpLLdI1NNVLKspMzyjJTczM0TU0MNbLTS0uTkxPzUlMKtZLzs/dxAj0MQMQ7GBcs93 zEKMkB5OSKG9Y6MxwIb6k/JTKjMTijPii0pzU4kOMMhwcShK8bsKzwoUEi1LTUyvSMnOAwQaT luDgURLhjQRJ8xYXJOYWZ6ZDpE4xKkqJ8+aCJARAEhmleXBtsAC/xCgrJczLCHSIEE9BalFuZ gmq/CtGcQ5GJWHejSBTeDLzSuCmvwJazAS0uDh2BsjikkSElFQDoyuXnd/zd9d32sxVu+a99+ oRwULNxA4ux5Bqt/iCkA8JfHNy3vqbJ03c4BOVZLNqwXpN1mO1ufp37nkyzfE6YXO/tbby9rp ohumzpVsVbGVmG91MO3j0MMsutYC49kM7Y0J2Jr+5KHjDd0F/VJWcztaUqqhFp8Jki/5yNarO ltHb0hEq8UFOiaU4I9FQi7moOBEAysa2cWsCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1469715635!26646407!2 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 44477 invoked from network); 28 Jul 2016 14:20:37 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-31.messagelabs.com with SMTP; 28 Jul 2016 14:20:37 -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 19164BB1; Thu, 28 Jul 2016 07:21:54 -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 DC2873F21A; Thu, 28 Jul 2016 07:20:35 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 28 Jul 2016 15:20:13 +0100 Message-Id: <1469715620-4670-9-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469715620-4670-1-git-send-email-julien.grall@arm.com> References: <1469715620-4670-1-git-send-email-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org, steve.capper@arm.com, wei.chen@linaro.org Subject: [Xen-devel] [PATCH v2 08/15] 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 overridden by p2m_alloc_table. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Rebase on the latest staging - Fix typo in the commit message - Add Stefano's reviewed-by --- 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 4e5259b..20bb2ba 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -569,9 +569,6 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, share_xen_page_with_guest( virt_to_page(d->shared_info), d, XENSHARE_writable); - 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 9ba8904..512fd7d 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1281,7 +1281,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; @@ -1397,10 +1397,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); @@ -1408,6 +1404,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);