From patchwork Thu Oct 24 09:02:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 21244 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 05F53244EE for ; Thu, 24 Oct 2013 09:03:03 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id pa12sf2773887veb.6 for ; Thu, 24 Oct 2013 02:03:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=ZeEdoqZGTDTStejJ+Nq4N9kl5ajKLaspOwSqss0SdM4=; b=X/+iDNUPzjY3qPztTUDZ80AOF2DJElcERwWf2DjU5rNWnnHNrs6WfggWeh4MJ08b/u WhXUgHjzTToAPg2lc7Yx34sfnrNSA9dRcSiS9Y/2wZaY7PUxq+RiaIAFX10JFr0s6fDW no3gT7vYrA0cP7TwMjTdQSuwt2yj11d4eY3Mvolk8e5i57ms9vROMiFY7+52tuNCoFpf 86GAPTvTHKUeZgTanhorCleit8RskxlYtnpWTxO6YY1vKWAMAGxEqEYMRn7EYRJsDQD6 9zP/9wtB9E+qGLXPY4+ObD4hHLihSOv7X09Lz53Yo1+f9e+4Lzqa7nmlzUnCaJj4Ld40 sFGA== X-Received: by 10.236.41.100 with SMTP id g64mr1563372yhb.31.1382605382381; Thu, 24 Oct 2013 02:03:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.14.106 with SMTP id o10ls766786qec.36.gmail; Thu, 24 Oct 2013 02:03:02 -0700 (PDT) X-Received: by 10.220.98.212 with SMTP id r20mr18807vcn.48.1382605382289; Thu, 24 Oct 2013 02:03:02 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id gq10si116536vdc.43.2013.10.24.02.03.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Oct 2013 02:03:02 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 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.171; Received: by mail-vc0-f171.google.com with SMTP id lf12so1314972vcb.30 for ; Thu, 24 Oct 2013 02:03:02 -0700 (PDT) X-Gm-Message-State: ALoCoQmEPXDM2GqCpB+1zCj2odt5XpQVuCVOqCUSJfNIY1Edvp5H6YyeCI9+IiMBUu4ziYvcn7o+ X-Received: by 10.221.54.129 with SMTP id vu1mr906412vcb.20.1382605382171; Thu, 24 Oct 2013 02:03:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp374586vcz; Thu, 24 Oct 2013 02:03:01 -0700 (PDT) X-Received: by 10.180.231.6 with SMTP id tc6mr1153766wic.59.1382605381183; Thu, 24 Oct 2013 02:03:01 -0700 (PDT) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by mx.google.com with ESMTPS id 19si239846wjz.155.2013.10.24.02.03.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Oct 2013 02:03:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.178 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.212.178; Received: by mail-wi0-f178.google.com with SMTP id hn9so2169296wib.11 for ; Thu, 24 Oct 2013 02:03:00 -0700 (PDT) X-Received: by 10.194.94.167 with SMTP id dd7mr1486893wjb.43.1382605380733; Thu, 24 Oct 2013 02:03:00 -0700 (PDT) Received: from laptop.eicc.co.uk (ed03490-ge-0-0-0.mgdfwr.lumison.net. [212.20.242.100]) by mx.google.com with ESMTPSA id fb4sm24947864wib.8.2013.10.24.02.02.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Oct 2013 02:03:00 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: ian.campbell@citrix.com, tim@xen.org, patches@linaro.org, stefano.stabellini@eu.citrix.com, Julien Grall Subject: [PATCH 1/3] xen/arm: p2m: extend create_p2m_entries to support read-only mapping Date: Thu, 24 Oct 2013 10:02:43 +0100 Message-Id: <1382605365-19244-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1382605365-19244-1-git-send-email-julien.grall@linaro.org> References: <1382605365-19244-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Signed-off-by: Julien Grall --- xen/arch/arm/p2m.c | 19 +++++++++++-------- xen/include/asm-arm/page.h | 5 +++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 2d09fef..fdbb07b 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -111,7 +111,7 @@ static int p2m_create_table(struct domain *d, clear_page(p); unmap_domain_page(p); - pte = mfn_to_p2m_entry(page_to_mfn(page), MATTR_MEM); + pte = mfn_to_p2m_entry(page_to_mfn(page), MATTR_MEM, 1); write_pte(entry, pte); @@ -129,7 +129,8 @@ static int create_p2m_entries(struct domain *d, paddr_t start_gpaddr, paddr_t end_gpaddr, paddr_t maddr, - int mattr) + int mattr, + bool_t rw) { int rc, flush; struct p2m_domain *p2m = &d->arch.p2m; @@ -201,14 +202,15 @@ static int create_p2m_entries(struct domain *d, goto out; } - pte = mfn_to_p2m_entry(page_to_mfn(page), mattr); + pte = mfn_to_p2m_entry(page_to_mfn(page), mattr, rw); write_pte(&third[third_table_offset(addr)], pte); } break; case INSERT: { - lpae_t pte = mfn_to_p2m_entry(maddr >> PAGE_SHIFT, mattr); + lpae_t pte = mfn_to_p2m_entry(maddr >> PAGE_SHIFT, + mattr, rw); write_pte(&third[third_table_offset(addr)], pte); maddr += PAGE_SIZE; } @@ -243,7 +245,7 @@ int p2m_populate_ram(struct domain *d, paddr_t start, paddr_t end) { - return create_p2m_entries(d, ALLOCATE, start, end, 0, MATTR_MEM); + return create_p2m_entries(d, ALLOCATE, start, end, 0, MATTR_MEM, 1); } int map_mmio_regions(struct domain *d, @@ -251,7 +253,8 @@ int map_mmio_regions(struct domain *d, paddr_t end_gaddr, paddr_t maddr) { - return create_p2m_entries(d, INSERT, start_gaddr, end_gaddr, maddr, MATTR_DEV); + return create_p2m_entries(d, INSERT, start_gaddr, end_gaddr, + maddr, MATTR_DEV, 1); } int guest_physmap_add_page(struct domain *d, @@ -261,7 +264,7 @@ int guest_physmap_add_page(struct domain *d, { return create_p2m_entries(d, INSERT, gpfn << PAGE_SHIFT, (gpfn + (1<