From patchwork Thu Aug 25 13:37:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 9299371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 24E1F60459 for ; Thu, 25 Aug 2016 13:40:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1659329332 for ; Thu, 25 Aug 2016 13:40:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AE4729335; Thu, 25 Aug 2016 13:40:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9EE9229332 for ; Thu, 25 Aug 2016 13:40:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bcur9-0000zt-KY; Thu, 25 Aug 2016 13:38: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 1bcur7-0000vD-UO for xen-devel@lists.xenproject.org; Thu, 25 Aug 2016 13:38:06 +0000 Received: from [85.158.137.68] by server-13.bemta-3.messagelabs.com id 57/C5-06162-DB4FEB75; Thu, 25 Aug 2016 13:38:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDLMWRWlGSWpSXmKPExsUyZ7p8oO6eL/v CDSa161h83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmP/05nLZgsUvFn037WBsZvAl2MXBxCAhOZ JK5+/MsO4XxjlNj4/SQzhLORUeJpywpGCGcao0TLkka2LkYODjYBE4k3qxxB4iICfYwSh49uA urg5GAGcfadBrOFBTwlTt/aww5iswioSsxrWcsCYvMKuEkceTqHEWSOhIC8xLPb9SBhTgF3id 8Nm9lAbCGgku+XOsDKJQQMJT5vXMo8gZFvASPDKkaN4tSistQiXUNLvaSizPSMktzEzBxdQwN jvdzU4uLE9NScxKRiveT83E2MwFCpZ2Bg3MH4+7jfIUZJDiYlUV7tFfvChfiS8lMqMxKLM+KL SnNSiw8xynBwKEnwTvkMlBMsSk1PrUjLzAEGLUxagoNHSYT3FUiat7ggMbc4Mx0idYpRUUqct wokIQCSyCjNg2uDRcolRlkpYV5GBgYGIZ6C1KLczBJU+VeM4hyMSsK8+0Cm8GTmlcBNfwW0mA loccv93SCLSxIRUlINjF1sieZza2fd/lKwLyraQi/6p176F0udDrN9nU1LnZk/FO+O2b+vJq5 D9PK91tlHFLd/ZL9xbAnzrbZL1fEPlrr9Wnly8X3R7TOiJb8eM3z1WO/pvi0fltjIcq5u497p /0lrd4Se9uuUazfjXa5PuKfZaXkmnkNj51P7TRcSTljLt1reOLnKoliJpTgj0VCLuag4EQBSM QLajwIAAA== X-Env-Sender: konrad.wilk@oracle.com X-Msg-Ref: server-2.tower-31.messagelabs.com!1472132282!57337589!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29356 invoked from network); 25 Aug 2016 13:38:04 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-2.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 25 Aug 2016 13:38:04 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u7PDbrpb030566 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Aug 2016 13:37:53 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u7PDbq5e010406 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 25 Aug 2016 13:37:53 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u7PDbqH4025881; Thu, 25 Aug 2016 13:37:52 GMT Received: from localhost.event.rightround.com (/75.98.193.200) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 25 Aug 2016 06:37:51 -0700 From: Konrad Rzeszutek Wilk To: xen-devel@lists.xenproject.org, konrad@kernel.org, ross.lagerwall@citrix.com, sstabellini@kernel.org, julien.grall@arm.com Date: Thu, 25 Aug 2016 09:37:23 -0400 Message-Id: <1472132255-23470-9-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1472132255-23470-1-git-send-email-konrad.wilk@oracle.com> References: <1472132255-23470-1-git-send-email-konrad.wilk@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: Andrew Cooper , Jan Beulich , Konrad Rzeszutek Wilk Subject: [Xen-devel] [PATCH v2 08/20] x86: change modify_xen_mappings to return error X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The implementation on x86 always returns zero, but other platforms may return error values. Suggested-by: Julien Grall Signed-off-by: Konrad Rzeszutek Wilk --- Cc: Stefano Stabellini Cc: Julien Grall Cc: Jan Beulich Cc: Andrew Cooper v2: First submission --- xen/arch/x86/livepatch.c | 4 +--- xen/arch/x86/mm.c | 5 +++-- xen/include/xen/mm.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/livepatch.c b/xen/arch/x86/livepatch.c index 5b0c863..67dda07 100644 --- a/xen/arch/x86/livepatch.c +++ b/xen/arch/x86/livepatch.c @@ -234,9 +234,7 @@ int arch_livepatch_secure(const void *va, unsigned int pages, enum va_type type) else flag = PAGE_HYPERVISOR_RO; - modify_xen_mappings(start, start + pages * PAGE_SIZE, flag); - - return 0; + return modify_xen_mappings(start, start + pages * PAGE_SIZE, flag); } void __init arch_livepatch_init(void) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index ff8e904..94e684e 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5974,7 +5974,7 @@ int populate_pt_range(unsigned long virt, unsigned long mfn, * * It is an error to call with present flags over an unpopulated range. */ -void modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) +int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) { bool_t locking = system_state > SYS_STATE_boot; l2_pgentry_t *pl2e; @@ -6149,13 +6149,14 @@ void modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf) flush_area(NULL, FLUSH_TLB_GLOBAL); #undef FLAGS_MASK + return 0; } #undef flush_area void destroy_xen_mappings(unsigned long s, unsigned long e) { - modify_xen_mappings(s, e, _PAGE_NONE); + (void)modify_xen_mappings(s, e, _PAGE_NONE); } void __set_fixmap( diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 58bc0b8..f257bbc 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -146,7 +146,7 @@ int map_pages_to_xen( unsigned long nr_mfns, unsigned int flags); /* Alter the permissions of a range of Xen virtual address space. */ -void modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags); +int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int flags); void destroy_xen_mappings(unsigned long v, unsigned long e); /* * Create only non-leaf page table entries for the