linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Subject: rtw88: The debugfs interface reads registers from the wrong device
Date: Mon, 15 Jul 2024 14:05:03 +0300	[thread overview]
Message-ID: <e28bbf72-678a-438b-b5dc-d4ae8b8f71f0@gmail.com> (raw)

Hi,

To reproduce the problem, you need a computer with two wifi
devices supported by rtw88. It's especially easy to notice
the problem if one of the devices is USB and the other is PCI,
because the PCI device will have various values in the
registers 0x300..0x3ff, but the USB device will have all
0xeaeaeaea there.

1. Let's assume the driver for the PCI device is already loaded.
   I have RTL8822CE.

2. Mount debugfs:

   # mount -t debugfs none /sys/kernel/debug

3. Check page 0x300:

   # cat /sys/kernel/debug/ieee80211/phy0/rtw88/mac_3
     00000300  f7138000    33330000    ffffb000    00000000
     .....

4. Plug the USB device. I used RTL8811CU.

5. Check page 0x300 again:

   # cat /sys/kernel/debug/ieee80211/phy0/rtw88/mac_3
     00000300  eaeaeaea    eaeaeaea    eaeaeaea    eaeaeaea
     .....

6. Bonus: unload rtw88_8821cu and check page 0x300 again to get
   a null pointer dereference:

   # rmmod rtw88_8821cu
   # cat /sys/kernel/debug/ieee80211/phy0/rtw88/mac_3

             reply	other threads:[~2024-07-15 11:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-15 11:05 Bitterblue Smith [this message]
2024-07-15 11:26 ` rtw88: The debugfs interface reads registers from the wrong device Bitterblue Smith
2024-07-16  1:19   ` Ping-Ke Shih
2024-07-16  2:56     ` Ping-Ke Shih
2024-07-18  6:45       ` Ping-Ke Shih
2024-07-30 16:27       ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e28bbf72-678a-438b-b5dc-d4ae8b8f71f0@gmail.com \
    --to=rtl8821cerfe2@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).