From patchwork Thu Apr 10 16:48:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Huang X-Patchwork-Id: 28233 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E0028212DC for ; Thu, 10 Apr 2014 16:53:56 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id p10sf12254345pdj.11 for ; Thu, 10 Apr 2014 09:53:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=/cCw1ONTCEttPziFErsYrWgG7clhb836YFcbxLAgpsk=; b=fcGtIK9NGF86l6DieuUpEUmE1f+VJJhJ51x4b78rrMFEOPqBE6NuwS8r0zjjOmB8BI KfDoSFNkKje/X0FoLxtbOSwRQcul9TwlpGkZfUKp8kkcDyVURyBHq7jV8mWWHa4QvRVC BedP5jMJzvJFHv6J3ndidpYWyF3tvSbnSZucaVE1tUYB+EqQhskN4EnTEJ3hkivo8RAb b5XGXLS/xyd6nAkyGra909N7RdJpEbxjWapLyBKVftjTshLGil3PM18SQEvD3z86X/T3 BbexOAjlbHwng0F4Y/1sR6htKjawDjKqmuhpm8UcrYRVQ347+FTIvz11/C+kCXGf49tE h0Sg== X-Gm-Message-State: ALoCoQkHHXxQcd+UMLxOvQFEAFm2vOPxyhLksmO630ENhYjArJoTlzW443LB/WR2yZGdM2mKvB5g X-Received: by 10.66.65.202 with SMTP id z10mr9432840pas.45.1397148835986; Thu, 10 Apr 2014 09:53:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.70 with SMTP id n64ls1045723qga.19.gmail; Thu, 10 Apr 2014 09:53:55 -0700 (PDT) X-Received: by 10.58.181.170 with SMTP id dx10mr1642024vec.25.1397148835785; Thu, 10 Apr 2014 09:53:55 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id si3si797757vcb.28.2014.04.10.09.53.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Apr 2014 09:53:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id il7so3777806vcb.32 for ; Thu, 10 Apr 2014 09:53:55 -0700 (PDT) X-Received: by 10.58.169.97 with SMTP id ad1mr413013vec.45.1397148835683; Thu, 10 Apr 2014 09:53:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp75314vcb; Thu, 10 Apr 2014 09:53:55 -0700 (PDT) X-Received: by 10.224.115.68 with SMTP id h4mr21957338qaq.35.1397148835109; Thu, 10 Apr 2014 09:53:55 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id s10si2120997qak.244.2014.04.10.09.53.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 10 Apr 2014 09:53:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WYIC7-0000ls-PB; Thu, 10 Apr 2014 16:51:19 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WYIC6-0000lZ-OS for xen-devel@lists.xen.org; Thu, 10 Apr 2014 16:51:18 +0000 Received: from [85.158.143.35:54292] by server-2.bemta-4.messagelabs.com id BB/BF-06539-50CC6435; Thu, 10 Apr 2014 16:51:17 +0000 X-Env-Sender: w1.huang@samsung.com X-Msg-Ref: server-16.tower-21.messagelabs.com!1397148674!8269793!1 X-Originating-IP: [203.254.224.24] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjAzLjI1NC4yMjQuMjQgPT4gMzY1MDA2\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 11625 invoked from network); 10 Apr 2014 16:51:16 -0000 Received: from mailout1.samsung.com (HELO mailout1.samsung.com) (203.254.224.24) by server-16.tower-21.messagelabs.com with DES-CBC3-SHA encrypted SMTP; 10 Apr 2014 16:51:16 -0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N3T00L8YQTCZP10@mailout1.samsung.com> for xen-devel@lists.xen.org; Fri, 11 Apr 2014 01:51:12 +0900 (KST) X-AuditID: cbfee61a-b7fb26d00000724f-19-5346cc00995c Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 64.0C.29263.00CC6435; Fri, 11 Apr 2014 01:51:12 +0900 (KST) Received: from weihp.spa.sarc.sas ([105.140.31.10]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N3T00LLWQT18X00@mmp2.samsung.com>; Fri, 11 Apr 2014 01:51:12 +0900 (KST) From: Wei Huang To: xen-devel@lists.xen.org Date: Thu, 10 Apr 2014 16:48:55 +0000 Message-id: <1397148539-19084-3-git-send-email-w1.huang@samsung.com> X-Mailer: git-send-email 1.8.3.2 In-reply-to: <1397148539-19084-1-git-send-email-w1.huang@samsung.com> References: <1397148539-19084-1-git-send-email-w1.huang@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprMLMWRmVeSWpSXmKPExsVy+t9jQV2GM27BBgseCFi86e1gsbjRe4vN YvqfO2wWP+9cZLR4fe4js8WSj4tZLDr+TWNzYPd4PXkCo8f2JyIed67tYfM4uvs3k0ffllWM AaxRXDYpqTmZZalF+nYJXBl7DuUWrOWtWNr8l6mB8TRXFyMnh4SAicSFi1eZIGwxiQv31rN1 MXJxCAlMZ5ToWN7HBpIQEmhmkrg2TwfEZhNQkzh18T8LiC0iIC1x7fNlRpAGZoGFjBK9mz+D JYQFnCRmvn0EZrMIqErse7QUbAOvgItEw8mVjBDbFCSWfVnLDGJzCrhKvNx2iBVimYvE/ZZX rBMYeRcwMqxiFE0tSC4oTkrPNdQrTswtLs1L10vOz93ECA6qZ1I7GFc2WBxiFOBgVOLhPbDM NViINbGsuDL3EKMEB7OSCC/3AbdgId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rwHWq0DhQTSE0tS s1NTC1KLYLJMHJxSDYx1oT+/nVXeHh7TM9H+r26+r03h5v0Fm2Waz23ceyvjnsU6/gfZjHqh Exwushd8bLg7Q/PER/WcWG/L/u2vvl+dz97XFi/5ae1x7/+zzthsUdWL7Ll6RHmaOctlx1O7 /7I8vHaCMaJ0fcuK7xkzdOQn9inWbeLbzS+rtHNL0yF7/q0l0fxnVssrsRRnJBpqMRcVJwIA BOFKhyYCAAA= Cc: w1.huang@samsung.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, julien.grall@linaro.org, jaeyong.yoo@samsung.com, yjhyun.yoo@samsung.com Subject: [Xen-devel] [PATCH 2/6] xen/arm: implement get_maximum_gpfn hypercall X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: w1.huang@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: From: Jaeyong Yoo This patchi implements get_maximum_gpfn by using the memory map info in arch_domain (from set_memory_map hypercall). Signed-off-by: Evgeny Fedotov --- xen/arch/arm/mm.c | 19 ++++++++++++++++++- xen/include/asm-arm/mm.h | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 362bc8d..14b4686 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -947,7 +947,11 @@ int page_is_ram_type(unsigned long mfn, unsigned long mem_type) unsigned long domain_get_maximum_gpfn(struct domain *d) { - return -ENOSYS; + paddr_t end; + + get_gma_start_end(d, NULL, &end); + + return (unsigned long) (end >> PAGE_SHIFT); } void share_xen_page_with_guest(struct page_info *page, @@ -1235,6 +1239,19 @@ int is_iomem_page(unsigned long mfn) return 1; return 0; } + +/* + * Return start and end addresses of guest + */ +void get_gma_start_end(struct domain *d, paddr_t *start, paddr_t *end) +{ + if ( start ) + *start = GUEST_RAM_BASE; + + if ( end ) + *end = GUEST_RAM_BASE + ((paddr_t) d->max_pages << PAGE_SHIFT); +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index b8d4e7d..341493a 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -341,6 +341,8 @@ static inline void put_page_and_type(struct page_info *page) put_page(page); } +void get_gma_start_end(struct domain *d, paddr_t *start, paddr_t *end); + #endif /* __ARCH_ARM_MM__ */ /* * Local variables: