Port-i386 archive

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

Re: inconsisten sizeof(paddr_t) in userland/kernel for PAE/i386



>>>>> "Manuel" == Manuel Bouyer <bouyer%antioche.eu.org@localhost> writes:

    Manuel> On Sat, Dec 05, 2009 at 10:51:35AM +0000, Cherry G. Mathew wrote:
    >> Hello,
    >> 
    >> If you run the test program from the agp(4) manpage on
    >> XEN3PAE_DOM0 and GENERIC, it fails on the former, and succeeds in
    >> the latter. ( A more interesting symptom is that
    >> xf86AllocateGARTMemory() fails for xorg on the PAE kernel; ie; no
    >> xorg with agp for Xen/i386 dom0s )
    >> 
    >> The symptom is caused by inconsistent values of the macro
    >> AGPIOC_ALLOCATE in user applications and the kernel.
    >> 
    >> The reason for this is that sizeof(paddr_t) can vary depending on
    >> the codebase you're compiling from, due to a double #if clause
    >> here:
    >> http://nxr.netbsd.org/xref/src/sys/arch/i386/include/types.h#50
    >> 
    >> There must be a better way to express PAE on i386 within
    >> machine/types.h, surely ?

    Manuel> What do you mean ? physical addresses are indeed 32bits on
    Manuel> i386 without PAE and 64bit on i386 with PAE. I don't think
    Manuel> you want to define paddr_t as being always 64bits, this
    Manuel> would add some overhead for non-PAE kernels (not to mention
    Manuel> that native i386 doesn't support PAE at this time and would
    Manuel> need some work to support 64bit paddr_t, even without PAE
    Manuel> support).  Maybe AGPIOC_ALLOCATE should be fixed to not use
    Manuel> paddr_t but a fixed size type instead ?

The following seems to work for me on both native i386 and xen.

Index: sys/sys/agpio.h
===================================================================
RCS file: /home/repos/netbsd-current/src/sys/sys/agpio.h,v
retrieving revision 1.5
diff -u -r1.5 agpio.h
--- sys/sys/agpio.h     26 Dec 2005 18:41:36 -0000      1.5
+++ sys/sys/agpio.h     5 Dec 2009 14:13:41 -0000
@@ -111,7 +111,7 @@
        int key;                /* tag of allocation            */
        size_t pg_count;        /* number of pages              */
        uint32_t type;          /* 0 == normal, other devspec   */
-       paddr_t physical;       /* device specific (some devices
+       uint64_t physical;      /* device specific (some devices
                                 * need a phys address of the
                                 * actual page behind the gatt
                                 * table)                        */

-- 
Cherry


Home | Main Index | Thread Index | Old Index