From: Kalle Valo <kvalo@kernel.org>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ziyang Huang <hzyitc@outlook.com>,
jjohnson@kernel.org, linux-wireless@vger.kernel.org,
ath11k@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: ath11k: fix remapped ce accessing issue on 64bit OS
Date: Thu, 02 May 2024 10:03:12 +0300 [thread overview]
Message-ID: <874jbgg0gf.fsf@kernel.org> (raw)
In-Reply-To: <22b0713e-49f2-482a-b145-e460b5632a7c@lwfinger.net> (Larry Finger's message of "Wed, 1 May 2024 11:55:08 -0500")
Larry Finger <Larry.Finger@lwfinger.net> writes:
> On 5/1/24 11:14 AM, Ziyang Huang wrote:
>
>> On 64bit OS, when ab->mem_ce is lower than or 4G far away from ab->mem,
>> u32 is not enough to store the offsets, which makes ath11k_ahb_read32()
>> and ath11k_ahb_write32() access incorrect address and causes Data Abort
>> Exception.
>> Let's use the high bits of offsets to decide where to access, which
>> is
>> similar as ath11k_pci_get_window_start() done. In the future, we can merge
>> these functions for unified regs accessing.
>> Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
>> ---
>> drivers/net/wireless/ath/ath11k/ahb.c | 34 ++++++++++++++++++++-------
>> drivers/net/wireless/ath/ath11k/hal.c | 17 +++++---------
>> drivers/net/wireless/ath/ath11k/hw.c | 14 +++++------
>> drivers/net/wireless/ath/ath11k/hw.h | 7 +++++-
>> 4 files changed, 45 insertions(+), 27 deletions(-)
>> diff --git a/drivers/net/wireless/ath/ath11k/ahb.c
>> b/drivers/net/wireless/ath/ath11k/ahb.c
>> index 7c0a23517949..9e59b4de93a9 100644
>> --- a/drivers/net/wireless/ath/ath11k/ahb.c
>> +++ b/drivers/net/wireless/ath/ath11k/ahb.c
>> @@ -198,12 +198,30 @@ static const struct ath11k_pci_ops ath11k_ahb_pci_ops_wcn6750 = {
>> static inline u32 ath11k_ahb_read32(struct ath11k_base *ab, u32
>> offset)
>> {
>> - return ioread32(ab->mem + offset);
>> + switch (offset & ATH11K_REG_TYPE_MASK) {
>> + case ATH11K_REG_TYPE_NORMAL:
>> + return ioread32(ab->mem + FIELD_GET(ATH11K_REG_OFFSET_MASK, offset));
>> + case ATH11K_REG_TYPE_CE:
>> + return ioread32(ab->mem_ce + FIELD_GET(ATH11K_REG_OFFSET_MASK, offset));
>> + default:
>> + BUG();
>
> Do you really want to crash the system here? A dev_warn() or something
> similar would log the situation. I suspect this case is never taken,
> but a system crash is not a good response if it is.
Correct, BUG() is more or less banned from all wireless code.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2024-05-02 7:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-01 16:14 [PATCH] wifi: ath11k: fix remapped ce accessing issue on 64bit OS Ziyang Huang
2024-05-01 16:55 ` Larry Finger
2024-05-02 7:03 ` Kalle Valo [this message]
2024-05-01 16:56 ` Jeff Johnson
2024-05-02 7:05 ` Kalle Valo
2024-05-02 16:24 ` Ziyang Huang
2024-05-02 19:27 ` Sergey Ryazanov
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=874jbgg0gf.fsf@kernel.org \
--to=kvalo@kernel.org \
--cc=Larry.Finger@lwfinger.net \
--cc=ath11k@lists.infradead.org \
--cc=hzyitc@outlook.com \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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