[PATCH] r300 ia64 fixes
Here are a few small fixes to get r300 going on ia64. Thanks to Stephane for pointing out the resource size mismatch. The patch just fixes that (PCI resources in Linux are 'unsigned long' at the moment, not 'unsigned int') and adds the checking for write combining regions I posted earlier since I don't think that's been applied. Thanks, Jesse Index: drm/linux-core/drmP.h === RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drmP.h,v retrieving revision 1.2 diff -u -r1.2 drmP.h --- drm/linux-core/drmP.h 2 Mar 2005 03:54:27 - 1.2 +++ drm/linux-core/drmP.h 8 Mar 2005 18:40:03 - @@ -55,6 +55,9 @@ #include linux/smp_lock.h/* For (un)lock_kernel */ #include linux/mm.h #include linux/pagemap.h +#ifdef __ia64__ +#include linux/efi.h +#endif #if defined(__alpha__) || defined(__powerpc__) #include asm/pgtable.h /* For pte_wrprotect */ #endif @@ -850,7 +853,7 @@ unsigned int cmd, unsigned long arg); extern int drm_rmmap(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_initmap(drm_device_t * dev, unsigned int offset, +extern int drm_initmap(drm_device_t * dev, unsigned long offset, unsigned int size, unsigned int resource, int type, int flags); extern int drm_addbufs(struct inode *inode, struct file *filp, Index: drm/linux-core/drm_bufs.c === RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drm_bufs.c,v retrieving revision 1.2 diff -u -r1.2 drm_bufs.c --- drm/linux-core/drm_bufs.c 2 Mar 2005 03:54:27 - 1.2 +++ drm/linux-core/drm_bufs.c 8 Mar 2005 18:40:03 - @@ -53,7 +53,7 @@ * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where * applicable and if supported by the kernel. */ -int drm_initmap(drm_device_t * dev, unsigned int offset, unsigned int size, +int drm_initmap(drm_device_t * dev, unsigned long offset, unsigned int size, unsigned int resource, int type, int flags) { drm_map_t *map; @@ -63,7 +63,7 @@ if ((offset (~PAGE_MASK)) || (size (~PAGE_MASK))) return -EINVAL; -#if !defined(__sparc__) !defined(__alpha__) +#if !defined(__sparc__) !defined(__alpha__) !defined(__ia64__) if (offset + size offset || offset virt_to_phys(high_memory)) return -EINVAL; #endif Index: drm/linux-core/drm_vm.c === RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drm_vm.c,v retrieving revision 1.2 diff -u -r1.2 drm_vm.c --- drm/linux-core/drm_vm.c 2 Mar 2005 03:54:27 - 1.2 +++ drm/linux-core/drm_vm.c 8 Mar 2005 18:40:03 - @@ -639,9 +639,13 @@ vma-vm_flags |= VM_IO; /* not in core dump */ } #if defined(__ia64__) - if (map-type != _DRM_AGP) + if (efi_range_is_wc(vma-vm_start, vma-vm_end - + vma-vm_start) (map-type != _DRM_AGP)) vma-vm_page_prot = - pgprot_writecombine(vma-vm_page_prot); + pgprot_writecombine(vma-vm_page_prot); + else + vma-vm_page_prot = + pgprot_noncached(vma-vm_page_prot); #endif offset = dev-driver-get_reg_ofs(dev); #ifdef __sparc__
Re: [PATCH] r300 ia64 fixes
On Tuesday, March 8, 2005 10:47 am, Jesse Barnes wrote: Here are a few small fixes to get r300 going on ia64. Thanks to Stephane for pointing out the resource size mismatch. The patch just fixes that (PCI resources in Linux are 'unsigned long' at the moment, not 'unsigned int') and adds the checking for write combining regions I posted earlier since I don't think that's been applied. Here's a more complete patch that fixes up some ppc stuff as well. Jesse Index: drm/linux-core/drmP.h === RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drmP.h,v retrieving revision 1.2 diff -u -p -r1.2 drmP.h --- drm/linux-core/drmP.h 2 Mar 2005 03:54:27 - 1.2 +++ drm/linux-core/drmP.h 8 Mar 2005 19:00:54 - @@ -55,6 +55,9 @@ #include linux/smp_lock.h/* For (un)lock_kernel */ #include linux/mm.h #include linux/pagemap.h +#ifdef __ia64__ +#include linux/efi.h +#endif #if defined(__alpha__) || defined(__powerpc__) #include asm/pgtable.h /* For pte_wrprotect */ #endif @@ -850,7 +853,7 @@ extern int drm_addmap(struct inode *inod unsigned int cmd, unsigned long arg); extern int drm_rmmap(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_initmap(drm_device_t * dev, unsigned int offset, +extern int drm_initmap(drm_device_t * dev, unsigned long offset, unsigned int size, unsigned int resource, int type, int flags); extern int drm_addbufs(struct inode *inode, struct file *filp, Index: drm/linux-core/drm_bufs.c === RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drm_bufs.c,v retrieving revision 1.2 diff -u -p -r1.2 drm_bufs.c --- drm/linux-core/drm_bufs.c 2 Mar 2005 03:54:27 - 1.2 +++ drm/linux-core/drm_bufs.c 8 Mar 2005 19:00:54 - @@ -53,7 +53,7 @@ EXPORT_SYMBOL(drm_get_resource_len); * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where * applicable and if supported by the kernel. */ -int drm_initmap(drm_device_t * dev, unsigned int offset, unsigned int size, +int drm_initmap(drm_device_t * dev, unsigned long offset, unsigned int size, unsigned int resource, int type, int flags) { drm_map_t *map; @@ -63,7 +63,7 @@ int drm_initmap(drm_device_t * dev, unsi if ((offset (~PAGE_MASK)) || (size (~PAGE_MASK))) return -EINVAL; -#if !defined(__sparc__) !defined(__alpha__) +#if !defined(__sparc__) !defined(__alpha__) !defined(__ia64__) !defined(__powerpc__) if (offset + size offset || offset virt_to_phys(high_memory)) return -EINVAL; #endif @@ -198,7 +198,7 @@ int drm_addmap(struct inode *inode, stru /* addmap didn't match an existing permanent map, that's an error */ return -EINVAL; } -#if !defined(__sparc__) !defined(__alpha__) !defined(__ia64__) +#if !defined(__sparc__) !defined(__alpha__) !defined(__ia64__) !defined(__powerpc__) if (map-offset + map-size map-offset || map-offset virt_to_phys(high_memory)) { drm_free(map, sizeof(*map), DRM_MEM_MAPS); Index: drm/linux-core/drm_vm.c === RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drm_vm.c,v retrieving revision 1.2 diff -u -p -r1.2 drm_vm.c --- drm/linux-core/drm_vm.c 2 Mar 2005 03:54:27 - 1.2 +++ drm/linux-core/drm_vm.c 8 Mar 2005 19:00:54 - @@ -639,9 +639,13 @@ int drm_mmap(struct file *filp, struct v vma-vm_flags |= VM_IO; /* not in core dump */ } #if defined(__ia64__) - if (map-type != _DRM_AGP) + if (efi_range_is_wc(vma-vm_start, vma-vm_end - + vma-vm_start) (map-type != _DRM_AGP)) vma-vm_page_prot = - pgprot_writecombine(vma-vm_page_prot); + pgprot_writecombine(vma-vm_page_prot); + else + vma-vm_page_prot = + pgprot_noncached(vma-vm_page_prot); #endif offset = dev-driver-get_reg_ofs(dev); #ifdef __sparc__
Re: [PATCH] r300 ia64 fixes
On Tuesday, March 8, 2005 10:47 am, Jesse Barnes wrote: Here are a few small fixes to get r300 going on ia64. Thanks to Stephane for pointing out the resource size mismatch. The patch just fixes that (PCI resources in Linux are 'unsigned long' at the moment, not 'unsigned int') and adds the checking for write combining regions I posted earlier since I don't think that's been applied. Thanks, Jesse Or another one that removes the silly overflow and 'offset within real memory' checks altogether. Take your pick as to which should be applied :) Thanks, Jesse Index: drm/linux-core/drmP.h === RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drmP.h,v retrieving revision 1.2 diff -u -p -r1.2 drmP.h --- drm/linux-core/drmP.h 2 Mar 2005 03:54:27 - 1.2 +++ drm/linux-core/drmP.h 8 Mar 2005 19:03:03 - @@ -55,6 +55,9 @@ #include linux/smp_lock.h/* For (un)lock_kernel */ #include linux/mm.h #include linux/pagemap.h +#ifdef __ia64__ +#include linux/efi.h +#endif #if defined(__alpha__) || defined(__powerpc__) #include asm/pgtable.h /* For pte_wrprotect */ #endif @@ -850,7 +853,7 @@ extern int drm_addmap(struct inode *inod unsigned int cmd, unsigned long arg); extern int drm_rmmap(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_initmap(drm_device_t * dev, unsigned int offset, +extern int drm_initmap(drm_device_t * dev, unsigned long offset, unsigned int size, unsigned int resource, int type, int flags); extern int drm_addbufs(struct inode *inode, struct file *filp, Index: drm/linux-core/drm_bufs.c === RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drm_bufs.c,v retrieving revision 1.2 diff -u -p -r1.2 drm_bufs.c --- drm/linux-core/drm_bufs.c 2 Mar 2005 03:54:27 - 1.2 +++ drm/linux-core/drm_bufs.c 8 Mar 2005 19:03:03 - @@ -53,7 +53,7 @@ EXPORT_SYMBOL(drm_get_resource_len); * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where * applicable and if supported by the kernel. */ -int drm_initmap(drm_device_t * dev, unsigned int offset, unsigned int size, +int drm_initmap(drm_device_t * dev, unsigned long offset, unsigned int size, unsigned int resource, int type, int flags) { drm_map_t *map; @@ -63,10 +63,6 @@ int drm_initmap(drm_device_t * dev, unsi if ((offset (~PAGE_MASK)) || (size (~PAGE_MASK))) return -EINVAL; -#if !defined(__sparc__) !defined(__alpha__) - if (offset + size offset || offset virt_to_phys(high_memory)) - return -EINVAL; -#endif if (!(list = drm_alloc(sizeof(*list), DRM_MEM_MAPS))) return -ENOMEM; memset(list, 0, sizeof(*list)); @@ -198,13 +194,6 @@ int drm_addmap(struct inode *inode, stru /* addmap didn't match an existing permanent map, that's an error */ return -EINVAL; } -#if !defined(__sparc__) !defined(__alpha__) !defined(__ia64__) - if (map-offset + map-size map-offset || - map-offset virt_to_phys(high_memory)) { - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - return -EINVAL; - } -#endif #ifdef __alpha__ map-offset += dev-hose-mem_space-start; #endif Index: drm/linux-core/drm_vm.c === RCS file: /cvsroot/r300/r300_driver/drm/linux-core/drm_vm.c,v retrieving revision 1.2 diff -u -p -r1.2 drm_vm.c --- drm/linux-core/drm_vm.c 2 Mar 2005 03:54:27 - 1.2 +++ drm/linux-core/drm_vm.c 8 Mar 2005 19:03:03 - @@ -639,9 +639,13 @@ int drm_mmap(struct file *filp, struct v vma-vm_flags |= VM_IO; /* not in core dump */ } #if defined(__ia64__) - if (map-type != _DRM_AGP) + if (efi_range_is_wc(vma-vm_start, vma-vm_end - + vma-vm_start) (map-type != _DRM_AGP)) vma-vm_page_prot = - pgprot_writecombine(vma-vm_page_prot); + pgprot_writecombine(vma-vm_page_prot); + else + vma-vm_page_prot = + pgprot_noncached(vma-vm_page_prot); #endif offset = dev-driver-get_reg_ofs(dev); #ifdef __sparc__
Re: [PATCH] r300 ia64 fixes
On Tuesday, March 8, 2005 11:04 am, Jesse Barnes wrote: On Tuesday, March 8, 2005 10:47 am, Jesse Barnes wrote: Here are a few small fixes to get r300 going on ia64. Thanks to Stephane for pointing out the resource size mismatch. The patch just fixes that (PCI resources in Linux are 'unsigned long' at the moment, not 'unsigned int') and adds the checking for write combining regions I posted earlier since I don't think that's been applied. Thanks, Jesse Or another one that removes the silly overflow and 'offset within real memory' checks altogether. Take your pick as to which should be applied :) Anyone have a preference on this stuff? Should we remove the checks altogether or just the ones against the highmem variable? If we did the latter, we could remove the #ifdefs altogether, though I'm not sure how useful that check is--seems like we'd run into trouble elsewhere if we got a bad address anyway... Thanks, Jesse --- SF email is sponsored by - The IT Product Guide Read honest candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595alloc_id=14396op=click -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [PATCH] r300 ia64 fixes
On Tuesday, March 8, 2005 12:24 pm, Jesse Barnes wrote: On Tuesday, March 8, 2005 11:04 am, Jesse Barnes wrote: On Tuesday, March 8, 2005 10:47 am, Jesse Barnes wrote: Here are a few small fixes to get r300 going on ia64. Thanks to Stephane for pointing out the resource size mismatch. The patch just fixes that (PCI resources in Linux are 'unsigned long' at the moment, not 'unsigned int') and adds the checking for write combining regions I posted earlier since I don't think that's been applied. Thanks, Jesse Or another one that removes the silly overflow and 'offset within real memory' checks altogether. Take your pick as to which should be applied :) Anyone have a preference on this stuff? Should we remove the checks altogether or just the ones against the highmem variable? If we did the latter, we could remove the #ifdefs altogether, though I'm not sure how useful that check is--seems like we'd run into trouble elsewhere if we got a bad address anyway... Oh, and these fixes, regardless of what they are, should go into the main drm tree not the r300 branch, since they're not related to the r300 stuff at all (IOW I can't commit them). Thanks, Jesse --- SF email is sponsored by - The IT Product Guide Read honest candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595alloc_id=14396op=click -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [PATCH] r300 ia64 fixes
Jesse Barnes writes: Anyone have a preference on this stuff? Should we remove the checks altogether or just the ones against the highmem variable? If we did the latter, we could remove the #ifdefs altogether, though I'm not sure how useful that check is--seems like we'd run into trouble elsewhere if we got a bad address anyway... My preference would be to remove the check altogether. Paul. --- SF email is sponsored by - The IT Product Guide Read honest candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595alloc_id=14396op=click -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel
Re: [PATCH] r300 ia64 fixes
On Tuesday, March 08, 2005 4:24 pm, Paul Mackerras wrote: Jesse Barnes writes: Anyone have a preference on this stuff? Should we remove the checks altogether or just the ones against the highmem variable? If we did the latter, we could remove the #ifdefs altogether, though I'm not sure how useful that check is--seems like we'd run into trouble elsewhere if we got a bad address anyway... My preference would be to remove the check altogether. Mine too, Dave, maybe you could check that one in (r300-ia64-fixes-3.patch)? How about the new virt_to_bus usage? That'll be a problem on ppc as well... Thanks, Jesse --- SF email is sponsored by - The IT Product Guide Read honest candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595alloc_id=14396op=click -- ___ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel