public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: hare@suse.de, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] aic7xxx: fix MMIO for PPC 44x platforms
Date: Fri, 11 Apr 2008 17:41:09 -0400	[thread overview]
Message-ID: <1207950070.5066.44.camel@localhost.localdomain> (raw)
In-Reply-To: <200804092309.32130.sshtylyov@ru.mvista.com>

On Wed, 2008-04-09 at 23:09 +0400, Sergei Shtylyov wrote:
> The driver stores the the PCI resource address into 'u_long' variable before
> calling ioremap_nocache() on it. This warrants kernel oops when the registers
> are accessed on PPC 44x platforms which (being 32-bit) have PCI memory space
> mapped beyond 4 GB.
> 
> The arch/ppc/ kernel has a fixup in ioremap() that creates an illusion of the
> PCI I/O and memory resources are mapped below 4 GB, but arch/powerpc/ code got
> rid of this trick, having instead CONFIG_RESOURCES_64BIT enabled.
> 
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

Well, all I can say about the architecture is: yuk!

However, if this is truly a problem, you only fixed half of it:
aic79xx_osm.h and aic79xx_osm_pci.c have the same problems.

Also, your fixes don't look complete.  This statement in
ahc_pci_map_registers(struct ahc_softc *ahc)

			ahc->bsh.ioport = base;

Should be warning because bsh.ioport is still u_long and base should be
u64 (so a truncation warning).  I think the correct fix (unless you also
have a ludicrous port space?) is simply to cast to (u_long).


> -               printf("aic7xxx: PCI%d:%d:%d MEM region 0x%lx "
> +               printf("aic7xxx: PCI%d:%d:%d MEM region 0x%llx "
>                        "unavailable. Cannot memory map device.\n",
>                        ahc_get_pci_bus(ahc->dev_softc),
>                        ahc_get_pci_slot(ahc->dev_softc),
>                        ahc_get_pci_function(ahc->dev_softc),
> -                      base);
> +                      (uint64_t)base);

This isn't quite right: uint64_t is unsigned long on 64 bit platforms,
so it won't match %llx (you need it to be unsigned long long
explicitly).

> @@ -398,7 +398,7 @@ ahc_pci_map_registers(struct ahc_softc *
>                                ahc_get_pci_bus(ahc->dev_softc),
>                                ahc_get_pci_slot(ahc->dev_softc),
>                                ahc_get_pci_function(ahc->dev_softc),
> -                              base);
> +                              (u_long)base);

This also isn't right ... you need to cast it to unsigned long long and
use %llx in the printf.

James



  reply	other threads:[~2008-04-11 21:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09 19:09 [PATCH] aic7xxx: fix MMIO for PPC 44x platforms Sergei Shtylyov
2008-04-11 21:41 ` James Bottomley [this message]
2008-04-12 14:52   ` Sergei Shtylyov

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=1207950070.5066.44.camel@localhost.localdomain \
    --to=james.bottomley@hansenpartnership.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sshtylyov@ru.mvista.com \
    /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