From patchwork Wed Jul 23 17:19:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 34173 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4CC462061E for ; Wed, 23 Jul 2014 17:22:40 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g18sf9298061oah.6 for ; Wed, 23 Jul 2014 10:22:39 -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:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=ch6SAz7hMeFUIvuYxP9g6ljmdpTtXvYy87n4l1+BJak=; b=XUK9qWAx7bYuJ4WzwiVMojqoOO0BMvj+7aTlQbPaVajCBytmwepf0kvRVRlkmBYk2H y2Ive8PSYkzyM5Jpbg8b7khOLarEMy0z8gaMpFn0FUysWljGFt9aKiooDpvpvXUV78NR LfNuWAu/P94asevC+IhLtVDeXsVbyp/6QcmekMzrr1pA7/obo6Z9hJ2PGrX/YvXXN+XA n84EwQ0YvH2iHFLR6K8rTmjQ9UQSgVC0qKyy9/LLqfsLKd8zPbm+JcwJobeXSL2YqtQQ yYQC0wHxCD6RfXmlHYTONJu+DD6zCCASKhh9qQzdewARtAocI0AhYRCmjddLqAjA93Yb gWNA== X-Gm-Message-State: ALoCoQkHyJx4rRcNGuCk17qDqJqDr6RorXmE6CSWbHo5Ic2D95U+NsDZJo93h976D0+vGde2XYCI X-Received: by 10.42.49.138 with SMTP id w10mr1432874icf.13.1406136159850; Wed, 23 Jul 2014 10:22:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.50.154.37 with SMTP id vl5ls3198518igb.33.canary; Wed, 23 Jul 2014 10:22:39 -0700 (PDT) X-Received: by 10.70.88.205 with SMTP id bi13mr3712768pdb.43.1406136159678; Wed, 23 Jul 2014 10:22:39 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id xj9si2830933veb.92.2014.07.23.10.22.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jul 2014 10:22:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hq11so2862723vcb.10 for ; Wed, 23 Jul 2014 10:22:39 -0700 (PDT) X-Received: by 10.52.120.38 with SMTP id kz6mr3581526vdb.86.1406136159559; Wed, 23 Jul 2014 10:22:39 -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.221.37.5 with SMTP id tc5csp298052vcb; Wed, 23 Jul 2014 10:22:39 -0700 (PDT) X-Received: by 10.68.223.202 with SMTP id qw10mr3506325pbc.163.1406136158275; Wed, 23 Jul 2014 10:22:38 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id e11si44387241igq.23.2014.07.23.10.22.37 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 23 Jul 2014 10:22:38 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) 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 1XA0Dj-0005TZ-6j; Wed, 23 Jul 2014 17:20:51 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XA0Di-0005TR-Dk for xen-devel@lists.xensource.com; Wed, 23 Jul 2014 17:20:50 +0000 Received: from [193.109.254.147:56826] by server-7.bemta-14.messagelabs.com id DB/C6-13362-1FEEFC35; Wed, 23 Jul 2014 17:20:49 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-11.tower-27.messagelabs.com!1406136047!15840566!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4282 invoked from network); 23 Jul 2014 17:20:48 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-11.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 23 Jul 2014 17:20:48 -0000 X-IronPort-AV: E=Sophos;i="5.01,718,1400025600"; d="scan'208";a="155506958" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 23 Jul 2014 17:20:47 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Wed, 23 Jul 2014 13:20:46 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1XA0DZ-0008HI-FP; Wed, 23 Jul 2014 18:20:41 +0100 From: Stefano Stabellini To: Date: Wed, 23 Jul 2014 18:19:41 +0100 Message-ID: <1406135982-15487-1-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA2 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v2 1/2] xen: introduce arch_iommu_grant_(un)map_page 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: , 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: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) 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: Introduce two arch specific functions to create a new p2m mapping of granted pages at pfn == mfn. The x86 implementation just returns ENOSYS. Signed-off-by: Stefano Stabellini --- xen/arch/arm/p2m.c | 19 +++++++++++++++++++ xen/include/asm-arm/p2m.h | 4 ++++ xen/include/asm-x86/p2m.h | 13 +++++++++++++ 3 files changed, 36 insertions(+) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 9960e17..c38af59 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -555,6 +555,25 @@ void guest_physmap_remove_page(struct domain *d, pfn_to_paddr(mfn), MATTR_MEM, p2m_invalid); } +int arch_grant_map_page_identity(struct domain *d, unsigned long frame, + bool_t writeable) +{ + p2m_type_t t; + + if ( writeable ) + t = p2m_ram_rw; + else + t = p2m_ram_ro; + + return guest_physmap_add_entry(d, frame, frame, 0, t); +} + +int arch_grant_unmap_page_identity(struct domain *d, unsigned long frame) +{ + guest_physmap_remove_page(d, frame, frame, 0); + return 0; +} + int p2m_alloc_table(struct domain *d) { struct p2m_domain *p2m = &d->arch.p2m; diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 911d32d..b682f51 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -181,6 +181,10 @@ static inline int get_page_and_type(struct page_info *page, return rc; } +int arch_grant_map_page_identity(struct domain *d, unsigned long frame, + bool_t writeable); +int arch_grant_unmap_page_identity(struct domain *d, unsigned long frame); + #endif /* _XEN_P2M_H */ /* diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h index 0ddbadb..faead11 100644 --- a/xen/include/asm-x86/p2m.h +++ b/xen/include/asm-x86/p2m.h @@ -717,6 +717,19 @@ static inline unsigned int p2m_get_iommu_flags(p2m_type_t p2mt) return flags; } + +static inline int arch_grant_map_page_identity(struct domain *d, + unsigned long frame, + bool_t writeable) +{ + return -ENOSYS; +} + +static inline int arch_grant_unmap_page_identity(struct domain *d, + unsigned long frame) +{ + return -ENOSYS; +} #endif /* _XEN_P2M_H */