From patchwork Fri Aug 5 17:35:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 9265625 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 045CF60754 for ; Fri, 5 Aug 2016 17:39:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE3182842E for ; Fri, 5 Aug 2016 17:39:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E303D28459; Fri, 5 Aug 2016 17:39:03 +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 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 7B3042842E for ; Fri, 5 Aug 2016 17:39:03 +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 1bVj2d-0006mx-4N; Fri, 05 Aug 2016 17:36:15 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bVj2Z-0006YN-SZ; Fri, 05 Aug 2016 17:36:11 +0000 Received: from [85.158.137.68] by server-13.bemta-3.messagelabs.com id E1/C7-06162-A8EC4A75; Fri, 05 Aug 2016 17:36:10 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJLMWRWlGSWpSXmKPExsVyuP0Ov27XuSX hBrPmS1m8/bqE2eL7lslMDkwehz9cYQlgjGLNzEvKr0hgzejb/pmp4BJvxZ0jn9gaGCdwdzFy ckgIGEm8nfiPqYuRi0NIYCGjxON7E9lAEmwCqhIbrp9iBbFFBNwkvnyfBRZnFoiQmPPhFAuIL SzgIHH+526wGhag+q0vTgDFOTh4geKv9itCzJeTuD5zOhOIzQkUXrh6CZgtJGAv8eZQM9sERu 4FjAyrGNWLU4vKUot0TfSSijLTM0pyEzNzdA0NjPVyU4uLE9NTcxKTivWS83M3MQK9zAAEOxg bvzgdYpTkYFIS5VXbtyRciC8pP6UyI7E4I76oNCe1+BCjDAeHkgSv7lmgnGBRanpqRVpmDjDc YNISHDxKIrz7zgCleYsLEnOLM9MhUqcYFaXEea1B+gRAEhmleXBtsBC/xCgrJczLCHSIEE9Ba lFuZgmq/CtGcQ5GJWHe/yDjeTLzSuCmvwJazAS0+KMV2OKSRISUVAOjy82fJ3I+uF/jjTrn0V C9g3l9hBhT0Ny4jPill+qrJi9k6rXeZdVSW9/AEavZZntjfQxjylKfitcv5zAzztl1/1ZIa4r 2LFOd6uufXrW7uPPGK3c+W90YvtEgRPPSz7jqsizrt96L7AtEJTec3af8VJrL3pXpplthdYVe KaPO7MI9Ft9XJCqxFGckGmoxFxUnAgDPIOaRbAIAAA== X-Env-Sender: jgross@suse.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1470418570!54293997!1 X-Originating-IP: [195.135.220.15] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 46099 invoked from network); 5 Aug 2016 17:36:10 -0000 Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by server-8.tower-31.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 5 Aug 2016 17:36:10 -0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2F104AD9E; Fri, 5 Aug 2016 17:36:10 +0000 (UTC) From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Date: Fri, 5 Aug 2016 19:35:57 +0200 Message-Id: <1470418562-11234-14-git-send-email-jgross@suse.com> X-Mailer: git-send-email 2.6.6 In-Reply-To: <1470418562-11234-1-git-send-email-jgross@suse.com> References: <1470418562-11234-1-git-send-email-jgross@suse.com> Cc: Juergen Gross , samuel.thibault@ens-lyon.org, wei.liu2@citrix.com Subject: [Xen-devel] [PATCH v2 13/18] mini-os: add function to map one frame 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 Add a function to map one physical frame to a specified virtual address as read/write. This will be used later multiple times. Signed-off-by: Juergen Gross Reviewed-by: Samuel Thibault --- include/arm/arch_mm.h | 2 ++ include/mm.h | 1 + mm.c | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/include/arm/arch_mm.h b/include/arm/arch_mm.h index 085d4e5..f4685d8 100644 --- a/include/arm/arch_mm.h +++ b/include/arm/arch_mm.h @@ -14,6 +14,8 @@ extern uint32_t physical_address_offset; /* Add this to a virtual address to get #define L1_PAGETABLE_SHIFT 12 +#define L1_PROT 0 + #define to_phys(x) (((paddr_t)(x)+physical_address_offset) & 0xffffffff) #define to_virt(x) ((void *)(((x)-physical_address_offset) & 0xffffffff)) diff --git a/include/mm.h b/include/mm.h index 9244e26..6add683 100644 --- a/include/mm.h +++ b/include/mm.h @@ -72,6 +72,7 @@ int do_map_frames(unsigned long addr, const unsigned long *f, unsigned long n, unsigned long stride, unsigned long increment, domid_t id, int *err, unsigned long prot); int unmap_frames(unsigned long va, unsigned long num_frames); +int map_frame_rw(unsigned long addr, unsigned long mfn); #ifdef HAVE_LIBC extern unsigned long heap, brk, heap_mapped, heap_end; #endif diff --git a/mm.c b/mm.c index ff071ca..fd66115 100644 --- a/mm.c +++ b/mm.c @@ -319,6 +319,11 @@ int free_physical_pages(xen_pfn_t *mfns, int n) return HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); } +int map_frame_rw(unsigned long addr, unsigned long mfn) +{ + return do_map_frames(addr, &mfn, 1, 1, 1, DOMID_SELF, NULL, L1_PROT); +} + #ifdef HAVE_LIBC void *sbrk(ptrdiff_t increment) {