[openfabrics-ewg] FW: Mstflint - not working on ppc64 andwhendriver is notloaded on AMD
Tseng-Hui (Frank) Lin
thlin at us.ibm.com
Mon Oct 2 12:34:23 PDT 2006
On Sun, 2006-10-01 at 09:50 +0200, Michael S. Tsirkin wrote:
> Quoting r. Tseng-Hui (Frank) Lin <thlin at us.ibm.com>:
> > Subject: RE: FW: Mstflint - not working on ppc64 andwhendriver is notloaded on AMD
> >
> > The ppc64 problem is actually in pci_64.c. Here is the patch:
> >
> > ============ cut here =============
> > diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
> > index 4c4449b..490403c 100644
> > --- a/arch/powerpc/kernel/pci_64.c
> > +++ b/arch/powerpc/kernel/pci_64.c
> > @@ -734,9 +734,7 @@ static struct resource *__pci_mmap_make_
> > if (hose == 0)
> > return NULL; /* should never happen */
> >
> > - /* If memory, add on the PCI bridge address offset */
> > if (mmap_state == pci_mmap_mem) {
> > - *offset += hose->pci_mem_offset;
> > res_bit = IORESOURCE_MEM;
> > } else {
> > io_offset = (unsigned long)hose->io_base_virt - pci_io_base;
> > ============= end cut =============
> >
> > The mmap() system call on resource0 does not work on ppc64 without this
> > patch. PowerMAC G5 got away with this because its hose->pci_mem_offset
> > was set to 0.
> >
> > The fix is made on 8/21. It may be able to make it into 2.6.19. But it
> > certainly won't get into SLES10, SLES9-SP3, or REHL4-U4 which have
> > already been released.
> >
> > To cover both cases with and without the fix, my patch try to
> > mmap /sys/bus/pci/..../resource0 first. It it failed it tries
> > mmap /proc/bus/pci/.... If it failed again, we have no choice but fall
> > back to use PCI config space.
>
> OK, so for OFED just mmap from /proc/bus/pci/ should be sufficient
> work-around - it will make things work when driver is loaded.
> Correct?
>
Michael:
No. Without the above patch for pci_64.c, mmap() is broken in ppc64
no matter mmap() from /sys/bus/pci/<pci location>/resource0
or /proc/bus/pci/<pci location>. The only way is "mstflint
-d /proc/bus/pci/<pci location>", which use pread() and pwrite() instaed
of mmap().
With the patch, mmap() from /sys/bus/pci/<pci location>/resource0
and /proc/bus/pci/<pci location> both work when mthca driver is loaded.
No workaround is needed.
Note that "-d <pci location>" uses mmap from /proc/bus/pci/<pci
location>. "-d /proc/bus/pci/<pci location>" uses pread() and pwrite().
More information about the ewg
mailing list