Skip to contentSkip to conversation

Does the reg_addr/reg_value reading work?

DISCUSSION Ben Greear 3 participants 7 messages Jun 8, 2015 – Jun 11, 2015 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore

Ben Greear

author
#0 lore raw

I am not getting expected values when I try to read registers through the ath10k reg_addr/reg_value API.

For instance, I tried reading a particular register 0x80e0 (as defined in the firmware), and I get a zero value. With a different API that I wrote to dump some specific registers over the WMI API, I get the expected value.

# echo 0x80e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr
# cat /debug/ieee80211/wiphy0/ath10k/reg_value
0x000080e0:0x00000000
# cat /debug/ieee80211/wiphy0/ath10k/fw_regs

ath10k Target Register Dump

             =================

           MAC-FILTER-ADDR-L32 0xd7ffffff

...

Is there some trick I am missing?

Thanks,
Ben

Signature · 8 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#1 lore raw

Am 08.06.2015 um 18:11 schrieb Ben Greear:

Quoted 13 lines

I am not getting expected values when I try to read registers through the ath10k reg_addr/reg_value API.

For instance, I tried reading a particular register 0x80e0 (as defined in the firmware), and I get a zero value. With a different API that I wrote to dump some specific registers over the WMI API, I get the expected value.

# echo 0x80e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr
# cat /debug/ieee80211/wiphy0/ath10k/reg_value
0x000080e0:0x00000000
# cat /debug/ieee80211/wiphy0/ath10k/fw_regs
Quoted 7 lines
    ath10k Target Register Dump
              =================

            MAC-FILTER-ADDR-L32 0xd7ffffff

...

Is there some trick I am missing?

0x20000 offset makes the voodoo. you will find this offset within your firmware source too. take a look at the preconfigured register tables. these contain already the ack,slot etc. settings. but with a special macro surrounding it which defines that offset

echo 0x2080e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr

Quoted 4 lines

Thanks,
Ben

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

author
#2 lore raw
Quoted 20 lines · Sebastian Gottschall

Am 08.06.2015 um 18:11 schrieb Ben Greear:

Quoted 19 lines

I am not getting expected values when I try to read registers through the ath10k reg_addr/reg_value API.

For instance, I tried reading a particular register 0x80e0 (as defined in the firmware), and I get a zero value. With a different API that I wrote to dump some specific registers over the WMI API, I get the expected value.

# echo 0x80e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr
# cat /debug/ieee80211/wiphy0/ath10k/reg_value
0x000080e0:0x00000000
# cat /debug/ieee80211/wiphy0/ath10k/fw_regs
    ath10k Target Register Dump
              =================

            MAC-FILTER-ADDR-L32 0xd7ffffff

...

Quoted 6 lines
Quoted 1 line

Is there some trick I am missing?

0x20000 offset makes the voodoo. you will find this offset within your firmware source too. take a look at the preconfigured register tables. these contain already the ack,slot etc. settings.
but with a special macro surrounding it which defines that offset

echo 0x2080e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr

This crashes my kernel....I instrumented the place that crashed in ath10k/pci.h:

[  100.676013] ath10k-pci-read32: ar ffff88020279ae20  ar_pci ffff88020279df08  offset: 0x2080e0
[  100.676016]   ar_pci->mem: 0xffffc90019c80000
[  100.676031] BUG: unable to handle kernel paging request at ffffc90019e880e0
[  100.681752] IP: [<ffffffff81364ad4>] ioread32+0x9/0x2f

Have you tried this on a 10.1.467 firmware?

And, what kernel? I'm trying 4.0.4+

Thanks,
Ben

Signature · 8 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
author
#3 lore raw
Quoted 30 lines · Ben Greear
Quoted 20 lines · Sebastian Gottschall

Am 08.06.2015 um 18:11 schrieb Ben Greear:

Quoted 19 lines

I am not getting expected values when I try to read registers through the ath10k reg_addr/reg_value API.

For instance, I tried reading a particular register 0x80e0 (as defined in the firmware), and I get a zero value. With a different API that I wrote to dump some specific registers over the WMI API, I get the expected value.

# echo 0x80e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr
# cat /debug/ieee80211/wiphy0/ath10k/reg_value
0x000080e0:0x00000000
# cat /debug/ieee80211/wiphy0/ath10k/fw_regs
    ath10k Target Register Dump
              =================

            MAC-FILTER-ADDR-L32 0xd7ffffff

...

Quoted 6 lines
Quoted 1 line

Is there some trick I am missing?

0x20000 offset makes the voodoo. you will find this offset within your firmware source too. take a look at the preconfigured register tables. these contain already the ack,slot etc. settings.
but with a special macro surrounding it which defines that offset

echo 0x2080e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr

This crashes my kernel....I instrumented the place that crashed in ath10k/pci.h:

Quoted 8 lines
[  100.676013] ath10k-pci-read32: ar ffff88020279ae20  ar_pci ffff88020279df08  offset: 0x2080e0
[  100.676016]   ar_pci->mem: 0xffffc90019c80000
[  100.676031] BUG: unable to handle kernel paging request at ffffc90019e880e0
[  100.681752] IP: [<ffffffff81364ad4>] ioread32+0x9/0x2f

Have you tried this on a 10.1.467 firmware?

And, what kernel? I'm trying 4.0.4+

I was using the wrong address value..it should be 0x280e0. Maybe the driver should still keep us from crashing the whole kernel (while holding locks!), but at least it works when I put in the right value.

Thanks,
Ben

Signature · 8 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#4 lore raw

Am 08.06.2015 um 22:02 schrieb Ben Greear:

Quoted 35 lines · Ben Greear
Quoted 34 lines · Sebastian Gottschall
Quoted 20 lines

Am 08.06.2015 um 18:11 schrieb Ben Greear:

Quoted 19 lines

I am not getting expected values when I try to read registers through the ath10k reg_addr/reg_value API.

For instance, I tried reading a particular register 0x80e0 (as defined in the firmware), and I get a zero value. With a different API that I wrote to dump some specific registers over the WMI API, I get the expected value.

# echo 0x80e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr
# cat /debug/ieee80211/wiphy0/ath10k/reg_value
0x000080e0:0x00000000
# cat /debug/ieee80211/wiphy0/ath10k/fw_regs
     ath10k Target Register Dump
               =================

             MAC-FILTER-ADDR-L32 0xd7ffffff

...

Quoted 6 lines
Quoted 1 line

Is there some trick I am missing?

0x20000 offset makes the voodoo. you will find this offset within your firmware source too. take a look at the preconfigured register tables. these contain already the ack,slot etc. settings.
but with a special macro surrounding it which defines that offset

echo 0x2080e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr

This crashes my kernel....I instrumented the place that crashed in ath10k/pci.h:

[  100.676013] ath10k-pci-read32: ar ffff88020279ae20  ar_pci ffff88020279df08  offset: 0x2080e0
[  100.676016]   ar_pci->mem: 0xffffc90019c80000
[  100.676031] BUG: unable to handle kernel paging request at ffffc90019e880e0
[  100.681752] IP: [<ffffffff81364ad4>] ioread32+0x9/0x2f
Quoted 6 lines
Quoted 3 lines

Have you tried this on a 10.1.467 firmware?

And, what kernel? I'm trying 4.0.4+

I was using the wrong address value..it should be 0x280e0. Maybe the driver should still keep us from crashing the whole kernel (while holding locks!), but at least it works when I put in the right value.

now that you say it. i see it too. but playing direct register writes can always lead to problematic scenarios. its a debug register. from my oppinion, a debug register should allow whatever is possible. even crashing something. its like using /dev/kmem

Quoted 5 lines

Thanks,
Ben

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

author
#5 lore raw
Quoted 38 lines · Sebastian Gottschall

Am 08.06.2015 um 22:02 schrieb Ben Greear:

Quoted 37 lines · Ben Greear
Quoted 36 lines · Sebastian Gottschall
Quoted 20 lines

Am 08.06.2015 um 18:11 schrieb Ben Greear:

Quoted 19 lines

I am not getting expected values when I try to read registers through the ath10k reg_addr/reg_value API.

For instance, I tried reading a particular register 0x80e0 (as defined in the firmware), and I get a zero value. With a different API that I wrote to dump some specific registers over the WMI API, I get the expected value.

# echo 0x80e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr
# cat /debug/ieee80211/wiphy0/ath10k/reg_value
0x000080e0:0x00000000
# cat /debug/ieee80211/wiphy0/ath10k/fw_regs
     ath10k Target Register Dump
               =================

             MAC-FILTER-ADDR-L32 0xd7ffffff

...

Quoted 6 lines
Quoted 1 line

Is there some trick I am missing?

0x20000 offset makes the voodoo. you will find this offset within your firmware source too. take a look at the preconfigured register tables. these contain already the ack,slot etc. settings.
but with a special macro surrounding it which defines that offset

echo 0x2080e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr

This crashes my kernel....I instrumented the place that crashed in ath10k/pci.h:

[  100.676013] ath10k-pci-read32: ar ffff88020279ae20  ar_pci ffff88020279df08  offset: 0x2080e0
[  100.676016]   ar_pci->mem: 0xffffc90019c80000
[  100.676031] BUG: unable to handle kernel paging request at ffffc90019e880e0
[  100.681752] IP: [<ffffffff81364ad4>] ioread32+0x9/0x2f

Have you tried this on a 10.1.467 firmware?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

And, what kernel? I'm trying 4.0.4+

I was using the wrong address value..it should be 0x280e0. Maybe the driver should still keep us from crashing the whole kernel (while holding locks!), but at least it works when I put in the right value.

now that you say it. i see it too. but playing direct register writes can always lead to problematic scenarios. its a debug register. from my oppinion, a debug register should allow
whatever is possible. even crashing something. its like using /dev/kmem

I am guessing the driver knows the pci address space that is available..it could probably just limit any access outside those bounds since they can never work anyway.

Anyway, I'll let someone else deal with it if they want.

Thanks,
Ben

Signature · 8 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#6 lore raw
Quoted 4 lines · Ben Greear
Quoted 3 lines · Sebastian Gottschall

Am 08.06.2015 um 22:02 schrieb Ben Greear:

Quoted 2 lines · Ben Greear
Quoted 1 line · Sebastian Gottschall

[...]

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 11 lines
Quoted 1 line

echo 0x2080e0 > /debug/ieee80211/wiphy0/ath10k/reg_addr

This crashes my kernel....I instrumented the place that crashed in ath10k/pci.h:

[  100.676013] ath10k-pci-read32: ar ffff88020279ae20  ar_pci ffff88020279df08  offset: 0x2080e0
[  100.676016]   ar_pci->mem: 0xffffc90019c80000
[  100.676031] BUG: unable to handle kernel paging request at ffffc90019e880e0
[  100.681752] IP: [<ffffffff81364ad4>] ioread32+0x9/0x2f

Have you tried this on a 10.1.467 firmware?

And, what kernel? I'm trying 4.0.4+

I was using the wrong address value..it should be 0x280e0. Maybe the driver should still keep us from crashing the whole kernel (while holding locks!), but at least it works when I put in the right value.

Quoted 8 lines
Quoted 3 lines

now that you say it. i see it too. but playing direct register writes can always lead to problematic scenarios. its a debug register. from my oppinion, a debug register should allow
whatever is possible. even crashing something. its like using /dev/kmem

I am guessing the driver knows the pci address space that is available..it could probably just limit any access outside those bounds since they can never work anyway.

Anyway, I'll let someone else deal with it if they want.

Yep. I've just sent a patch for review which introduces a sanity check to prevent out of bounds MMIO access.

Michał

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k