Re: de(4) bus_dma diff needs testing.

2009-06-14 Thread Christian Weisgerber
Theo de Raadt dera...@cvs.openbsd.org wrote:

  ahci0: error 35 loading dmamap
  de0: unable to load tx map, error = 35
 
 bigmem is unworkable.
 Your DMA descriptor rings are in high memory.
 They should be in low memory.

I thought iommu takes care of that?

-- 
Christian naddy Weisgerber  na...@mips.inka.de



Re: de(4) bus_dma diff needs testing.

2009-06-14 Thread David Gwynne

On 15/06/2009, at 1:39 AM, Christian Weisgerber wrote:


Theo de Raadt dera...@cvs.openbsd.org wrote:


ahci0: error 35 loading dmamap
de0: unable to load tx map, error = 35


bigmem is unworkable.
Your DMA descriptor rings are in high memory.
They should be in low memory.


I thought iommu takes care of that?


what iommu?

also, why should you have to fix these mappings in bus_dma if you  
simply allocate memory up front in the right place for the devices?


dlg



Re: de(4) bus_dma diff needs testing.

2009-06-13 Thread Theo de Raadt
   Please test the following diff if you have a de(4) Ethernet
   adapter. This should fix the issues with the bus_dma map
   handling. Already tested by matthieu@ on an alpha.. so I'm
   looking for some further testing.
  
  Anyone? I'd really like to remove the Alpha hack and have this
  fixed properly.
 
 I tried this in my bigmem amd64.  Both with and without the diff
 the machine becomes unusable and I get streams of these errors on
 the console:
 
 de0: unable to load tx map, error = 35
 de0: unable to load tx map, error = 35
 de0: unable to load tx map, error = 35
 ahci0: error 35 loading dmamap
 ahci0: error 35 loading dmamap
 de0: unable to load tx map, error = 35
 ahci0: error 35 loading dmamap
 de0: unable to load tx map, error = 35
 de0: unable to load tx map, error = 35

bigmem is unworkable.

Your DMA descriptor rings are in high memory.

They should be in low memory.



Re: de(4) bus_dma diff needs testing.

2009-06-11 Thread Brad
On Saturday 23 May 2009 15:59:06 Brad wrote:
 Please test the following diff if you have a de(4) Ethernet
 adapter. This should fix the issues with the bus_dma map
 handling. Already tested by matthieu@ on an alpha.. so I'm
 looking for some further testing.

Anyone? I'd really like to remove the Alpha hack and have this
fixed properly.


 Index: if_de.c
 ===
 RCS file: /cvs/src/sys/dev/pci/if_de.c,v
 retrieving revision 1.101
 diff -u -p -r1.101 if_de.c
 --- if_de.c   28 Nov 2008 02:44:17 -  1.101
 +++ if_de.c   27 Apr 2009 05:15:35 -
 @@ -227,6 +227,10 @@ void tulip_initring(tulip_softc_t * cons
  tulip_desc_t *descs, int ndescs);
  void tulip_shutdown(void *arg);

 +bus_dmamap_t tulip_alloc_rxmap(tulip_softc_t *);
 +void tulip_free_rxmap(tulip_softc_t *, bus_dmamap_t);
 +bus_dmamap_t tulip_alloc_txmap(tulip_softc_t *);
 +void tulip_free_txmap(tulip_softc_t *, bus_dmamap_t);

  void
  tulip_timeout_callback(void *arg)
 @@ -2859,6 +2863,30 @@ tulip_ifmedia_status(struct ifnet * cons
  req-ifm_active = tulip_media_to_ifmedia[sc-tulip_media];
  }

 +bus_dmamap_t
 +tulip_alloc_rxmap(tulip_softc_t *sc)
 +{
 + return (sc-tulip_free_rxmaps[--sc-tulip_num_free_rxmaps]);
 +}
 +
 +void
 +tulip_free_rxmap(tulip_softc_t *sc, bus_dmamap_t map)
 +{
 + sc-tulip_free_rxmaps[sc-tulip_num_free_rxmaps++] = map;
 +}
 +
 +bus_dmamap_t
 +tulip_alloc_txmap(tulip_softc_t *sc)
 +{
 + return (sc-tulip_free_txmaps[--sc-tulip_num_free_txmaps]);
 +}
 +
 +void
 +tulip_free_txmap(tulip_softc_t *sc, bus_dmamap_t map)
 +{
 + sc-tulip_free_txmaps[sc-tulip_num_free_txmaps++] = map;
 +}
 +
  void
  tulip_addr_filter(tulip_softc_t * const sc)
  {
 @@ -3048,7 +3076,7 @@ tulip_reset(tulip_softc_t * const sc)
   break;
   map = TULIP_GETCTX(m, bus_dmamap_t);
   bus_dmamap_unload(sc-tulip_dmatag, map);
 - sc-tulip_txmaps[sc-tulip_txmaps_free++] = map;
 + tulip_free_txmap(sc, map);
   m_freem(m);
  }

 @@ -3086,7 +3114,7 @@ tulip_reset(tulip_softc_t * const sc)
   break;
   map = TULIP_GETCTX(m, bus_dmamap_t);
   bus_dmamap_unload(sc-tulip_dmatag, map);
 - sc-tulip_rxmaps[sc-tulip_rxmaps_free++] = map;
 + tulip_free_rxmap(sc, map);
   m_freem(m);
  }

 @@ -3242,12 +3270,9 @@ tulip_rx_intr(tulip_softc_t * const sc)
   IF_DEQUEUE(sc-tulip_rxq, ms);
   for (me = ms; total_len  0; total_len--) {
   map = TULIP_GETCTX(me, bus_dmamap_t);
 -#ifdef __alpha__
 - if (map-_dm_window != NULL)
 -#endif
   TULIP_RXMAP_POSTSYNC(sc, map);
   bus_dmamap_unload(sc-tulip_dmatag, map);
 - sc-tulip_rxmaps[sc-tulip_rxmaps_free++] = map;
 + tulip_free_rxmap(sc, map);
  #if defined(DIAGNOSTIC)
   TULIP_SETCTX(me, NULL);
  #endif
 @@ -3270,7 +3295,7 @@ tulip_rx_intr(tulip_softc_t * const sc)
   bus_dmamap_sync(sc-tulip_dmatag, map, 0, me-m_len,
   BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
   bus_dmamap_unload(sc-tulip_dmatag, map);
 - sc-tulip_rxmaps[sc-tulip_rxmaps_free++] = map;
 + tulip_free_rxmap(sc, map);
  #if defined(DIAGNOSTIC)
   TULIP_SETCTX(me, NULL);
  #endif
 @@ -3318,7 +3343,7 @@ tulip_rx_intr(tulip_softc_t * const sc)

   map = TULIP_GETCTX(me, bus_dmamap_t);
   bus_dmamap_unload(sc-tulip_dmatag, map);
 - sc-tulip_rxmaps[sc-tulip_rxmaps_free++] = map;
 + tulip_free_rxmap(sc, map);
  #if defined(DIAGNOSTIC)
   TULIP_SETCTX(me, NULL);
  #endif
 @@ -3399,9 +3424,9 @@ tulip_rx_intr(tulip_softc_t * const sc)
*/
   do {
   tulip_desc_t * const nextout = ri-ri_nextout;
 - if (sc-tulip_rxmaps_free  0)
 - map = sc-tulip_rxmaps[--sc-tulip_rxmaps_free];
 - else {
 + if (sc-tulip_num_free_rxmaps  0) {
 + map = tulip_alloc_rxmap(sc);
 + } else {
   m_freem(ms);
   sc-tulip_flags |= TULIP_RXBUFSLOW;
  #if defined(TULIP_DEBUG)
 @@ -3493,11 +3518,8 @@ tulip_tx_intr(tulip_softc_t * const sc)
   IF_DEQUEUE(sc-tulip_txq, m);
   if (m != NULL) {
   bus_dmamap_t map = TULIP_GETCTX(m, bus_dmamap_t);
 -#ifdef __alpha__
 - if (map-_dm_window != NULL)
 -#endif
   TULIP_TXMAP_POSTSYNC(sc, map);
 - sc-tulip_txmaps[sc-tulip_txmaps_free++] = map;
 + tulip_free_txmap(sc, map);
  #if NBPFILTER  0
   if (sc-tulip_bpf != NULL)
   bpf_mtap(sc-tulip_if.if_bpf, m, BPF_DIRECTION_OUT);
 @@ -3844,14 +3866,14 @@ tulip_txput(tulip_softc_t * const sc, st
  /*
   * Reclaim some DMA maps from if we are out.
   */
 -if (sc-tulip_txmaps_free == 0) {
 +if (sc-tulip_num_free_txmaps == 0) {
  #if defined(TULIP_DEBUG)
   sc-tulip_dbg.dbg_no_txmaps++;
  #endif
   freedescs +=