tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: check & reprogram PCI BAR



On Tue, Jan 19, 2010 at 12:50:55PM +0100, Christoph Egger wrote:
> > > bge0 at pci8 dev 4 function 0: Broadcom BCM5714/5715 Gigabit Ethernet
> > > extent_alloc_region: extent `iomem' (0x0 - 0xffffffff)
> > > extent_alloc_region: start 0xf3ed988fd8410000, end 0xf3ed988fd841ffff
> > > panic: extent_alloc_region: region lies outside extent
> > > fatal breakpoint trap in supervisor mode
> > > trap type 1 code 0 rip ffffffff801fd13d cs e030 rflags 246 cr2  0 cpl 8
> > rsp ffffffff80eb2070
> > > Stopped in pid 0.1 (system) at  netbsd:breakpoint+0x5:  leave
> > > breakpoint() at netbsd:breakpoint+0x5
> > > panic() at netbsd:panic+0x26e
> > > extent_alloc_region() at netbsd:extent_alloc_region+0x91
> > > bus_space_map() at netbsd:bus_space_map+0x52
> > > pci_mapreg_submap() at netbsd:pci_mapreg_submap+0xe6
> > > pci_mapreg_map() at netbsd:pci_mapreg_map+0x2e
> > > bge_attach() at netbsd:bge_attach+0x181
> > > [...]
> > > 
> > > 
> > > Hence I think, we need to check the PCI BARs if they are
> > > within the range of DMA-safe memory.
> > 
> > Why do you think it should be in DMA-safe memory ?
> > If it's a 64bit PCI BAR then there's no problems having it
> > mapped anywhere in physical memory (AFAIK).
> > To me, the problem looks more like in x86 bus_space(9) which
> > doesn't handle 64bit BAR very well.
> 
> Please describe the 64bit BAR problem with x86 bus_space(9).

It looks like the x86 bus_space(9) thinks a memory-mapped register
can only be mapped below 4Gb (extent `iomem' (0x0 - 0xffffffff)).
This is not true with 64bit BARs.
The right fix probably needs more thoughs than just making the
iomem extent larger (maybe a different iomem extent for 64bit BARs ?
which are mapped above 4Gb)

>  
> > > If they are not then reprogram the PCI BARs properly.
> > > 
> > > I would like to get some ideas how this should be done
> > > in NetBSD. Any ideas ?
> > 
> > Look at the *FIXUP options.
> 
> How does the PCI_ADDR_FIXUP exactly work?

I think they do reprogram the BAR based on the kernel's knowledge of
allocated memory ranges. You'd have to check the sources.

> Why are the *FIXUP options disabled by default in x86 kernels?

Because on some systems it reprograms the BARs in a way which doesn't
work. I'm not sure the kernel can do this in a reasonable and safe
way anyway, it would need detailled knowledge of the hardware,
which may not be available.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index