From patchwork Tue Sep 12 10:03:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112268 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674242edi; Tue, 12 Sep 2017 03:05:35 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBtr6bpdxTmP5RuF3F4lJ6GehjY6jK8m1Y9hnCiQrzmnWBQmgsxjO7rPF7D8dXfst8Mr3rg X-Received: by 10.107.151.81 with SMTP id z78mr20859707iod.157.1505210735088; Tue, 12 Sep 2017 03:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210735; cv=none; d=google.com; s=arc-20160816; b=vTDpuWl8vlea4QN/ow3kUvkGWy67U8PoDa4hJzlkTtoqeWY7W2CdJbbWnTJ2DjWOOE L6auR5TrU3Q8mT+6H1lyIzJEwTcbxCVxp9DeUS4ETo3Zg2bIWNQ27kpKGen+YoVbYOg4 YbDUBYKOkWui6BCEHEBt/Ea40tlV/nG8lALTbuKKDgxIcZ4EEnm9VVztRopf4avzjoKP 3RHA1bvxrIXGF5EPGmqIfBTdlRBXZWo7qjYTScX3C6rjkZyQ/BVCACVcdcapwpQZgVvd GS5YxrQHPrUD06vy3xfMVwmbVXPvLz8E1CvVGfhcfSbqRjLk6RjHAWSGzA8g6FqgoQxN sryg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=N/Ied7LZhrKpic+wACZm7SjqYcHhj+C84/TDKnjhqro=; b=R4S/bHqBiXRLt3NUSlhF/qCUd1IT+kmEk06a39EE6JlPhrCXcfMKz1nE9XE+ASWmNj 7ydsUSu201580RYEOjqsw62YNKFa+bytaVfCvnCA17buSF2DzJn/0BUdgF6WWIw4BKYM BY0BzsMcEh32107nXRRKW83UWA23bFrF6MLJdvb9JfU4arbmP58uNFJU8wKIoU3Hf5BQ vYxFYa6s1KMAZwX0Fefv8VtAIKefcQWnkD92+tf+9UqPCPxElQQdrDgNfq0jY35szdCM iCazsGIv5ce4yF9GPnTspXKGmFJ3sKPXpFUvlCwxpfSI31ovKwgfHmRINd4d+rv48lca F7yg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id w8si534243ite.79.2017.09.12.03.05.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:35 -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 1dri2g-0002nR-NI; Tue, 12 Sep 2017 10:03:42 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2f-0002n5-3s for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:41 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 29/C3-03423-CF0B7B95; Tue, 12 Sep 2017 10:03:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTff3hu2 RBn/Wmlos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmHr71mKbjJWfG0qYepgXElRxcjF4eQwGZG iYOPHzFBOKcZJaaeP8jSxcjJwSagKXHn8ycmEFtEQFri2ufLjCA2s8ByRonFu9O6GDk4hAX8J NZ/YQMxWQRUJW4uFgKp4BWwkFg0Yx4ziC0hIC+xq+0iK4jNKWApseLjLzYQWwio5vvLH4wTGL kXMDKsYtQoTi0qSy3SNTLQSyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQI9C4DEOx g/LUs4BCjJAeTkijvkfXbI4X4kvJTKjMSizPii0pzUosPMcpwcChJ8LIDg0VIsCg1PbUiLTMH GGYwaQkOHiURXiGQNG9xQWJucWY6ROoUoy5Hx827f5iEWPLy81KlxHkzQOYLgBRllObBjYCF/ CVGWSlhXkago4R4ClKLcjNLUOVfMYpzMCoJ894BmcKTmVcCt+kV0BFMQEfwXNoCckRJIkJKqo GRxzJueSpvr9D++V7hurG28iem6bTYNC22uZDMUPJZXut24v5EaQfLiY+EojYxnuNpz2kxZ4z Kqv+6qU8sNUfbfc15kefP/PRjgg+y11l85zfbyh9S2Pax6OH9E5euhlQ0rRG2epLca7+y5fkm h03sq3J9HTlvCltFBf/gz99lrZfx3mXxISWW4oxEQy3mouJEAL2PQwZ0AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-4.tower-27.messagelabs.com!1505210619!115519550!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36255 invoked from network); 12 Sep 2017 10:03:39 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-4.tower-27.messagelabs.com with SMTP; 12 Sep 2017 10:03:39 -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 2C63E15A2; Tue, 12 Sep 2017 03:03:39 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EB3F33F578; Tue, 12 Sep 2017 03:03:37 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:07 +0100 Message-Id: <20170912100330.2168-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH v2 01/24] xen/x86: mm: Introduce {G, M}FN <-> {G, M}ADDR helpers 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 new wrappers will add more safety when converting an address to a frame number (either machine or guest). They are already existing for Arm and could be useful in common code. Signed-off-by: Julien Grall Reviewed-by: Andrew Cooper Reviewed-by: Wei Liu --- Changes in v2: - Implement it in arch specific rather than in common code. Hence rename the patch. Cc: Andrew Cooper Cc: Jan Beulich --- xen/include/asm-x86/page.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h index cde5c6b89b..45ca742678 100644 --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -250,6 +250,10 @@ void copy_page_sse2(void *, const void *); /* Convert between frame number and address formats. */ #define __pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT) #define __paddr_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT)) +#define gfn_to_gaddr(gfn) __pfn_to_paddr(gfn_x(gfn)) +#define gaddr_to_gfn(ga) _gfn(__paddr_to_pfn(ga)) +#define mfn_to_maddr(mfn) __pfn_to_paddr(mfn_x(mfn)) +#define maddr_to_mfn(ma) _mfn(__paddr_to_pfn(ma)) /* * We define non-underscored wrappers for above conversion functions. These are From patchwork Tue Sep 12 10:03:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112281 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674633edi; Tue, 12 Sep 2017 03:05:54 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBzrDkAQXr8Lbj259LpRbQmc6a74fbtdVbUqyOEaUuBHoPyWevJhkIl6uOtxJqw0QJ1ByNf X-Received: by 10.107.40.19 with SMTP id o19mr17300040ioo.120.1505210754138; Tue, 12 Sep 2017 03:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210754; cv=none; d=google.com; s=arc-20160816; b=VM55SDZLRFBWBEv9JgeUu2VAuvKjD7phckgLpElBf1jyTFdp9ceiq70lKBL2UbrKNi 1lKlP9Ei2BF8nwf7LuKG/b5nB1ZdqYTTk8tcAyTqkRp56/TG/vPuwCM95AOJuOFqcdw7 mdBK78UEw/M8iim/Qng1k8fUAnYhOZl50uJYpe3vZxeeDjEZa0JmISDUvKzgWzMcv5Mo bmyzLRcfL/C7bjdstCY2/oHKZg+EqW7+ZudVz2ZQaf6/PsE3eHx2harqQIxvjDxIEYKV Cy1Oj/ZV+WtxC+HIpTRMXzpUvK4GlK3UsilkTtS5E2gDl/+GG/RDbQwxPYgtSXLxCojz Bvhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=ncJSXbWyuElzPnTlhZVBMtP7n6ZrDwvvOA0H9SGH+Sc=; b=hShq0tpBYYbb9QxRts0zEes40XOM4ENsMIa4tX7fOLOU8WGeFP81BE9AuKTYxE0NTA gMNBX+uj46PeErypNCFuvjK2KKYy4kZGF9O5R16G1AEpVGcrf77UoBxf5Ltkw5GhRfOp pygnfGaKmTGGvj4CyfV8OCo2tIIP37sg2wOpiFyGq3Z0/DwPkQvZy6BgbfB7K6ozsKwz AkPJBUsUkSFiTm591z8fl2haa9IArRZMKtoFjc9wxA9Yp0ysebJERyB0XUuYJSEBcowo hJbavAT2sKNVqM1nHVPGvWmzrfQeqQRrIdp2GaQ0/3roQpeD4RyhgazIrkf6Rs6/WyRR atHQ== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 74si1475774itv.67.2017.09.12.03.05.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:53 -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 1dri2i-0002oQ-Uh; Tue, 12 Sep 2017 10:03:44 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2h-0002nm-SW for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:43 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id 17/68-03422-FF0B7B95; Tue, 12 Sep 2017 10:03:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsVysyfVTfffhu2 RBjsPyFks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnfvy1kKZjqVnHufBdzA+Naiy5GLg4hgc2M Eqf+HGKEcE4zStxdd4Cpi5GTg01AU+LO509gtoiAtMS1z5fBipgFXjNJfN66jRkkISzgJzFh9 28WEJtFQFXi5cFpYDavgIXEtmcvwWwJAXmJXW0XWUFsTgFLiRUff7GB2EJANd9f/mCcwMi9gJ FhFaN6cWpRWWqRrqVeUlFmekZJbmJmjq6hgZlebmpxcWJ6ak5iUrFecn7uJkaghxmAYAfj3U0 BhxglOZiURHmPrN8eKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCdxpITrAoNT21Ii0zBxhqMGkJ Dh4lEd7ZIGne4oLE3OLMdIjUKUZjjmObLv9h4ui4efcPkxBLXn5eqpQ47xuQUgGQ0ozSPLhBs Bi4xCgrJczLCHSaEE9BalFuZgmq/CtGcQ5GJWHe+SBTeDLzSuD2vQI6hQnoFJ5LW0BOKUlESE k1MIpvLfhge1ZtkfM9OdXnmbM6jNg+/rx94Mza06LRL2yMjooezOuVyPTuOtp0yqRHxsyFbf0 mqTm1rqKW6Yz83D8Wnp4x2cq4OXf73HYFA9WUYKcFla+c+A6d7lv3tHNbcMSTK6y6bm4eyuKz +bVyGVRTD4sKnllc8ZjXUJv78oem0G3H/7+bo8RSnJFoqMVcVJwIAKy0SB98AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1505210621!93115805!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20827 invoked from network); 12 Sep 2017 10:03:42 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-10.tower-27.messagelabs.com with SMTP; 12 Sep 2017 10:03:42 -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 89CDF1529; Tue, 12 Sep 2017 03:03:41 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 699093F578; Tue, 12 Sep 2017 03:03:39 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:08 +0100 Message-Id: <20170912100330.2168-3-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: sstabellini@kernel.org, Wei Liu , George Dunlap , andre.przywara@arm.com, Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH v2 02/24] xen/mm: Use typesafe MFN for alloc_boot_pages return 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" At the moment, most of the callers will have to use mfn_x. However follow-up patches will remove some of them by propagating the typesafe a bit further. Signed-off-by: Julien Grall Acked-by: Jan Beulich Reviewed-by: Wei Liu Acked-by: George Dunlap Reviewed-by: Stefano Stabellini --- Changes in v2: - Push down a bit some mfn_t to convert some unsigned long local variables to mfn_t. Cc: Stefano Stabellini Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Tim Deegan Cc: Wei Liu --- xen/arch/arm/mm.c | 26 ++++++++++++++------------ xen/arch/arm/setup.c | 4 ++-- xen/arch/x86/mm.c | 7 ++++--- xen/arch/x86/numa.c | 2 +- xen/arch/x86/srat.c | 5 +++-- xen/common/page_alloc.c | 7 +++---- xen/drivers/acpi/osl.c | 2 +- xen/include/xen/mm.h | 3 +-- 8 files changed, 29 insertions(+), 27 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index b39677eac9..965d0573a4 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -864,13 +864,13 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, } else { - unsigned long first_mfn = alloc_boot_pages(1, 1); + mfn_t first_mfn = alloc_boot_pages(1, 1); - clear_page(mfn_to_virt(first_mfn)); - pte = mfn_to_xen_entry(_mfn(first_mfn), WRITEALLOC); + clear_page(mfn_to_virt(mfn_x(first_mfn))); + pte = mfn_to_xen_entry(first_mfn, WRITEALLOC); pte.pt.table = 1; write_pte(p, pte); - first = mfn_to_virt(first_mfn); + first = mfn_to_virt(mfn_x(first_mfn)); } pte = mfn_to_xen_entry(_mfn(mfn), WRITEALLOC); @@ -891,11 +891,12 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) unsigned long nr_pages = (pe - ps) >> PAGE_SHIFT; unsigned long nr_pdxs = pfn_to_pdx(nr_pages); unsigned long frametable_size = nr_pdxs * sizeof(struct page_info); - unsigned long base_mfn; + mfn_t base_mfn; const unsigned long mapping_size = frametable_size < MB(32) ? MB(2) : MB(32); #ifdef CONFIG_ARM_64 lpae_t *second, pte; - unsigned long nr_second, second_base; + unsigned long nr_second; + mfn_t second_base; int i; #endif @@ -908,18 +909,19 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) /* Compute the number of second level pages. */ nr_second = ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT; second_base = alloc_boot_pages(nr_second, 1); - second = mfn_to_virt(second_base); + second = mfn_to_virt(mfn_x(second_base)); for ( i = 0; i < nr_second; i++ ) { - clear_page(mfn_to_virt(second_base + i)); - pte = mfn_to_xen_entry(_mfn(second_base + i), WRITEALLOC); + clear_page(mfn_to_virt(mfn_x(mfn_add(second_base, i)))); + pte = mfn_to_xen_entry(mfn_add(second_base, i), WRITEALLOC); pte.pt.table = 1; write_pte(&xen_first[first_table_offset(FRAMETABLE_VIRT_START)+i], pte); } - create_mappings(second, 0, base_mfn, frametable_size >> PAGE_SHIFT, mapping_size); + create_mappings(second, 0, mfn_x(base_mfn), frametable_size >> PAGE_SHIFT, + mapping_size); #else - create_mappings(xen_second, FRAMETABLE_VIRT_START, - base_mfn, frametable_size >> PAGE_SHIFT, mapping_size); + create_mappings(xen_second, FRAMETABLE_VIRT_START, mfn_x(base_mfn), + frametable_size >> PAGE_SHIFT, mapping_size); #endif memset(&frame_table[0], 0, nr_pdxs * sizeof(struct page_info)); diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 92f173be0c..b00eebd96e 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -561,7 +561,7 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) init_boot_pages(pfn_to_paddr(boot_mfn_start), pfn_to_paddr(boot_mfn_end)); /* Copy the DTB. */ - fdt = mfn_to_virt(alloc_boot_pages(dtb_pages, 1)); + fdt = mfn_to_virt(mfn_x(alloc_boot_pages(dtb_pages, 1))); copy_from_paddr(fdt, dtb_paddr, dtb_size); device_tree_flattened = fdt; @@ -671,7 +671,7 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) dtb_pages = (dtb_size + PAGE_SIZE-1) >> PAGE_SHIFT; /* Copy the DTB. */ - fdt = mfn_to_virt(alloc_boot_pages(dtb_pages, 1)); + fdt = mfn_to_virt(mfn_x(alloc_boot_pages(dtb_pages, 1))); copy_from_paddr(fdt, dtb_paddr, dtb_size); device_tree_flattened = fdt; diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index e5a029c9be..850e4721cd 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -200,7 +200,8 @@ static void __init init_frametable_chunk(void *start, void *end) { unsigned long s = (unsigned long)start; unsigned long e = (unsigned long)end; - unsigned long step, mfn; + unsigned long step; + mfn_t mfn; ASSERT(!(s & ((1 << L2_PAGETABLE_SHIFT) - 1))); for ( ; s < e; s += step << PAGE_SHIFT ) @@ -216,7 +217,7 @@ static void __init init_frametable_chunk(void *start, void *end) while ( step && s + (step << PAGE_SHIFT) > e + (4 << PAGE_SHIFT) ) step >>= PAGETABLE_ORDER; mfn = alloc_boot_pages(step, step); - map_pages_to_xen(s, mfn, step, PAGE_HYPERVISOR); + map_pages_to_xen(s, mfn_x(mfn), step, PAGE_HYPERVISOR); } memset(start, 0, end - start); @@ -5328,7 +5329,7 @@ void *alloc_xen_pagetable(void) return ptr; } - return mfn_to_virt(alloc_boot_pages(1, 1)); + return mfn_to_virt(mfn_x(alloc_boot_pages(1, 1))); } void free_xen_pagetable(void *v) diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index 32914bce27..4fc967f893 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -99,7 +99,7 @@ static int __init populate_memnodemap(const struct node *nodes, static int __init allocate_cachealigned_memnodemap(void) { unsigned long size = PFN_UP(memnodemapsize * sizeof(*memnodemap)); - unsigned long mfn = alloc_boot_pages(size, 1); + unsigned long mfn = mfn_x(alloc_boot_pages(size, 1)); memnodemap = mfn_to_virt(mfn); mfn <<= PAGE_SHIFT; diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index 95660a9bbc..528ec7181a 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -187,14 +187,15 @@ static __init int slit_valid(struct acpi_table_slit *slit) /* Callback for SLIT parsing */ void __init acpi_numa_slit_init(struct acpi_table_slit *slit) { - unsigned long mfn; + mfn_t mfn; + if (!slit_valid(slit)) { printk(KERN_INFO "ACPI: SLIT table looks invalid. " "Not used.\n"); return; } mfn = alloc_boot_pages(PFN_UP(slit->header.length), 1); - acpi_slit = mfn_to_virt(mfn); + acpi_slit = mfn_to_virt(mfn_x(mfn)); memcpy(acpi_slit, slit, slit->header.length); } diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index b5243fca3c..86bd298b44 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -325,8 +325,7 @@ void __init init_boot_pages(paddr_t ps, paddr_t pe) } } -unsigned long __init alloc_boot_pages( - unsigned long nr_pfns, unsigned long pfn_align) +mfn_t __init alloc_boot_pages(unsigned long nr_pfns, unsigned long pfn_align) { unsigned long pg, _e; unsigned int i = nr_bootmem_regions; @@ -355,14 +354,14 @@ unsigned long __init alloc_boot_pages( if ( pg + nr_pfns > PFN_DOWN(highmem_start) ) continue; r->s = pg + nr_pfns; - return pg; + return _mfn(pg); } #endif _e = r->e; r->e = pg; bootmem_region_add(pg + nr_pfns, _e); - return pg; + return _mfn(pg); } BUG(); diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c index 9881db19da..52c9b4ba9a 100644 --- a/xen/drivers/acpi/osl.c +++ b/xen/drivers/acpi/osl.c @@ -214,7 +214,7 @@ void *__init acpi_os_alloc_memory(size_t sz) void *ptr; if (system_state == SYS_STATE_early_boot) - return mfn_to_virt(alloc_boot_pages(PFN_UP(sz), 1)); + return mfn_to_virt(mfn_x(alloc_boot_pages(PFN_UP(sz), 1))); ptr = xmalloc_bytes(sz); ASSERT(!ptr || is_xmalloc_memory(ptr)); diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index c2f5a089ec..f8b6177c32 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -151,8 +151,7 @@ struct domain *__must_check page_get_owner_and_reference(struct page_info *); /* Boot-time allocator. Turns into generic allocator after bootstrap. */ void init_boot_pages(paddr_t ps, paddr_t pe); -unsigned long alloc_boot_pages( - unsigned long nr_pfns, unsigned long pfn_align); +mfn_t alloc_boot_pages(unsigned long nr_pfns, unsigned long pfn_align); void end_boot_allocator(void); /* Xen suballocator. These functions are interrupt-safe. */ From patchwork Tue Sep 12 10:03:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112283 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674653edi; Tue, 12 Sep 2017 03:05:55 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCkZI/BSKZf4sUpAyn+x8Wbl79KPCKkmcZ5qfCH4nf22GM2hI4iEEX6xofQu69KkDuGdvkw X-Received: by 10.36.20.86 with SMTP id 83mr284041itg.44.1505210755462; Tue, 12 Sep 2017 03:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210755; cv=none; d=google.com; s=arc-20160816; b=lcMmZoFPSmwUw7Kd7ySSDnDpW7Q+lhVL6iCxwZtBfifFVW97O/Uu24mfwDoVbnmTjq NegssQpjYg1ABCrPjqHb0NMjBlEd5hoBOn5HD8g/oqBBHnD7X+lI5gfugyMPCaTrLfE4 jzq+oMgEDBySVulJAFUooeSIcf49arrmNkgOSnnWxeny76VD8p/EBnpbsp+9QEe1VaBR 2JqN1S/WZE1q2mTt1N5OBxSQcvN6RS237fTn3NFXyfw+uwpw/atux4dkTcPyyjdOV7+C BNiNuM+8z9M3vmMj+3EtRm+EsbZo8zyRWIC2kadx4LY58QlL0OKJdsc5IVutPXQE2i2t Kpjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=B6jcBPgV6NlVehCTUSFK+/rKQvC+vSKS7jK0s8oMiqI=; b=o9mehT8zCikeUUMzd5rjSKonr833hwRfxrCmlsZ9cblxKBcYzJPcttW8uSIW6dM+Xl eOusBE0gDg2qmbaYt893X4tjjoV9xdDjXN09X7yWT10sn8Coq5ZAGPZukAFwZERWtmsx bJvAhqJdrrp7DsoxctD5Unf7NvGCyFmOjrEdzHEmUgpxzYloHVbYJceDtdzvuq9eUHsU Ae2k0jdXnyFrM17dMXjcoCTlr2GpzWCvqL2o/To7T3TysJU+XDfGwqth2FTqJIEVoGSr zkR2E60qZ4COHF6nGtv7klYvQiPN2d8B32EKG3wFG9k0fP/h3NeeVdBfCVMfKQsucsU4 tmng== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 8si935236ita.114.2017.09.12.03.05.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:55 -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 1dri2l-0002qK-A4; Tue, 12 Sep 2017 10:03:47 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2j-0002pC-M5 for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:45 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id CE/36-03283-101B7B95; Tue, 12 Sep 2017 10:03:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTZdh4/Z IgwuLpS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyFa8ILnghXNJ9+z9LA+EWgi5GLQ0hgM6NE 2/QtjBDOaUaJt8+6WLoYOTnYBDQl7nz+xARiiwhIS1z7fBmsiFngNZPE563bmLsYOTiEBWIl7 l51A6lhEVCV6Nywhh3E5hWwkGie1MUKYksIyEvsarsIZnMKWEqs+PiLDcQWAqr5/vIH4wRG7g WMDKsY1YtTi8pSi3RN9JKKMtMzSnITM3N0DQ3M9HJTi4sT01NzEpOK9ZLzczcxAr3LAAQ7GLs v+x9ilORgUhLl/S28PVKILyk/pTIjsTgjvqg0J7X4EKMMB4eSBO+09UA5waLU9NSKtMwcYJjB pCU4eJREeONA0rzFBYm5xZnpEKlTjLocHTfv/mESYsnLz0uVEufNACkSACnKKM2DGwEL+UuMs lLCvIxARwnxFKQW5WaWoMq/YhTnYFQS5p0PMoUnM68EbtMroCOYgI7gubQF5IiSRISUVANjpu GWzd09PKt5F63ku1bg/FZu8Rx9AfXi3RWizgd5DJY1zd/EfS69qVxyj8jT1lnC399WpCxLrGV alzt557kdsbpPTXXVlTdxmFx0XRSZ1Fbt9STc8xr3l8+Wp7eo/XiXUaM7ncNZ+OHZ3nlsR+xD 2AreyPBwGf9iX3+/LfrEoksRtmpTo78osRRnJBpqMRcVJwIAw/vHMHQCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1505210623!106791695!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10430 invoked from network); 12 Sep 2017 10:03:44 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-13.tower-27.messagelabs.com with SMTP; 12 Sep 2017 10:03:44 -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 B9A7C15A2; Tue, 12 Sep 2017 03:03:43 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C6CCC3F578; Tue, 12 Sep 2017 03:03:41 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:09 +0100 Message-Id: <20170912100330.2168-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: sstabellini@kernel.org, Wei Liu , George Dunlap , andre.przywara@arm.com, Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH v2 03/24] xen/mm: Use __virt_to_mfn in map_domain_page instead of virt_to_mfn 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" virt_to_mfn may by overridden by the source files, for improving locally typesafe. Therefore map_domain_page has to use __virt_to_mfn to prevent any compilation issue in sources files that override the helper. Signed-off-by: Julien Grall Acked-by: Jan Beulich Reviewed-by: Wei Liu Acked-by: Stefano Stabellini --- Changes in v2: - Add Jan's acked-by Cc: Stefano Stabellini Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Konrad Rzeszutek Wilk Cc: Tim Deegan Cc: Wei Liu --- xen/include/asm-arm/mm.h | 3 ++- xen/include/xen/domain_page.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 7de2f32f58..cd6dfb54b9 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -281,7 +281,7 @@ static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags) /* Convert between Xen-heap virtual addresses and machine frame numbers. */ #define __virt_to_mfn(va) (virt_to_maddr(va) >> PAGE_SHIFT) -#define mfn_to_virt(mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT)) +#define __mfn_to_virt(mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT)) /* * We define non-underscored wrappers for above conversion functions. @@ -291,6 +291,7 @@ static inline int gvirt_to_maddr(vaddr_t va, paddr_t *pa, unsigned int flags) #define mfn_to_page(mfn) __mfn_to_page(mfn) #define page_to_mfn(pg) __page_to_mfn(pg) #define virt_to_mfn(va) __virt_to_mfn(va) +#define mfn_to_virt(mfn) __mfn_to_virt(mfn) /* Convert between Xen-heap virtual addresses and page-info structures. */ static inline struct page_info *virt_to_page(const void *v) diff --git a/xen/include/xen/domain_page.h b/xen/include/xen/domain_page.h index 93f2a5aaf7..890bae5b9c 100644 --- a/xen/include/xen/domain_page.h +++ b/xen/include/xen/domain_page.h @@ -53,7 +53,7 @@ static inline void *__map_domain_page_global(const struct page_info *pg) #else /* !CONFIG_DOMAIN_PAGE */ -#define map_domain_page(mfn) mfn_to_virt(mfn_x(mfn)) +#define map_domain_page(mfn) __mfn_to_virt(mfn_x(mfn)) #define __map_domain_page(pg) page_to_virt(pg) #define unmap_domain_page(va) ((void)(va)) #define domain_page_map_to_mfn(va) virt_to_mfn((unsigned long)(va)) From patchwork Tue Sep 12 10:03:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112274 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674427edi; Tue, 12 Sep 2017 03:05:43 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDhKVjVy36VYlBdqj921IoLCpOpTZYRiZg9iqOcocZSqVq7kC4Tl7V0dxK8ZLDkX9pAax9v X-Received: by 10.36.29.137 with SMTP id 131mr258442itj.91.1505210743896; Tue, 12 Sep 2017 03:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210743; cv=none; d=google.com; s=arc-20160816; b=G4X2SavdskdXMQ5AtP8UU4Cc5060R3N6nNLvMP9SbzOPjicOGU4Cj3y18Vju7WX6IR VN2CCfl1/kLoe2Mxq19/XBs/1ZCyPQt7F8v96rsm9RsOBkIR/Fj4IT5vNFwdthDwuhBB Gb0ktOEZCrdPLzZHhnwp0gsd0jgVbkErqXD/1lFB6aI/7Lrt3IFxXP9I6KbU8WUz9w9X t27H2oVmDq/YQitdgZKAES5O+wi++J46Ws97Tz3QC8DC7VOP3jI86oXjWRt5zmcK0E4c 970PVo0KiDMsOElLaSh/eiofpsh9E5tP+tQj7QJevOOI88gqOtJCPWjqkL3PsnpYvGwv Tj/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=/hfzjxyGu1E7IIxZQ6/RNSgK6lznxw9ga2HHCpAJHCA=; b=XfYImS646DO22ElXHv2HIz8vJ/RJLIlDR4VqcK07U2LrTAXUA2m5MTwp0K6dWpZ8bQ PCcqg8JyjTs2S9CNWKORNmmZFh6YlwUxrWnoWEIApG+AtuRmK2wAAuk6pE31NbhigCZ/ ysKg+2e0ISuZEFHse4panSWH+HfY2xsFdjAOnudtKBBEGa0aFtd2gyIBbDd2f8VJh+6l JgHIzbNmstNtThEAb3qKBs8myZfreJnrxzSgEHB7Mtw7EI0ybZH0k6hAW9FoMiLLmyF6 emkwyR7GI9X7c6H9z0LdzPMkE2hjUrS7d7vWDeVmA98uibq97mq0M448h4O6KwCtlm+Y aDlg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id p186si11334712ita.207.2017.09.12.03.05.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:43 -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 1dri2p-0002uq-Vy; Tue, 12 Sep 2017 10:03:51 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2p-0002tF-0y for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:51 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id B7/A8-02817-601B7B95; Tue, 12 Sep 2017 10:03:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTZdx4/Z IgxufdS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozOCx9ZC6ZLVFxYfoi1gfG8UBcjF4eQwGZG iVlTfrNCOKcZJfZ23mHrYuTkYBPQlLjz+RMTiC0iIC1x7fNlRhCbWSBS4vCHH+wgtrCAt8St2 YtYQWwWAVWJz/PegtXwClhIbNzwBKxGQkBeYlfbRbAaTgFLiRUff4HNFwKq+f7yB+MERu4FjA yrGNWLU4vKUot0zfWSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKTivWS83M3MQL9ywAEOxiPTXY +xCjJwaQkyntk/fZIIb6k/JTKjMTijPii0pzU4kOMMhwcShK850FygkWp6akVaZk5wECDSUtw 8CiJ8F4DSfMWFyTmFmemQ6ROMepydNy8+4dJiCUvPy9VSpw3A6RIAKQoozQPbgQs6C8xykoJ8 zICHSXEU5BalJtZgir/ilGcg1FJmFduA9AUnsy8ErhNr4COYAI6gufSFpAjShIRUlINjN3llc wm51jf3pbbni23YVfItPMO/fWSTevDzryc4GHxR3VP7rvJQf9zLIKm3HuTbsLkb76ovfRLYNR jiSjVnRqRCx+e2zb74MqSPdlBdzX33Sk4ql+lpK3z1704/KvcthjWUydPlkTWCXhdDPm0UqKm 6IL7xbZS1oS9DPNblnfOWLbyX8o5EyWW4oxEQy3mouJEAE1vcid1AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1505210625!97099909!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 33284 invoked from network); 12 Sep 2017 10:03:45 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-15.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:03:45 -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 E35611529; Tue, 12 Sep 2017 03:03:44 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 010B73F578; Tue, 12 Sep 2017 03:03:43 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:10 +0100 Message-Id: <20170912100330.2168-5-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 04/24] xen/arm: mm: Redefine mfn_to_virt to use typesafe 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" This add a bit more safety in the memory subsystem code. Signed-off-by: Julien Grall --- xen/arch/arm/mm.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 965d0573a4..5716ef1123 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -47,6 +47,8 @@ struct domain *dom_xen, *dom_io, *dom_cow; /* Override macros from asm/page.h to make them work with mfn_t */ #undef virt_to_mfn #define virt_to_mfn(va) _mfn(__virt_to_mfn(va)) +#undef mfn_to_virt +#define mfn_to_virt(mfn) __mfn_to_virt(mfn_x(mfn)) /* Static start-of-day pagetables that we use before the allocators * are up. These are used by all CPUs during bringup before switching @@ -837,7 +839,7 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, * Virtual address aligned to previous 1GB to match physical * address alignment done above. */ - vaddr = (vaddr_t)mfn_to_virt(base_mfn) & FIRST_MASK; + vaddr = (vaddr_t)__mfn_to_virt(base_mfn) & FIRST_MASK; while ( mfn < end_mfn ) { @@ -849,7 +851,7 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, /* mfn_to_virt is not valid on the 1st 1st mfn, since it * is not within the xenheap. */ first = slot == xenheap_first_first_slot ? - xenheap_first_first : mfn_to_virt(p->pt.base); + xenheap_first_first : __mfn_to_virt(p->pt.base); } else if ( xenheap_first_first_slot == -1) { @@ -866,11 +868,11 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, { mfn_t first_mfn = alloc_boot_pages(1, 1); - clear_page(mfn_to_virt(mfn_x(first_mfn))); + clear_page(mfn_to_virt(first_mfn)); pte = mfn_to_xen_entry(first_mfn, WRITEALLOC); pte.pt.table = 1; write_pte(p, pte); - first = mfn_to_virt(mfn_x(first_mfn)); + first = mfn_to_virt(first_mfn); } pte = mfn_to_xen_entry(_mfn(mfn), WRITEALLOC); @@ -909,10 +911,10 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) /* Compute the number of second level pages. */ nr_second = ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT; second_base = alloc_boot_pages(nr_second, 1); - second = mfn_to_virt(mfn_x(second_base)); + second = mfn_to_virt(second_base); for ( i = 0; i < nr_second; i++ ) { - clear_page(mfn_to_virt(mfn_x(mfn_add(second_base, i)))); + clear_page(mfn_to_virt(mfn_add(second_base, i))); pte = mfn_to_xen_entry(mfn_add(second_base, i), WRITEALLOC); pte.pt.table = 1; write_pte(&xen_first[first_table_offset(FRAMETABLE_VIRT_START)+i], pte); @@ -1005,7 +1007,7 @@ static int create_xen_entries(enum xenmap_operation op, BUG_ON(!lpae_valid(*entry)); - third = mfn_to_virt(entry->pt.base); + third = __mfn_to_virt(entry->pt.base); entry = &third[third_table_offset(addr)]; switch ( op ) { From patchwork Tue Sep 12 10:03:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112267 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674189edi; Tue, 12 Sep 2017 03:05:33 -0700 (PDT) X-Google-Smtp-Source: AOwi7QD4TjLDdKBMwyFno5UoHi8SBQXirFruy/qp7OeFyU4YedXljVQIeNZ7mDuchXq36lmeXdC2 X-Received: by 10.107.131.77 with SMTP id f74mr16999551iod.215.1505210733182; Tue, 12 Sep 2017 03:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210733; cv=none; d=google.com; s=arc-20160816; b=VjUeh2/UhpzHG+S2OhmchniSMqnuZ9wpw1RLjx2eW2Tws5fE/Jea0SsuzEN/qEwIR0 h9OixVyEQSGVxXwWJ+6KHDwfiVy9N5mpX552YJDovFys6nCM9oLNPR68oNAkAdOFoBpt 26mLb0hAyrO4RTNHDA4pkvUYHqM0FGNW24uLJlLvcYd/85/kXLi4zRWmxfimUXOzoh4/ 3Hh2aMU+ciOcNHP1zkvvxN1OzJeJP3KHTT3+zGf1xqbTl4w6IKidVBJLeZyb0rEv4lpP pgOHlfsQhQ7s8TPcH5Vu5ERw8jjwjzscqxlR9ax1QuC0vdUyruSfgLzJGQQyPf45mNuD Fj6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=5shk4Rz4aQKahkHUmQiDsQAl9Y4zUVPLP/2kcOyrZAE=; b=1ABh32+qBqtzHikJd3zhSZ5vzYFGi9K+4l9aR9XHMMI36V9wguhuNENmlEszyE10XK +ZzoF+whvMdoAAvkasLsisYYp4fDYrzg/419gAyyJ9dctIpelTkoJGZjOdRM694oJ0f5 FAVV21GEQR2Sp+5uqHbQmJljhcTw5ENPPJNBY8S9/mdh6xeTP6g13IeEBEGaNyQoSXTp heG7/NFfwF49YfWH+Ki4HZiWsO34XR2KoQNeU90OL2BZ/ItDFT5vFaNodf/qEMn65eIp eUDwAtM4VsV5kN+c0dQ/qq0plg7cupRH53tFQmoeAua0xuRdymZKQPRrUVoOQA4/YoIn pI7g== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f16si10773269itb.143.2017.09.12.03.05.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:33 -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 1dri2n-0002s3-Gz; Tue, 12 Sep 2017 10:03:49 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2m-0002qq-5k for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:48 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id 14/D1-02224-301B7B95; Tue, 12 Sep 2017 10:03:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRWlGSWpSXmKPExsVysyfVTZdp4/Z IgxXzzSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oxfS2awFszmqLi3ZzF7A+NKti5GLg4hgc2M EhO+nGCBcE4zShxZNpO1i5GTg01AU+LO509MILaIgLTEtc+XGUFsZoFIicMffrCD2MICDhIn+ 34BTeLgYBFQlZixLwMkzCtgIdG/fwEziC0hIC+xq+0i2EhOAUuJFR9ByjmBdllIfH/5g3ECI/ cCRoZVjBrFqUVlqUW6RgZ6SUWZ6RkluYmZObqGBsZ6uanFxYnpqTmJScV6yfm5mxiB/q1nYGD cwdh8wu8QoyQHk5Io75H12yOF+JLyUyozEosz4otKc1KLDzFqcHAIbF67+gKjFEtefl6qkgTv NJA6waLU9NSKtMwcYADClEpw8CiJ8F4DSfMWFyTmFmemQ6ROMepydNy8+4dJCGyGlDjvG5AiA ZCijNI8uBGwaLjEKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZj3DsgUnsy8ErhNr4COYAI6gu fSFpAjShIRUlINjN1nmU9Gfjsdf+QU05xYAfM/tyvtO5w+vpTjsJXboJQvlVO0dCuv8heFI0d Z33xICix9fOfqogk7buqqzUjzbd+k+GbS8cPJ1taiGs4G/Elrz7y6W1a6t++/v13D2kdPf/o/ Lfwpef/zh66Q79a1FxfwiOSfOtCmnvD629IiprfrIj6ueb1FT1qJpTgj0VCLuag4EQC8biKgg QIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1505210626!111127207!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18479 invoked from network); 12 Sep 2017 10:03:46 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-31.messagelabs.com with SMTP; 12 Sep 2017 10:03:46 -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 18F8715BF; Tue, 12 Sep 2017 03:03:46 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2ACCB3F578; Tue, 12 Sep 2017 03:03:45 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:11 +0100 Message-Id: <20170912100330.2168-6-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 05/24] xen/arm: hsr_iabt: Document RES0 field 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" Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Acked-by: Stefano Stabellini Acked-by: Stefano Stabellini --- Note that the missing FnV bits present ARMv8 will be added in a follow-up patch. Changes in v2: - Add Andre's reviewed-by --- xen/include/asm-arm/processor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index 9f7a42f86b..bea4a56190 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -583,9 +583,9 @@ union hsr { struct hsr_iabt { unsigned long ifsc:6; /* Instruction fault status code */ - unsigned long res0:1; + unsigned long res0:1; /* RES0 */ unsigned long s1ptw:1; /* Stage 2 fault during stage 1 translation */ - unsigned long res1:1; + unsigned long res1:1; /* RES0 */ unsigned long eat:1; /* External abort type */ unsigned long res2:15; unsigned long len:1; /* Instruction length */ From patchwork Tue Sep 12 10:03:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112271 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674341edi; Tue, 12 Sep 2017 03:05:39 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBgoujxZQ3WyA0mHqX3Q2CtztppBwYXEduqnuC891WahAZeFrnBM0b0BmmBIK87DM8fPCru X-Received: by 10.36.9.206 with SMTP id 197mr212445itm.77.1505210739279; Tue, 12 Sep 2017 03:05:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210739; cv=none; d=google.com; s=arc-20160816; b=BwHvN10+8mW8Ghb71vGJhFxP7xzov0SaimLJmLIjukNzgNBUdTsM34Z1n6G15iSndA hq1m8uKLTEIPcv0JEbM/zIrDjZLIs2QG/Su7PVmq0ad1tn3E46tEPcRrED7U8MSZF1Dv ajAU/4ACM8cVfOoFYkhWt7Gy65XH1yJN7qQ3xoktoyNG+WlSKu8xwEXAFpuSyoUuH7ga Dn1KEQIcCUJdyyNC9i2NHDqbsWbB7hYTfPwbjptnWxIcjfzb1gk1fOBeH53pApqfUyad NXXcwR6hVbYU5B95XgcunUqn157ZE9dzU3hqmVPZ5bMnETUZR0nilLisMcere1tdhuQO 6zQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=LBXMZ5MKhJyKxTY4DTzQ55I+xGlIv+j7kpTInLoA9HE=; b=ojdp7QwXQQnb0si+tmw9Wpzm51DWSjcX3jLZYzvJuKAo8yssK3iHfC1tBtUzD2UdLv H/fRkI+SB+4ZO3gac3dH+Ewp5qtQ0H37lduAa+tS2j47RxosC7MOcX1uyV12bYpDQ34o J02uC9Jugvr/esFDLlpkB3hcp3tvfafKp7dtWO7v1dJqZ5lXqbY3a32jGEVsNjzLOqdT /grmz/wd+vX5oEm1sLA/TdtToTvTybVGMQo5WWeqLY+GoL9af6GrD49x1aDAYhG+NPxK dg9Ej8Jed4JaFcMY9v1h+ipDaGta5Lx94BaSLar42xlga5FB2BOz/L0uguL+sv5m+ohg hO6w== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id t125si10580640itg.166.2017.09.12.03.05.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:39 -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 1dri2o-0002tL-OP; Tue, 12 Sep 2017 10:03:50 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2n-0002rb-Eg for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:49 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 20/FC-01910-401B7B95; Tue, 12 Sep 2017 10:03:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTZdl4/Z Ig2mLGS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oxXm1vYCl7wVly9+oWtgXEjVxcjF4eQwGZG iSc/TrFCOKcZJZa0rwZyODnYBDQl7nz+xARiiwhIS1z7fJkRxGYWiJQ4/OEHO4gtLOAhseHUD 2YQm0VAVeL8+uVsIDavgIXEit+HwOISAvISu9ougs3kFLCUWPHxF1iNEFDN95c/GCcwci9gZF jFqFGcWlSWWqRraK6XVJSZnlGSm5iZo2toYKyXm1pcnJiempOYVKyXnJ+7iRHoYQYg2MH48rT nIUZJDiYlUd4j67dHCvEl5adUZiQWZ8QXleakFh9ilOHgUJLgPQ+SEyxKTU+tSMvMAYYaTFqC g0dJhHc2SJq3uCAxtzgzHSJ1ilGXo+Pm3T9MQix5+XmpUuK8GSBFAiBFGaV5cCNgYX+JUVZKm JcR6CghnoLUotzMElT5V4ziHIxKwrzxIFN4MvNK4Da9AjqCCegInktbQI4oSURISTUwriq34n K8FuC18ox+a374is/3nCytpMXKOzpNutiCtiaWTbkovINpLs/kh1yvksTr+mIrfMXZTB/uujw h/VVoHGPczP2ekbdX23kueGsq5XrPryd09wWBhUbzTd/4asvM2MLa/urZ9tdRayb+LTb8+CC0 RV38gK39JFnZ88u7HXfwbb+zVOSsEktxRqKhFnNRcSIALpThAHYCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1505210627!114366351!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53730 invoked from network); 12 Sep 2017 10:03:47 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-31.messagelabs.com with SMTP; 12 Sep 2017 10:03:47 -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 42D111529; Tue, 12 Sep 2017 03:03:47 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 548CB3F578; Tue, 12 Sep 2017 03:03:46 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:12 +0100 Message-Id: <20170912100330.2168-7-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 06/24] xen/arm: traps: Don't define FAR_EL2 for ARM32 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" Aliasing FAR_EL2 to HIFAR makes the code confusing because on ARMv8 FAR_EL2[31:0] is architecturally mapped to HDFAR and FAR_EL2[63:32] to HIFAR. See D7.2.30 in ARM DDI 0487B.a. Open-code the alias instead. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- Changes in v2: - Fix register name in the commit message - Add Andre's reviewed-by --- xen/arch/arm/traps.c | 8 +++++++- xen/include/asm-arm/cpregs.h | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 7f6ec15b5e..967bfea4ed 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2579,11 +2579,17 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, const union hsr hsr) { int rc; - register_t gva = READ_SYSREG(FAR_EL2); + register_t gva; uint8_t fsc = hsr.iabt.ifsc & ~FSC_LL_MASK; paddr_t gpa; mfn_t mfn; +#ifdef CONFIG_ARM_32 + gva = READ_CP32(HIFAR); +#else + gva = READ_SYSREG64(FAR_EL2); +#endif + /* * If this bit has been set, it means that this instruction abort is caused * by a guest external abort. We can handle this instruction abort as guest diff --git a/xen/include/asm-arm/cpregs.h b/xen/include/asm-arm/cpregs.h index af45ec7a65..1889d7cbfb 100644 --- a/xen/include/asm-arm/cpregs.h +++ b/xen/include/asm-arm/cpregs.h @@ -307,7 +307,6 @@ #define ESR_EL1 DFSR #define ESR_EL2 HSR #define FAR_EL1 HIFAR -#define FAR_EL2 HIFAR #define HCR_EL2 HCR #define HPFAR_EL2 HPFAR #define HSTR_EL2 HSTR From patchwork Tue Sep 12 10:03:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112275 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674449edi; Tue, 12 Sep 2017 03:05:44 -0700 (PDT) X-Google-Smtp-Source: AOwi7QC+SwLS5sZgIxt70rtMNH+5YN2Rp1s5HzhzI8PWmyfWPNaR/9wyUJhFTpHelli79mXMfdTg X-Received: by 10.36.50.150 with SMTP id j144mr248483ita.52.1505210744813; Tue, 12 Sep 2017 03:05:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210744; cv=none; d=google.com; s=arc-20160816; b=v11UAVxYvodkU8a14l3z8TUmVvaSZ+sDO2yAPvepZn+5tsL+2jXoWrl/Z3OBN7uv+f LDaSuuyS4/5rwIA0coIykdlbax1vucBLZVM+vIfmPEj9G37o0yNX/b3aiW6ZNEjKMCu2 vD/pEKU6ZT5uSVwlW8oNiqoOJDOPL7/hAGtV6d7MLClY1DXtEKk457Yh6khFq3C2JcPW kKAZiYzemL2v6pOdOHxQDbtwH96NuxKLViM4RH/X/Np+XsdZ0jn2f5hZ7qHHSCSHXN0C MvJvMlvOvMafLTZmyRHrCd26l98CbLJiB1fiscBhRpG2JSTV2RM9vyThpnScaHLJwxdt 9QPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=QzSPQmQTGmLXImXmsozNT5jsNfb3ZHMWFXiCPO4pkA4=; b=QflxFjgDJe0XJ5BVHrc7nI/1eGn2SSZA6zeZ5C8j0wONBjqzVFBKSYIZvSrDo/n2u6 yZ+w/LECJQo4NukUVHfQBuIs12Sp/niBjrK8o7TbVfigHTsicxxi0aJQc2l8gbXigCdS G34Dg5qYQE64bA1Ixt69e+mRz6A0+grI2XluwoPd34RJbMjVZFof/VQGRzVm1pmox9Da kE8q3/eJ+Ze+eV+8doYQA5QvWmtgPtDePi6kZiI6C/Ne+N5qlHNPme2+KwOK+JRIWnZq a/oFNQEoOzLpVHd118u0zIcBADqjhVzfEO2yhvDEfWYImFZ4hlHLEnltOI6aEPxjBfuc yH+A== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id b129si283872itb.66.2017.09.12.03.05.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:44 -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 1dri2t-0002ye-L6; Tue, 12 Sep 2017 10:03:55 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2r-0002vt-F8 for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:53 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 98/A4-02208-801B7B95; Tue, 12 Sep 2017 10:03:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRWlGSWpSXmKPExsVysyfVTZd14/Z Ig/YfvBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bRxg/sBVvZK3oat7E1MB5m7WLk4hAS2Mwo sfzySjYI5zSjxILLq1i6GDk52AQ0Je58/sQEYosISEtc+3yZEcRmFoiUOPzhBzuILSxgJzHzd gcbiM0ioCrxc8kfoBoODl4BC4nVZ5RBwhIC8hK72i6ygticApYSKz7+AisXAir5/vIH4wRG7g WMDKsYNYpTi8pSi3QNDfWSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKTivWS83M3MQL9ywAEOxh XtjsfYpTkYFIS5T2yfnukEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQneaSA5waLU9NSKtMwcYKDB pCU4eJREeK+BpHmLCxJzizPTIVKnGI05bjy8/oeJo+Pm3T9MQix5+XmpUuK8b0BKBUBKM0rz4 AbBIuASo6yUMC8j0GlCPAWpRbmZJajyrxjFORiVhHnvgEzhycwrgdv3CugUJqBTeC5tATmlJB EhJdXAaFfDczK1waC2hbk1yf5KloWD9hnZ2wmh579/L5z111Wk7Dfzrpz1k3/6etZ5nqs1iuf KZ30U9KVooXeQ/qUJyQkfNi36X/1msd4G7eenfP6/m7XJVt7mtr7Lct3lZ98yGU9Pc5T7UZFr EpPWpBTPZn927qL1r6OuWDEuWZyec/DTjqCg5q1rlViKMxINtZiLihMBsVh86HsCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1505210628!82692588!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64404 invoked from network); 12 Sep 2017 10:03:49 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-10.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:03:49 -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 6C52E15A2; Tue, 12 Sep 2017 03:03:48 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7E5303F578; Tue, 12 Sep 2017 03:03:47 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:13 +0100 Message-Id: <20170912100330.2168-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 07/24] xen/arm: arm32: Don't define FAR_EL1 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" Aliasing FAR_EL1 to IFAR is wrong because on ARMv8 FAR_EL1[31:0] is architecturally mapped to DFAR and FAR_EL1[63:32] to IFAR. As FAR_EL1 is not currently used in ARM32 code, remove it. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Acked-by: Stefano Stabellini --- Changes in v2: - Fix register name in the commit message - Add Andre's reviewed-by --- xen/include/asm-arm/cpregs.h | 1 - 1 file changed, 1 deletion(-) diff --git a/xen/include/asm-arm/cpregs.h b/xen/include/asm-arm/cpregs.h index 1889d7cbfb..9e138489f0 100644 --- a/xen/include/asm-arm/cpregs.h +++ b/xen/include/asm-arm/cpregs.h @@ -306,7 +306,6 @@ #define DACR32_EL2 DACR #define ESR_EL1 DFSR #define ESR_EL2 HSR -#define FAR_EL1 HIFAR #define HCR_EL2 HCR #define HPFAR_EL2 HPFAR #define HSTR_EL2 HSTR From patchwork Tue Sep 12 10:03:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112278 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674556edi; Tue, 12 Sep 2017 03:05:50 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCmW4fluf7awfNnUuo/HKCBt3Lnn3arPyPCYVDBdaeNxprymMfcaPeUCQ2cqchhP/oPAlmJ X-Received: by 10.36.209.7 with SMTP id w7mr241800itg.6.1505210750397; Tue, 12 Sep 2017 03:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210750; cv=none; d=google.com; s=arc-20160816; b=hU80x0RNafUhejW9t/5HwqgSnjAG+cdJL/G6KASUNXoo9/xFZtC+Ya8mzDf5z7Jnim PobUbpRnH3kp3wTx2Hzdmk7GTomQuahyasKqMXKbk8hQzUiL8fjlX1No8eACTULAXvX8 0uRGaFr34bsuoMHDdVBeMjDO8Jgwceo7xddwGEXCMI8dCDocF775mFakZqRWxl5qB7cF 2yFEuK5SVJ6xDZyM6lG8eh1rE7LyO/pQjCvOFiWNfaaWdQzxyEsHdqfbLW9kAqsG8RG5 mYKY3zVQYcGXwjQW3/puIq3eiNYGvhX3+klhN8aDGvTvnek4HXeUY3wJMklNxkQAuzO3 kHWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=jhDX+QdC6vJBlHtCqTKCwuSxRkh+qWfkLk0J6yzexRY=; b=QObVLCvUXhHWGJybZsQ6pCjKNGrhH/OIxE1xpIdgGWPGHOAG7JiiNn1qqIF9ZTmzkx z+2q5hiGcKtyFVAVgrjfAEa2kd6yMYHaz8JfIQQjCxM7EhSouGA6jDE3kkC1TJMeJJeP sau0CVIFXscKZmec/xtEyqVzS9tTyTjritYMf8yzmgujgrDQr0dlEeOuFHHtihMaaUmj uylP2HfUVnVnsY1EQqgB2RMQOSiT8krf7eSm88hAiHuw0NRA8aXEU/Z9NZ+uUqdfZpTT hLY1vQn9s+g0h+g2zi1XyJWG2JzuUJt2JxW6SMbJ/BADDJrIbktFMYvwNxJkoYpQtRmY 2tmg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id x1si2728918itd.33.2017.09.12.03.05.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:50 -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 1dri2r-0002vz-6i; Tue, 12 Sep 2017 10:03:53 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2p-0002tv-Hy for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:51 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 67/1D-02046-601B7B95; Tue, 12 Sep 2017 10:03:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTZdt4/Z Ig52HxCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ozn746yFlzgq2hYt4yxgbGBu4uRi0NIYDOj xJPfa9kgnNOMEm8nv2PqYuTkYBPQlLjz+ROYLSIgLXHt82VGEJtZIFLi8Icf7CC2sICNROepb 0A1HBwsAqoSj79wgoR5BSwkJjWfBiuREJCX2NV2kRXE5hSwlFjx8RcbiC0EVPP95Q/GCYzcCx gZVjFqFKcWlaUW6RqZ6SUVZaZnlOQmZuboGhoY6+WmFhcnpqfmJCYV6yXn525iBPq3noGBcQd jw16/Q4ySHExKorxH1m+PFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBy74BKCdYlJqeWpGWmQMM NJi0BAePkgjvbJBW3uKCxNzizHSI1ClGXY6Om3f/MAmx5OXnpUqJ874BKRIAKcoozYMbAQv6S 4yyUsK8jAwMDEI8BalFuZklqPKvGMU5GJWEeeNBpvBk5pXAbXoFdAQT0BE8l7aAHFGSiJCSam B0m6csfXjJpVNPK3gmx/acyj/Y+rih/21AsXMDw/bY+uqN11q3brnKeodZJ/qJd+YXt5S7s7y 9vh3mdGp7NKP9eplUuuzK6swzlvd7r+RdtQ9MM3qffc19SsO+noffn97Mlfn/ys1XeoaPhte8 67Vq62tX3WxedXzl6zixpf/aa9jKjzHqfT6hxFKckWioxVxUnAgA7ddJYnUCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1505210629!114366363!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 54504 invoked from network); 12 Sep 2017 10:03:50 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-31.messagelabs.com with SMTP; 12 Sep 2017 10:03:50 -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 9628815BF; Tue, 12 Sep 2017 03:03:49 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A7F723F578; Tue, 12 Sep 2017 03:03:48 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:14 +0100 Message-Id: <20170912100330.2168-9-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 08/24] xen/arm: Add FnV field in hsr_*abt 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" FnV (FAR not Valid) bit was introduced by ARMv8 in both AArch32 and AArch64 (See D7-2275, D7-2277, G6-4958, G6-4962 in ARM DDI 0487B.a). Note the new revision of ARMv8 defined more bits in HSR. They haven't been added at the moment because we have no use of them in Xen. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Acked-by: Stefano Stabellini --- Changes in v2: - Expand the commit message to explain why the other bits have not been added. - Add Andre's reviewed-by --- xen/include/asm-arm/processor.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index bea4a56190..b6432b6bf4 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -587,7 +587,8 @@ union hsr { unsigned long s1ptw:1; /* Stage 2 fault during stage 1 translation */ unsigned long res1:1; /* RES0 */ unsigned long eat:1; /* External abort type */ - unsigned long res2:15; + unsigned long fnv:1; /* FAR not Valid */ + unsigned long res2:14; unsigned long len:1; /* Instruction length */ unsigned long ec:6; /* Exception Class */ } iabt; /* HSR_EC_INSTR_ABORT_* */ @@ -598,10 +599,11 @@ union hsr { unsigned long s1ptw:1; /* Stage 2 fault during stage 1 translation */ unsigned long cache:1; /* Cache Maintenance */ unsigned long eat:1; /* External Abort Type */ + unsigned long fnv:1; /* FAR not Valid */ #ifdef CONFIG_ARM_32 - unsigned long sbzp0:6; + unsigned long sbzp0:5; #else - unsigned long sbzp0:4; + unsigned long sbzp0:3; unsigned long ar:1; /* Acquire Release */ unsigned long sf:1; /* Sixty Four bit register */ #endif From patchwork Tue Sep 12 10:03:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112276 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674462edi; Tue, 12 Sep 2017 03:05:45 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDmfa6cmid8dE94TzyHsikz0h2MtW2bc3+hMQTOC/OWnxzr3Zf2vTIvL1vly7o28CbNwtu2 X-Received: by 10.107.165.146 with SMTP id o140mr19165934ioe.11.1505210745571; Tue, 12 Sep 2017 03:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210745; cv=none; d=google.com; s=arc-20160816; b=U12FyEH7O3fgkFCQSJ13Hbf8+qzSQdiDzLUfwLNeTm00DtKgutWj9sq8RetTLkyI7y FPa74BBmaxq2xeYr+zpQ2yYGR+ItDS1fnFNoEThUUzGedvi58eeWG2qD6ubdyn8jSQGI F7c6Mb2zEcr5i0tXAJcBoQ0Ee4XSDTHbtXK6Am/mC7vUBLxVYLyyndkUn9cC9Vy5xJTz ejFl22AVXKK/h4HBAt2kK9SbZws6CdYa8Dxhr4Ta6D5aztWlCC3gQ1u28j2uyqxwjsFx GHHI2RXwDcVXhjN/EXDJPNBUpA3knq0NWp/7S3Rj0/6nsos8qPcrxRjqi/VLKgJW0tbU m0Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=UP267qAbUkLh+VgAhcxud11xzNJFjuSPG+LYH5c0g/g=; b=LFlzqc4eZPlGi6N2SMIxSNMBlTzzAmbNWNqGLdtexQaSltbtVftb1vDxMcGG4EpPNl HvMNkltFgK/0LIPWzY0z7zkwBSwptdf1n/jQ9mXSV1LE5U9jJv11QYKRV0Q+zgM19WiK TRJHWf6bKBOJZ+dBu6EMcPnZxGfLnDS1CjTHdCxlGfh98KD7q9Jn4EUqRCZFTnTSIbJo NDaIqbYRgemWsNg2ghXAGHmVdTo4SpSia8w/N6lwhxAOlJWr3aaRbXA2ux0JkHFROaax JRYG/ipZUfZDMqUG0X1rx/FLor24zhAz/Nk1g/6N9dkoi3VDMuoIbGlRiqk/bdlkj7Dh 05ZA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id q77si10824143itb.28.2017.09.12.03.05.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:45 -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 1dri2x-000361-Qd; Tue, 12 Sep 2017 10:03:59 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2w-00032t-4R for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:58 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id BF/FE-03093-D01B7B95; Tue, 12 Sep 2017 10:03:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLLMWRWlGSWpSXmKPExsVysyfVTZd94/Z IgzeH5SyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ow9R94zFxzlqnj7opW1gbGFo4uRi0NIYDOj xM+Xj9ggnNOMEqtnH2TsYuTkYBPQlLjz+RMTiC0iIC1x7fNlsDizQKTE4Q8/2LsYOTiEBRIkl uywBAmzCKhKrJ/TyQ5i8wpYSrxeeogVxJYQkJfY1XYRzOYEiq/4+IsNxBYSsJD4/vIH4wRG7g WMDKsYNYpTi8pSi3SNzPSSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQL9ywAEOxj PLAg8xCjJwaQkyntk/fZIIb6k/JTKjMTijPii0pzU4kOM6hwcAo0T34ZLseTl56UqSfBOAykT LEpNT61Iy8wBhh9MpQQHj5II72yQNG9xQWJucWY6ROoUoy5Hx827f5iEwGZIifNmgBQJgBRll ObBjYDFwiVGWSlhXkag+4R4ClKLcjNLUOVfMYpzMCoJ884HmcKTmVcCt+kV0BFMQEfwXNoCck RJIkJKqoFR6sL9ZzJX+21vKRfcNWZsniPPNrGZK21ebosJv9zlp89M5n1NneqcGLJ2u9L+LUp fA7f8rLgQKfLgfSKTaeDKg4mbAmqO/LFWv+A8J7hzs6svkyrvQ/G4Fdk8GxSmmip/X8m257eZ ppUR18osBoWbPLnroiZ/2X4jY2b9i++PrZhsHkzyc8lSYinOSDTUYi4qTgQACKAa3oACAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-16.tower-21.messagelabs.com!1505210631!70445453!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28792 invoked from network); 12 Sep 2017 10:03:51 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-16.tower-21.messagelabs.com with SMTP; 12 Sep 2017 10:03:51 -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 BFD501529; Tue, 12 Sep 2017 03:03:50 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D1BAF3F578; Tue, 12 Sep 2017 03:03:49 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:15 +0100 Message-Id: <20170912100330.2168-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 09/24] xen/arm: Introduce hsr_xabt to gather common bits between hsr_dabt and 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" This will allow to consolidate some part of the data abort and prefetch abort handling in a single function later on. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- Changes in v2: - Add Andre's reviewed-by --- xen/include/asm-arm/processor.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h index b6432b6bf4..51e1c92665 100644 --- a/xen/include/asm-arm/processor.h +++ b/xen/include/asm-arm/processor.h @@ -615,6 +615,19 @@ union hsr { unsigned long ec:6; /* Exception Class */ } dabt; /* HSR_EC_DATA_ABORT_* */ + /* Contain the common bits between DABT and IABT */ + struct hsr_xabt { + unsigned long fsc:6; /* Fault status code */ + unsigned long pad1:1; + unsigned long s1ptw:1; /* Stage 2 fault during stage 1 translation */ + unsigned long pad2:1; + unsigned long eat:1; /* External abort type */ + unsigned long fnv:1; /* FAR not Valid */ + unsigned long pad3:14; + unsigned long len:1; /* Instruction length */ + unsigned long ec:6; /* Exception Class */ + } xabt; + #ifdef CONFIG_ARM_64 struct hsr_brk { unsigned long comment:16; /* Comment */ From patchwork Tue Sep 12 10:03:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112280 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674603edi; Tue, 12 Sep 2017 03:05:52 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCYbmnCcgBFiWXstmeioXih1Ja96O4o0c1yeqj4BeU1k/8pTh5TOX63X838FoRKdUsFQdx7 X-Received: by 10.36.202.69 with SMTP id k66mr238432itg.86.1505210752597; Tue, 12 Sep 2017 03:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210752; cv=none; d=google.com; s=arc-20160816; b=Dkw63hDTFH1z6HkyXdF4JOrD1GygJT1x5jAzCXJRA5WGcpLI3NtaAzgVX7Rmlt+Zfh wQVXKl2wMdkyCvcQsbziXKO+3PBrWMaGBLk2hvmAvWCYuVdFWhHxrBuBIw1uXQyuc3t6 +LQUD/THqZIvyQVcivrI8KfKmWs6OKM+eklPq2iQCeVPaWDkggrXPLhhUWc7E9lGYniz rzvmiF2zjuR08XqDf9GB4EwB8F0y0b540ESJ99QmSPKyhSTY6ZJbXNPW6y2DWnoE7ri8 vgGgHv2JK41UjbnNyGQ26QLNrdeXk2/Wpiw70F7/gMti4K+/aGTuzJDPthgZvxwEYAGw /IYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=fNlySk1h0+PrrGhLQpqAok6agpSwZ/HDmVG6ybZm81w=; b=oHJTH1uSOw+Ny9S242BbGtJcBsKndGC7k3dnX6QJsSDA4MtZvgVLFYlbt4hwxVSz+U PadYf8pRVpvtwrc8n8E6ZizUNNVT3J7TXtCf48kagYyS8l/bkcvbhhRs6ZDc9/AE7HbJ Or2yHvpCabGGihcF+28rFEnMUQoziKwcio3zzdNw6QR5/+2B+lxQEU7XGHDvf1NltG0m ZtoiigMI/HU3Hh2VYrIyR+7/p+iykJlPUvs46VbSCaf8jej9s6zvqwVS0YYUl7BYZgnv 34mk5QSWUvL9RF+qcwtWQElxS5PesAUiwAs4f7muFRRQhWE5g5WjlQta2lyvMF7kHdV1 7KXw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id d6si139236iog.213.2017.09.12.03.05.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:52 -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 1dri2t-0002yC-Dp; Tue, 12 Sep 2017 10:03:55 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2r-0002rb-Cq for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:53 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 59/1D-01910-901B7B95; Tue, 12 Sep 2017 10:03:53 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTZdj4/Z Ig9bPWhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8ayc2uYC54IVPS0PWJtYNzH28XIxSEksJlR 4ube/UxdjJxAzmlGiRu9pSA2m4CmxJ3Pn8DiIgLSEtc+X2YEsZkFIiUOf/jBDmILCyRJtPw+A WazCKhK9F77CVbPK2ApMW/rQmYQW0JAXmJX20VWEJsTKL7i4y82iF0WEt9f/mCcwMi9gJFhFa NGcWpRWWqRrqGlXlJRZnpGSW5iZo6uoYGxXm5qcXFiempOYlKxXnJ+7iZGoH/rGRgYdzD+Pu5 3iFGSg0lJlPfI+u2RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR42TcA5QSLUtNTK9Iyc4CBBpOW 4OBREuG9BtLKW1yQmFucmQ6ROsWoy9Fx8+4fJiGWvPy8VClx3jcgRQIgRRmleXAjYEF/iVFWS piXkYGBQYinILUoN7MEVf4VozgHo5Iw7x2QKTyZeSVwm14BHcEEdATPpS0gR5QkIqSkGhi3Bj 5OuWVlkads1XDYYOoRdaENy3Zulvfjve37aeWTAnPdhRlhAiE5Nv4n9/EtaH/52XDynqMLhe4 sjnH/6N1+92nWLYsqPTnr+QJ+q2sV/5UsOK5xWSNU01SwkTF9rf2qNS1fy8/X2h3b9Xzag42X Yt6dNOmavC7U1CuD3Xv3xk0luhuavdOUWIozEg21mIuKEwEcu1cadQIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1505210632!114366376!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56488 invoked from network); 12 Sep 2017 10:03:52 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-31.messagelabs.com with SMTP; 12 Sep 2017 10:03:52 -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 E9A2115A2; Tue, 12 Sep 2017 03:03:51 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 075B43F578; Tue, 12 Sep 2017 03:03:50 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:16 +0100 Message-Id: <20170912100330.2168-11-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 10/24] xen/arm: traps: Introduce a helper to read the hypersivor fault register 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" While ARM32 has 2 distinct registers for the hypervisor fault register (one for prefetch abort, the other for data abort), AArch64 has only one. Currently, the logic is open-code but a follow-up patch will require to read it too. So move the logic in a separate helper and use it instead of open-coding it. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Andre's reviewed-by --- xen/arch/arm/traps.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 967bfea4ed..2e48089d61 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2549,6 +2549,28 @@ done: if (first) unmap_domain_page(first); } +/* + * Return the value of the hypervisor fault address register. + * + * On ARM32, the register will be different depending whether the + * fault is a prefetch abort or data abort. + */ +static inline vaddr_t get_hfar(bool is_data) +{ + vaddr_t gva; + +#ifdef CONFIG_ARM_32 + if ( is_data ) + gva = READ_CP32(HDFAR); + else + gva = READ_CP32(HIFAR); +#else + gva = READ_SYSREG(FAR_EL2); +#endif + + return gva; +} + static inline paddr_t get_faulting_ipa(vaddr_t gva) { register_t hpfar = READ_SYSREG(HPFAR_EL2); @@ -2584,11 +2606,7 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, paddr_t gpa; mfn_t mfn; -#ifdef CONFIG_ARM_32 - gva = READ_CP32(HIFAR); -#else - gva = READ_SYSREG64(FAR_EL2); -#endif + gva = get_hfar(false /* is_data */); /* * If this bit has been set, it means that this instruction abort is caused @@ -2730,11 +2748,8 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, return __do_trap_serror(regs, true); info.dabt = dabt; -#ifdef CONFIG_ARM_32 - info.gva = READ_CP32(HDFAR); -#else - info.gva = READ_SYSREG64(FAR_EL2); -#endif + + info.gva = get_hfar(true /* is_data */); if ( hpfar_is_valid(dabt.s1ptw, fsc) ) info.gpa = get_faulting_ipa(info.gva); From patchwork Tue Sep 12 10:03:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112261 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674000edi; Tue, 12 Sep 2017 03:05:21 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCSr6KfYfaNrjGOqbiHqyQLVC/LXbcJXEeyEXo9ScaDd3uIdOCfGdcD4wEBetFmklrzISlb X-Received: by 10.107.140.70 with SMTP id o67mr19543489iod.35.1505210721452; Tue, 12 Sep 2017 03:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210721; cv=none; d=google.com; s=arc-20160816; b=m/R79CbRHpxqY8EHCtwoXGuPDCTJ7Vv5zVGmpnx7Pir6FQ8MekxnUI4/+5W2jYrEu+ bTbMPr4kIHqEJ8EBRxcF9GZEx4ecvGfMToctM/lcv2VvRvdJG0h0TyMXM8GE97/lRwxs THuJjAZtERIHsI529Vjdsji3IPrWWKS47yzLTF40UvP6P0KBvY/0iFx4/yNq3a165Lsr IKYfiT6Hykh2fuHHRFstpRTe94nJRywTpXjuy4poW33A9Dz+wRfA4SzMTHaSx7Ybisrz Uk8s7xGytOcnS/qJWuZXF3+c6OiMYGFSYtUSL5NiB9S5kgheqba4jeHgAC4bpi62aKYX ohPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=6gXikjPvENVCxhW2/eaJY1vJYsuOvJNnBTzBz4Aexms=; b=BIjyldDPPP25S9NykU1CEWm16ZCRyw5mMyuK7kFtd0yrD1Fd51l0R765Itd/xGIXtl RKHdr7NRaVLRoH/ddAN7Y/HXla8g46Sirrlmm8YXveQWwdmsMdm699CWeTUenhB87J0w Bv0X7gC0XqTuxO5Ri5W4wCk1ANIuV/aoTbq8eb0Itw66T8jHZx3wwRSSQrxc45TaH6In h8PAN0VZWDv2w4yHuL1PntWgramtZJR+pGbKrxMbOpnaVtYDVAiINb5+qI4Ffnh+lb0z ln5S8E+9F6hCahW6zW50CkU9UxpD9UZtFgVHSy/A7phGInio7N+5KQwSXlh76H4Y983D 0EZA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y15si10548437iti.180.2017.09.12.03.05.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:21 -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 1dri2u-0002zu-0M; Tue, 12 Sep 2017 10:03:56 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2s-0002tF-TY for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:55 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 44/E8-02817-A01B7B95; Tue, 12 Sep 2017 10:03:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTZdz4/Z Ig2n7zS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyZG7YxF7zgqdg4bQtLA+Ntzi5GLg4hgc2M Ek82nGODcE4zSvR27GHtYuTkYBPQlLjz+RMTiC0iIC1x7fNlRhCbWSBS4vCHH+wgtrBAuMSDp 4fA4iwCqhL3Z+8DGsTBwStgKbFxizhIWEJAXmJX20WwkZxA4RUff7GB2EICFhLfX/5gnMDIvY CRYRWjRnFqUVlqka6RmV5SUWZ6RkluYmaOrqGBqV5uanFxYnpqTmJSsV5yfu4mRqB/6xkYGHc w3p7sd4hRkoNJSZT3yPrtkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeM+D5ASLUtNTK9Iyc4CB BpOW4OBREuGdDZLmLS5IzC3OTIdInWLU5ei4efcPkxBLXn5eqpQ4bwZIkQBIUUZpHtwIWNBfY pSVEuZlZGBgEOIpSC3KzSxBlX/FKM7BqCTMewdkCk9mXgncpldARzABHcFzaQvIESWJCCmpBk bdsxEHIv3Di75nZF2uqbivpcAUPrX1dBX785gpaV5fT9ppno8xZJMtzWJ8uyH+VmD14SN39kV F2rxo3M0pplphdW4Hd9v1mkcy53KbvQVThXP8Ji0zmHrER6B16YfWLyYBr/0f3Jk0n42lqPQc 8z8VUVE/0SiX3HX7tFf/fX3rQb+4s177RSWW4oxEQy3mouJEABxqdA11AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1505210633!111086264!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63082 invoked from network); 12 Sep 2017 10:03:53 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-4.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:03:53 -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 20639165D; Tue, 12 Sep 2017 03:03:53 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3105A3F578; Tue, 12 Sep 2017 03:03:52 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:17 +0100 Message-Id: <20170912100330.2168-12-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 11/24] xen/arm: traps: Improve logging for data/prefetch abort fault 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" Walk the hypervisor page table for data/prefetch abort fault to help diagnostics error in the page tables. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Acked-by: Stefano Stabellini --- Andre, I assumed you were happy with changes you suggested, so I kept your reviewed-by. Changes in v2: - Add Andre's reviewed-by - Simplify condition check - Update warning message --- xen/arch/arm/traps.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 2e48089d61..0b856fb4fd 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2986,7 +2986,26 @@ void do_trap_hyp_sync(struct cpu_user_regs *regs) do_trap_brk(regs, hsr); break; #endif + case HSR_EC_DATA_ABORT_CURR_EL: + case HSR_EC_INSTR_ABORT_CURR_EL: + { + bool is_data = (hsr.ec == HSR_EC_DATA_ABORT_CURR_EL); + const char *fault = (is_data) ? "Data Abort" : "Instruction Abort"; + + printk("%s Trap. Syndrome=%#x\n", fault, hsr.iss); + /* + * FAR may not be valid for a Synchronous External abort other + * than translation table walk. + */ + if ( hsr.xabt.fsc == FSC_SEA && hsr.xabt.fnv ) + printk("Invalid FAR, not walking the hypervisor tables\n"); + else + dump_hyp_walk(get_hfar(is_data)); + + do_unexpected_trap(fault, regs); + break; + } default: printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n", hsr.bits, hsr.ec, hsr.len, hsr.iss); From patchwork Tue Sep 12 10:03:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112262 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674056edi; Tue, 12 Sep 2017 03:05:25 -0700 (PDT) X-Google-Smtp-Source: AOwi7QB0htXlimGCmAJGA2sktsrdXW3GOc5oQNd0I9Nq6g4JKg0e328xx63+8zcltQpEH8NV14+2 X-Received: by 10.36.141.67 with SMTP id w64mr250378itd.8.1505210725010; Tue, 12 Sep 2017 03:05:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210725; cv=none; d=google.com; s=arc-20160816; b=zJBSpRAbzw4jUdj4FS8DNGO49/pBcvseyLURfs+qREE5DrrX3gstUKrW+63u33MmDt MDYjrK1Dwybl5mMxUazeDkiwYvydDtXfZ1gOwIIfAnCNPkLMEyTJcrIYpJ4ctJ92yooK MTpiTSRdsr35GQAD1iHNver9UIckO7zCCrWenkMF4qhC+e0RkL6CCstVCm9c3u/F8rix z7xaGi8XSUZVUzstTNw9Zjaw+a7sTv0J6xOjKtRl3oskwvUEqti1vu+1wocnCP9JUm74 PQr75Lq9mcSwtJtkESt8IPl4hiTKEc7ncTCvnaDFk2w5i8uXkdyygiKfyqQK2Veue/yb yLOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=vPBerR/SpGq7wLWuNjzbkxN7rdRh3syzvI9LWSKVYKQ=; b=XqLFAj208YJ+GGgk+EIkKP+oBg+l7ez75yMwtewObxZMrKxrlk4IChcF1XDMjM2UEK +IPH/La9gjicU9nnZ7vxWi90L1UBGs+PIOxbGRSzs2iBtMYYaqvxep3Uw+ND8UQ/xKLa C2Hxt33vJw9BGOgJJWdlSc2ob6wx6GnDgpENso17bxEbgwzig46TZlYSDR4ft0xgVWJD Pe61duLWpmLi3eXjLUVwXcFRCPocCn3zt5sx5sKgRIrvfYAWreorw/KALtpy4ezU1LWE TKBpS6A12l53qkVtFe3Clg+z4dgGTGVtatGvI7cKsPO/Llc6h4Rz3pMy67d3XcgNJu4p ALrw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id o130si287181itb.88.2017.09.12.03.05.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:24 -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 1dri2v-00031z-8j; Tue, 12 Sep 2017 10:03:57 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2u-0002ym-6l for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:56 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 4C/BC-01760-B01B7B95; Tue, 12 Sep 2017 10:03:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBLMWRWlGSWpSXmKPExsVysyfVTZd74/Z Ig7fz2SyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ox/O5YyF3zjq1h+YB9bA2MbTxcjF4eQwGZG iV1dL5ggnNOMEi9enGTuYuTkYBPQlLjz+RMTiC0iIC1x7fNlRhCbWSBS4vCHH+wgtrBAhsTF4 +fZuhg5OFgEVCUezpIDCfMKWErM+H6MBcSWEJCX2NV2kRXE5gSKr/j4iw3EFhKwkPj+8gfjBE buBYwMqxg1ilOLylKLdA2N9JKKMtMzSnITM3N0DQ1M9XJTi4sT01NzEpOK9ZLzczcxAv3LAAQ 7GPtmOR9ilORgUhLlPbJ+e6QQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCV72DUA5waLU9NSKtMwc YKDBpCU4eJREeIVA0rzFBYm5xZnpEKlTjMYc7yZd+cPE0XHz7h8mIZa8/LxUKXHeNyBbBEBKM 0rz4AbBIuASo6yUMC8j0GlCPAWpRbmZJajyrxjFORiVhHnlQBbyZOaVwO17BXQKE9ApPJe2gJ xSkoiQkmpgrF65aXuisMn6uGSPpf/faV96Hsk9vZO/OEIhqU+pPvLxAqV1jQX9W4PEGM6cFVk StddOwEzv6jG/ifWrD+gx/E88cCZ0W1zJPT0vyUl9t8xqG1ab/ok36haclvl9jc6KAKlPTOv7 2ywPbN6Yx6e0Sr7gvcXCz4dceOYvfx+36mrfVIFf08MClFiKMxINtZiLihMBB/cPjHsCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1505210634!111086269!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63417 invoked from network); 12 Sep 2017 10:03:54 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-4.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:03:54 -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 48F681529; Tue, 12 Sep 2017 03:03:54 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5AD0A3F578; Tue, 12 Sep 2017 03:03:53 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:18 +0100 Message-Id: <20170912100330.2168-13-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 12/24] xen/arm: Replace ioremap_attr(PAGE_HYPERVISOR_NOCACHE) call by ioremap_nocache 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" ioremap_cache is a wrapper of ioremap_attr(...). Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Andre's reviewed-by --- xen/arch/arm/platforms/exynos5.c | 2 +- xen/arch/arm/platforms/omap5.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/platforms/exynos5.c b/xen/arch/arm/platforms/exynos5.c index 2ae5fa66e0..95d6581d33 100644 --- a/xen/arch/arm/platforms/exynos5.c +++ b/xen/arch/arm/platforms/exynos5.c @@ -62,7 +62,7 @@ static int exynos5_init_time(void) dprintk(XENLOG_INFO, "mct_base_addr: %016llx size: %016llx\n", mct_base_addr, size); - mct = ioremap_attr(mct_base_addr, size, PAGE_HYPERVISOR_NOCACHE); + mct = ioremap_nocache(mct_base_addr, size); if ( !mct ) { dprintk(XENLOG_ERR, "Unable to map MCT\n"); diff --git a/xen/arch/arm/platforms/omap5.c b/xen/arch/arm/platforms/omap5.c index 1e1f9fa970..7dbba95756 100644 --- a/xen/arch/arm/platforms/omap5.c +++ b/xen/arch/arm/platforms/omap5.c @@ -51,8 +51,7 @@ static int omap5_init_time(void) unsigned int sys_clksel; unsigned int num, den, frac1, frac2; - ckgen_prm_base = ioremap_attr(OMAP5_CKGEN_PRM_BASE, - 0x20, PAGE_HYPERVISOR_NOCACHE); + ckgen_prm_base = ioremap_nocache(OMAP5_CKGEN_PRM_BASE, 0x20); if ( !ckgen_prm_base ) { dprintk(XENLOG_ERR, "%s: PRM_BASE ioremap failed\n", __func__); @@ -64,8 +63,7 @@ static int omap5_init_time(void) iounmap(ckgen_prm_base); - rt_ct_base = ioremap_attr(REALTIME_COUNTER_BASE, - 0x20, PAGE_HYPERVISOR_NOCACHE); + rt_ct_base = ioremap_nocache(REALTIME_COUNTER_BASE, 0x20); if ( !rt_ct_base ) { dprintk(XENLOG_ERR, "%s: REALTIME_COUNTER_BASE ioremap failed\n", __func__); From patchwork Tue Sep 12 10:03:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112277 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674537edi; Tue, 12 Sep 2017 03:05:49 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBzE33dfglCipg2q/klR8+7lZNa8mEBs+q7etNbL0n9WHwMhNgOtu7gQAxw6K+oXeq0cee2 X-Received: by 10.107.168.98 with SMTP id r95mr15572660ioe.158.1505210749590; Tue, 12 Sep 2017 03:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210749; cv=none; d=google.com; s=arc-20160816; b=HyStgKqE0tYBeDoKavG/1YBpqjkbwOk3mbPl2iipmgH5M8tsYoMtB4qoJSOxVKNygj vrt3rEHy3onJd0GD3l0S9agx/+C+uDmupq+5Va0HHcDRr6ZQGYqxo+YcOeZKw1r+Ze09 Lk6UOCODdqpa/7FuShH8ruHkCik7wljzbbxLMD9hcSn5tC8AwIgXWCAGpZ9s2TNDpkbM qStSEsvOhSaen7IJ361GZwp80EBv1RWwtdVgXOX+AyFWIzZA4Ew8pFSf3F7X7rM1Smhf hzNIx25T019Mo34D14IigymO1PvIvN20A8YdP64dC/2dW2ymc0+hcr79nRwrmz7j3Pq4 VBYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=54xj2PYD+enQ3vNIqfGdZZvTw5y0UAHQzjSlvXIpV9A=; b=VBxCYHH8LCfATPfjxSGuQNSQS/rAJdaZK1u9pVwsMNy/PLSh1FY7bYJk6SNccqVg5U c6RNH2tO3wxVg/qui7JfOUgz28UwfhEhvd3Lhv3zMxFkwiy3NVIRSQ7aPYiYu2oSQMK1 UZCDIpJ8YurIH3bWmL3Rp4fXy9oyZep/gLGU8/bSKPWHRlWB2z6VIyffSUrb2Y++9Gi2 ZatbLB4kUrhQIqoM+AvVxlQFly7Ah2gdWbZHf6UDUgHwfFdXj7/MvXZsSP88n48yJzPS XnpjhDpQvgnL36o/K3uyGINOiGRGO2GNlfAPvgVBaY2hWf4ISGp2ubCQc9x989muo1ni Ijtw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id w63si10901772itg.128.2017.09.12.03.05.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:49 -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 1dri2x-00035C-GZ; Tue, 12 Sep 2017 10:03:59 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2v-00031r-LK for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:57 +0000 Received: from [85.158.139.211] by server-17.bemta-5.messagelabs.com id 7B/CA-01791-C01B7B95; Tue, 12 Sep 2017 10:03:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTZdn4/Z Igy0LBCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ozn39czFSzkq9h8+ghbA+MU7i5GLg4hgc2M Ej2n5jFBOKcZJRaePwDkcHKwCWhK3Pn8CcwWEZCWuPb5MiOIzSwQKXH4ww92EFtYIE7i8IppY DaLgKrEqc1PwOp5BSwl1k3/DhaXEJCX2NV2kRXE5gSKr/j4iw3EFhKwkPj+8gfjBEbuBYwMqx g1ilOLylKLdI3M9JKKMtMzSnITM3N0DQ1M9XJTi4sT01NzEpOK9ZLzczcxAj1cz8DAuIPx9mS /Q4ySHExKorxH1m+PFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBex4kJ1iUmp5akZaZAww1mLQE B4+SCO9skDRvcUFibnFmOkTqFKMuR8fNu3+YhFjy8vNSpcR5M0CKBECKMkrz4EbAwv4So6yUM C8jAwODEE9BalFuZgmq/CtGcQ5GJWHeOyBTeDLzSuA2vQI6ggnoCJ5LW0COKElESEk1MKbVNf 9e/Ucp9aaftdAKf4Hc5U/XyfgFXLjE0Cj3ddekuFTeXfMNJOrmuB2T+No7Ifscp+//w7rz52i 8YFmqrbDvYPUZswR/DdbVT0/9mLqeXbBO/5nuVF1PsWsF/9j2963UNvfgevLv/jvWjwZTZipL pU7um6aSJB27/d/d8m3PFOJ+bDIx36HEUpyRaKjFXFScCAAoM3PrdgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-8.tower-206.messagelabs.com!1505210635!110981200!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13431 invoked from network); 12 Sep 2017 10:03:56 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-8.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:03:56 -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 7292F15A2; Tue, 12 Sep 2017 03:03:55 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8490B3F578; Tue, 12 Sep 2017 03:03:54 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:19 +0100 Message-Id: <20170912100330.2168-14-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 13/24] xen/arm: page: Remove unused attributes DEV_NONSHARED and DEV_CACHED 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" They were imported from non-LPAE Linux, but Xen is LPAE only. It is time to do some clean-up in the memory attribute and keep only what make sense for Xen. Follow-up patch will do more clean-up. Also, update the comment saying our attribute matches Linux. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- Changes in v2: - Add Andre's reviewed-by --- xen/include/asm-arm/page.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index b8d641bfaf..d7939bb944 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -21,9 +21,9 @@ #define LPAE_SH_OUTER 0x2 #define LPAE_SH_INNER 0x3 -/* LPAE Memory region attributes, to match Linux's (non-LPAE) choices. - * Indexed by the AttrIndex bits of a LPAE entry; - * the 8-bit fields are packed little-endian into MAIR0 and MAIR1 +/* + * LPAE Memory region attributes. Indexed by the AttrIndex bits of a + * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1. * * ai encoding * UNCACHED 000 0000 0000 -- Strongly Ordered @@ -35,9 +35,7 @@ * reserved 110 * WRITEALLOC 111 1111 1111 -- Write-back write-allocate * - * DEV_NONSHARED 100 (== DEV_SHARED) * DEV_WC 001 (== BUFFERABLE) - * DEV_CACHED 011 (== WRITEBACK) */ #define MAIR0VAL 0xeeaa4400 #define MAIR1VAL 0xff000004 @@ -57,9 +55,7 @@ #define WRITEBACK 0x3 #define DEV_SHARED 0x4 #define WRITEALLOC 0x7 -#define DEV_NONSHARED DEV_SHARED #define DEV_WC BUFFERABLE -#define DEV_CACHED WRITEBACK #define PAGE_HYPERVISOR (WRITEALLOC) #define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED) From patchwork Tue Sep 12 10:03:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112284 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674666edi; Tue, 12 Sep 2017 03:05:56 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBd/RNXcFLY3vU01vhs9Jk0LEnCabu3yIDbqNlMHcqCZly9ChW3jOi824XNCw4RpcEdFSde X-Received: by 10.107.27.205 with SMTP id b196mr1227620iob.239.1505210756038; Tue, 12 Sep 2017 03:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210756; cv=none; d=google.com; s=arc-20160816; b=lupPoVNob4W0SD/A2+y40jym285GZ+Jr2shJ/SVOJ+Hf2UQ7M376QcKwg2sTsiTG55 R3Mpd6hU0lKGLL67TMjbdqYw1rWml1iYbdZaAQgim8SWJ4el4NRKQ5Uzl29cpHmQM5Cp 5zyRZ7D/fAxUMCsGngb2vv0iVsG34BCGN2LZXGTDBU6PeBSqmj+u3XW7G5T/21NJs+se AewtP+sBLIvMShehzC69VGrQ5t4ipomFdIVAgSF0AoJdT/0LtXrHe5MtRZUESnjgDLn1 n7YZioVFU9O6BdhH5v/QirIlUAKKwFeP4hP6yJJgifTuFKIWjor8UZAjTvvgLhbZPa+G 4KIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=MuD6x1Hym5GS+zx0NirtQgh44QHeaPyatEa3c5zVUps=; b=bkTojr8keweTmDMUxdubRvupb5c+de7KQVsX1LGRSsPYru1wfCgLm9my1RbrhsZkaP 9Cqf3VEMRYg9XWzvYyQp4Ruz7yiCspZ6Nbpz+XIGw9eZlk3LVevzDf7AUHNSQVJjllky CeksCKW8FEpaqZgag5REYKtoi9qtShMSA8rXxTTTF6CgHHcbE9Kp8fGzY6mgVgVXIa3l wUj9vngI6+A6Atto6bfOy6nMA+LaM6iCaV5md/vPv3lNc5/6PkPx2YhQyXxY67C/yUvJ vBhZHcbRGxjUGHfhWuntYvVaMzvelRZ/FEGxBUqnMr9at++anxcL9R6jlXAqnXIlaiYU 46Wg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id r5si10399019itr.160.2017.09.12.03.05.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:56 -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 1dri2y-00036g-24; Tue, 12 Sep 2017 10:04:00 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2w-00033r-RE for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:03:58 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 77/0F-02023-E01B7B95; Tue, 12 Sep 2017 10:03:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTZd34/Z Ig2+PpS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oy9N64zF+zhrPi67x1TA+NW9i5GLg4hgc2M Ep/O7WWGcE4zSqzb/ZKli5GTg01AU+LO509MILaIgLTEtc+XGUFsZoFIicMffrCD2MICARLvX lwGq2ERUJWYeuEkWC+vgKXEu79vmUFsCQF5iV1tF1lBbE6g+IqPv9hAbCEBC4nvL38wTmDkXs DIsIpRozi1qCy1SNfQQi+pKDM9oyQ3MTNH19DAVC83tbg4MT01JzGpWC85P3cTI9DDDECwg7F pu+chRkkOJiVR3t/C2yOF+JLyUyozEosz4otKc1KLDzHKcHAoSfD6rwfKCRalpqdWpGXmAEMN Ji3BwaMkwiu0ASjNW1yQmFucmQ6ROsWoy9Fx8+4fJiGWvPy8VClx3gyQGQIgRRmleXAjYGF/i VFWSpiXEegoIZ6C1KLczBJU+VeM4hyMSsK8GiBTeDLzSuA2vQI6ggnoCJ5LW0COKElESEk1ME ormTQXvnw5j7nlpYjvA17d2bfZKopeSafvzjz/SHUCr6zDM0XlOW06FfOvrf/yYcHSDtH9xyu M+Zr2eImZhK1Tk71bFbv92izP6xYr9/1hm73iqXxYhP/pj+r3L1w8VTN1o0Cd25Nrwtv3XI/x 6tZ4Vi9htGr/96C1rz64Zb/mrHMJf2zDYaTEUpyRaKjFXFScCAA6gOQ+dgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1505210636!74831598!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 1559 invoked from network); 12 Sep 2017 10:03:57 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-12.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:03:57 -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 9CEF61529; Tue, 12 Sep 2017 03:03:56 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AE5A63F578; Tue, 12 Sep 2017 03:03:55 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:20 +0100 Message-Id: <20170912100330.2168-15-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 14/24] xen/arm: page: Use directly BUFFERABLE and drop DEV_WC 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" DEV_WC is only used for PAGE_HYPERVISOR_WC and does not bring much improvement. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara --- Changes in v2: - Remove DEV_WC from the comment as well - Add Andre's reviewed-by --- xen/include/asm-arm/page.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index d7939bb944..ee0422579b 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -34,8 +34,6 @@ * ?? 101 * reserved 110 * WRITEALLOC 111 1111 1111 -- Write-back write-allocate - * - * DEV_WC 001 (== BUFFERABLE) */ #define MAIR0VAL 0xeeaa4400 #define MAIR1VAL 0xff000004 @@ -55,11 +53,10 @@ #define WRITEBACK 0x3 #define DEV_SHARED 0x4 #define WRITEALLOC 0x7 -#define DEV_WC BUFFERABLE #define PAGE_HYPERVISOR (WRITEALLOC) #define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED) -#define PAGE_HYPERVISOR_WC (DEV_WC) +#define PAGE_HYPERVISOR_WC (BUFFERABLE) /* * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be From patchwork Tue Sep 12 10:03:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112265 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674132edi; Tue, 12 Sep 2017 03:05:29 -0700 (PDT) X-Google-Smtp-Source: AOwi7QD7HSDvw6yfIUBhabzsIxsRiuKg+yfXg74XPf7ZgyKS3oGHirGwfplYBvhHhCGv5mE6Qwjf X-Received: by 10.107.141.130 with SMTP id p124mr9502743iod.288.1505210729747; Tue, 12 Sep 2017 03:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210729; cv=none; d=google.com; s=arc-20160816; b=gv9VINKenbPY1tqQcFHAqwGpH9ECDoFucYeoxBts0O/AuGN54i9IYXDQ07QgxU9yNv yDMkYgIC4Dd8A+w+PBSMvzjuCNo6+724ayvaH/6JFTXYPezWDqetaVmKrr1KuUe5GZb+ e6u/l9a0K9QayQsLMG8udZz1LyudPSLqtqICrQ6vS0vJXndeVIykzBinMlP2ogsqi0fH 50ItOhX9CZSmGfAeg2VccsS3qxKUAieP2jqp03qRwXqWvvquYyWu/wCxFvgszCOHH3E/ jGLxqbiXXWqoUHxO/Q/N+pT6WqzBiEw+QQUZ3zWzKqVokT4XrWNK0tH53ZxQHvSNnehZ iXBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=cp1kXcXKvMl17Nr6LJUNFda7X9y/Y5EnTDXWw4+KjV4=; b=ABZjHgAZfJFX4RCGeF69BTOSgl58h4D++cedZ1qmN1M+rHKAatYC2mDHCObsa2991O XffB6w+wDihCp67XPRGPc51Il4Y8bskyeqq5CVAj0Yv+vdL7Z5BNSTfW0Y/SbQzU2PvG ZJV9qt5uNW8CfAgd/0NvxaqtHgb0oI7Bjy/pettPxMJtAeYeWKyEFBxn7xD5CIpLsScj zeaBZUb2IlHKeJdJkFCOGKlzcfCd1IcGt3IsTr2Q0Vt7YST13Hyy50pa/CTAPnL3o4Kn 0oKJ2X6jqnwIhPe90T9HmRcNLIwEq1U+hAsjfzWYMKyknuni06Eb+IlVcvH/JGIAGn53 qzNg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id i68si11169315itf.10.2017.09.12.03.05.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:29 -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 1dri30-0003Ai-An; Tue, 12 Sep 2017 10:04:02 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2z-00038Q-7s for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:01 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id EF/51-02202-011B7B95; Tue, 12 Sep 2017 10:04:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsVysyfVTZdv4/Z Ig1/vTCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ox9b9cwFrz2qNi25Q5zA+Nn8y5GLg4hgc2M Ene/nGWEcE4zSjTvu8vcxcjJwSagKXHn8ycmEFtEQFri2ufLjCA2s0CkxOEPP9hBbGEBV4kbW 9vBalgEVCV6ty5jAbF5BSwlju6YDjZHQkBeYlfbRVYQmxMovuLjLzYQW0jAQuL7yx+MExi5Fz AyrGLUKE4tKkst0jWy1EsqykzPKMlNzMzRNTQw1ctNLS5OTE/NSUwq1kvOz93ECPRwPQMD4w7 Gy1v8DjFKcjApifIeWb89UogvKT+lMiOxOCO+qDQntfgQowwHh5IE73mQnGBRanpqRVpmDjDU YNISHDxKIrxxIGne4oLE3OLMdIjUKUZjjkc37v5h4ui4CSSFWPLy81KlxHnfgJQKgJRmlObBD YLFwCVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrx3QKbwZOaVwO17BXQKE9ApPJe2gJxSko iQkmpgTN18VfSG5Mqzyyuf+LIHdxkzL/FiM+E/O0nbtS3C4apCiVF0o0qQ7PcWq9WcB1y2LFp wW5jh8bK19y0jj62S/HLtG/N7m63nIiZ5Hrn/XiFoZ1n52beGFbJ5AtsPHb14eItUC1PArFtv l4Te0F/i/+PW/JfBbw+/NDiu2luZleq6ban5Fr53K5VYijMSDbWYi4oTASxgsLR8AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1505210638!109495371!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36622 invoked from network); 12 Sep 2017 10:03:58 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:03:58 -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 C69DF15A2; Tue, 12 Sep 2017 03:03:57 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D86C83F578; Tue, 12 Sep 2017 03:03:56 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:21 +0100 Message-Id: <20170912100330.2168-16-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 15/24] xen/arm: page: Prefix memory types with MT_ 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" This will avoid confusion in the code when using them. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Andre's reviewed-by --- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mm.c | 28 ++++++++++++++-------------- xen/arch/arm/platforms/vexpress.c | 2 +- xen/drivers/video/arm_hdlcd.c | 2 +- xen/include/asm-arm/page.h | 38 +++++++++++++++++++------------------- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index 7403ec0c0e..9c183f96da 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -54,7 +54,7 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len) s = paddr & (PAGE_SIZE-1); l = min(PAGE_SIZE - s, len); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), BUFFERABLE); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), MT_BUFFERABLE); memcpy(dst, src + s, l); clean_dcache_va_range(dst, l); diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 5716ef1123..7ffeb36bfa 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -290,7 +290,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) switch ( attr ) { - case BUFFERABLE: + case MT_BUFFERABLE: /* * ARM ARM: Overlaying the shareability attribute (DDI * 0406C.b B3-1376 to 1377) @@ -305,8 +305,8 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) */ e.pt.sh = LPAE_SH_OUTER; break; - case UNCACHED: - case DEV_SHARED: + case MT_UNCACHED: + case MT_DEV_SHARED: /* * Shareability is ignored for non-Normal memory, Outer is as * good as anything. @@ -369,7 +369,7 @@ static void __init create_mappings(lpae_t *second, count = nr_mfns / LPAE_ENTRIES; p = second + second_linear_offset(virt_offset); - pte = mfn_to_xen_entry(_mfn(base_mfn), WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(base_mfn), MT_WRITEALLOC); if ( granularity == 16 * LPAE_ENTRIES ) pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */ for ( i = 0; i < count; i++ ) @@ -422,7 +422,7 @@ void *map_domain_page(mfn_t mfn) else if ( map[slot].pt.avail == 0 ) { /* Commandeer this 2MB slot */ - pte = mfn_to_xen_entry(_mfn(slot_mfn), WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_WRITEALLOC); pte.pt.avail = 1; write_pte(map + slot, pte); break; @@ -543,7 +543,7 @@ static inline lpae_t pte_of_xenaddr(vaddr_t va) { paddr_t ma = va + phys_offset; - return mfn_to_xen_entry(maddr_to_mfn(ma), WRITEALLOC); + return mfn_to_xen_entry(maddr_to_mfn(ma), MT_WRITEALLOC); } /* Map the FDT in the early boot page table */ @@ -652,7 +652,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* Initialise xen second level entries ... */ /* ... Xen's text etc */ - pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC); pte.pt.xn = 0;/* Contains our text mapping! */ xen_second[second_table_offset(XEN_VIRT_START)] = pte; @@ -669,7 +669,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* ... Boot Misc area for xen relocation */ dest_va = BOOT_RELOC_VIRT_START; - pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC); /* Map the destination in xen_second. */ xen_second[second_table_offset(dest_va)] = pte; /* Map the destination in boot_second. */ @@ -700,7 +700,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT); if ( !is_kernel(va) ) break; - pte = mfn_to_xen_entry(mfn, WRITEALLOC); + pte = mfn_to_xen_entry(mfn, MT_WRITEALLOC); pte.pt.table = 1; /* 4k mappings always have this bit set */ if ( is_kernel_text(va) || is_kernel_inittext(va) ) { @@ -771,7 +771,7 @@ int init_secondary_pagetables(int cpu) for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ ) { pte = mfn_to_xen_entry(virt_to_mfn(domheap+i*LPAE_ENTRIES), - WRITEALLOC); + MT_WRITEALLOC); pte.pt.table = 1; write_pte(&first[first_table_offset(DOMHEAP_VIRT_START+i*FIRST_SIZE)], pte); } @@ -869,13 +869,13 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, mfn_t first_mfn = alloc_boot_pages(1, 1); clear_page(mfn_to_virt(first_mfn)); - pte = mfn_to_xen_entry(first_mfn, WRITEALLOC); + pte = mfn_to_xen_entry(first_mfn, MT_WRITEALLOC); pte.pt.table = 1; write_pte(p, pte); first = mfn_to_virt(first_mfn); } - pte = mfn_to_xen_entry(_mfn(mfn), WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(mfn), MT_WRITEALLOC); /* TODO: Set pte.pt.contig when appropriate. */ write_pte(&first[first_table_offset(vaddr)], pte); @@ -915,7 +915,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) for ( i = 0; i < nr_second; i++ ) { clear_page(mfn_to_virt(mfn_add(second_base, i))); - pte = mfn_to_xen_entry(mfn_add(second_base, i), WRITEALLOC); + pte = mfn_to_xen_entry(mfn_add(second_base, i), MT_WRITEALLOC); pte.pt.table = 1; write_pte(&xen_first[first_table_offset(FRAMETABLE_VIRT_START)+i], pte); } @@ -969,7 +969,7 @@ static int create_xen_table(lpae_t *entry) if ( p == NULL ) return -ENOMEM; clear_page(p); - pte = mfn_to_xen_entry(virt_to_mfn(p), WRITEALLOC); + pte = mfn_to_xen_entry(virt_to_mfn(p), MT_WRITEALLOC); pte.pt.table = 1; write_pte(entry, pte); return 0; diff --git a/xen/arch/arm/platforms/vexpress.c b/xen/arch/arm/platforms/vexpress.c index a26ac324ba..9badbc079d 100644 --- a/xen/arch/arm/platforms/vexpress.c +++ b/xen/arch/arm/platforms/vexpress.c @@ -65,7 +65,7 @@ int vexpress_syscfg(int write, int function, int device, uint32_t *data) uint32_t *syscfg = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC); int ret = -1; - set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), DEV_SHARED); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), MT_DEV_SHARED); if ( syscfg[V2M_SYS_CFGCTRL/4] & V2M_SYS_CFG_START ) goto out; diff --git a/xen/drivers/video/arm_hdlcd.c b/xen/drivers/video/arm_hdlcd.c index 3915f731f5..5fa7f518b1 100644 --- a/xen/drivers/video/arm_hdlcd.c +++ b/xen/drivers/video/arm_hdlcd.c @@ -227,7 +227,7 @@ void __init video_init(void) /* uses FIXMAP_MISC */ set_pixclock(videomode->pixclock); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), DEV_SHARED); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), MT_DEV_SHARED); HDLCD[HDLCD_COMMAND] = 0; HDLCD[HDLCD_LINELENGTH] = videomode->xres * bytes_per_pixel; diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index ee0422579b..30fcfa0778 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -25,15 +25,15 @@ * LPAE Memory region attributes. Indexed by the AttrIndex bits of a * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1. * - * ai encoding - * UNCACHED 000 0000 0000 -- Strongly Ordered - * BUFFERABLE 001 0100 0100 -- Non-Cacheable - * WRITETHROUGH 010 1010 1010 -- Write-through - * WRITEBACK 011 1110 1110 -- Write-back - * DEV_SHARED 100 0000 0100 -- Device - * ?? 101 - * reserved 110 - * WRITEALLOC 111 1111 1111 -- Write-back write-allocate + * ai encoding + * MT_UNCACHED 000 0000 0000 -- Strongly Ordered + * MT_BUFFERABLE 001 0100 0100 -- Non-Cacheable + * MT_WRITETHROUGH 010 1010 1010 -- Write-through + * MT_WRITEBACK 011 1110 1110 -- Write-back + * MT_DEV_SHARED 100 0000 0100 -- Device + * ?? 101 + * reserved 110 + * MT_WRITEALLOC 111 1111 1111 -- Write-back write-allocate */ #define MAIR0VAL 0xeeaa4400 #define MAIR1VAL 0xff000004 @@ -47,16 +47,16 @@ * registers, as defined above. * */ -#define UNCACHED 0x0 -#define BUFFERABLE 0x1 -#define WRITETHROUGH 0x2 -#define WRITEBACK 0x3 -#define DEV_SHARED 0x4 -#define WRITEALLOC 0x7 - -#define PAGE_HYPERVISOR (WRITEALLOC) -#define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED) -#define PAGE_HYPERVISOR_WC (BUFFERABLE) +#define MT_UNCACHED 0x0 +#define MT_BUFFERABLE 0x1 +#define MT_WRITETHROUGH 0x2 +#define MT_WRITEBACK 0x3 +#define MT_DEV_SHARED 0x4 +#define MT_WRITEALLOC 0x7 + +#define PAGE_HYPERVISOR (MT_WRITEALLOC) +#define PAGE_HYPERVISOR_NOCACHE (MT_DEV_SHARED) +#define PAGE_HYPERVISOR_WC (MT_BUFFERABLE) /* * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be From patchwork Tue Sep 12 10:03:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112264 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674119edi; Tue, 12 Sep 2017 03:05:28 -0700 (PDT) X-Google-Smtp-Source: AOwi7QChG/Ev6EazcWw1kQkHop8SKkj5c2O9Qk7VHQmxTxtOstjFV/op1pwMcZT9OH63bxLU5yX3 X-Received: by 10.107.138.223 with SMTP id c92mr17753224ioj.91.1505210728864; Tue, 12 Sep 2017 03:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210728; cv=none; d=google.com; s=arc-20160816; b=BnjSaqjpSWnzyx2CToXTbnLjQ4eRIpCmqTAoNRigTPrjg/O3pahMfZkxcvU0oigNl7 S1GCmkR/mYG8x15ehihTyD9TGu8dFIKw+IYrz01ZIbruGtWkEwLEOxTRn/llKh81T19X nxDmfL+ZacqpycGJEbBjA9m4IUee54W3zkddJOIYczXwbxEBcPB21H9P5T41GzrBZ3jd IIS5Wn9XU6JEnISJR6XDAB55/kx8WGepyHjLK6BtFwCElANUDgdqYJTaJSRDmj/IV5po mVXkqsDXYMhp6AgEZiR0gGweMTM84QaXgDeikNG0zhbUV6mh74ggeGmbZyWRbM1FksvH 7oKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=XLzA45VQzGirLgdy7UaHDNgpmZQPRO9KswQa/SGxyAU=; b=S4BN+kCCXGa4uf3Ln3FdfuHB0BeyhBRQ0W3uDJ35gZ37Zj/6X2G5mV1rFMh1y/VCLI V4yMF9DStWghvF6QloRWp72zjaPmJnCEGrncIyexy934guqzzUGeJ6cchutn7B+xNfka IITYbiSUAOq2fK8Y6qnMIAOO2aGLTNnzBe4Es2u1egAZVBfy1bdfVBJBgyE0QcVNdcMt YBtJ9tuAd1LbghSkn0q6yVjxg9m+aNCK7jzw5lzh/uF0s0xNu+84uhkOajntuGUtR3M6 P87rF9KDyl79fzS60IwK24Oz94KfPgIVMMGo7XPuCJaoOC9V1LNOPg89HUQzYeQq5Uhl dIow== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id e200si10252704ite.204.2017.09.12.03.05.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:28 -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 1dri31-0003Dl-Ow; Tue, 12 Sep 2017 10:04:03 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri2z-00038N-JE for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:01 +0000 Received: from [85.158.143.35] by server-8.bemta-6.messagelabs.com id 84/C6-17770-011B7B95; Tue, 12 Sep 2017 10:04:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRWlGSWpSXmKPExsVysyfVTZd/4/Z Ig6OHzC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1owv25cwFSz1rPh8eQNTA+Nxiy5GLg4hgc2M EndaHrFAOKcZJZq2nAdyODnYBDQl7nz+xARiiwhIS1z7fJkRxGYWiJQ4/OEHO4gtLBAgsWr/G rAaFgFViT+/t4DV8ApYSmy/u4wNxJYQkJfY1XaRFcTmBIqv+PgLLC4kYCHx/eUPxgmM3AsYGV YxahSnFpWlFukamuolFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFesl5+duYgR6mAEIdjB+WxZ wiFGSg0lJlPfI+u2RQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4PTcA5QSLUtNTK9Iyc4ChBpOW 4OBREuG9BtLKW1yQmFucmQ6ROsVozPHoxt0/TBwdN4GkEEtefl6qlDhvFMgkAZDSjNI8uEGwG LjEKCslzMsIdJoQT0FqUW5mCar8K0ZxDkYlYd47IAt5MvNK4Pa9AjqFCegUnktbQE4pSURIST UwMq4tKWabWTEtdqtEhQ+jhNwB89eWU24v+yecK/zm8oe7E3UePp+os7jpY9uFOX1tv6pVOae o/H+1mjfz6c70X9EvnoXPvK9+XEr2aOOmUo13z2XtzA98PFo8rZVL2vcl+xJjzXi5M9zfIpd9 vpD8+LvFuwvLXih7WqpN9LngM7Pxdqex8atfu5RYijMSDbWYi4oTAdDnSGh8AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1505210639!78928801!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 47072 invoked from network); 12 Sep 2017 10:03:59 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-21.messagelabs.com with SMTP; 12 Sep 2017 10:03:59 -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 F091E1529; Tue, 12 Sep 2017 03:03:58 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0E3153F578; Tue, 12 Sep 2017 03:03:57 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:22 +0100 Message-Id: <20170912100330.2168-17-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 16/24] xen/arm: page: Use ARMv8 naming to improve readability 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" This is based on the Linux ARMv8 naming scheme (see arch/arm64/mm/proc.S). Each type will contain "NORMAL" or "DEVICE" to make clear whether each attribute targets device or normal memory. Signed-off-by: Julien Grall --- Changes in v2: * Move the patch before "xen/arm: page: Clean-up the definition of MAIRVAL" --- xen/arch/arm/kernel.c | 2 +- xen/arch/arm/mm.c | 28 ++++++++++++++-------------- xen/arch/arm/platforms/vexpress.c | 2 +- xen/drivers/video/arm_hdlcd.c | 2 +- xen/include/asm-arm/page.h | 32 ++++++++++++++++---------------- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index 9c183f96da..a12baa86e7 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -54,7 +54,7 @@ void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len) s = paddr & (PAGE_SIZE-1); l = min(PAGE_SIZE - s, len); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), MT_BUFFERABLE); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(paddr), MT_NORMAL_NC); memcpy(dst, src + s, l); clean_dcache_va_range(dst, l); diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 7ffeb36bfa..fc76f03526 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -290,7 +290,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) switch ( attr ) { - case MT_BUFFERABLE: + case MT_NORMAL_NC: /* * ARM ARM: Overlaying the shareability attribute (DDI * 0406C.b B3-1376 to 1377) @@ -305,8 +305,8 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) */ e.pt.sh = LPAE_SH_OUTER; break; - case MT_UNCACHED: - case MT_DEV_SHARED: + case MT_DEVICE_nGnRnE: + case MT_DEVICE_nGnRE: /* * Shareability is ignored for non-Normal memory, Outer is as * good as anything. @@ -369,7 +369,7 @@ static void __init create_mappings(lpae_t *second, count = nr_mfns / LPAE_ENTRIES; p = second + second_linear_offset(virt_offset); - pte = mfn_to_xen_entry(_mfn(base_mfn), MT_WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(base_mfn), MT_NORMAL); if ( granularity == 16 * LPAE_ENTRIES ) pte.pt.contig = 1; /* These maps are in 16-entry contiguous chunks. */ for ( i = 0; i < count; i++ ) @@ -422,7 +422,7 @@ void *map_domain_page(mfn_t mfn) else if ( map[slot].pt.avail == 0 ) { /* Commandeer this 2MB slot */ - pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_NORMAL); pte.pt.avail = 1; write_pte(map + slot, pte); break; @@ -543,7 +543,7 @@ static inline lpae_t pte_of_xenaddr(vaddr_t va) { paddr_t ma = va + phys_offset; - return mfn_to_xen_entry(maddr_to_mfn(ma), MT_WRITEALLOC); + return mfn_to_xen_entry(maddr_to_mfn(ma), MT_NORMAL); } /* Map the FDT in the early boot page table */ @@ -652,7 +652,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* Initialise xen second level entries ... */ /* ... Xen's text etc */ - pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_NORMAL); pte.pt.xn = 0;/* Contains our text mapping! */ xen_second[second_table_offset(XEN_VIRT_START)] = pte; @@ -669,7 +669,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) /* ... Boot Misc area for xen relocation */ dest_va = BOOT_RELOC_VIRT_START; - pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_WRITEALLOC); + pte = mfn_to_xen_entry(maddr_to_mfn(xen_paddr), MT_NORMAL); /* Map the destination in xen_second. */ xen_second[second_table_offset(dest_va)] = pte; /* Map the destination in boot_second. */ @@ -700,7 +700,7 @@ void __init setup_pagetables(unsigned long boot_phys_offset, paddr_t xen_paddr) unsigned long va = XEN_VIRT_START + (i << PAGE_SHIFT); if ( !is_kernel(va) ) break; - pte = mfn_to_xen_entry(mfn, MT_WRITEALLOC); + pte = mfn_to_xen_entry(mfn, MT_NORMAL); pte.pt.table = 1; /* 4k mappings always have this bit set */ if ( is_kernel_text(va) || is_kernel_inittext(va) ) { @@ -771,7 +771,7 @@ int init_secondary_pagetables(int cpu) for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ ) { pte = mfn_to_xen_entry(virt_to_mfn(domheap+i*LPAE_ENTRIES), - MT_WRITEALLOC); + MT_NORMAL); pte.pt.table = 1; write_pte(&first[first_table_offset(DOMHEAP_VIRT_START+i*FIRST_SIZE)], pte); } @@ -869,13 +869,13 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, mfn_t first_mfn = alloc_boot_pages(1, 1); clear_page(mfn_to_virt(first_mfn)); - pte = mfn_to_xen_entry(first_mfn, MT_WRITEALLOC); + pte = mfn_to_xen_entry(first_mfn, MT_NORMAL); pte.pt.table = 1; write_pte(p, pte); first = mfn_to_virt(first_mfn); } - pte = mfn_to_xen_entry(_mfn(mfn), MT_WRITEALLOC); + pte = mfn_to_xen_entry(_mfn(mfn), MT_NORMAL); /* TODO: Set pte.pt.contig when appropriate. */ write_pte(&first[first_table_offset(vaddr)], pte); @@ -915,7 +915,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) for ( i = 0; i < nr_second; i++ ) { clear_page(mfn_to_virt(mfn_add(second_base, i))); - pte = mfn_to_xen_entry(mfn_add(second_base, i), MT_WRITEALLOC); + pte = mfn_to_xen_entry(mfn_add(second_base, i), MT_NORMAL); pte.pt.table = 1; write_pte(&xen_first[first_table_offset(FRAMETABLE_VIRT_START)+i], pte); } @@ -969,7 +969,7 @@ static int create_xen_table(lpae_t *entry) if ( p == NULL ) return -ENOMEM; clear_page(p); - pte = mfn_to_xen_entry(virt_to_mfn(p), MT_WRITEALLOC); + pte = mfn_to_xen_entry(virt_to_mfn(p), MT_NORMAL); pte.pt.table = 1; write_pte(entry, pte); return 0; diff --git a/xen/arch/arm/platforms/vexpress.c b/xen/arch/arm/platforms/vexpress.c index 9badbc079d..df2c4b5bec 100644 --- a/xen/arch/arm/platforms/vexpress.c +++ b/xen/arch/arm/platforms/vexpress.c @@ -65,7 +65,7 @@ int vexpress_syscfg(int write, int function, int device, uint32_t *data) uint32_t *syscfg = (uint32_t *) FIXMAP_ADDR(FIXMAP_MISC); int ret = -1; - set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), MT_DEV_SHARED); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(V2M_SYS_MMIO_BASE), MT_DEVICE_nGnRE); if ( syscfg[V2M_SYS_CFGCTRL/4] & V2M_SYS_CFG_START ) goto out; diff --git a/xen/drivers/video/arm_hdlcd.c b/xen/drivers/video/arm_hdlcd.c index 5fa7f518b1..1175399dbc 100644 --- a/xen/drivers/video/arm_hdlcd.c +++ b/xen/drivers/video/arm_hdlcd.c @@ -227,7 +227,7 @@ void __init video_init(void) /* uses FIXMAP_MISC */ set_pixclock(videomode->pixclock); - set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), MT_DEV_SHARED); + set_fixmap(FIXMAP_MISC, maddr_to_mfn(hdlcd_start), MT_DEVICE_nGnRE); HDLCD[HDLCD_COMMAND] = 0; HDLCD[HDLCD_LINELENGTH] = videomode->xres * bytes_per_pixel; diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 30fcfa0778..899fd1801a 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -26,14 +26,14 @@ * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1. * * ai encoding - * MT_UNCACHED 000 0000 0000 -- Strongly Ordered - * MT_BUFFERABLE 001 0100 0100 -- Non-Cacheable - * MT_WRITETHROUGH 010 1010 1010 -- Write-through - * MT_WRITEBACK 011 1110 1110 -- Write-back - * MT_DEV_SHARED 100 0000 0100 -- Device + * MT_DEVICE_nGnRE 000 0000 0000 -- Strongly Ordered/Device nGnRnE + * MT_NORMAL_NC 001 0100 0100 -- Non-Cacheable + * MT_NORMAL_WT 010 1010 1010 -- Write-through + * MT_NORMAL_WB 011 1110 1110 -- Write-back + * MT_DEVICE_nGnRE 100 0000 0100 -- Device nGnRE * ?? 101 * reserved 110 - * MT_WRITEALLOC 111 1111 1111 -- Write-back write-allocate + * MT_NORMAL 111 1111 1111 -- Write-back write-allocate */ #define MAIR0VAL 0xeeaa4400 #define MAIR1VAL 0xff000004 @@ -47,16 +47,16 @@ * registers, as defined above. * */ -#define MT_UNCACHED 0x0 -#define MT_BUFFERABLE 0x1 -#define MT_WRITETHROUGH 0x2 -#define MT_WRITEBACK 0x3 -#define MT_DEV_SHARED 0x4 -#define MT_WRITEALLOC 0x7 - -#define PAGE_HYPERVISOR (MT_WRITEALLOC) -#define PAGE_HYPERVISOR_NOCACHE (MT_DEV_SHARED) -#define PAGE_HYPERVISOR_WC (MT_BUFFERABLE) +#define MT_DEVICE_nGnRnE 0x0 +#define MT_NORMAL_NC 0x1 +#define MT_NORMAL_WT 0x2 +#define MT_NORMAL_WB 0x3 +#define MT_DEVICE_nGnRE 0x4 +#define MT_NORMAL 0x7 + +#define PAGE_HYPERVISOR (MT_NORMAL) +#define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE) +#define PAGE_HYPERVISOR_WC (MT_NORMAL_NC) /* * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be From patchwork Tue Sep 12 10:03:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112282 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674642edi; Tue, 12 Sep 2017 03:05:54 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAQ6VhsJQCpaa+4c7JlA5cWtfItf0R8Ei4bFWFwB7frVzIoRwCfAthDo891uHNVDnBSaaXx X-Received: by 10.107.202.133 with SMTP id a127mr18933816iog.22.1505210754785; Tue, 12 Sep 2017 03:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210754; cv=none; d=google.com; s=arc-20160816; b=XLVL5yJjZMhJwrUHali4OVBPTBeEK2EtmOUQU9rhWUXZvDyjISKQiwWPDHFAUzI/wl zLEzTxP1SAmqDF2d03P3T68ZLhLoZ6TslKNNP3Xq1lE2bL8uyE8cCJ3jV7gZ67bAARxE hjRF6Kb3AdIUMH0ci6jT+EUi5D5sqHwzQ7tH00qRR7RkOqxw+rWswOikH0cYciQkB9fj TMSH8tf2MugU02HxF7TX3HOHYxDkbGaEStdjX6dTz4pPU3Ocraz9uHFAocdYxbhEQ1zq /4Rl3bJWbbVnaXhbDeYCaSKj4n6VILxkZ29xYudWF+g3Dvs8oTfw7OHJurrxAojnfFNt 5Qdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=ZLkEJoGUWhYGZhL0S2FTZ8p0eygy1B9ydzgBIoNd1V0=; b=CJDDAqk4plBnnmtsdlQZO2hpohmpgojmnJKwcsurW5yhWFgiMXEhNfvXCzp/5cWEUf 4lINXn/18n4fG8v9TcuAV9NUjfMRxkOnDVJMfAQ66eSa7XPt4RRFaOezq8WMm8p4Fd8m MzDMBmJGt1Qoso6NYkmTuODDgw9MTnrQQVl5g7Kd5oNBv9YicG7elXZB6khFGMqFuMYI 3ZVcMObKZhDbL02VmxUMr/KNxc47mV+VI7qLxUu9ezgg5Ax19hnN0nKPggn/zZok5bjh FaKgCWhHdfDl5OcwkN/EsbvJzYHzq6BgNn1g7QoNTZo3NLwqgx1XrU4p4kETN2SHDMb3 oqBw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id d99si2803313ioj.8.2017.09.12.03.05.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:54 -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 1dri32-0003EX-0P; Tue, 12 Sep 2017 10:04:04 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri30-00039r-Ac for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:02 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 83/0D-01760-111B7B95; Tue, 12 Sep 2017 10:04:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsVysyfVTVdg4/Z Ig2MrLC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ox3R5axF2wSrrj/aSVbA+Mk/i5GLg4hgc2M Eh1v1zJ2MXICOacZJW6vEwSx2QQ0Je58/sQEYosISEtc+3wZrIZZIFLi8Icf7CC2sIC3xLJrC 5hBbBYBVYldT+eD1fAKWEosm72eBcSWEJCX2NV2kRXE5gSKr/j4iw1il4XE95c/GCcwci9gZF jFqFGcWlSWWqRraKaXVJSZnlGSm5iZo2toYKqXm1pcnJiempOYVKyXnJ+7iRHoXwYg2ME49X3 cIUZJDiYlUd4j67dHCvEl5adUZiQWZ8QXleakFh9ilOHgUJLgZd8AlBMsSk1PrUjLzAEGGkxa goNHSYT3Gkgrb3FBYm5xZjpE6hSjLkfHzbt/mIRY8vLzUqXEed+AFAmAFGWU5sGNgAX9JUZZK WFeRqCjhHgKUotyM0tQ5V8xinMwKgnz3gGZwpOZVwK36RXQEUxAR/Bc2gJyREkiQkqqgdHr/p oFb93E7CbJdexi3GR988LkP/2vzV7Lyk7Wa9WJ7Tz45G7bxGuyjF82rH5Q+EU7f+cfVm+RO62 ipyT36Uk78Lwo/C42j/s1z5flTvyv9v+Y8IE77IjzfXfD2u/Xas5M8P9pbf4xqupOVd6WxE/z eWZJmnySvD6F82nr4lt3RYr2fOWJuyWoxFKckWioxVxUnAgAjGmQ2XUCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1505210640!95619857!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 46495 invoked from network); 12 Sep 2017 10:04:00 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-13.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:04:00 -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 2695C15BF; Tue, 12 Sep 2017 03:04:00 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 381C43F578; Tue, 12 Sep 2017 03:03:59 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:23 +0100 Message-Id: <20170912100330.2168-18-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 17/24] xen/arm: page: Clean-up the definition of MAIRVAL 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" Currently MAIRVAL is defined in term of MAIR0VAL and MAIR1VAL which are both hardcoded value. This makes quite difficult to understand the value written in both registers. Rework the definition by using value of each attribute shifted by their associated index. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Move this patch after "xen/arm: page: Use ARMv8 naming to improve readability" --- xen/include/asm-arm/page.h | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 899fd1801a..088746828d 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -22,6 +22,21 @@ #define LPAE_SH_INNER 0x3 /* + * Attribute Indexes. + * + * These are valid in the AttrIndx[2:0] field of an LPAE stage 1 page + * table entry. They are indexes into the bytes of the MAIR* + * registers, as defined above. + * + */ +#define MT_DEVICE_nGnRnE 0x0 +#define MT_NORMAL_NC 0x1 +#define MT_NORMAL_WT 0x2 +#define MT_NORMAL_WB 0x3 +#define MT_DEVICE_nGnRE 0x4 +#define MT_NORMAL 0x7 + +/* * LPAE Memory region attributes. Indexed by the AttrIndex bits of a * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1. * @@ -35,24 +50,17 @@ * reserved 110 * MT_NORMAL 111 1111 1111 -- Write-back write-allocate */ -#define MAIR0VAL 0xeeaa4400 -#define MAIR1VAL 0xff000004 -#define MAIRVAL (MAIR0VAL|MAIR1VAL<<32) +#define MAIR(attr, mt) (_AC(attr, ULL) << ((mt) * 8)) -/* - * Attribute Indexes. - * - * These are valid in the AttrIndx[2:0] field of an LPAE stage 1 page - * table entry. They are indexes into the bytes of the MAIR* - * registers, as defined above. - * - */ -#define MT_DEVICE_nGnRnE 0x0 -#define MT_NORMAL_NC 0x1 -#define MT_NORMAL_WT 0x2 -#define MT_NORMAL_WB 0x3 -#define MT_DEVICE_nGnRE 0x4 -#define MT_NORMAL 0x7 +#define MAIRVAL (MAIR(0x00, MT_DEVICE_nGnRnE)| \ + MAIR(0x44, MT_NORMAL_NC) | \ + MAIR(0xaa, MT_NORMAL_WT) | \ + MAIR(0xee, MT_NORMAL_WB) | \ + MAIR(0x04, MT_DEVICE_nGnRE) | \ + MAIR(0xff, MT_NORMAL)) + +#define MAIR0VAL (MAIRVAL & 0xffffffff) +#define MAIR1VAL (MAIRVAL >> 32) #define PAGE_HYPERVISOR (MT_NORMAL) #define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE) From patchwork Tue Sep 12 10:03:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112263 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674066edi; Tue, 12 Sep 2017 03:05:25 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDL93BB63Q0o5oNJ/PoVCStjK03fha5RblQrqCspYU5bqsasJkqxuOd3s5VU19FfN6jHsfn X-Received: by 10.36.152.133 with SMTP id n127mr262181itd.17.1505210725604; Tue, 12 Sep 2017 03:05:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210725; cv=none; d=google.com; s=arc-20160816; b=Ge7baedBjKfpJafpzqHi0r9/KdHw8HDuVweN593je0R7riVrkeIAXw8uL1u+ZTdr1S h88R3FqpwJBX5kHU5VVMAxZygDb+5DSA1EfAl7bPxaEgnQx+VGJjxyyOp3AKTQROTeDY uIFSWTPSAi2SeOvgJ9yTsmjceEBy8ZEf3DQeLv96+EvOhGqXR+oFLBA4hABqxSxHyC0J uGblRgZ3wTu2NIm+HgbeiWXjpolL5AfGn8PO7XtQSy3aLG+MQcCQNOYNH08298wsG/HR ZzbotAQTZzhO9aZnQJvNbyEfkTWcF4nhOxPwh2s84m+LBwjOo6jXSwp0e15SlcOXUGid o8UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=i5yp3SYgCHONVnE0HiL1vax+I6H3fp/DnqqNexix6+c=; b=o1W8NiucVYy2T2swSPQoyCgdp0Dqc3gGCchVxNstV6uMn8n2qO1kdSvruE29wehOt8 Hj7b/IGU+bA2c4PKZox9HNd4I7iivCIGMz/QxR72XCv1JIbrX03zlzb+HtUv5bfLcowW GKhBbCPKLcD6VzOdBVpWpfT7lYNc/XPsO/L4qRQWih9p5NrGWS8JG1B84uDtH2LV7Vnt 1G1tNeQHfDtZvvJS+gPEqDskDlOSx/656yMhZi7c/xsoKfEmmikv5uipCClmwBEGIwjb kgPuWZKSh7hoa3ZMGOUDhbH/2BYsrza8TkabIf7fUGshaCFK0qLdFrFFZsHJft3N/zYL hdyA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id s206si11066872itd.200.2017.09.12.03.05.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:25 -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 1dri32-0003FH-7o; Tue, 12 Sep 2017 10:04:04 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri31-0003Cn-Jm for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:03 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 65/DB-02044-211B7B95; Tue, 12 Sep 2017 10:04:02 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTVdo4/Z Ig2lTWC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oxJa/ULnotUvJ99g62B8QlfFyMXh5DAZkaJ hs+T2SCc04wSSzevZu9i5ORgE9CUuPP5ExOILSIgLXHt82VGEJtZIFLi8IcfYDXCQPbqpa3MI DaLgKrEikOrWEFsXgFLiZZD98DiEgLyErvaLoLFOYHiKz7+YgOxhQQsJL6//ME4gZF7ASPDKk b14tSistQiXUu9pKLM9IyS3MTMHF1DA2O93NTi4sT01JzEpGK95PzcTYxA79YzMDDuYHz90+k QoyQHk5Io75H12yOF+JLyUyozEosz4otKc1KLDzHKcHAoSfCybwDKCRalpqdWpGXmAMMMJi3B waMkwisEkuYtLkjMLc5Mh0idYtTl6Lh59w+TEEtefl6qlDjvG5D5AiBFGaV5cCNgIX+JUVZKm JeRgYFBiKcgtSg3swRV/hWjOAejkjCvHMgqnsy8ErhNr4COYAI6gufSFpAjShIRUlINjGtXC7 qVHzq9ad1C/yOWcwW/i7WeD9zLnRE96Xm8doBV3u7PwsfuupVnTJeo9Pi3v3DdS62v72+bvlx wX6Yr+lS1x+IynrOvVTxX3bvfPfF45/u8+3M18h3shJdqLDFd916kM25t7jF7/wVx04P81nWk /5vfadR9JM/ipP6ejx/WheZaF0d80FdiKc5INNRiLipOBACPrhC5dAIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1505210641!111127284!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20744 invoked from network); 12 Sep 2017 10:04:01 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-31.messagelabs.com with SMTP; 12 Sep 2017 10:04:01 -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 50B57165D; Tue, 12 Sep 2017 03:04:01 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 622673F578; Tue, 12 Sep 2017 03:04:00 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:24 +0100 Message-Id: <20170912100330.2168-19-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 18/24] xen/arm: mm: Rename and clarify AP[1] in the stage-1 page table 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 description of AP[1] in Xen is based on testing rather than the ARM ARM. Per the ARM ARM, on EL2 stage-1 page table, AP[1] is RES1 as the translation regime applies to only one exception level (see D4.4.4 and G4.6.1 in ARM DDI 0487B.a). Update the comment and also rename the field to match the description in the ARM ARM. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Acked-by: Stefano Stabellini --- Changes in v2: - Add Andre's reviewed-by --- xen/arch/arm/mm.c | 10 +++++----- xen/include/asm-arm/lpae.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index fc76f03526..b3286b4a89 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -273,7 +273,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) .table = 0, /* Set to 1 for links and 4k maps */ .ai = attr, .ns = 1, /* Hyp mode is in the non-secure world */ - .user = 1, /* See below */ + .up = 1, /* See below */ .ro = 0, /* Assume read-write */ .af = 1, /* No need for access tracking */ .ng = 1, /* Makes TLB flushes easier */ @@ -282,10 +282,10 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr) .avail = 0, /* Reference count for domheap mapping */ }}; /* - * Setting the User bit is strange, but the ATS1H[RW] instructions - * don't seem to work otherwise, and since we never run on Xen - * pagetables in User mode it's OK. If this changes, remember - * to update the hard-coded values in head.S too. + * For EL2 stage-1 page table, up (aka AP[1]) is RES1 as the translation + * regime applies to only one exception level (see D4.4.4 and G4.6.1 + * in ARM DDI 0487B.a). If this changes, remember to update the + * hard-coded values in head.S too. */ switch ( attr ) diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h index 118ee5ae1a..b30853e79d 100644 --- a/xen/include/asm-arm/lpae.h +++ b/xen/include/asm-arm/lpae.h @@ -35,7 +35,7 @@ typedef struct __packed { */ unsigned long ai:3; /* Attribute Index */ unsigned long ns:1; /* Not-Secure */ - unsigned long user:1; /* User-visible */ + unsigned long up:1; /* Unpriviledged access */ unsigned long ro:1; /* Read-Only */ unsigned long sh:2; /* Shareability */ unsigned long af:1; /* Access Flag */ From patchwork Tue Sep 12 10:03:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112266 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674148edi; Tue, 12 Sep 2017 03:05:30 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBQawmqF0bxhw28YwZFQyBKZkuFJUmtGh77rRMaRdoSQJcZ7HuqURIxpcqltpL0euRCc9Pi X-Received: by 10.107.164.97 with SMTP id n94mr21160038ioe.162.1505210730500; Tue, 12 Sep 2017 03:05:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210730; cv=none; d=google.com; s=arc-20160816; b=crK8K+EcGSCD9zOuokwvSp2fsq7Uegt6Q+tDqnYfnGYym90JlL/8odMt8dQbv4QKD1 3XlRBYWEH/dEIHy+zJ0OYJ9yKOgwxOdA919DP1ryhiyvPFcTKACGDCVb2ryHc6mo8AKk vnM3g6VHMayq4ZT72m8WwHiK8DBXfuWYq9aCU/+kWynSZLasEXeyVlRvWDcm9uLtRIWi 1CCiIsrB1GAEQLWrxqG4C7mPAgTTV208zmDMm+SZtU4Vm0EXMeB5yieFdWKSrsfY9gx+ eUdU/2XAX2aHZHLvHFlWbRrQIaHoCTP5AWLYTw2gA2rQEBR/unLgrVJNKjoOAafUzAAp ACNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=LyYGAS4osaVxS/RD9ko1YRVFz+WNIQNIU0zdZQFTe8s=; b=arSV2JQQEzuhitZWR1yCy8FDNwAZ/mn2m8Y7reQj/o+5QcE5PFAJ3NYbP41AKANHZ/ hhhknI0XhJQPxyqMBcRxinpWE2KYAX9z5PzyE0hdTgqyU6zpr09RVzxWetMUSXAlT1B1 47/HcXH64m9Tf8WY2hnVfr3dA1UrxKszaj75RNPsrYuHWuGiK+/1pzP4hb4OHVER3gA0 tOkfluu71CoZNghe/qzXJx1/NtjZiMU624iohG4w3vn7538NY9k3CgmXwYk9yQRAbyfo tWm7+IUoOeK7+hn49ubfvIXPSw2Va5iw93Fe6TZX02vtSUi29LoKTkEYpFdBB8vfxng1 ecbw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id e129si10088922ioa.298.2017.09.12.03.05.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:30 -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 1dri34-0003Jn-Fl; Tue, 12 Sep 2017 10:04:06 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri33-0003HJ-Iz for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:05 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id E3/E4-03610-411B7B95; Tue, 12 Sep 2017 10:04:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTVd44/Z Ig64j3BZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bp5vtMBV85KlbfO8XcwDiFvYuRk0NIYDOj xNNmxi5GLiD7NKPEnJd3wBJsApoSdz5/YgKxRQSkJa59vswIYjMLREoc/vADrEZYIFpizdkjL CA2i4CqxIp958BqeAUsJc5/u8EMYksIyEvsarvICmJzAsVXfPzFBrHYQuL7yx+MExi5FzAyrG JUL04tKkst0jXUSyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQI9C4DEOxg3Pnc6RC jJAeTkijvb+HtkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeM+vB8oJFqWmp1akZeYAwwwmLcHB oyTCGweS5i0uSMwtzkyHSJ1i1OXouHn3D5MQS15+XqqUOG8GSJEASFFGaR7cCFjIX2KUlRLmZ QQ6SoinILUoN7MEVf4VozgHo5Iwr9wGoCk8mXklcJteAR3BBHQEz6UtIEeUJCKkpBoYS961TD g9+eiEYL/JV7jTmO9IbO5nfromLGmVsZO1s9zG6MvRUnH9jv9eBsQ2SZ5eWMYma7TgfrS50pJ 38bnlvRM7UnyWXVHU3n1q3pIPyr9+7/6i+G53Ko/XvzXLPx6WW3PcfOtcuX+Gn7WeHUnvcNaO urDs0LwNUk9muQVefN88YX/UK/2tF5RYijMSDbWYi4oTAUzbrfh0AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1505210642!103883571!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40587 invoked from network); 12 Sep 2017 10:04:03 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-27.messagelabs.com with SMTP; 12 Sep 2017 10:04:03 -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 7B5341529; Tue, 12 Sep 2017 03:04:02 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8C50C3F578; Tue, 12 Sep 2017 03:04:01 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:25 +0100 Message-Id: <20170912100330.2168-20-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 19/24] xen/arm: Switch to SYS_STATE_boot just after end_boot_allocator() 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" We should consider the early boot period to end when we stop using the boot allocator. This is inline with x86 and will be helpful to know whether we should allocate memory from the boot allocator or xenheap. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Andre's reviewed-by --- xen/arch/arm/setup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index b00eebd96e..b0306a917b 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -757,6 +757,12 @@ void __init start_xen(unsigned long boot_phys_offset, end_boot_allocator(); + /* + * The memory subsystem has been initialized, we can now switch from + * early_boot -> boot. + */ + system_state = SYS_STATE_boot; + vm_init(); if ( acpi_disabled ) @@ -779,8 +785,6 @@ void __init start_xen(unsigned long boot_phys_offset, console_init_preirq(); console_init_ring(); - system_state = SYS_STATE_boot; - processor_id(); smp_init_cpus(); From patchwork Tue Sep 12 10:03:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112285 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674711edi; Tue, 12 Sep 2017 03:05:58 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBez0K7YcjENLFGScmo73a/2LGbGj+wkjcgnNFEM/PRi+cyfIhe0UZvaq2rznW+0EOGPo6j X-Received: by 10.36.77.66 with SMTP id l63mr262122itb.49.1505210758522; Tue, 12 Sep 2017 03:05:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210758; cv=none; d=google.com; s=arc-20160816; b=agVD/9TD/RoWqkdCTnmlAHSUx1yFhFFCW4QEBGhCdd+1GmqsKcPIrCVoFSs92Dc1MB gemm4RNkytPP/sdboXq7K956DiKYIUOcWSCQdE6UekZGzumrTW4GBNgai7zMAyt9VvlV So833810KLpr2h9G3y0cTcMNTDj/9VHHh3UJD8NCsI15DTGu4I1E4kMqd0vi2lIGu4wq xHJWT/I6E52/AgcEKW1H5lh55kIUbkeRIJpoFuL88jcxKsOSF3xObzkl1xkLboH1zpVZ uyS++LEY3ZtI7nsXUsOgMGCrxpSpHWtntBjRRCDf7dKNE3jWnvuYJOBPDL2efXpp09PA CehA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=3Zkgr53pNBV8ABVmBRFb8XpSHCHT/qfOHYcQ1l0H/SQ=; b=kEROAr3esMGW7yS1rhbJqQBkKDREbU63UhyHVz56Z8PKSdy5j2mTqQCMb5Oqm8ci+e MCkpLgMnSXuZg10d15xx0IsvStPZhtEvsYYf7+mCGbhh1JeSAUi7rKfeCUNVO1Py0WEL InQ/X7GkKbj4EjBZmTxzWaybcSwMR8Ccey6rA1TpC37iE1MvxuHZx2oNS+q+lb5MEAaU xwKceWWwKrDcOqzpSl0nG6byxu4ybVkFIG1jUcrgXsIuicgH4XZRPovD8ntDlWjQb1sC wpei7gX++PBkcEkj1pamFx6xCpwOKo8QHdZ5mmFLlzm6rhTpddTJUitT51jksCkVRdo1 WZ0g== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id l22si10502864ita.21.2017.09.12.03.05.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:58 -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 1dri35-0003MH-NK; Tue, 12 Sep 2017 10:04:07 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri34-0003Hq-1C for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:06 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id D7/DF-01812-511B7B95; Tue, 12 Sep 2017 10:04:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTVdk4/Z Ig48npC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozlq3+zFJzgq3ix6x9zA2MPZxcjF4eQwGZG ie75J9ggnNOMErebuhm7GDk52AQ0Je58/sQEYosISEtc+3wZLM4sEClx+MMPdhBbWCBUYnvLL 6AaDg4WAVWJCWfiQMK8ApYS81duYAWxJQTkJXa1XQSzOYHiKz7+YgOxhQQsJL6//ME4gZF7AS PDKkb14tSistQiXRO9pKLM9IyS3MTMHF1DA2O93NTi4sT01JzEpGK95PzcTYxA7zIAwQ7Gxi9 OhxglOZiURHmPrN8eKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCt2oDUE6wKDU9tSItMwcYZjBp CQ4eJRHeAJA0b3FBYm5xZjpE6hSjLkfHzbt/mIRY8vLzUqXEed+AzBcAKcoozYMbAQv5S4yyU sK8jEBHCfEUpBblZpagyr9iFOdgVBLmDQVZxZOZVwK36RXQEUxAR/Bc2gJyREkiQkqqgXGm4E ZP3x1VE/Z9nbxs54V9lm67p7J4MO5aFXdul+ImwXtMl3+Vftzz9P48zT8BM3ynLHrgzqlRuX7 di+6zE/M/R2bnnAhVmv/IjN/lmMmTJRPPi+iV/fItu9HZmyDnc/fPC/YTh21vPjZe+aqEbzPv 43u5RYm7TedETX/6aon4Lm1+6ZqpfonxSizFGYmGWsxFxYkAhS4+4nQCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1505210643!111127297!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22072 invoked from network); 12 Sep 2017 10:04:04 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-31.messagelabs.com with SMTP; 12 Sep 2017 10:04:04 -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 A52FA1682; Tue, 12 Sep 2017 03:04:03 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B704D3F578; Tue, 12 Sep 2017 03:04:02 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:26 +0100 Message-Id: <20170912100330.2168-21-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 20/24] xen/arm: mm: Rename 'ai' into 'flags' in create_xen_entries 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 parameter 'ai' is used either for attribute index or for permissions. Follow-up patch will rework that parameters to carry more information. So rename the parameter to 'flags'. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Andre's reviewed-by --- xen/arch/arm/mm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index b3286b4a89..3379d29f8a 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -986,7 +986,7 @@ static int create_xen_entries(enum xenmap_operation op, unsigned long virt, mfn_t mfn, unsigned long nr_mfns, - unsigned int ai) + unsigned int flags) { int rc; unsigned long addr = virt, addr_end = addr + nr_mfns * PAGE_SIZE; @@ -1021,7 +1021,7 @@ static int create_xen_entries(enum xenmap_operation op, } if ( op == RESERVE ) break; - pte = mfn_to_xen_entry(mfn, ai); + pte = mfn_to_xen_entry(mfn, flags); pte.pt.table = 1; write_pte(entry, pte); break; @@ -1038,8 +1038,8 @@ static int create_xen_entries(enum xenmap_operation op, else { pte = *entry; - pte.pt.ro = PTE_RO_MASK(ai); - pte.pt.xn = PTE_NX_MASK(ai); + pte.pt.ro = PTE_RO_MASK(flags); + pte.pt.xn = PTE_NX_MASK(flags); if ( !pte.pt.ro && !pte.pt.xn ) { printk("%s: Incorrect combination for addr=%lx\n", From patchwork Tue Sep 12 10:03:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112279 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674582edi; Tue, 12 Sep 2017 03:05:51 -0700 (PDT) X-Google-Smtp-Source: AOwi7QAO5tG2jStQW6Yr9eAT3W08IAMdo2VoAv57P9mUN7P49MSPxDTbVYu2MRZVq6jbs2ftlC0O X-Received: by 10.36.101.12 with SMTP id u12mr199359itb.135.1505210751618; Tue, 12 Sep 2017 03:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210751; cv=none; d=google.com; s=arc-20160816; b=w7dk9fv19SWsw594fgqHTE/NlgykxxQ/5GK6j3LNeRegGAvyvO75PlRJ5nRPrcgDgv WeE+5TCrMVHctS9aEtZoA8nSfCBlWnbcGdOakAhbt5NW9WSii5+ztn7Vk+wJPNhRWWIR zpRd5zCl90JVrGcXPJZlbjJV/iSyWjZREqj3tNoDXFxWoA8J+UdGHzht4btmvup9n+tX wU3kFAIBDlCifykMUMsaJaYfEE8R+QNFpdH6C3ZM3Ho5obDfjahUfKr1lJEHmTEaSWoM A0vRwoVKF4C0djnpvTsMgwa8IhJ//beORfDTXo38Y2aT2aTloRL9mJ4zusrN8XVDK86r Pd7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=gZ5jubc9325f6paR6Y4g36oastkO7CmlpesmdIXtC/Y=; b=qB3ZfIiMLErO9QChVI0eNWxH805lytUWHVKWPBulD/Wj+AbZACW/xRrPa70Unrihm6 nJoB9CyEKDx6r8k2XSArKoru8jr0Lun8ux7OokMyuIgZA6D2M6mn+CAECWd1drIBTKAZ 3s7wwNXfCZ4ns3BB3cJi6mUFGB2wcaitQHi63h5bu5/83TlWzc7iCV+CTzQua+hynReN jHMEPNZ/62c3D306KQC3Jthq9vlOSH97JdhiQsxIYlgysXOf7zDWPcJw5JgtNN04ZHxO G1x556r/zv/H+4Y6Hp8wSU7y2JiXTSgi11+JeaS0YXWZUHy+5ZVH6qhxHwWI+/4VJfXv lOZA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id p68si11393689ite.126.2017.09.12.03.05.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:51 -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 1dri35-0003N7-W4; Tue, 12 Sep 2017 10:04:07 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri34-00038Q-D6 for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:06 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 98/A1-02202-611B7B95; Tue, 12 Sep 2017 10:04:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTVd04/Z Igwcr1S2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozz+3+xFLTwV0w8xt3AeJ67i5GLQ0hgM6PE 39lT2CGc04wSDfP/M3cxcnKwCWhK3Pn8iQnEFhGQlrj2+TIjiM0sEClx+MMPoAYODmGBBImPB 6NBwiwCqhLbnzWzg9i8ApYSPXf2gpVLCMhL7Gq7yApicwLFV3z8xQZiCwlYSHx/+YNxAiP3Ak aGVYwaxalFZalFuoZGeklFmekZJbmJmTm6hgamermpxcWJ6ak5iUnFesn5uZsYgd5lAIIdjH2 znA8xSnIwKYnyHlm/PVKILyk/pTIjsTgjvqg0J7X4EKMMB4eSBC/7BqCcYFFqempFWmYOMMxg 0hIcPEoivEIgad7igsTc4sx0iNQpRl2Ojpt3/zAJseTl56VKifO+AZkvAFKUUZoHNwIW8pcYZ aWEeRmBjhLiKUgtys0sQZV/xSjOwagkzCsHsoonM68EbtMroCOYgI7gubQF5IiSRISUVANjyJ PMuUf2Lt+fyP74wI8bPj9OfNX3T3r5v0V710xnrunH1TZILN8ZGjZd6VfHRen/yU1rr+b0/z0 cb9dzYsIu7veWEm+1XdzZj7FftXytzHP2tQaPeHP8g4DdytuWtAfddWS+teBpkUdqlcPdqmNr WFJYjDk+FJ39UWeX2TuJbZf4T7lDHnsqlViKMxINtZiLihMB4yv73HQCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-206.messagelabs.com!1505210645!108236303!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28903 invoked from network); 12 Sep 2017 10:04:05 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-206.messagelabs.com with SMTP; 12 Sep 2017 10:04:05 -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 CF4411529; Tue, 12 Sep 2017 03:04:04 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E0E6E3F578; Tue, 12 Sep 2017 03:04:03 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:27 +0100 Message-Id: <20170912100330.2168-22-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 21/24] xen/arm: page: Describe the layout of flags used to update page tables 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" Currently, the flags used to update page tables (i.e PAGE_HYPERVISOR_*) only contains the memory attribute index. Follow-up patches will add more information in it. So document the current layout. At the same time introduce PAGE_AI_MASK to get the memory attribute index easily. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Reviewed-by: Stefano Stabellini --- Andre, I have slightly update the commit message to show that we just describe the current layout. Hope you are fine with keeping your reviewed-by. Changes in v2: - Slightly update the commit message to specify we describe the current layout. - Add Andre's reviewed-by --- xen/arch/arm/mm.c | 2 +- xen/include/asm-arm/page.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 3379d29f8a..8a56f37821 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1021,7 +1021,7 @@ static int create_xen_entries(enum xenmap_operation op, } if ( op == RESERVE ) break; - pte = mfn_to_xen_entry(mfn, flags); + pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags)); pte.pt.table = 1; write_pte(entry, pte); break; diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 088746828d..4022b7dc33 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -62,6 +62,13 @@ #define MAIR0VAL (MAIRVAL & 0xffffffff) #define MAIR1VAL (MAIRVAL >> 32) +/* + * Layout of the flags used for updating the hypervisor page tables + * + * [0:2] Memory Attribute Index + */ +#define PAGE_AI_MASK(x) ((x) & 0x7U) + #define PAGE_HYPERVISOR (MT_NORMAL) #define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE) #define PAGE_HYPERVISOR_WC (MT_NORMAL_NC) From patchwork Tue Sep 12 10:03:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112269 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674273edi; Tue, 12 Sep 2017 03:05:36 -0700 (PDT) X-Google-Smtp-Source: AOwi7QB60+G57CR5C2lN4YmrU1io3rIgm4JWJeS3Bkc6OF3iaN9OUjXss4MQv3Dl0cc//xUrC+6X X-Received: by 10.36.124.77 with SMTP id a74mr218534itd.53.1505210736686; Tue, 12 Sep 2017 03:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210736; cv=none; d=google.com; s=arc-20160816; b=X4UR7T5ABbCoomgG8R44yVF+n7p6RY4drt7poP5tbQZgSvhi1DaOqHydvCiQsIIqPx +YNlv4GRJXpG5o6sA3nsTEh9i5znRYGkCjeawvCNwhh3hesFeohajmEJsaSAiPIruz77 LovRI0PBKKYFlcs1hcz7PPmtzLEuUxGdUsa5P4U2ObyhzqUN++c3yZiJLiscRiW8USwE zeqlUbMcIIQvWiOlh5dsKvkrSHpKiVaueMR936C/+Mha99ncKYHch8boIePyqF1M9pyZ IX5c73TfaXkKVv7TmrJHcD7HMkV0bf03/4EdalFgk25bL14mQNbZcwJKVrnSgNzYRR6x qokQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=O8L0u/18UCJvcia00MJ5v0PQLj3VzH0jvOCkaYiVAAY=; b=FsoNsYg7O+/IsDqZe56O3QqkeUE3BUtasrzLv5jYRhPoFag3J2w60eXn5dl0gGplGB i2AJcTs5qxSzhbuhu8KfIqXbJ7h+7f0ISnca4KN0goMEZSWgC7CDZjy1bfuX5HmXvIW6 JeACdWtAPQaUHRFaXK+6HebtPrZe610cACswnP/U/YHWJQel3SipvQFVPY+6GY6b19UE pBr6/nYRA8mNVxqAXMybq5Ln7XzhvDeWKPhZncnlPVUo1M7ppziJMrn6gtgI9p+PufPF bziIqwwQPkSe7Xa6MRGyUcE7Qtp1Pa9GA77YV3istopOv1aycbqLvdi806gi35YlP9bR o8bA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y18si9575601ioi.306.2017.09.12.03.05.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:36 -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 1dri37-0003Qt-Cn; Tue, 12 Sep 2017 10:04:09 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri36-0003Ly-0q for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:08 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 89/DE-02224-711B7B95; Tue, 12 Sep 2017 10:04:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTVds4/Z Ig1vT9C2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyF264zFzwSrOh/cIyxgfEXXxcjF4eQwGZG ibPfG1khnNOMEhM2bWbpYuTkYBPQlLjz+RMTiC0iIC1x7fNlRhCbWSBS4vCHH+xdjBwcwgIuE mc/iYGYLAKqEmfOxoNU8ApYSkw5dBpsioSAvMSutousIDYnUHzFx19sILaQgIXE95c/GCcwci 9gZFjFqFGcWlSWWqRrZK6XVJSZnlGSm5iZo2toYKyXm1pcnJiempOYVKyXnJ+7iRHo3XoGBsY djC17/Q4xSnIwKYnyHlm/PVKILyk/pTIjsTgjvqg0J7X4EKMMB4eSBC/7BqCcYFFqempFWmYO MMxg0hIcPEoivAEgad7igsTc4sx0iNQpRl2Ojpt3/zAJseTl56VKifO+AZkvAFKUUZoHNwIW8 pcYZaWEeRkZGBiEeApSi3IzS1DlXzGKczAqCfPKgaziycwrgdv0CugIJqAjeC5tATmiJBEhJd XAaO3QySPOv/HEAumjYm/uH9dgUHIUWttc4bpGrbuDWf3JKttDBbaL7AVk4rIOzC5SPOynGZZ uIlOcd0FgWaRea/f1XwEiXlcc9QXl9Wdv4T85VfvvsUU6c6a0agfmWZ3Xt14yU87t4BPXiXUr P/hmfztU4nhz94o1aaeXpO3I/qnZ+kXm0/4FSizFGYmGWsxFxYkAvPUQ2nQCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1505210646!113666026!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG, UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3041 invoked from network); 12 Sep 2017 10:04:06 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-10.tower-31.messagelabs.com with SMTP; 12 Sep 2017 10:04:06 -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 04E7C165D; Tue, 12 Sep 2017 03:04:06 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 16C7C3F578; Tue, 12 Sep 2017 03:04:04 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:28 +0100 Message-Id: <20170912100330.2168-23-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 22/24] xen/arm: mm: Embed permission in the flags 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" Currently, it is not possible to specify the permission of a new mapping. It would be necessary to use the function modify_xen_mappings with a different set of flags. Introduce a couple of new flags for the permissions (Non-eXecutable, Read-Only) and also provides definition that combine the memory attribute and permission for common combinations. PAGE_HYPERVISOR is now an alias to PAGE_HYPERVISOR_RW (read-write, non-executable mappings). This does not affect the current mapping using PAGE_HYPERVISOR because Xen is currently forcing all the mapping to be non-executable by default (see mfn_to_xen_entry). A follow-up patch will change modify_xen_mappings to use the new flags. Signed-off-by: Julien Grall --- Changes in v2: - Update the commit message --- xen/include/asm-arm/page.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 4022b7dc33..814ed126ec 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -66,12 +66,28 @@ * Layout of the flags used for updating the hypervisor page tables * * [0:2] Memory Attribute Index + * [3:4] Permission flags */ #define PAGE_AI_MASK(x) ((x) & 0x7U) -#define PAGE_HYPERVISOR (MT_NORMAL) -#define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE) -#define PAGE_HYPERVISOR_WC (MT_NORMAL_NC) +#define _PAGE_XN_BIT 3 +#define _PAGE_RO_BIT 4 +#define _PAGE_XN (1U << _PAGE_XN_BIT) +#define _PAGE_RO (1U << _PAGE_RO_BIT) +#define PAGE_XN_MASK(x) (((x) >> _PAGE_XN_BIT) & 0x1U) +#define PAGE_RO_MASK(x) (((x) >> _PAGE_RO_BIT) & 0x1U) + +/* Device memory will always be mapped read-write non-executable. */ +#define _PAGE_DEVICE _PAGE_XN +#define _PAGE_NORMAL MT_NORMAL + +#define PAGE_HYPERVISOR_RO (_PAGE_NORMAL|_PAGE_RO|_PAGE_XN) +#define PAGE_HYPERVISOR_RX (_PAGE_NORMAL|_PAGE_RO) +#define PAGE_HYPERVISOR_RW (_PAGE_NORMAL|_PAGE_XN) + +#define PAGE_HYPERVISOR PAGE_HYPERVISOR_RW +#define PAGE_HYPERVISOR_NOCACHE (_PAGE_DEVICE|MT_DEVICE_nGnRE) +#define PAGE_HYPERVISOR_WC (_PAGE_DEVICE|MT_NORMAL_NC) /* * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be From patchwork Tue Sep 12 10:03:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112270 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674328edi; Tue, 12 Sep 2017 03:05:39 -0700 (PDT) X-Google-Smtp-Source: AOwi7QB+xz5Htv0W+/GNE57hwPzxwGI1uiBHsOvadk/KXY/lWoSzrnzk+ogHuhVjSPfIuidXS9us X-Received: by 10.107.55.135 with SMTP id e129mr22098494ioa.166.1505210738924; Tue, 12 Sep 2017 03:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210738; cv=none; d=google.com; s=arc-20160816; b=pnWc7ml2ZQ3y8fZ+f+3KvYFrBxJuIDmFZ9MMmVikj87weaPlKSgVwJ5Lo4BHig42UK RWrZkMJUJXe0TQWUH6WyEZfVyCEZdOjMol8Mw4g68P56YcrSS04eO+iGnoxse8w8JkFY i6ttuuWxdor4qcmOJoQ0dpGYzUmLVyXtrtG814cF04wIDo02W7kOeH7ZNzV1WFJR1H4F moIJoUg0SEBIuSjo9+XKgIPln8Uk++pNrFOWOnnlhG8GmD5nE9PnRYkuKhVtVqiAYEL5 kED9F0ya4OopZGkvtgrtscRGE1Kd6A34U1Z4GTJJVsphHZi026tveASMM/EJV97HsBbd h8Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=v3owfXPiZIjsUFLjf9TspmayFxyt9ZGvmUnCstkL3u8=; b=iZaK3fCAtCE4ACQEFgOS69aBA12CTKaCuqT1+j/+sS1CDF4zmK36RbFSTLMxBQK8nX QWSQkQFuniq15aaL/31mVLilNkS9gb0ZZ04vz6icEK+c/JPFbmO/obgAKIx5gewn1DiX MjbE8yM/5OXYEyQXp9MkcPe1BKZv3nvTY6Gwf/SE4jbAZJ3EpOIs9MRE2n7X9TmHBLOh HtyvAITWpssoyV0yzI7bxikAKr77dOvQFVHtJeH6FWCE2mXtG6YhWZbBWGZYjtaY0gcg X5osaB/PSjuSVTRezPaiHf7bvG78miDnQ3OYBWV8P+QJ/74FB8YNwt0/ltOiXBCUQyBt qoKg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id w197si10475655iod.352.2017.09.12.03.05.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:38 -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 1dri38-0003Ti-MH; Tue, 12 Sep 2017 10:04:10 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri37-0003PR-4r for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:09 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id D0/A5-02226-811B7B95; Tue, 12 Sep 2017 10:04:08 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOLMWRWlGSWpSXmKPExsVysyfVTVd84/Z Ig3nvLCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oxLTbOYC3rYKz4+v8LWwNjK2sXIxSEksJlR 4sXO6cxdjJxAzmlGid3L+EBsNgFNiTufPzGB2CIC0hLXPl9mBLGZBSIlDn/4wQ5iCwtESMx+d IoFxGYRUJU4ueM4UJyDg1fAUqJ5fTpIWEJAXmJX20VWEJsTKLzi4y82iFUWEt9f/mCcwMi9gJ FhFaNGcWpRWWqRrqG5XlJRZnpGSW5iZo6uoYGxXm5qcXFiempOYlKxXnJ+7iZGoHcZgGAH48v TnocYJTmYlER5j6zfHinEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgpd9A1BOsCg1PbUiLTMHGGYw aQkOHiUR3msgrbzFBYm5xZnpEKlTjMYcNx5e/8PE0XHz7h8mIZa8/LxUKXHeNyClAiClGaV5c INg4X+JUVZKmJcR6DQhnoLUotzMElT5V4ziHIxKwrzzQabwZOaVwO17BXQKE9ApPJe2gJxSko iQkmpg1BHaafXB7MYWh7JUscicBY9uLCgLOX+sosXn1uVdq/5P3m3GPPUou5NpSqzSEaPHl4X OVdxI1Vw/+0ye/7Gpc8W8Z3XbTjXx4X2sFPKDUX2W5OmsNmbVz4cXJooF7Lp/e9rcjl3z3Q3a UnK3m9+trd75iN0q522VwW2P75PYgv+HruDg071kocRSnJFoqMVcVJwIALgrEFt6AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1505210647!106810621!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10850 invoked from network); 12 Sep 2017 10:04:07 -0000 Received: from usa-sjc-mx-foss1.foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-31.messagelabs.com with SMTP; 12 Sep 2017 10:04:07 -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 2EF391529; Tue, 12 Sep 2017 03:04:07 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 407A93F578; Tue, 12 Sep 2017 03:04:06 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:29 +0100 Message-Id: <20170912100330.2168-24-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 23/24] xen/arm: mm: Handle permission flags when adding a new mapping 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" Currently, all the new mappings will be read-write non-executable. Allow the caller to use other permissions. Signed-off-by: Julien Grall --- Changes in v2: - Switch the runtime check to a BUG_ON() --- xen/arch/arm/mm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 8a56f37821..a6b228ba9b 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1022,6 +1022,9 @@ static int create_xen_entries(enum xenmap_operation op, if ( op == RESERVE ) break; pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags)); + pte.pt.ro = PAGE_RO_MASK(flags); + pte.pt.xn = PAGE_XN_MASK(flags); + BUG_ON(!pte.pt.ro && !pte.pt.xn); pte.pt.table = 1; write_pte(entry, pte); break; From patchwork Tue Sep 12 10:03:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 112273 Delivered-To: patch@linaro.org Received: by 10.80.202.13 with SMTP id d13csp5674393edi; Tue, 12 Sep 2017 03:05:42 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCClZNcjoOioO338HhDsL1zgNZx3yXAxzGUln2lhOhO5E8ZZrqMDd8qDG9XN84Gs631Id9i X-Received: by 10.36.225.75 with SMTP id n72mr278148ith.82.1505210742425; Tue, 12 Sep 2017 03:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505210742; cv=none; d=google.com; s=arc-20160816; b=n1fcBBNJMao02HOK/h207y77KHRNNUt/4E+DARtJ7I9llVPlHLyt6Pq4n4yWqT6GzK n+g2M1jnr3J4y1LzJOcHCtyciDqJMMTCaW9XB7DNxWc/gCJNXo9xAbQ6KxSKZ+RmZMQU quA72kdRNv5nL0ZyhjY/IFEKtvrE/mGVqHt7sMkkpWDY7E7JCSgzKqlJ3f5N6+3pcIGA b0ZBsk+qJCeFyYgP86MoMsBk+n8hk26Eqm2WwSPIjraAy4pSjPxo+IXMyXghLF/zeLZx ppjtta1Uk/WGUwXd2xUoocIk42P7L7ofUuTVCX3pOIosoSEiaGUXpNnEsBDv3krkksno 1XUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=bGoG6jCHetRkyKlamTEcKXmMTx7r7384PeICz6hRI0M=; b=eezKXysigT1bTAh0kYdWehEIRJ6zEzu6ZIvFd2vX3rv11SI5OomrhaZXtMO+m4gHeQ NwbZ7fcZOpjruPZxd3SIsBrJVOuGKv8x/tFtZ9GfyEMP9bb+MmxpiV51iehyNzmwSvmn vOhcr57Tl3LxtSjl+N85He70gh7zEqWDhzHjzMe9AmT0lnGBhhdjukN8AmjA2qktlQVP 07sOzAvdOBKIU1bV234e/3byCPdSHwkGHz+tJtwT/OjwlV5XimAdsNVU8arPEezyFzyQ s2Arp56RotlACwHBGQo7gC5kVbYUz3y8ScP5GONJ/ARSEuVlZPAuBrTbHHHKjqjzHTpY k1mw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 194si103111itz.55.2017.09.12.03.05.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 03:05:42 -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 1dri3C-0003cJ-Ut; Tue, 12 Sep 2017 10:04:14 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dri3B-0003YS-Kr for xen-devel@lists.xen.org; Tue, 12 Sep 2017 10:04:13 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 76/28-03283-D11B7B95; Tue, 12 Sep 2017 10:04:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsVysyfVTVdy4/Z Ig1nrpSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oxZ/xczFmyVqNj85DFzA+MsoS5GLg4hgc2M Eq8XL2CCcE4zSuy49YC5i5GTg01AU+LO509MILaIgLTEtc+XGUGKmAW2M0qcn/ubvYuRg0NYI E3iyyJbkBoWAVWJn3v+gvXyClhK/Ov9wQ5iSwjIS+xqu8gKYnMCxVd8/MUGYgsJWEh8f/mDcQ Ij9wJGhlWMGsWpRWWpRbpGlnpJRZnpGSW5iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmbGIEeZgC CHYwHFgUeYpTkYFIS5T2yfnukEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQlef5CcYFFqempFWmYO MNRg0hIcPEoivHEgad7igsTc4sx0iNQpRl2Ojpt3/zAJseTl56VKifNmgBQJgBRllObBjYCF/ SVGWSlhXkago4R4ClKLcjNLUOVfMYpzMCoJ88aDTOHJzCuB2/QK6AgmoCN4Lm0BOaIkESEl1c AourDp9JeqI1lWco8jP0ZtYzJY033269ZDJR5Rj2P0axuD94bJaF6JUHlnqqrE+0tkukaUl9+ s3kwxlh4Pg76CSZLHJHY5fvoy2c35r7fN8uxq+fbTHscL8rY1Xu6ISX4ftjV/jc7M9SwFHCuk y+yUZj6LEmS5OWfaVI4vd/5XxSs7L7mYdFCJpTgj0VCLuag4EQDnBRq2dgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-27.messagelabs.com!1505210648!111727141!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50082 invoked from network); 12 Sep 2017 10:04:09 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-27.messagelabs.com with SMTP; 12 Sep 2017 10:04:09 -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 B48D71529; Tue, 12 Sep 2017 03:04:08 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6B1703F578; Tue, 12 Sep 2017 03:04:07 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 12 Sep 2017 11:03:30 +0100 Message-Id: <20170912100330.2168-25-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com> References: <20170912100330.2168-1-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, Ross Lagerwall Subject: [Xen-devel] [PATCH v2 24/24] xen/arm: mm: Use memory flags for modify_xen_mappings rather than custom one 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" This will help to consolidate the page-table code and avoid different path depending on the action to perform. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Reviewed-by: Stefano Stabellini --- Cc: Konrad Rzeszutek Wilk Cc: Ross Lagerwall arch_livepatch_secure is now the same as on x86. It might be possible to combine both, but I left that alone for now. Changes in v2: - Add Andre's reviewed-by --- xen/arch/arm/livepatch.c | 6 +++--- xen/arch/arm/mm.c | 5 ++--- xen/include/asm-arm/page.h | 11 ----------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c index 3e53524365..279d52cc6c 100644 --- a/xen/arch/arm/livepatch.c +++ b/xen/arch/arm/livepatch.c @@ -146,15 +146,15 @@ int arch_livepatch_secure(const void *va, unsigned int pages, enum va_type type) switch ( type ) { case LIVEPATCH_VA_RX: - flags = PTE_RO; /* R set, NX clear */ + flags = PAGE_HYPERVISOR_RX; break; case LIVEPATCH_VA_RW: - flags = PTE_NX; /* R clear, NX set */ + flags = PAGE_HYPERVISOR_RW; break; case LIVEPATCH_VA_RO: - flags = PTE_NX | PTE_RO; /* R set, NX set */ + flags = PAGE_HYPERVISOR_RO; break; default: diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index a6b228ba9b..71de68fe0d 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -1041,8 +1041,8 @@ static int create_xen_entries(enum xenmap_operation op, else { pte = *entry; - pte.pt.ro = PTE_RO_MASK(flags); - pte.pt.xn = PTE_NX_MASK(flags); + pte.pt.ro = PAGE_RO_MASK(flags); + pte.pt.xn = PAGE_XN_MASK(flags); if ( !pte.pt.ro && !pte.pt.xn ) { printk("%s: Incorrect combination for addr=%lx\n", @@ -1085,7 +1085,6 @@ int destroy_xen_mappings(unsigned long v, unsigned long e) int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags) { - ASSERT((flags & (PTE_NX | PTE_RO)) == flags); return create_xen_entries(MODIFY, s, INVALID_MFN, (e - s) >> PAGE_SHIFT, flags); } diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index 814ed126ec..2b9d5e6a5c 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -90,17 +90,6 @@ #define PAGE_HYPERVISOR_WC (_PAGE_DEVICE|MT_NORMAL_NC) /* - * Defines for changing the hypervisor PTE .ro and .nx bits. This is only to be - * used with modify_xen_mappings. - */ -#define _PTE_NX_BIT 0U -#define _PTE_RO_BIT 1U -#define PTE_NX (1U << _PTE_NX_BIT) -#define PTE_RO (1U << _PTE_RO_BIT) -#define PTE_NX_MASK(x) (((x) >> _PTE_NX_BIT) & 0x1U) -#define PTE_RO_MASK(x) (((x) >> _PTE_RO_BIT) & 0x1U) - -/* * Stage 2 Memory Type. * * These are valid in the MemAttr[3:0] field of an LPAE stage 2 page