Skip to contentSkip to conversation

bcm43xx: Busting the 1G limit

PATCH In review Michael Buesch 2 participants 4 messages Jun 17, 2006 – Jun 19, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcm43xx: Busting the 1G limit

Hi,

This patch adds full 32-bit and 64-bit DMA support to the bcm43xx driver. Well, it _should_ do this. I can not test it, as I don't have a machine to trigger the 1G limit.
The 1G limit should be exploitable on an AMD64 machine with more than 1G RAM.

Please test and report, if it works or not. In the case of "works not", please provide full dmesg log.

Note that I am not sure which cards actually support full 32-bit or even 64-bit mode. Older cards might still only support 30-bit DMA.

drivers/net/wireless/bcm43xx/bcm43xx.h +42 -16
Index: wireless-dev/drivers/net/wireless/bcm43xx/bcm43xx.h
===================================================================
@@ -32,14 +32,18 @@
 #define BCM43xx_PCICFG_ICR		0x94
 
 /* MMIO offsets */
-#define BCM43xx_MMIO_DMA1_REASON	0x20
-#define BCM43xx_MMIO_DMA1_IRQ_MASK	0x24
-#define BCM43xx_MMIO_DMA2_REASON	0x28
-#define BCM43xx_MMIO_DMA2_IRQ_MASK	0x2C
-#define BCM43xx_MMIO_DMA3_REASON	0x30
-#define BCM43xx_MMIO_DMA3_IRQ_MASK	0x34
-#define BCM43xx_MMIO_DMA4_REASON	0x38
-#define BCM43xx_MMIO_DMA4_IRQ_MASK	0x3C
+#define BCM43xx_MMIO_DMA0_REASON	0x20
+#define BCM43xx_MMIO_DMA0_IRQ_MASK	0x24
+#define BCM43xx_MMIO_DMA1_REASON	0x28
+#define BCM43xx_MMIO_DMA1_IRQ_MASK	0x2C
+#define BCM43xx_MMIO_DMA2_REASON	0x30
+#define BCM43xx_MMIO_DMA2_IRQ_MASK	0x34
+#define BCM43xx_MMIO_DMA3_REASON	0x38
+#define BCM43xx_MMIO_DMA3_IRQ_MASK	0x3C
+#define BCM43xx_MMIO_DMA4_REASON	0x40
+#define BCM43xx_MMIO_DMA4_IRQ_MASK	0x44
+#define BCM43xx_MMIO_DMA5_REASON	0x48
+#define BCM43xx_MMIO_DMA5_IRQ_MASK	0x4C
 #define BCM43xx_MMIO_STATUS_BITFIELD	0x120
 #define BCM43xx_MMIO_STATUS2_BITFIELD	0x124
 #define BCM43xx_MMIO_GEN_IRQ_REASON	0x128
@@ -55,14 +59,27 @@
 #define BCM43xx_MMIO_XMITSTAT_1		0x174
 #define BCM43xx_MMIO_REV3PLUS_TSF_LOW	0x180 /* core rev >= 3 only */
 #define BCM43xx_MMIO_REV3PLUS_TSF_HIGH	0x184 /* core rev >= 3 only */
-#define BCM43xx_MMIO_DMA1_BASE		0x200
-#define BCM43xx_MMIO_DMA2_BASE		0x220
-#define BCM43xx_MMIO_DMA3_BASE		0x240
-#define BCM43xx_MMIO_DMA4_BASE		0x260
+
+/* 32-bit DMA */
+#define BCM43xx_MMIO_DMA32_BASE0	0x200
+#define BCM43xx_MMIO_DMA32_BASE1	0x220
+#define BCM43xx_MMIO_DMA32_BASE2	0x240
+#define BCM43xx_MMIO_DMA32_BASE3	0x260
+#define BCM43xx_MMIO_DMA32_BASE4	0x280
+#define BCM43xx_MMIO_DMA32_BASE5	0x2A0
+/* 64-bit DMA */
+#define BCM43xx_MMIO_DMA64_BASE0	0x200
+#define BCM43xx_MMIO_DMA64_BASE1	0x240
+#define BCM43xx_MMIO_DMA64_BASE2	0x280
+#define BCM43xx_MMIO_DMA64_BASE3	0x2C0
+#define BCM43xx_MMIO_DMA64_BASE4	0x300
+#define BCM43xx_MMIO_DMA64_BASE5	0x340
+/* PIO */
 #define BCM43xx_MMIO_PIO1_BASE		0x300
 #define BCM43xx_MMIO_PIO2_BASE		0x310
 #define BCM43xx_MMIO_PIO3_BASE		0x320
 #define BCM43xx_MMIO_PIO4_BASE		0x330
+
 #define BCM43xx_MMIO_PHY_VER		0x3E0
 #define BCM43xx_MMIO_PHY_RADIO		0x3E2
 #define BCM43xx_MMIO_ANTENNA		0x3E8
@@ -231,8 +248,14 @@
 #define BCM43xx_SBTMSTATELOW_FORCE_GATE_CLOCK	0x20000
 
 /* sbtmstatehigh state flags */
-#define BCM43xx_SBTMSTATEHIGH_SERROR		0x1
-#define BCM43xx_SBTMSTATEHIGH_BUSY		0x4
+#define BCM43xx_SBTMSTATEHIGH_SERROR		0x00000001
+#define BCM43xx_SBTMSTATEHIGH_BUSY		0x00000004
+#define BCM43xx_SBTMSTATEHIGH_TIMEOUT		0x00000020
+#define BCM43xx_SBTMSTATEHIGH_COREFLAGS		0x1FFF0000
+#define BCM43xx_SBTMSTATEHIGH_DMA64BIT		0x10000000
+#define BCM43xx_SBTMSTATEHIGH_GATEDCLK		0x20000000
+#define BCM43xx_SBTMSTATEHIGH_BISTFAILED	0x40000000
+#define BCM43xx_SBTMSTATEHIGH_BISTCOMPLETE	0x80000000
 
 /* sbimstate flags */
 #define BCM43xx_SBIMSTATE_IB_ERROR		0x20000
@@ -566,8 +589,11 @@
 	struct bcm43xx_dmaring *tx_ring1;
 	struct bcm43xx_dmaring *tx_ring2;
 	struct bcm43xx_dmaring *tx_ring3;
+	struct bcm43xx_dmaring *tx_ring4;
+	struct bcm43xx_dmaring *tx_ring5;
+
 	struct bcm43xx_dmaring *rx_ring0;
-	struct bcm43xx_dmaring *rx_ring1; /* only available on core.rev < 5 */
+	struct bcm43xx_dmaring *rx_ring3; /* only available on core.rev < 5 */
 };
 
 /* Data structures for PIO transmission, per 80211 core. */
@@ -708,7 +734,7 @@
 
 	/* Reason code of the last interrupt. */
 	u32 irq_reason;
-	u32 dma_reason[4];
+	u32 dma_reason[6];
 	/* saved irq enable/disable state bitfield. */
 	u32 irq_savedstate;
 	/* Link Quality calculation context. */
drivers/net/wireless/bcm43xx/bcm43xx_dma.c +387 -198

939 lines not on this page · raw message

drivers/net/wireless/bcm43xx/bcm43xx_dma.h +214 -75

356 lines not on this page · raw message

drivers/net/wireless/bcm43xx/bcm43xx_main.c +49 -36

164 lines not on this page · raw message

Signature · 1 line
Greetings Michael.
#1 lore raw
Quoted 9 lines · Michael Buesch

Hi,

This patch adds full 32-bit and 64-bit DMA support to the bcm43xx driver. Well, it _should_ do this. I can not test it, as I don't have a machine to trigger the 1G limit.
The 1G limit should be exploitable on an AMD64 machine with more than 1G RAM.

Quoted 6 lines

Please test and report, if it works or not. In the case of "works not", please provide full dmesg log.

Note that I am not sure which cards actually support full 32-bit or even 64-bit mode. Older cards might still only support 30-bit DMA.

Hi.

I tried this on both 2.6.17-rc6 and on wireless-dev, and got pretty much the same panic on both (modulo locking). My box is a turion with 2 GB of ram and a BCM4318. Here's the panic from wireless-dev:

Unable to handle kernel NULL pointer dereference at 0000000000000020
RIP:
<ffffffff88104f24>{:bcm43xx:bcm43xx_dma_handle_xmitstatus+436}
PGD 0
Oops: 0000 [1] PREEMPT
CPU 0
Modules linked in: uhci_hdc ieee80211_crypt_wep cryptoloop loop

snd_atiixp_modem
snd_atiixp snd_ac97_codec snd_ac97_bus bcm43xx snd_pcm snd_timer ieee80211softmac ehci_hcd snd ohci1394 ieee80211 ohci_hdc sdhci ieee1394 yenta_socket usbcore mmc_core soundcore rsrc_nonstatic ieee80211_crypt 8139too
snd_page_alloc pcmcia_core
Pid: 6139, comm: iwconfig Not tainted 2.6.17-rc6-dfg1-g57aab842-dirty #1

RIP: 0010:[<ffffffff88104f24>]
<ffffffff88104f24>{:bcm43xx:bcm43xx_dma_handle_xmitstatus+436}
RSP: 0018:ffffffff81445df8  EFLAGS: 00010002
RAX: 0000000000000063 RBX: 0000000000000001 RCX: 00000000ffffffff
RDX: 0000000000000000 RSI: 0000000000000082 RDI: 0000000000000001
RBP: ffffffff81445e28 R08: 000000000002e8c7 R09: 0000000000000000
R10: 0000000000000000 R11: 00000000fffffffa R12: 0000000000000000
R13: 00000000000030d1 R14: ffffffff81445eb8 R15: 00000000000000d0
FS:  00002b8b5dc68d20(0000) GS:ffffffff81445eb8(0000)

knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000020 CR3: 0000000076314000 CR4: 00000000000006e0 Process iwconfig (pid: 6139, threadinfo ffff8100748ae000, task ffff810075840890)

Stack: ffff81007510f050 0000000000000000 ffff81007510f050
0000000000008800
       ffffffff814453b8 0000000020000800 ffffffff814453f8
ffffffff880f13cb
       ffffffff81445e78 ffff81007541e740
Call Trace: <IRQ> <ffffffff880f13cb>{:bcm43xx:bcm43xx_interrupt_tasklet
+2379}
       <ffffffff81092b78>{tasklet_action+72}
<ffffffff810126d0>{__do_softirq+80}
       <ffffffff8106872a>{call_softirq+30} <ffffffff81075e04>{do_softirq
+52}
       <ffffffff81092cf4>{irq_exit+63} <ffffffff81075e51>{do_IRQ+65}
       <ffffffff81067dae>{ret_from_intr+0} <EOI>
<ffffffff810078c8>{_raw_spin_lock+296}
       <ffffffff8106dc9e>{_spin_lock+30}
<ffffffff810202dd>{unlink_file_vma+61}
       <ffffffff810206a8>{free_pagetables+152}
<ffffffff8103ee97>{exit_mmap+135}
       <ffffffff810416b6>{mmput+54} <ffffffff81047b63>{exit_mmap+243}
       <ffffffff81016a9a>{do_exit+602} <ffffffff81012e1c>{__fput+428}
       <ffffffff810506e0>{debug_mutex_init+0}
<ffffffff81054862>{sys_exit_group+18}
       <ffffffff81067892>{system_call+126}
Code: 45 3b 7c 24 20 7c 28 49 c7 c0 be 9e 10 88 b9 59 03 00 00 48

RIP <ffffffff88104f24>{:bcm43xx:bcm43xx_dma_handle_xmitstatus+436} RSP <ffffffff81445df8>
CR2: 0000000000000020
<0>Kernel panic - not syncing: Aiee, killing interrupt handler!

Daniel

#2 lore raw
Quoted 19 lines · Daniel Gryniewicz
Quoted 9 lines · Michael Buesch

Hi,

This patch adds full 32-bit and 64-bit DMA support to the bcm43xx driver. Well, it _should_ do this. I can not test it, as I don't have a machine to trigger the 1G limit.
The 1G limit should be exploitable on an AMD64 machine with more than 1G RAM.

Quoted 6 lines

Please test and report, if it works or not. In the case of "works not", please provide full dmesg log.

Note that I am not sure which cards actually support full 32-bit or even 64-bit mode. Older cards might still only support 30-bit DMA.

Hi.

Quoted 7 lines

I tried this on both 2.6.17-rc6 and on wireless-dev, and got pretty much the same panic on both (modulo locking). My box is a turion with 2 GB of ram and a BCM4318. Here's the panic from wireless-dev:

Unable to handle kernel NULL pointer dereference at 0000000000000020

RIP:
<ffffffff88104f24>{:bcm43xx:bcm43xx_dma_handle_xmitstatus+436}

I am still not absolutely sure where this oops comes from. Could you remove at least 1G of your RAM and retry?

Signature · 1 line
Greetings Michael.
#3 lore raw
Quoted 24 lines · Michael Buesch
Quoted 23 lines · Daniel Gryniewicz
Quoted 9 lines · Michael Buesch

Hi,

This patch adds full 32-bit and 64-bit DMA support to the bcm43xx driver. Well, it _should_ do this. I can not test it, as I don't have a machine to trigger the 1G limit.
The 1G limit should be exploitable on an AMD64 machine with more than 1G RAM.

Quoted 6 lines

Please test and report, if it works or not. In the case of "works not", please provide full dmesg log.

Note that I am not sure which cards actually support full 32-bit or even 64-bit mode. Older cards might still only support 30-bit DMA.

Hi.

I tried this on both 2.6.17-rc6 and on wireless-dev, and got pretty much the same panic on both (modulo locking). My box is a turion with 2 GB of ram and a BCM4318. Here's the panic from wireless-dev:

Quoted 7 lines
Quoted 3 lines
Unable to handle kernel NULL pointer dereference at 0000000000000020

RIP:
<ffffffff88104f24>{:bcm43xx:bcm43xx_dma_handle_xmitstatus+436}

I am still not absolutely sure where this oops comes from. Could you remove at least 1G of your RAM and retry?

I took out 1G of RAM (2 1G sticks), and there was no more panic. It still didn't work (no output from iwlist scan), but also no panic.

dmesg output was:

Jun 19 18:00:54 athena bcm43xx: Radio turned on
Jun 19 18:00:54 athena bcm43xx: ASSERTION FAILED (radio_attenuation <
10) at:
drivers/net/wireless/bcm43xx/bcm43xx_phy.c:1485:bcm43xx_find_lopair()
Jun 19 18:00:54 athena bcm43xx: ASSERTION FAILED (radio_attenuation <
10) at:
drivers/net/wireless/bcm43xx/bcm43xx_phy.c:1485:bcm43xx_find_lopair()
Jun 19 18:00:54 athena bcm43xx: Chip initialized
Jun 19 18:00:54 athena bcm43xx: 32-bit DMA initialized
Jun 19 18:00:54 athena bcm43xx: 80211 cores initialized
Jun 19 18:00:54 athena bcm43xx: Keys cleared
Jun 19 18:00:54 athena SoftMAC: Associate: Scanning for networks first.
Jun 19 18:00:54 athena SoftMAC: Associate: failed to initiate scan. Is

device up?

followed by a bunch of:

Jun 19 18:01:15 athena SoftMAC: Start scanning with channel: 1
Jun 19 18:01:15 athena SoftMAC: Scanning 14 channels
Jun 19 18:01:15 athena SoftMAC: Scanning finished

followed by:

Jun 19 18:02:03 athena SoftMAC: Associate: Scanning for networks first.
Jun 19 18:02:03 athena SoftMAC: Start scanning with channel: 1
Jun 19 18:02:03 athena SoftMAC: Scanning 14 channels
Jun 19 18:02:03 athena bcm43xx: set security called
Jun 19 18:02:03 athena bcm43xx:    .level = 0
Jun 19 18:02:03 athena bcm43xx:    .enabled = 0
Jun 19 18:02:03 athena bcm43xx:    .encrypt = 0
Jun 19 18:02:03 athena SoftMAC: Scanning finished
Jun 19 18:02:03 athena SoftMAC: Associate: Scanning for networks first.
Jun 19 18:02:03 athena SoftMAC: Start scanning with channel: 1
Jun 19 18:02:03 athena SoftMAC: Scanning 14 channels
Jun 19 18:02:03 athena SoftMAC: Scanning finished
Jun 19 18:02:03 athena SoftMAC: Associate: Scanning for networks first.
Jun 19 18:02:03 athena SoftMAC: Start scanning with channel: 1
Jun 19 18:02:03 athena SoftMAC: Scanning 14 channels
Jun 19 18:02:04 athena SoftMAC: Scanning finished
Jun 19 18:02:04 athena SoftMAC: Unable to find matching network after

scan!

and finally:

Jun 19 18:02:44 athena bcm43xx: Radio turned off
Jun 19 18:02:44 athena bcm43xx: DMA-32 0x0200 (RX) max used slots: 0/64
Jun 19 18:02:44 athena bcm43xx: DMA-32 0x02A0 (TX) max used slots: 0/512
Jun 19 18:02:44 athena bcm43xx: DMA-32 0x0280 (TX) max used slots: 0/512
Jun 19 18:02:44 athena bcm43xx: DMA-32 0x0260 (TX) max used slots: 0/512
Jun 19 18:02:44 athena bcm43xx: DMA-32 0x0240 (TX) max used slots: 0/512
Jun 19 18:02:44 athena bcm43xx: DMA-32 0x0220 (TX) max used slots: 2/512
Jun 19 18:02:44 athena bcm43xx: DMA-32 0x0200 (TX) max used slots: 0/512

At that point, I remove the bcm43xx module, and switched over to my prism54 card in order to get net access.

This was all on wireless-dev as of yesterday with the 1G limit patch from this thread.

Let me know if there's anything I can try, I'd love to get this working properly.

Daniel