* Re: [PATCH] sh: use declared coherent memory for dreamcast pci
2008-01-24 9:40 [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
@ 2008-01-24 22:33 ` Adrian McMenamin
2008-01-24 22:53 ` Adrian McMenamin
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Adrian McMenamin @ 2008-01-24 22:33 UTC (permalink / raw)
To: linux-sh
On Thu, 2008-01-24 at 18:40 +0900, Magnus Damm wrote:
> sh: use declared coherent memory for dreamcast pci ethernet adapter
>
> This patch makes the dreamcast use the recently added declared coherent
> memory functions to point out the memory window suitable for dma.
>
> Apart from cleaning up, this gives the dreamcast a proper memory allocator
> for pci dma memory.
>
> Signed-off-by: Magnus Damm <damm@igel.co.jp>
I get this now:
[ 2.894858] IP-Config: Failed to open eth0
[ 2.898395] IP-Config: No network devices available.
So it appears, on first blush, that the patch breaks the driver. I'll
test further to confirm.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] sh: use declared coherent memory for dreamcast pci
2008-01-24 9:40 [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
2008-01-24 22:33 ` [PATCH] sh: use declared coherent memory for dreamcast pci Adrian McMenamin
@ 2008-01-24 22:53 ` Adrian McMenamin
2008-01-25 4:16 ` [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Adrian McMenamin @ 2008-01-24 22:53 UTC (permalink / raw)
To: linux-sh
On Thu, 2008-01-24 at 22:33 +0000, Adrian McMenamin wrote:
> On Thu, 2008-01-24 at 18:40 +0900, Magnus Damm wrote:
> > sh: use declared coherent memory for dreamcast pci ethernet adapter
> >
> > This patch makes the dreamcast use the recently added declared coherent
> > memory functions to point out the memory window suitable for dma.
> >
> > Apart from cleaning up, this gives the dreamcast a proper memory allocator
> > for pci dma memory.
> >
> > Signed-off-by: Magnus Damm <damm@igel.co.jp>
>
>
> I get this now:
>
> [ 2.894858] IP-Config: Failed to open eth0
> [ 2.898395] IP-Config: No network devices available.
>
> So it appears, on first blush, that the patch breaks the driver. I'll
> test further to confirm.
>
I can confirm that the patches:
f838a96ef5cdc261cb458b154e79b259688008b8
b82c3460d4a2d86cdac80e178a76f3833f1aecba
1b0a4750bf70d0e6f1b4ef573b1231530b9891be
all need to be reverted as they break the Dreamcast network driver
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter
2008-01-24 9:40 [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
2008-01-24 22:33 ` [PATCH] sh: use declared coherent memory for dreamcast pci Adrian McMenamin
2008-01-24 22:53 ` Adrian McMenamin
@ 2008-01-25 4:16 ` Magnus Damm
2008-01-25 21:00 ` [PATCH] sh: use declared coherent memory for dreamcast pci Adrian McMenamin
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Magnus Damm @ 2008-01-25 4:16 UTC (permalink / raw)
To: linux-sh
[-- Attachment #1: Type: text/plain, Size: 2179 bytes --]
On Jan 25, 2008 7:53 AM, Adrian McMenamin
<adrian@newgolddream.dyndns.info> wrote:
> On Thu, 2008-01-24 at 22:33 +0000, Adrian McMenamin wrote:
> > On Thu, 2008-01-24 at 18:40 +0900, Magnus Damm wrote:
> > > sh: use declared coherent memory for dreamcast pci ethernet adapter
> > >
> > > This patch makes the dreamcast use the recently added declared coherent
> > > memory functions to point out the memory window suitable for dma.
> > >
> > > Apart from cleaning up, this gives the dreamcast a proper memory allocator
> > > for pci dma memory.
> > >
> > > Signed-off-by: Magnus Damm <damm@igel.co.jp>
> >
> >
> > I get this now:
> >
> > [ 2.894858] IP-Config: Failed to open eth0
> > [ 2.898395] IP-Config: No network devices available.
> >
> > So it appears, on first blush, that the patch breaks the driver. I'll
> > test further to confirm.
> >
>
> I can confirm that the patches:
>
> f838a96ef5cdc261cb458b154e79b259688008b8
> b82c3460d4a2d86cdac80e178a76f3833f1aecba
> 1b0a4750bf70d0e6f1b4ef573b1231530b9891be
>
> all need to be reverted as they break the Dreamcast network driver
Hi Adrian,
Thanks for testing and sorry about breaking the dreamcast ethernet
driver. We do need declared coherent memory support for the sm501 chip
and there shouldn't be any problems with using that interface for the
dreamcast. At least in theory. =)
I did unfortunately introduce a generic bug with the declared coherent
memory V2 patch yesterday, but I've posted a fix for that earlier
today. I don't however think that fix will help you. What you're
seeing seems to be that IP-config doesn't work which hints that packet
data isn't transferred as it should. And in your case it's most likely
because some virtual address or dma handle isn't setup properly.
The main thing here is that dma_alloc_coherent() should return the
same virtual address and dma handle regardless if my coherent patches
are applied. Or the values should at least be sane.
Can you please apply the attached patch and test both with and without
the 3 declared coherent patches? I'd like to see the values printed
out by printk() both with and without the declared coherent patches.
Thank you.
/ magnus
[-- Attachment #2: linux-2.6.25-pre-sh-8139too-dma-printk-20080125.patch --]
[-- Type: application/octet-stream, Size: 710 bytes --]
--- 0001/drivers/net/8139too.c
+++ work/drivers/net/8139too.c 2008-01-25 13:08:46.000000000 +0900
@@ -1311,6 +1311,15 @@ static int rtl8139_open (struct net_devi
&tp->tx_bufs_dma, GFP_KERNEL);
tp->rx_ring = dma_alloc_coherent(&tp->pci_dev->dev, RX_BUF_TOT_LEN,
&tp->rx_ring_dma, GFP_KERNEL);
+
+ printk("zzzzzzzz:"
+ "tx_bufs = 0x%08lx/0x%08lx, "
+ "rx_ring = 0x%08lx/0x%08lx, "
+ "(0x%08lx)\n",
+ (unsigned long)tp->tx_bufs, (unsigned long)tp->tx_bufs_dma,
+ (unsigned long)tp->rx_ring, (unsigned long)tp->rx_ring_dma,
+ (unsigned long)tp->pci_dev->dev.dma_mem);
+
if (tp->tx_bufs == NULL || tp->rx_ring == NULL) {
free_irq(dev->irq, dev);
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] sh: use declared coherent memory for dreamcast pci
2008-01-24 9:40 [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
` (2 preceding siblings ...)
2008-01-25 4:16 ` [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
@ 2008-01-25 21:00 ` Adrian McMenamin
2008-01-25 21:46 ` Adrian McMenamin
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Adrian McMenamin @ 2008-01-25 21:00 UTC (permalink / raw)
To: linux-sh
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 6023 bytes --]
On Fri, 2008-01-25 at 13:16 +0900, Magnus Damm wrote:
> Can you please apply the attached patch and test both with and without
> the 3 declared coherent patches? I'd like to see the values printed
> out by printk() both with and without the declared coherent patches.
>
> Thank you.
>
> / magnus
Without the coherency patches...
[ 2.833387] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring 0xa1842000/0x01842000, (0x00000000)
[ 0.000000] Linux version 2.6.24-rc8-g96010b55-dirty (adrian@bossclass) (gcc version 3.4.6) #325 PREEMPT Fri Jan 25 20:55:23 GMT 2008
[ 0.000000] console [sercon0] enabled
[ 0.000000] Booting machvec: Sega Dreamcast
[ 0.000000] Node 0: start_pfn = 0xc000, low = 0xd000
[ 0.000000] Zone PFN ranges:
[ 0.000000] Normal 49152 -> 53248
[ 0.000000] Movable zone start PFN for each node
[ 0.000000] early_node_map[1] active PFN ranges
[ 0.000000] 0: 49152 -> 53248
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 4064
[ 0.000000] Kernel command line: root=/dev/nfs rw nfsroot\x192.168.61.50:/home/adrian/debdist ip=dhcp earlyprintk=serial video=pvr2fb:640x480-32@60 consol7
[ 0.000000] PID hash table entries: 64 (order: 6, 256 bytes)
[ 0.000000] Using tmu for system timer
[ 0.004322] Using 12.469 MHz high precision timer.
[ 0.010042] Console: colour dummy device 80x25
[ 0.015260] Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.023141] Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.032852] Memory: 13492k/16384k available (1907k kernel code, 632k data, 96k init)
[ 0.041763] PVR\x040205c1 CVR\0000000 PRR\0000000
[ 0.047277] I-cache : n_ways=1 n_sets%6 way_incr92
[ 0.053284] I-cache : entry_mask=0x00001fe0 alias_mask=0x00001000 n_aliases=2
[ 0.061475] D-cache : n_ways=1 n_setsQ2 way_incr\x16384
[ 0.067580] D-cache : entry_mask=0x00003fe0 alias_mask=0x00003000 n_aliases=4
[ 0.075997] SLUB: Genslabs=9, HWalign2, Order=0-1, MinObjects=4, CPUs=1, Nodes=1
[ 0.175560] Mount-cache hash table entries: 512
[ 0.181822] CPU: SH7750
[ 0.188425] net_namespace: 64 bytes
[ 0.195981] NET: Registered protocol family 16
[ 0.218402] Maple bus core now registered.
[ 0.223419] DMA: Registering DMA API.
[ 0.227713] DMA: Registering sh_dmac handler (4 channels).
[ 0.237179] DMA: Registering pvr2_dmac handler (1 channel).
[ 0.245030] DMA: Registering g2_dmac handler (4 channels).
[ 0.254340] Autoconfig PCI channel 0x8c278530
[ 0.259497] Scanning bus 00, I/O 0x01001600:0x01003600, Mem 0x01840000:0x01848000
[ 0.268201] 00:00.0 Class 0200: 11db:1234 (rev 10)
[ 0.273749] I/O at 0x01001600 [size=0x100]
[ 0.279483] Mem at 0x01840000 [size=0x100]
[ 0.285923] PCI: Fixing up device 0000:00:00.0
[ 0.310760] Time: SuperH clocksource has been installed.
[ 0.321218] NET: Registered protocol family 2
[ 0.363178] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.373744] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[ 0.381772] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[ 0.389184] TCP: Hash tables configured (established 512 bind 512)
[ 0.396293] TCP reno registered
[ 0.411663] sq: Registering store queue API.
[ 0.418456] cpufreq: SuperH CPU frequency driver.
[ 0.423949] cpufreq: clock framework rate rounding not supported on this CPU.
[ 0.435453] Total HugeTLB memory allocated, 0
[ 0.442081] io scheduler noop registered
[ 0.446662] io scheduler anticipatory registered (default)
[ 1.578357] Console: switching to colour frame buffer device 80x30
[ 1.637402] fb0: NEC PowerVR2 (rev 1.1) frame buffer device, using 1200k/8192k of video memory
[ 1.647303] fb0: Mode 640x480-32 pitch = 2560 cable: VGA video output: VGA
[ 1.655257] fb0: registering with SQ API
[ 1.660102] sqremap: NEC PowerVR2 [2048 pages] va 0xe0000000 pa 0xa5000000
[ 1.668709] fb0: Mapped video memory to SQ addr 0xe0000000
[ 2.232603] SuperH SCI(F) driver initialized
[ 2.238353] sh-sci: ttySC0 at MMIO 0xffe00000 (irq = 25) is a sci
[ 2.246417] sh-sci: ttySC1 at MMIO 0xffe80000 (irq = 43) is a scif
�kÈ 2.253707] console handover: boot [sercon0] -> real [ttySC1]
[ 2.261322] sh-sci sh-sci: CPU frequency notifier registered
[ 2.267290] 8139too Fast Ethernet driver 0.9.28
[ 2.274966] eth0: RealTek RTL8139 at 0xa1001700, 00:d0:f1:03:12:b9, IRQ 83
[ 2.282232] Dreamcast_keyboard: probe of 0:0.port failed with error -22
[ 2.288540] Dreamcast_keyboard: probe of 1:0.port failed with error -22
[ 2.295327] Dreamcast_keyboard: probe of 2:0.port failed with error -22
[ 2.302148] Dreamcast_keyboard: probe of 3:0.port failed with error -22
[ 2.308991] TCP cubic registered
[ 2.312239] NET: Registered protocol family 1
[ 2.316745] NET: Registered protocol family 17
[ 2.322042] RPC: Registered udp transport module.
[ 2.326201] RPC: Registered tcp transport module.
[ 2.833387] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring = 0xa1842000/0x01842000, (0x00000000)
[ 2.842145] eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
[ 3.848013] Sending DHCP requests ., OK
[ 3.867949] IP-Config: Got DHCP answer from 192.168.61.50, my address is 192.168.61.55
[ 3.876893] IP-Config: Complete:
[ 3.879289] device=eth0, addr\x192.168.61.55, mask%5.255.255.224, gw\x192.168.61.50,
[ 3.887844] host\x192.168.61.55, domain=, nis-domain=(none),
[ 3.893976] bootserver\x192.168.61.50, rootserver\x192.168.61.50, rootpath[ 3.902331] Looking up port of RPC 100003/2 on 192.168.61.50
[ 3.912680] Looking up port of RPC 100005/1 on 192.168.61.50
[ 3.953472] VFS: Mounted root (nfs filesystem).
[ 3.958001] Freeing unused kernel memory: 96k freed
-
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] sh: use declared coherent memory for dreamcast pci
2008-01-24 9:40 [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
` (3 preceding siblings ...)
2008-01-25 21:00 ` [PATCH] sh: use declared coherent memory for dreamcast pci Adrian McMenamin
@ 2008-01-25 21:46 ` Adrian McMenamin
2008-01-27 4:37 ` [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Adrian McMenamin @ 2008-01-25 21:46 UTC (permalink / raw)
To: linux-sh
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 6055 bytes --]
On Fri, 2008-01-25 at 21:00 +0000, Adrian McMenamin wrote:
> On Fri, 2008-01-25 at 13:16 +0900, Magnus Damm wrote:
>
> > Can you please apply the attached patch and test both with and without
> > the 3 declared coherent patches? I'd like to see the values printed
> > out by printk() both with and without the declared coherent patches.
> >
> > Thank you.
> >
> > / magnus
>
> Without the coherency patches...
> [ 2.833387] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring > 0xa1842000/0x01842000, (0x00000000)
>
With the coherency patches...
[ 2.890870] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring = 0x00000000/0x00000000, (0x8cd010e0)
dreamy login: �[ 0.000000] Linux version 2.6.24-rc8-g3f58465d-dirty (adrian@bossclass) (gcc version 3.4.6) #326 PREEMPT Fri Jan 25 21:43:31 GMT 2008
[ 0.000000] console [sercon0] enabled
[ 0.000000] Booting machvec: Sega Dreamcast
[ 0.000000] Node 0: start_pfn = 0xc000, low = 0xd000
[ 0.000000] Zone PFN ranges:
[ 0.000000] Normal 49152 -> 53248
[ 0.000000] Movable zone start PFN for each node
[ 0.000000] early_node_map[1] active PFN ranges
[ 0.000000] 0: 49152 -> 53248
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 4064
[ 0.000000] Kernel command line: root=/dev/nfs rw nfsroot\x192.168.61.50:/home/adrian/debdist ip=dhcp earlyprintk=serial video=pvr2fb:640x480-32@60 consol7
[ 0.000000] PID hash table entries: 64 (order: 6, 256 bytes)
[ 0.000000] Using tmu for system timer
[ 0.004317] Using 12.469 MHz high precision timer.
[ 0.010038] Console: colour dummy device 80x25
[ 0.015264] Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.023145] Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.032828] Memory: 13492k/16384k available (1907k kernel code, 632k data, 96k init)
[ 0.041737] PVR\x040205c1 CVR\0000000 PRR\0000000
[ 0.047252] I-cache : n_ways=1 n_sets%6 way_incr92
[ 0.053261] I-cache : entry_mask=0x00001fe0 alias_mask=0x00001000 n_aliases=2
[ 0.061449] D-cache : n_ways=1 n_setsQ2 way_incr\x16384
[ 0.067556] D-cache : entry_mask=0x00003fe0 alias_mask=0x00003000 n_aliases=4
[ 0.075993] SLUB: Genslabs=9, HWalign2, Order=0-1, MinObjects=4, CPUs=1, Nodes=1
[ 0.175612] Mount-cache hash table entries: 512
[ 0.181888] CPU: SH7750
[ 0.188400] net_namespace: 64 bytes
[ 0.195963] NET: Registered protocol family 16
[ 0.218251] Maple bus core now registered.
[ 0.223390] DMA: Registering DMA API.
[ 0.227711] DMA: Registering sh_dmac handler (4 channels).
[ 0.234246] Maple bus at (0, 0): Connected function 0x1
[ 0.240286] No maple driver found for this device
[ 0.246516] Maple bus at (1, 0): Connected function 0x40
[ 0.252651] No maple driver found for this device
[ 0.259225] No maple devices attached to port 2
[ 0.264485] No maple devices attached to port 3
[ 0.271997] DMA: Registering pvr2_dmac handler (1 channel).
[ 0.279888] DMA: Registering g2_dmac handler (4 channels).
[ 0.289247] Autoconfig PCI channel 0x8c278530
[ 0.294387] Scanning bus 00, I/O 0x01001600:0x01003600, Mem 0x01840000:0x01848000
[ 0.303027] Maple bus at (0, 1): Connected function 0xE
[ 0.309065] No maple driver found for this device
[ 0.314888] 00:00.0 Class 0200: 11db:1234 (rev 10)
[ 0.320438] I/O at 0x01001600 [size=0x100]
[ 0.325984] Mem at 0x01840000 [size=0x100]
[ 0.332308] Maple bus at (0, 2): Connected function 0x10
[ 0.338442] No maple driver found for this device
[ 0.344736] PCI: Fixing up device 0000:00:00.0
[ 0.366638] Time: SuperH clocksource has been installed.
[ 0.376928] NET: Registered protocol family 2
[ 0.419080] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.429569] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[ 0.437609] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[ 0.445045] TCP: Hash tables configured (established 512 bind 512)
[ 0.452150] TCP reno registered
[ 0.467588] sq: Registering store queue API.
[ 0.474363] cpufreq: SuperH CPU frequency driver.
[ 0.479926] cpufreq: clock framework rate rounding not supported on this CPU.
[ 0.491474] Total HugeTLB memory allocated, 0
[ 0.498290] io scheduler noop registered
[ 0.502845] io scheduler anticipatory registered (default)
[ 1.640505] Console: switching to colour frame buffer device 80x30
[ 1.700596] fb0: NEC PowerVR2 (rev 1.1) frame buffer device, using 1200k/8192k of video memory
[ 1.710566] fb0: Mode 640x480-32 pitch = 2560 cable: VGA video output: VGA
[ 1.718540] fb0: registering with SQ API
[ 1.723397] sqremap: NEC PowerVR2 [2048 pages] va 0xe0000000 pa 0xa5000000
[ 1.732097] fb0: Mapped video memory to SQ addr 0xe0000000
[ 2.296084] SuperH SCI(F) driver initialized
[ 2.301844] sh-sci: ttySC0 at MMIO 0xffe00000 (irq = 25) is a sci
[ 2.309935] sh-sci: ttySC1 at MMIO 0xffe80000 (irq = 43) is a scif
�kÈ 2.317207] console handover: boot [sercon0] -> real [ttySC1]
[ 2.324926] sh-sci sh-sci: CPU frequency notifier registered
[ 2.330778] 8139too Fast Ethernet driver 0.9.28
[ 2.338340] eth0: RealTek RTL8139 at 0xa1001700, 00:d0:f1:03:12:b9, IRQ 83
[ 2.346804] input: Keyboard as /devices/maple/1:00.40/input/input0
[ 2.367072] TCP cubic registered
[ 2.369682] NET: Registered protocol family 1
[ 2.374272] NET: Registered protocol family 17
[ 2.379687] RPC: Registered udp transport module.
[ 2.383910] RPC: Registered tcp transport module.
[ 2.890870] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring = 0x00000000/0x00000000, (0x8cd010e0)
[ 2.899672] IP-Config: Failed to open eth0
[ 2.903757] IP-Config: No network devices available.
[ 2.909606] Looking up port of RPC 100003/2 on 192.168.61.50
-
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter
2008-01-24 9:40 [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
` (4 preceding siblings ...)
2008-01-25 21:46 ` Adrian McMenamin
@ 2008-01-27 4:37 ` Magnus Damm
2008-02-01 3:00 ` Paul Mundt
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Magnus Damm @ 2008-01-27 4:37 UTC (permalink / raw)
To: linux-sh
Adrian,
Thanks for testing and posting the results.
On Jan 26, 2008 6:46 AM, Adrian McMenamin
<adrian@newgolddream.dyndns.info> wrote:
>
> On Fri, 2008-01-25 at 21:00 +0000, Adrian McMenamin wrote:
> > On Fri, 2008-01-25 at 13:16 +0900, Magnus Damm wrote:
> >
> > > Can you please apply the attached patch and test both with and without
> > > the 3 declared coherent patches? I'd like to see the values printed
> > > out by printk() both with and without the declared coherent patches.
> > >
> > > Thank you.
> > >
> > > / magnus
> >
> > Without the coherency patches...
> > [ 2.833387] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring > > 0xa1842000/0x01842000, (0x00000000)
> >
> With the coherency patches...
>
>
> [ 2.890870] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring = 0x00000000/0x00000000, (0x8cd010e0)
Ok, it looks like i got the dma values right at least, but that the rx
ring allocation fails.
The amount of dma memory for the dreamcast ethernet adapter seems to
be 8 pages (32k), and for dreamcast the 8139too driver allocates 2
pages (4*1536) for tx and 5 pages (16k+16+2048) for rx. It all adds up
to 7 pages (tx+rx) which in theory should fit within 8 pages of
available dma memory.
It does however look like the bitmap code operates on order
granularity both when it comes to size and alignment which means that
the rx allocation of 5 pages becomes an order 3 allocation - 8 pages
aligned to 8 pages - which in turn results in that we can't fulfill
the allocation request. At least that's my theory. =)
As a test and/or workaround, can you try changing RX_BUF_IDX in
8139too.c from 1 in the dreamcast case to 0? That should result in 3
pages for the rx buffer which should lead to an order 2 allocation
unless I'm mistaken. And we should be able to fulfill that request
without problems.
Does the RX_BUF_IDX change make the declared coherent patches work?
Thank you!
/ magnus
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter
2008-01-24 9:40 [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
` (5 preceding siblings ...)
2008-01-27 4:37 ` [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
@ 2008-02-01 3:00 ` Paul Mundt
2008-02-03 21:32 ` [PATCH] sh: use declared coherent memory for dreamcast pci Adrian McMenamin
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Paul Mundt @ 2008-02-01 3:00 UTC (permalink / raw)
To: linux-sh
On Sun, Jan 27, 2008 at 01:37:40PM +0900, Magnus Damm wrote:
> On Jan 26, 2008 6:46 AM, Adrian McMenamin
> <adrian@newgolddream.dyndns.info> wrote:
> >
> > On Fri, 2008-01-25 at 21:00 +0000, Adrian McMenamin wrote:
> > > On Fri, 2008-01-25 at 13:16 +0900, Magnus Damm wrote:
> > >
> > > > Can you please apply the attached patch and test both with and without
> > > > the 3 declared coherent patches? I'd like to see the values printed
> > > > out by printk() both with and without the declared coherent patches.
> > > >
> > > > Thank you.
> > > >
> > > > / magnus
> > >
> > > Without the coherency patches...
> > > [ 2.833387] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring > > > 0xa1842000/0x01842000, (0x00000000)
> > >
> > With the coherency patches...
> >
> >
> > [ 2.890870] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring = 0x00000000/0x00000000, (0x8cd010e0)
>
> Ok, it looks like i got the dma values right at least, but that the rx
> ring allocation fails.
>
> The amount of dma memory for the dreamcast ethernet adapter seems to
> be 8 pages (32k), and for dreamcast the 8139too driver allocates 2
> pages (4*1536) for tx and 5 pages (16k+16+2048) for rx. It all adds up
> to 7 pages (tx+rx) which in theory should fit within 8 pages of
> available dma memory.
>
> It does however look like the bitmap code operates on order
> granularity both when it comes to size and alignment which means that
> the rx allocation of 5 pages becomes an order 3 allocation - 8 pages
> aligned to 8 pages - which in turn results in that we can't fulfill
> the allocation request. At least that's my theory. =)
>
> As a test and/or workaround, can you try changing RX_BUF_IDX in
> 8139too.c from 1 in the dreamcast case to 0? That should result in 3
> pages for the rx buffer which should lead to an order 2 allocation
> unless I'm mistaken. And we should be able to fulfill that request
> without problems.
>
> Does the RX_BUF_IDX change make the declared coherent patches work?
>
Adrian? It would be nice to know if dropping RX_BUF_IDX works for you.
The other alternative is to break this down on to a single page boundary,
but that requires that we change the bitmap management approach away from
order-granularity. I've hacked together some changes in the bitmap API to
handle this as a proof of concept, so at least it's doable, and it may
make sense to try and extend the API in this way in the future.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] sh: use declared coherent memory for dreamcast pci
2008-01-24 9:40 [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
` (6 preceding siblings ...)
2008-02-01 3:00 ` Paul Mundt
@ 2008-02-03 21:32 ` Adrian McMenamin
2008-02-03 23:26 ` Adrian McMenamin
2008-02-04 9:07 ` [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
9 siblings, 0 replies; 11+ messages in thread
From: Adrian McMenamin @ 2008-02-03 21:32 UTC (permalink / raw)
To: linux-sh
On Sun, 2008-01-27 at 13:37 +0900, Magnus Damm wrote:
> Adrian,
>
> Thanks for testing and posting the results.
>
> On Jan 26, 2008 6:46 AM, Adrian McMenamin
> <adrian@newgolddream.dyndns.info> wrote:
> >
> > On Fri, 2008-01-25 at 21:00 +0000, Adrian McMenamin wrote:
> > > On Fri, 2008-01-25 at 13:16 +0900, Magnus Damm wrote:
> > >
> > > > Can you please apply the attached patch and test both with and without
> > > > the 3 declared coherent patches? I'd like to see the values printed
> > > > out by printk() both with and without the declared coherent patches.
> > > >
> > > > Thank you.
> > > >
> > > > / magnus
> > >
> > > Without the coherency patches...
> > > [ 2.833387] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring > > > 0xa1842000/0x01842000, (0x00000000)
> > >
> > With the coherency patches...
> >
> >
> > [ 2.890870] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring = 0x00000000/0x00000000, (0x8cd010e0)
>
> Ok, it looks like i got the dma values right at least, but that the rx
> ring allocation fails.
>
> The amount of dma memory for the dreamcast ethernet adapter seems to
> be 8 pages (32k), and for dreamcast the 8139too driver allocates 2
> pages (4*1536) for tx and 5 pages (16k+16+2048) for rx. It all adds up
> to 7 pages (tx+rx) which in theory should fit within 8 pages of
> available dma memory.
>
> It does however look like the bitmap code operates on order
> granularity both when it comes to size and alignment which means that
> the rx allocation of 5 pages becomes an order 3 allocation - 8 pages
> aligned to 8 pages - which in turn results in that we can't fulfill
> the allocation request. At least that's my theory. =)
>
> As a test and/or workaround, can you try changing RX_BUF_IDX in
> 8139too.c from 1 in the dreamcast case to 0? That should result in 3
> pages for the rx buffer which should lead to an order 2 allocation
> unless I'm mistaken. And we should be able to fulfill that request
> without problems.
>
> Does the RX_BUF_IDX change make the declared coherent patches work?
>
I am afraid the short answer is "no".
[ 2.749341] eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
[ 3.756113] Sending DHCP requests .<3>eth0: PCI Bus error 2200.
[ 3.760108] eth0: PCI Bus error 2200.
[ 3.764106] eth0: PCI Bus error 2200.
[ 3.768130] eth0: PCI Bus error 2200.
[ 3.772120] eth0: PCI Bus error 2200.
[ 3.776112] eth0: PCI Bus error 2200.
[ 3.780113] eth0: PCI Bus error 2200.
[ 3.784113] eth0: PCI Bus error 2200.
[ 3.788090] eth0: PCI Bus error 2200.
[ 3.791806] eth0: PCI Bus error 2200.
[ 3.792113] eth0: PCI Bus error 2200.
[ 3.796113] eth0: PCI Bus error 2200.
[ 3.800118] eth0: PCI Bus error 2200.
[ 3.804117] eth0: PCI Bus error 2200.
[ 3.808113] eth0: PCI Bus error 2200.
[ 3.812113] eth0: PCI Bus error 2200.
[ 3.816113] eth0: PCI Bus error 2200.
[ 3.820122] eth0: PCI Bus error 2200.
[ 3.824113] eth0: PCI Bus error 2200.
[ 3.828113] eth0: PCI Bus error 2200.
[ 3.832113] eth0: PCI Bus error 2200.
[ 3.836118] eth0: PCI Bus error 2200.
[ 3.840117] eth0: PCI Bus error 2200.
[ 3.844114] eth0: PCI Bus error 2200.
[ 3.848113] eth0: PCI Bus error 2200.
[ 3.852113] eth0: PCI Bus error 2200.
[ 3.856122] eth0: PCI Bus error 2200.
[ 3.859835] eth0: PCI Bus error 2200.
[ 3.860114] eth0: PCI Bus error 2200.
[ 3.864114] eth0: PCI Bus error 2200.
[ 3.868122] eth0: PCI Bus error 2200.
[ 3.872114] eth0: PCI Bus error 2200.
[ 3.876114] eth0: PCI Bus error 2200.
[ 3.880114] eth0: PCI Bus error 2200.
[ 3.884119] eth0: PCI Bus error 2200.
[ 3.888118] eth0: PCI Bus error 2200.
[ 3.892114] eth0: PCI Bus error 2200.
[ 3.896114] eth0: PCI Bus error 2200.
[ 3.900114] eth0: PCI Bus error 2200.
[ 3.904123] eth0: PCI Bus error 2200.
[ 3.908114] eth0: PCI Bus error 2200.
[ 3.912115] eth0: PCI Bus error 2200.
[ 3.916115] eth0: PCI Bus error 2200.
[ 3.920120] eth0: PCI Bus error 2200.
[ 3.924119] eth0: PCI Bus error 2200.
[ 3.928114] eth0: PCI Bus error 2200.
And so on, seemingly for ever.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] sh: use declared coherent memory for dreamcast pci
2008-01-24 9:40 [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
` (7 preceding siblings ...)
2008-02-03 21:32 ` [PATCH] sh: use declared coherent memory for dreamcast pci Adrian McMenamin
@ 2008-02-03 23:26 ` Adrian McMenamin
2008-02-04 9:07 ` [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
9 siblings, 0 replies; 11+ messages in thread
From: Adrian McMenamin @ 2008-02-03 23:26 UTC (permalink / raw)
To: linux-sh
On Sun, 2008-02-03 at 21:32 +0000, Adrian McMenamin wrote:
> On Sun, 2008-01-27 at 13:37 +0900, Magnus Damm wrote:
> > Adrian,
> >
> > Thanks for testing and posting the results.
> >
> > On Jan 26, 2008 6:46 AM, Adrian McMenamin
> > <adrian@newgolddream.dyndns.info> wrote:
> > >
> > > On Fri, 2008-01-25 at 21:00 +0000, Adrian McMenamin wrote:
> > > > On Fri, 2008-01-25 at 13:16 +0900, Magnus Damm wrote:
> > > >
> > > > > Can you please apply the attached patch and test both with and without
> > > > > the 3 declared coherent patches? I'd like to see the values printed
> > > > > out by printk() both with and without the declared coherent patches.
> > > > >
> > > > > Thank you.
> > > > >
> > > > > / magnus
> > > >
> > > > Without the coherency patches...
> > > > [ 2.833387] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring > > > > 0xa1842000/0x01842000, (0x00000000)
> > > >
> > > With the coherency patches...
> > >
> > >
> > > [ 2.890870] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring = 0x00000000/0x00000000, (0x8cd010e0)
> >
> > Ok, it looks like i got the dma values right at least, but that the rx
> > ring allocation fails.
> >
> > The amount of dma memory for the dreamcast ethernet adapter seems to
> > be 8 pages (32k), and for dreamcast the 8139too driver allocates 2
> > pages (4*1536) for tx and 5 pages (16k+16+2048) for rx. It all adds up
> > to 7 pages (tx+rx) which in theory should fit within 8 pages of
> > available dma memory.
> >
> > It does however look like the bitmap code operates on order
> > granularity both when it comes to size and alignment which means that
> > the rx allocation of 5 pages becomes an order 3 allocation - 8 pages
> > aligned to 8 pages - which in turn results in that we can't fulfill
> > the allocation request. At least that's my theory. =)
> >
> > As a test and/or workaround, can you try changing RX_BUF_IDX in
> > 8139too.c from 1 in the dreamcast case to 0? That should result in 3
> > pages for the rx buffer which should lead to an order 2 allocation
> > unless I'm mistaken. And we should be able to fulfill that request
> > without problems.
> >
> > Does the RX_BUF_IDX change make the declared coherent patches work?
> >
OK, I redid this with the latest patch - which went into Paul's git repo
a couple of days ago and it works. The earlier error was with the
patches that were about a fortnight old.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter
2008-01-24 9:40 [PATCH] sh: use declared coherent memory for dreamcast pci ethernet adapter Magnus Damm
` (8 preceding siblings ...)
2008-02-03 23:26 ` Adrian McMenamin
@ 2008-02-04 9:07 ` Magnus Damm
9 siblings, 0 replies; 11+ messages in thread
From: Magnus Damm @ 2008-02-04 9:07 UTC (permalink / raw)
To: linux-sh
On Feb 4, 2008 8:26 AM, Adrian McMenamin
<adrian@newgolddream.dyndns.info> wrote:
> On Sun, 2008-02-03 at 21:32 +0000, Adrian McMenamin wrote:
> > On Sun, 2008-01-27 at 13:37 +0900, Magnus Damm wrote:
> > > On Jan 26, 2008 6:46 AM, Adrian McMenamin <adrian@newgolddream.dyndns.info> wrote:
> > > > On Fri, 2008-01-25 at 21:00 +0000, Adrian McMenamin wrote:
> > > > > Without the coherency patches...
> > > > > [ 2.833387] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring > > > > > 0xa1842000/0x01842000, (0x00000000)
> > > > >
> > > > With the coherency patches...
> > > >
> > > > [ 2.890870] zzzzzzzz:tx_bufs = 0xa1840000/0x01840000, rx_ring = 0x00000000/0x00000000, (0x8cd010e0)
> > >
> > > Ok, it looks like i got the dma values right at least, but that the rx
> > > ring allocation fails.
> > >
> > > The amount of dma memory for the dreamcast ethernet adapter seems to
> > > be 8 pages (32k), and for dreamcast the 8139too driver allocates 2
> > > pages (4*1536) for tx and 5 pages (16k+16+2048) for rx. It all adds up
> > > to 7 pages (tx+rx) which in theory should fit within 8 pages of
> > > available dma memory.
> > >
> > > It does however look like the bitmap code operates on order
> > > granularity both when it comes to size and alignment which means that
> > > the rx allocation of 5 pages becomes an order 3 allocation - 8 pages
> > > aligned to 8 pages - which in turn results in that we can't fulfill
> > > the allocation request. At least that's my theory. =)
> > >
> > > As a test and/or workaround, can you try changing RX_BUF_IDX in
> > > 8139too.c from 1 in the dreamcast case to 0? That should result in 3
> > > pages for the rx buffer which should lead to an order 2 allocation
> > > unless I'm mistaken. And we should be able to fulfill that request
> > > without problems.
> > >
> > > Does the RX_BUF_IDX change make the declared coherent patches work?
>
> OK, I redid this with the latest patch - which went into Paul's git repo
> a couple of days ago and it works. The earlier error was with the
> patches that were about a fortnight old.
Thanks for the help with the testing. Feel free to send a fixed
version of your patch to the 8139too maintainers!
/ magnus
^ permalink raw reply [flat|nested] 11+ messages in thread