NetBSD-Bugs archive

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

re: port-i386/42966: kernel built from today's netbsd-5 crashes



The following reply was made to PR port-i386/42966; it has been noted by GNATS.

From: matthew green <mrg%eterna.com.au@localhost>
To: Anne Bennett <anne%porcupine.montreal.qc.ca@localhost>
Cc: port-i386-maintainer%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
    netbsd-bugs%netbsd.org@localhost, gnats-bugs%netbsd.org@localhost,
    "David H. Gutteridge" <dhgutteridge%sympatico.ca@localhost>
Subject: re: port-i386/42966: kernel built from today's netbsd-5 crashes
Date: Thu, 18 Mar 2010 15:30:32 +1100

    
    > it comes from this call in i915_dma.c:
    > 
    >   drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
    > 
    > and the final argument is passed as the boundary.  notice how it is
    > not a power of two?  it really wants to be 0x1.0000.0000.
    > 
    > anne, david, can one of you try changing this to 0?  or if you have
    > 2GB of ram or less, try 0x80000000...
    
    Kernel says:
      total memory = 2038 MB
      avail memory = 1991 MB
    
    Any preference as to whether I try 0x80000000 or 0x0 (to replace
    0xffffffff, I assume)?  Which one are you hoping to patch to in
    the end?
 
 nope.
    
    Meanwhile, I have two files "i915_dma.c" with different contents:
       (1) /usr/src/sys/dev/pci/drm/i915_dma.c
       (2) /usr/src/sys/external/bsd/drm/dist/shared-core/i915_dma.c
 
 it's the 2nd one.  the old code is ... no longer used.  however,
 i think this patch might be something that works and is correct,
 but since i don't have intel drm i can't test it.  (it does compile :)
 
 
 thanks,
 
 .mrg.
 
 
 
 Index: bsd-core/drmP.h
 ===================================================================
 RCS file: /cvsroot/src/sys/external/bsd/drm/dist/bsd-core/drmP.h,v
 retrieving revision 1.9.10.3
 diff -p -r1.9.10.3 drmP.h
 *** bsd-core/drmP.h    30 Jan 2010 19:41:19 -0000      1.9.10.3
 --- bsd-core/drmP.h    18 Mar 2010 04:28:20 -0000
 *************** extern struct drm_device *drm_units[];
 *** 310,322 ****
   #define PCIY_EXPRESS 0x10
   #endif
   
 - typedef unsigned long dma_addr_t;
   #if defined(__FreeBSD__)
   typedef u_int64_t u64;
   typedef u_int32_t u32;
   typedef u_int16_t u16;
   typedef u_int8_t u8;
   #else
   typedef uint64_t u64;
   typedef uint32_t u32;
   typedef uint16_t u16;
 --- 310,323 ----
   #define PCIY_EXPRESS 0x10
   #endif
   
   #if defined(__FreeBSD__)
 + typedef unsigned long dma_addr_t;
   typedef u_int64_t u64;
   typedef u_int32_t u32;
   typedef u_int16_t u16;
   typedef u_int8_t u8;
   #else
 + typedef bus_addr_t dma_addr_t;
   typedef uint64_t u64;
   typedef uint32_t u32;
   typedef uint16_t u16;
 Index: bsd-core/drm_pci.c
 ===================================================================
 RCS file: /cvsroot/src/sys/external/bsd/drm/dist/bsd-core/drm_pci.c,v
 retrieving revision 1.4.10.1
 diff -p -r1.4.10.1 drm_pci.c
 *** bsd-core/drm_pci.c 20 Jun 2009 23:36:59 -0000      1.4.10.1
 --- bsd-core/drm_pci.c 18 Mar 2010 04:28:20 -0000
 *************** drm_pci_alloc(struct drm_device *dev, si
 *** 112,118 ****
   #elif   defined(__NetBSD__)
        dmah->tag = dev->pa.pa_dmat;
   
 !      if ((ret = bus_dmamem_alloc(dmah->tag, size, align, maxaddr,
            dmah->segs, 1, &nsegs, BUS_DMA_WAITOK)) != 0) {
                printf("drm: Unable to allocate %zu bytes of DMA, error %d\n",
                    size, ret);
 --- 112,118 ----
   #elif   defined(__NetBSD__)
        dmah->tag = dev->pa.pa_dmat;
   
 !      if ((ret = bus_dmamem_alloc(dmah->tag, size, align, maxaddr+1,
            dmah->segs, 1, &nsegs, BUS_DMA_WAITOK)) != 0) {
                printf("drm: Unable to allocate %zu bytes of DMA, error %d\n",
                    size, ret);
 *************** drm_pci_alloc(struct drm_device *dev, si
 *** 136,142 ****
                free(dmah, DRM_MEM_DMA);
                return NULL;
        }
 !      if ((ret = bus_dmamap_create(dmah->tag, size, 1, size, maxaddr,
             BUS_DMA_NOWAIT, &dmah->map)) != 0) {
                printf("drm: Unable to create DMA map, error %d\n", ret);
                bus_dmamem_unmap(dmah->tag, dmah->vaddr, size);
 --- 136,142 ----
                free(dmah, DRM_MEM_DMA);
                return NULL;
        }
 !      if ((ret = bus_dmamap_create(dmah->tag, size, 1, size, maxaddr+1,
             BUS_DMA_NOWAIT, &dmah->map)) != 0) {
                printf("drm: Unable to create DMA map, error %d\n", ret);
                bus_dmamem_unmap(dmah->tag, dmah->vaddr, size);
 


Home | Main Index | Thread Index | Old Index