From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751555AbbJLIMY (ORCPT ); Mon, 12 Oct 2015 04:12:24 -0400 Received: from mga01.intel.com ([192.55.52.88]:19417 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751094AbbJLIMW (ORCPT ); Mon, 12 Oct 2015 04:12:22 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,671,1437462000"; d="scan'208";a="824751125" Message-ID: <1444637538.8361.560.camel@linux.intel.com> Subject: Re: [PATCH v2 1/1] x86/early_printk: Use __iomem address space for IO From: Andy Shevchenko To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Ingo Molnar , "H . Peter Anvin" , x86@kernel.org Date: Mon, 12 Oct 2015 11:12:18 +0300 In-Reply-To: References: <1444400949-103551-1-git-send-email-andriy.shevchenko@linux.intel.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); > > ==> u32 *vaddr = 0x1000; > ==> vaddr + offset = 0x1004 > > with your change > > ==> void __iomem *vaddr = 0x1000; > > ==> vaddr + offset = 0x1001 > > This comment is there for a reason: > > /* shift implied by pointer type */ > > Thanks, > > tglx -- Andy Shevchenko Intel Finland Oy