From patchwork Fri May 10 16:24:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 16871 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3D044238F6 for ; Fri, 10 May 2013 16:25:05 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id 12sf5023082vbf.0 for ; Fri, 10 May 2013 09:24:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to: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 :content-type:content-transfer-encoding; bh=E2fOGvoO+x5xURk3Q2toDNJ34xgNer+/OWr7H9AZrs8=; b=Q8FG8FxoROT8i2aaDq/pHjyLju1O+NOOCIVhqkUQ76x4lqMT6D56qp9xGKHPg1tabI hhRBNixu/hCWFc2j8CtmqH+Ee8Siygk+h0EJfyfo0IyHkVNno3NdKZ2jylt3laLkAMgb K5RRfMGZXtdtt8ghU37KhEl1UWHFYYGUJObPCj+8OGryOAoWDD8SlS+WUHveDjg4XdK8 lSPDhoN9ZBSvqXhH/XKHQUAVAnfRbU9okQHMXgHSE4rODj4CUkLjEM//jCjY9a6/IVeI Xg5iau6ijgYid8/FpddEpspi0LWB+XZDzxqwP/OvupM0/HXMAaY6eghRMH83v1ZBFPWl qxXg== X-Received: by 10.236.81.115 with SMTP id l79mr8898911yhe.20.1368203079073; Fri, 10 May 2013 09:24:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.48.4 with SMTP id h4ls472023qen.50.gmail; Fri, 10 May 2013 09:24:38 -0700 (PDT) X-Received: by 10.220.73.199 with SMTP id r7mr3913989vcj.67.1368203078848; Fri, 10 May 2013 09:24:38 -0700 (PDT) Received: from mail-ve0-x232.google.com (mail-ve0-x232.google.com [2607:f8b0:400c:c01::232]) by mx.google.com with ESMTPS id sa4si1636391vdc.62.2013.05.10.09.24.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 May 2013 09:24:38 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::232 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::232; Received: by mail-ve0-f178.google.com with SMTP id jy13so4001907veb.23 for ; Fri, 10 May 2013 09:24:38 -0700 (PDT) X-Received: by 10.52.53.36 with SMTP id y4mr9460118vdo.51.1368203078728; Fri, 10 May 2013 09:24:38 -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 hk15csp62176vcb; Fri, 10 May 2013 09:24:37 -0700 (PDT) X-Received: by 10.194.62.80 with SMTP id w16mr14713408wjr.16.1368203076726; Fri, 10 May 2013 09:24:36 -0700 (PDT) Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com [2a00:1450:400c:c05::22e]) by mx.google.com with ESMTPS id pk5si861849wjc.13.2013.05.10.09.24.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 May 2013 09:24:36 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::22e is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=2a00:1450:400c:c05::22e; Received: by mail-wi0-f174.google.com with SMTP id m6so815464wiv.13 for ; Fri, 10 May 2013 09:24:36 -0700 (PDT) X-Received: by 10.194.92.231 with SMTP id cp7mr25982997wjb.3.1368203075880; Fri, 10 May 2013 09:24:35 -0700 (PDT) Received: from [10.80.2.139] (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id s1sm4488395wiz.2.2013.05.10.09.24.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 May 2013 09:24:34 -0700 (PDT) Message-ID: <518D1F41.4070902@linaro.org> Date: Fri, 10 May 2013 17:24:33 +0100 From: Julien Grall User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Julien Grall CC: xen-devel@lists.xen.org, Stefano.Stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org Subject: Re: [PATCH V4 04/32] xen/arm: Add helpers ioreadl/iowritel References: <1368198723-24639-1-git-send-email-julien.grall@linaro.org> <1368198723-24639-5-git-send-email-julien.grall@linaro.org> In-Reply-To: <1368198723-24639-5-git-send-email-julien.grall@linaro.org> X-Gm-Message-State: ALoCoQlS0+DjKzuOyp1V4vJFBRfyJ2bEn8a10B/KMLNLVs+4vdQmQJjB4VTdCMzYdrDNDYjnvSWZ X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::232 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 Changes in v5: - Use functions from linux code --- xen/include/asm-arm/arm32/io.h | 46 ++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/arm64/io.h | 38 +++++++++++++++++++++++++++++++++ xen/include/asm-arm/mm.h | 8 +++++++ 3 files changed, 92 insertions(+) create mode 100644 xen/include/asm-arm/arm32/io.h create mode 100644 xen/include/asm-arm/arm64/io.h diff --git a/xen/include/asm-arm/arm32/io.h b/xen/include/asm-arm/arm32/io.h new file mode 100644 index 0000000..0d6da1f --- /dev/null +++ b/xen/include/asm-arm/arm32/io.h @@ -0,0 +1,46 @@ +/* + * Based on linux arch/arm/include/asm/io.h + * + * Copyright (C) 1996-2000 Russell King + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Modifications: + * 16-Sep-1996 RMK Inlined the inx/outx functions & optimised for both + * constant addresses and variable addresses. + * 04-Dec-1997 RMK Moved a lot of this stuff to the new architecture + * specific IO header files. + * 27-Mar-1999 PJB Second parameter of memcpy_toio is const.. + * 04-Apr-1999 PJB Added check_signature. + * 12-Dec-1999 RMK More cleanups + * 18-Jun-2000 RMK Removed virt_to_* and friends definitions + * 05-Oct-2004 BJD Moved memory string functions to use void __iomem + */ +#ifndef _ARM_ARM32_IO_H +#define _ARM_ARM32_IO_H + +#include + +static inline uint32_t ioreadl(const volatile void __iomem *addr) +{ + uint32_t val; + + asm volatile("ldr %1, %0" + : "+Qo" (*(volatile uint32_t __force *)addr), + "=r" (val)); + dsb(); + + return val; +} + +static inline void iowritel(const volatile void __iomem *addr, uint32_t val) +{ + dsb(); + asm volatile("str %1, %0" + : "+Qo" (*(volatile uint32_t __force *)addr) + : "r" (val)); +} + +#endif /* _ARM_ARM32_IO_H */ diff --git a/xen/include/asm-arm/arm64/io.h b/xen/include/asm-arm/arm64/io.h new file mode 100644 index 0000000..ec041cd --- /dev/null +++ b/xen/include/asm-arm/arm64/io.h @@ -0,0 +1,38 @@ +/* + * Based on linux arch/arm64/include/asm/io.h + * + * Copyright (C) 1996-2000 Russell King + * Copyright (C) 2012 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef _ARM_ARM64_IO_H +#define _ARM_ARM64_IO_H + +static inline uint32_t ioreadl(const volatile void __iomem *addr) +{ + uint32_t val; + + asm volatile("ldr %w0, [%1]" : "=r" (val) : "r" (addr)); + dsb(); + + return val; +} + +static inline void iowritel(const volatile void __iomem *addr, uint32_t val) +{ + dsb(); + asm volatile("str %w0, [%1]" : : "r" (val), "r" (addr)); +} + +#endif /* _ARM_ARM64_IO_H */ diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index 63e1069..5e7c5a3 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -6,6 +6,14 @@ #include #include +#if defined(CONFIG_ARM_32) +# include +#elif defined(CONFIG_ARM_64) +# include +#else +# error "unknown ARM variant" +#endif + /* Align Xen to a 2 MiB boundary. */ #define XEN_PADDR_ALIGN (1 << 21)