From patchwork Mon Oct 1 22:46:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Yariv X-Patchwork-Id: 1532951 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 32E5B3FE1C for ; Mon, 1 Oct 2012 22:49:52 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TIolX-000786-6l; Mon, 01 Oct 2012 22:47:07 +0000 Received: from mail-qa0-f49.google.com ([209.85.216.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TIolJ-00076o-ND for linux-arm-kernel@lists.infradead.org; Mon, 01 Oct 2012 22:46:54 +0000 Received: by qaea17 with SMTP id a17so74827qae.15 for ; Mon, 01 Oct 2012 15:46:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=HItc0pKyK2/T7QY9vLJH2TZ6LSfUDIWKGPcKFvNj6jE=; b=EeauRGMzR3zSxwtk2mgKhKN4zB+i/l4daueAGhVVIEqzqGyreTu+lwgiP7Mijb+i3j sqP0dJsQygFz9YA2NHGzeYK5XOnvUQ8Uq6bikI45J/XWDCVe0Wv/y3DcKHcA3C+mzvQb KXRbrrIjxL3bWo+91wLEPqsXzQE9B9mKPjVuP2dwa4afez2DqfF4UrcDh1XihMR2dgLc Rjod48pvGGbJms5ENDqIwtVpHdQRd4GWSyTNo0fyothfvAdJA1mhySAKwlDxkUQqHve9 kmk2BwMGEE3p5pUJtp0h7YNRzv5qpS+KUL53Nt2x4UIMiFo4b6KfT/hArrSf614zSBNn q7og== Received: by 10.49.133.97 with SMTP id pb1mr1647658qeb.31.1349131613213; Mon, 01 Oct 2012 15:46:53 -0700 (PDT) Received: from localhost.localdomain (c-76-24-20-17.hsd1.ma.comcast.net. [76.24.20.17]) by mx.google.com with ESMTPS id f12sm599020qey.5.2012.10.01.15.46.51 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Oct 2012 15:46:52 -0700 (PDT) From: Ido Yariv To: Tony Lindgren , Russell King , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 3/5] iommu/omap: Make some definitions local Date: Mon, 1 Oct 2012 18:46:29 -0400 Message-Id: <1349131591-10804-3-git-send-email-ido@wizery.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1349131591-10804-1-git-send-email-ido@wizery.com> References: <20120927195526.GP4840@atomide.com> <1349131591-10804-1-git-send-email-ido@wizery.com> X-Gm-Message-State: ALoCoQm402OPhf8yPHnSiUUSGsx7n8DXz5Orx1WaAq3liAy0hKrEj72YRdJrvj3nM/8b3QI89xtU X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.216.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Ido Yariv X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Move some of the definitions in plat/iommu.h that can be made local to either drivers/iommu or arch/arm/mach-omap2. This minimizes the number of global definitions once plat/iommu.h moves to platform_data/ as part of the single zImage effort. Signed-off-by: Ido Yariv --- arch/arm/mach-omap2/iommu2.c | 6 ++++ arch/arm/plat-omap/include/plat/iommu.h | 55 ------------------------------ drivers/iommu/omap-iommu-debug.c | 2 ++ drivers/iommu/omap-iommu.c | 2 ++ drivers/iommu/omap-iommu.h | 59 +++++++++++++++++++++++++++++++++ drivers/iommu/omap-iovmm.c | 2 ++ 6 files changed, 71 insertions(+), 55 deletions(-) create mode 100644 drivers/iommu/omap-iommu.h diff --git a/arch/arm/mach-omap2/iommu2.c b/arch/arm/mach-omap2/iommu2.c index eefc379..c986880 100644 --- a/arch/arm/mach-omap2/iommu2.c +++ b/arch/arm/mach-omap2/iommu2.c @@ -65,6 +65,12 @@ ((pgsz) == MMU_CAM_PGSZ_64K) ? 0xffff0000 : \ ((pgsz) == MMU_CAM_PGSZ_4K) ? 0xfffff000 : 0) +/* IOMMU errors */ +#define OMAP_IOMMU_ERR_TLB_MISS (1 << 0) +#define OMAP_IOMMU_ERR_TRANS_FAULT (1 << 1) +#define OMAP_IOMMU_ERR_EMU_MISS (1 << 2) +#define OMAP_IOMMU_ERR_TBLWALK_FAULT (1 << 3) +#define OMAP_IOMMU_ERR_MULTIHIT_FAULT (1 << 4) static void __iommu_set_twl(struct omap_iommu *obj, bool on) { diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h index 7e8c7b6..35a0245 100644 --- a/arch/arm/plat-omap/include/plat/iommu.h +++ b/arch/arm/plat-omap/include/plat/iommu.h @@ -77,11 +77,6 @@ struct cr_regs { }; }; -struct iotlb_lock { - short base; - short vict; -}; - /* architecture specific functions */ struct iommu_functions { unsigned long version; @@ -145,26 +140,6 @@ struct omap_iommu_arch_data { struct omap_iommu *iommu_dev; }; -#ifdef CONFIG_IOMMU_API -/** - * dev_to_omap_iommu() - retrieves an omap iommu object from a user device - * @dev: iommu client device - */ -static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev) -{ - struct omap_iommu_arch_data *arch_data = dev->archdata.iommu; - - return arch_data->iommu_dev; -} -#endif - -/* IOMMU errors */ -#define OMAP_IOMMU_ERR_TLB_MISS (1 << 0) -#define OMAP_IOMMU_ERR_TRANS_FAULT (1 << 1) -#define OMAP_IOMMU_ERR_EMU_MISS (1 << 2) -#define OMAP_IOMMU_ERR_TBLWALK_FAULT (1 << 3) -#define OMAP_IOMMU_ERR_MULTIHIT_FAULT (1 << 4) - /* * MMU Register offsets */ @@ -192,16 +167,6 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev) /* * MMU Register bit definitions */ -#define MMU_LOCK_BASE_SHIFT 10 -#define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT) -#define MMU_LOCK_BASE(x) \ - ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT) - -#define MMU_LOCK_VICT_SHIFT 4 -#define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT) -#define MMU_LOCK_VICT(x) \ - ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT) - #define MMU_CAM_VATAG_SHIFT 12 #define MMU_CAM_VATAG_MASK \ ((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT) @@ -257,32 +222,12 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev) /* * global functions */ -extern u32 omap_iommu_arch_version(void); - -extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); - -extern int -omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e); - -extern int omap_iommu_set_isr(const char *name, - int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs, - void *priv), - void *isr_priv); - extern void omap_iommu_save_ctx(struct device *dev); extern void omap_iommu_restore_ctx(struct device *dev); extern int omap_install_iommu_arch(const struct iommu_functions *ops); extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops); -extern int omap_foreach_iommu_device(void *data, - int (*fn)(struct device *, void *)); - -extern ssize_t -omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len); -extern size_t -omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len); - /* * register accessors */ diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index f55fc5d..a0b0309 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -24,6 +24,8 @@ #include +#include "omap-iommu.h" + #define MAXCOLUMN 100 /* for short messages */ static DEFINE_MUTEX(iommu_debug_lock); diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index d0b1234..80844b3 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -28,6 +28,8 @@ #include +#include "omap-iommu.h" + #define for_each_iotlb_cr(obj, n, __i, cr) \ for (__i = 0; \ (__i < (n)) && (cr = __iotlb_read_cr((obj), __i), true); \ diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h new file mode 100644 index 0000000..51fd00c --- /dev/null +++ b/drivers/iommu/omap-iommu.h @@ -0,0 +1,59 @@ +/* + * omap iommu: miscellaneous iommu functions and structures + * + * Copyright (C) 2008-2009 Nokia Corporation + * Copyright (C) 2012 Texas Instruments + * + * 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. + */ + +#ifndef _OMAP_IOMMU_H +#define _OMAP_IOMMU_H + +/* + * MMU Register bit definitions + */ +#define MMU_LOCK_BASE_SHIFT 10 +#define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT) +#define MMU_LOCK_BASE(x) \ + ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT) + +#define MMU_LOCK_VICT_SHIFT 4 +#define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT) +#define MMU_LOCK_VICT(x) \ + ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT) + +struct iotlb_lock { + short base; + short vict; +}; + +extern u32 omap_iommu_arch_version(void); + +extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); + +extern int +omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e); + +extern int omap_foreach_iommu_device(void *data, + int (*fn)(struct device *, void *)); + +extern ssize_t +omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len); +extern size_t +omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len); + +/** + * dev_to_omap_iommu() - retrieves an omap iommu object from a user device + * @dev: iommu client device + */ +static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev) +{ + struct omap_iommu_arch_data *arch_data = dev->archdata.iommu; + + return arch_data->iommu_dev; +} + +#endif diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c index 2e10c3e..b362fb5 100644 --- a/drivers/iommu/omap-iovmm.c +++ b/drivers/iommu/omap-iovmm.c @@ -26,6 +26,8 @@ #include +#include "omap-iommu.h" + static struct kmem_cache *iovm_area_cachep; /* return the offset of the first scatterlist entry in a sg table */