From patchwork Fri May 10 02:17:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 16823 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f197.google.com (mail-ye0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6E689238F7 for ; Fri, 10 May 2013 02:19:45 +0000 (UTC) Received: by mail-ye0-f197.google.com with SMTP id q11sf3848132yen.0 for ; Thu, 09 May 2013 19:19:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=hV9CRz/tHNvn2I0WGjhxzJdgd8AMW2dhlvCwdW7BL9w=; b=Gnh2FoQaITdVUlTgOVzIKuAPEa5SFH3O1SaYtPH600bjOi8MHWliFrDGiUyARumWvC qb9b+miWJOKZFc6UPW+yLp9Y8Pzo/yrxdKQiGd4B83e2z3KFO2xcz0LoIM5ynISQNssK iT1cTi7j5jv85NTHOmNGUO5KmDCCF7UZIgaY0EZe5W9jfVL90rHYzYdDoTAxcm/huu8+ OcEtB9QFWQlI7Y82zZ7IVaAhUMehx4elYa4dkMyBAo8k3pkL7mWGULdJLXCih6CSLDMW gJAOeG9CrVLJMBL43wGQuepikCmyZSY7txkyuN7tfEVa78Jl1B1WQJ84jZShCklVZxxq npsg== X-Received: by 10.236.29.80 with SMTP id h56mr7476101yha.38.1368152360916; Thu, 09 May 2013 19:19:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.51.69 with SMTP id i5ls1811336qeo.89.gmail; Thu, 09 May 2013 19:19:20 -0700 (PDT) X-Received: by 10.52.165.36 with SMTP id yv4mr8384793vdb.31.1368152360363; Thu, 09 May 2013 19:19:20 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id by3si356300vdc.17.2013.05.09.19.19.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 May 2013 19:19:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 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.177; Received: by mail-vc0-f177.google.com with SMTP id ha12so3254419vcb.8 for ; Thu, 09 May 2013 19:19:20 -0700 (PDT) X-Received: by 10.220.89.198 with SMTP id f6mr9923105vcm.45.1368152360249; Thu, 09 May 2013 19:19:20 -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.217.15 with SMTP id hk15csp36214vcb; Thu, 9 May 2013 19:19:19 -0700 (PDT) X-Received: by 10.180.198.49 with SMTP id iz17mr711537wic.19.1368152359188; Thu, 09 May 2013 19:19:19 -0700 (PDT) Received: from mail-we0-x233.google.com (mail-we0-x233.google.com [2a00:1450:400c:c03::233]) by mx.google.com with ESMTPS id mc9si175143wjb.5.2013.05.09.19.19.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 May 2013 19:19:19 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::233 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=2a00:1450:400c:c03::233; Received: by mail-we0-f179.google.com with SMTP id t59so3429249wes.38 for ; Thu, 09 May 2013 19:19:18 -0700 (PDT) X-Received: by 10.194.109.103 with SMTP id hr7mr16112034wjb.0.1368152358709; Thu, 09 May 2013 19:19:18 -0700 (PDT) Received: from belegaer.uk.xensource.com. (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id dj7sm597075wib.6.2013.05.09.19.19.17 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 May 2013 19:19:17 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: Stefano.Stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, Julien Grall Subject: [PATCH V3 11/41] xen/arm: Introduce ioremap_attr Date: Fri, 10 May 2013 03:17:57 +0100 Message-Id: <1368152307-598-12-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1368152307-598-1-git-send-email-julien.grall@linaro.org> References: <1368152307-598-1-git-send-email-julien.grall@linaro.org> X-Gm-Message-State: ALoCoQlnwHtxQLxooojAzWLgnnydJeuWzkrwsn2C8dWph8ciJR91XO4qL1mOAD4ORQil7ZWSdeFA X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 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: , Map physical range in virtual memory with a specific mapping attribute. Also add new mapping attributes for ARM: PAGE_HYPERVISOR_NOCACHE and PAGE_HYPERVISOR_WC. Signed-off-by: Julien Grall --- xen/arch/arm/mm.c | 14 ++++++++++++++ xen/arch/arm/setup.c | 4 ++-- xen/include/asm-arm/mm.h | 2 ++ xen/include/asm-arm/page.h | 2 ++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 96297d3..10d2869 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -38,6 +38,7 @@ #include #include #include +#include struct domain *dom_xen, *dom_io, *dom_cow; @@ -608,6 +609,19 @@ void *__init arch_vmap_virt_end(void) return (void *)early_vmap_start; } +/* + * This function should only be used to remap device address ranges + * TODO: add a check to verify this assumption + */ +void *ioremap_attr(paddr_t pa, size_t len, unsigned int attributes) +{ + unsigned long pfn = PFN_DOWN(pa); + unsigned int offs = pa & (PAGE_SIZE - 1); + unsigned int nr = PFN_UP(offs + len); + + return (__vmap(&pfn, nr, 1, 1, attributes) + offs); +} + static int create_xen_table(lpae_t *entry) { void *p; diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 29447ef..a667db4 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -429,6 +429,8 @@ void __init start_xen(unsigned long boot_phys_offset, setup_pagetables(boot_phys_offset, get_xen_paddr()); setup_mm(fdt_paddr, fdt_size); + vm_init(); + #ifdef EARLY_UART_ADDRESS /* TODO Need to get device tree or command line for UART address */ pl011_init(0, FIXMAP_ADDR(FIXMAP_CONSOLE)); @@ -483,8 +485,6 @@ void __init start_xen(unsigned long boot_phys_offset, console_init_postirq(); - vm_init(); - do_presmp_initcalls(); for_each_present_cpu ( i ) diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 26c271e..4ac8fab 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -155,6 +155,8 @@ extern void set_fixmap(unsigned map, unsigned long mfn, unsigned attributes); extern void clear_fixmap(unsigned map); /* map a 2MB aligned physical range in virtual memory. */ void* early_ioremap(paddr_t start, size_t len, unsigned attributes); +/* map a physical range in virtual memory */ +void *ioremap_attr(paddr_t start, size_t len, unsigned attributes); #define mfn_valid(mfn) ({ \ unsigned long __m_f_n = (mfn); \ diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index fd6946e..13fbd78 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -59,6 +59,8 @@ #define DEV_CACHED WRITEBACK #define PAGE_HYPERVISOR (MATTR_MEM) +#define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED) +#define PAGE_HYPERVISOR_WC (DEV_WC) #define MAP_SMALL_PAGES PAGE_HYPERVISOR /*