From patchwork Wed Oct 12 14:43:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Gala X-Patchwork-Id: 119224 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id C00FFB7460 for ; Thu, 13 Oct 2011 01:43:49 +1100 (EST) Received: by ozlabs.org (Postfix) id 6C039B6F81; Thu, 13 Oct 2011 01:43:43 +1100 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CD767B6F80 for ; Thu, 13 Oct 2011 01:43:42 +1100 (EST) Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id p9CEhb6d016691; Wed, 12 Oct 2011 09:43:37 -0500 From: Kumar Gala To: hjk@hansjkoch.de Subject: [PATCH] UIO: Allow a UIO driver to override the default pgprot when we mmap Date: Wed, 12 Oct 2011 09:43:36 -0500 Message-Id: <1318430616-20351-1-git-send-email-galak@kernel.crashing.org> X-Mailer: git-send-email 1.5.6.5 Cc: linuxppc-dev@ozlabs.org, gregkh@suse.de, linux-kernel@vger.kernel.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org For some devices the default behavior of pgprot_noncached is not the correct flags for the address space. Provide a means for the kernel side UIO driver to override the flags without having to implement its own full mmap callback. Signed-off-by: Kumar Gala --- drivers/uio/uio.c | 6 +++++- include/linux/uio_driver.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index d2efe82..88f4444 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -656,7 +656,11 @@ static int uio_mmap_physical(struct vm_area_struct *vma) vma->vm_flags |= VM_IO | VM_RESERVED; - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + if (idev->info->mem[mi].set_pgprot) + vma->vm_page_prot = + idev->info->mem[mi].set_pgprot(vma->vm_page_prot); + else + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); return remap_pfn_range(vma, vma->vm_start, diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index 665517c..4c618cd 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h @@ -28,6 +28,7 @@ struct uio_map; * @memtype: type of memory addr points to * @internal_addr: ioremap-ped version of addr, for driver internal use * @map: for use by the UIO core only. + * @set_pgprot: allow driver to override default(noncached) pgprot */ struct uio_mem { const char *name; @@ -36,6 +37,7 @@ struct uio_mem { int memtype; void __iomem *internal_addr; struct uio_map *map; + pgprot_t (*set_pgprot)(pgprot_t prot); }; #define MAX_UIO_MAPS 5