mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org
Subject: Re: [PATCH v2 1/1] x86/early_printk: Use __iomem address space for IO
Date: Mon, 12 Oct 2015 11:12:18 +0300	[thread overview]
Message-ID: <1444637538.8361.560.camel@linux.intel.com> (raw)
In-Reply-To: <alpine.DEB.2.11.1510112115190.6097@nanos>

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 <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2015-10-12  8:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 14:29 Andy Shevchenko
2015-10-09 14:35 ` Andy Shevchenko
2015-10-11 19:18 ` Thomas Gleixner
2015-10-12  8:12   ` Andy Shevchenko [this message]
2015-10-12  9:11     ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444637538.8361.560.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome