From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751741AbbJLJMb (ORCPT ); Mon, 12 Oct 2015 05:12:31 -0400 Received: from www.linutronix.de ([62.245.132.108]:43490 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751585AbbJLJMa (ORCPT ); Mon, 12 Oct 2015 05:12:30 -0400 Date: Mon, 12 Oct 2015 11:11:50 +0200 (CEST) From: Thomas Gleixner To: Andy Shevchenko cc: linux-kernel@vger.kernel.org, Ingo Molnar , "H . Peter Anvin" , x86@kernel.org Subject: Re: [PATCH v2 1/1] x86/early_printk: Use __iomem address space for IO In-Reply-To: <1444637538.8361.560.camel@linux.intel.com> Message-ID: References: <1444400949-103551-1-git-send-email-andriy.shevchenko@linux.intel.com> <1444637538.8361.560.camel@linux.intel.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 12 Oct 2015, Andy Shevchenko wrote: > On Sun, 2015-10-11 at 21:18 +0200, Thomas Gleixner wrote: > > Andy, > > > > On Fri, 9 Oct 2015, Andy Shevchenko wrote: > > > #ifdef CONFIG_PCI > > > static void mem32_serial_out(unsigned long addr, int offset, int > > value) > > > { > > > - u32 *vaddr = (u32 *)addr; > > > + void __iomem *vaddr = (void __iomem *)addr; > > > /* shift implied by pointer type */ > > > writel(value, vaddr + offset); > > > > This is broken. Assume vaddr = 0x1000 and offset = 1 > > Yes, I noticed in reply to myself > http://www.spinics.net/lists/kernel/msg2094143.html > > Tests were okay because platform I have is using 8-bit I/O. > > Does it make sense to use the following approach? > > void __iomem *vaddr = (void __iomem *)addr; > writel(value, vaddr + offset << 2); What's wrong with: u32 __iomem *vaddr ? Thanks, tglx