Bug 438947

Summary: Map MMIO aperture failed when region's size(4K) < PageSize(16K)
Product: [Fedora] Fedora Reporter: Zhan, Yi <yi.zhan>
Component: xorg-x11-drv-atiAssignee: Dave Airlie <airlied>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: xgl-maint
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-03-26 23:28:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 163350    
Attachments:
Description Flags
patch to fix ia64 map MMIO aperture issue none

Description Zhan, Yi 2008-03-26 03:57:34 UTC
Description of problem:

I ran into this issue on IA64. When I tried to start X server, ati driver failed
with 
    (EE) MACH64(0): Unable to map mmio aperture. Argument list too long (7) .

By looking into this closer I found that the issue is caused by a call to
pci_device_map_range() when trying to map MMIO aperture.
        int err = pci_device_map_range(pVideo,
                                       MMIOBase,
                                       PageSize,
                                       mode, &pATI->pMMIO);

Here the PageSize, which is 16K on ia64, is passed as the size argument but the
size of the corresponding region in my ati card is only 4K.  
        Region 0: Memory at fa000000 (32-bit, non-prefetchable) [size=16M]
        Region 1: I/O ports at 5800 [size=256]
        Region 2: Memory at fbfd0000 (32-bit, non-prefetchable) [size=4K]
        Expansion ROM at fbfa0000 [disabled] [size=128K]

Then an E2BIG is returned when the pci_device_map_range() checks arguments and
the X server failed to start. I also do some investigation about why I didn't
run into this on F8. It turns out recently X server changed to use libpciaccess
instead of previous xf86* method. Previously xf86MapPciMem() is used to do the
map and somehow allow the map succeed. 

I saw this on IA64, but I image that other platform which has a 4k region2 ati
card and 16K page size would run into the same issue. I think the real region
size instead of PageSize would be passed to the MMIO map and unmap functions in
this case. I will attach a patch to do this. 

Version-Release number of selected component (if applicable):
xorg-x11-drv-ati-6.8.0-4.fc9.ia64.rpm

How reproducible:

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Zhan, Yi 2008-03-26 03:57:34 UTC
Created attachment 299093 [details]
patch to fix ia64 map MMIO aperture issue

Comment 2 Dave Airlie 2008-03-26 06:32:19 UTC
its probably easier to just fix this to do the same path for all systems
regardless of pagesize.

I've put a modified patch into fedoras driver now it should be in
xf86-video-ati-6.8.0-5 when it hits rawhide.

Comment 3 Zhan, Yi 2008-03-26 11:09:26 UTC
Thanks, I have checked out the source from fedora cvs and it works fine :) Any
other info is needed?  

Comment 4 Dave Airlie 2008-03-26 23:28:39 UTC
nope I've put the fix upstream as well, thanks for testing.