From patchwork Fri Dec 9 19:59:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas Lengyel X-Patchwork-Id: 9468977 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 1210E607D8 for ; Fri, 9 Dec 2016 20:01:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 028A128687 for ; Fri, 9 Dec 2016 20:01:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA2E92868B; Fri, 9 Dec 2016 20:01:57 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 5FB3028687 for ; Fri, 9 Dec 2016 20:01:57 +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 1cFRKS-0004Bl-Ad; Fri, 09 Dec 2016 19:59:36 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cFRKQ-0004Bc-C1 for xen-devel@lists.xenproject.org; Fri, 09 Dec 2016 19:59:34 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id 07/31-12362-52D0B485; Fri, 09 Dec 2016 19:59:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeJIrShJLcpLzFFi42K5GHrdRVeF1zv CoPmDlcX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmrF37yzmgrmCFY/ntDE3MN7n7WLk4hASmMYo MW/ZYWYQh0XgDYvEy5cXWUEcCYF3LBL3z05m6WLkBHJiJO5862WFsCslrrRdYgexhQQ0JQ5uO MMMMWoSk8TblpnMIAk2ASOJq1d72EBsEQEliXurJjOBFDELtDBK7P9wEaibg0NYIELi1alCkB oWAVWJ/TfWgNXzCthLdGyYxg6xTF5i4fkjTBMY+RYwMqxiVC9OLSpLLdI11EsqykzPKMlNzMz RNTQw1stNLS5OTE/NSUwq1kvOz93ECAwVBiDYwbj8o9MhRkkOJiVR3mImrwghvqT8lMqMxOKM +KLSnNTiQ4wyHBxKErzCPN4RQoJFqempFWmZOcCghUlLcPAoifBag6R5iwsSc4sz0yFSpxiNO Y7NWvyUiWNX55qnTEIsefl5qVLivCe5gUoFQEozSvPgBsGi6RKjrJQwLyPQaUI8BalFuZklqP KvGMU5GJWEeblAFvJk5pXA7XsFdAoT0CnzbriDnFKSiJCSamC8EG8pei5FiTH4y9PUE/sm9d/ +mzZ/8zYvoYlrph28+G7J49xrK5TSRIs5OV0yVkaVvTzg+3IP33uvJYJ8vz+oJt9zqMud4bnC i+mhg9ayhrdHkuT/W4aE80iaRabzTmaoWMW54ui3nQcqZx0tX6DXHDdtxklVxx0aEgc6i/rd7 tXO/ZR+/nqLEktxRqKhFnNRcSIAgObS5aECAAA= X-Env-Sender: tamas.lengyel@zentific.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1481313572!17299713!1 X-Originating-IP: [209.85.215.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 47088 invoked from network); 9 Dec 2016 19:59:32 -0000 Received: from mail-lf0-f68.google.com (HELO mail-lf0-f68.google.com) (209.85.215.68) by server-4.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 9 Dec 2016 19:59:32 -0000 Received: by mail-lf0-f68.google.com with SMTP id o20so912124lfg.3 for ; Fri, 09 Dec 2016 11:59:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zentific-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=yq0C/o3u07wQ6o6TvvfzbrJK25SJbkvHa+rcGFzxzwo=; b=Ghtd9rPT8iHfeZIUWAVh5p0Naw2j1KPfI3QfaDl32S7QMB6mNbQpqxO4wFqMhiiw8m Ic5xQsvdLT0vndHLUu2xVuHvFkydEJQkhJXnAjs73iZlZcgoWzkdM8siLKcHxnb/TDqZ j755EtmmYdieJWVsxBtPDa8o0aYFZev69VP4AGWQrBu2qYIlj4SkylMEk5Z/V06RNN6m FXRDOB46KRQ+OtxrskmFtZ2w4Wwht+Nx+zpdeuLA6CnKB+DCaRLfDpgnSWR5UfeO6MSO 2h7CO4Het4y0lYB5ENHFOrXw9Pmt8fXZNAkpG5UGiC/YRklNW5t3lTo5aO3NBbwKzAl1 9gqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yq0C/o3u07wQ6o6TvvfzbrJK25SJbkvHa+rcGFzxzwo=; b=YRTbRwAPSVxomPljDwaFe74WECGQixDQlIYIMw36jPXCLoql+a/HirdV8ozZO/M90j n6d4mtKN2ihHv7HtZn9MYnm5CRjKv/yqHozHgrt2JQxNZvhTFRfwpa6iZ2neKgYt+Ozn qIvzStoLBFgYzHB/SMjAomnsuY1ICYzjmQgGDTpIf/k3rqaUv+Rn737eUHRe7MX4tECi KPT+8V9lEnbpQD7rgLtkwPhxdzBfxeRjFkjVsbFi4586NFahIaGaBMEVzmVy6w4D5JOa dl99Ag0MDpWltNrTbT4lqWZUCnAoWnSPCN5rrqJrdOkOxG9HFYHc2hCwR7CEGn3qJquW cExA== X-Gm-Message-State: AKaTC03gkYHYbjuWovBzPGRKHhaO2l8Va20IVYKK5Q3lrJXSkLTSRHe9LovikNdauZQrqg== X-Received: by 10.46.33.165 with SMTP id h37mr35961208lji.57.1481313572097; Fri, 09 Dec 2016 11:59:32 -0800 (PST) Received: from l1.lan (c-73-14-35-59.hsd1.co.comcast.net. [73.14.35.59]) by smtp.gmail.com with ESMTPSA id r204sm6798756lfr.19.2016.12.09.11.59.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Dec 2016 11:59:31 -0800 (PST) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Fri, 9 Dec 2016 12:59:24 -0700 Message-Id: <20161209195925.21420-1-tamas.lengyel@zentific.com> X-Mailer: git-send-email 2.10.2 Cc: Tamas K Lengyel , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH v2 1/2] arm/mem_access: adjust check_and_get_page to not rely on current 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 only caller of this function is get_page_from_gva which already takes a vcpu pointer as input. Pass this along to make the function in-line with its intended use-case. Signed-off-by: Tamas K Lengyel Reviewed-by: Stefano Stabellini --- Cc: Stefano Stabellini Cc: Julien Grall --- xen/arch/arm/p2m.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index cc5634b..837be1d 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1461,7 +1461,8 @@ mfn_t gfn_to_mfn(struct domain *d, gfn_t gfn) * we indeed found a conflicting mem_access setting. */ static struct page_info* -p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag) +p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag, + const struct vcpu *v) { long rc; paddr_t ipa; @@ -1470,7 +1471,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag) xenmem_access_t xma; p2m_type_t t; struct page_info *page = NULL; - struct p2m_domain *p2m = ¤t->domain->arch.p2m; + struct p2m_domain *p2m = &v->domain->arch.p2m; rc = gva_to_ipa(gva, &ipa, flag); if ( rc < 0 ) @@ -1482,7 +1483,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag) * We do this first as this is faster in the default case when no * permission is set on the page. */ - rc = __p2m_get_mem_access(current->domain, gfn, &xma); + rc = __p2m_get_mem_access(v->domain, gfn, &xma); if ( rc < 0 ) goto err; @@ -1546,7 +1547,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag) page = mfn_to_page(mfn_x(mfn)); - if ( unlikely(!get_page(page, current->domain)) ) + if ( unlikely(!get_page(page, v->domain)) ) page = NULL; err: @@ -1587,7 +1588,7 @@ struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va, err: if ( !page && p2m->mem_access_enabled ) - page = p2m_mem_access_check_and_get_page(va, flags); + page = p2m_mem_access_check_and_get_page(va, flags, v); p2m_read_unlock(p2m);