From nobody Mon May 25 06:41:09 2026 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6637A2F7F13 for ; Sun, 17 May 2026 04:27:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778992055; cv=none; b=IqC6K5A12wvVcbyOFLz04JUla++qP9EawFvIDXlHxNGZIy8kjmK/eSJEswgj5TGUiBdBQuKEXf4LROyM5fqPiYsBjz0sw1S5e6wZq+yox7gRCIq5AUaARMLeWxhubg46HZXiyY7lv0X4AamIcn7vkVNTADceSWn0V5lLdVdy7ug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778992055; c=relaxed/simple; bh=ygmSXCXK8eNSoZ3xS9hSZvc8k8v9GD4nJKF95kpJoyw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bSmqpfjNtKhhlAuHSaD2IkbtGjInsNDuKN26VTEFLktj4l/GztexovPxG5BR84QKgHqDilPSy+j4+lHxe0q4VJ11RSM0YqA0YdUGPj0+wcnIWmjQEqcCLqMBSoWvAtFRL1ApM4iocpdHYHVpGsI8ZzC0LEB/IKnMx3CYYyATpNE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IyndeO20; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IyndeO20" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2b941cd869cso6482715ad.1 for ; Sat, 16 May 2026 21:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778992054; x=1779596854; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pp/9zZs5nlRYKvE9M7Qf49KtZUbVgu/YWLhMJjU+jtI=; b=IyndeO20UutAfYTZSlLyminmR5ajkAOXuQUEQaOp16NyE0Vvz+2acfuegFV8L+yVAC tso8guqfBhhi0KtxAP2TzFn7FNjha4nZ6y2wOvbw10o3ou6pMLck3CLlcNaDyIo3UsGh mER4wv2YLlqhJ++IBF+blW+f4stHwWziIuiqdUVB32dCcBd6sYYKOy6fLq4/m0HN8gSt tWtyZYwE9t3ag7SaDdFMtN+dvxTAybWFfBC0fE2RoV9hH2kATyK/pjz/cNLWg8OBCPa0 AUeBRfgTVBeoQmtOSBvKiiaLfEkhwUe10S6ZW6G4IeCUl6bUyQPOLuOoV+cCMRi6xDhG c0oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778992054; x=1779596854; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pp/9zZs5nlRYKvE9M7Qf49KtZUbVgu/YWLhMJjU+jtI=; b=BsTmIGvDa9lfCsJWbSw9P2ae0BLuVZlPxFaKqo8vtC9r3QI1GiN8jqFKpNpPlJ1Cf+ 5RWDYKif8k40nH8q6KzPf2spkhlTEYOTxgquvNmOpT+nvkH5q84BPbLX96xHdoldA1lL zDF0JiGcJnanvTwIwly6FB1kllV7vpGVhPvei7LsU+u/lOMI9drEVNd8R5JtGXSjGzoU AjP5pFm3isvBLQvKHcof93GdbP35XAEDpuMgAT+uOvz3nlKzDg8SiHeykoZIpGr7fNd0 JhVEeQzAjqEu51oe0B/aGkx9G0y2H3gwdjkY8d3CGPARMisOI9Zb5CNOF1wjPsJHnPMW t+Zg== X-Forwarded-Encrypted: i=1; AFNElJ+Dy9dokkgVIorM8+1hwc4oG+TNMP73wtMTtMBFGpz3lFPn3uJ8DWPAISUDqEzVIKMgQHNr//5SllKO/dE=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6YO6lWHk/quno+G0h/XwEfT++9R5Nv65GVixEaWoVuVKB+v7j e+7J4LW7i+gSORQ/CDTBSr98cc2r4A8ZwBJAdquz7doZjlp95BnAAZ7cq/78jQ== X-Gm-Gg: Acq92OE2CD0Me0KO3RZn7oSpqbmrrGrvPAPwt5WRNO5DH3fz61+g05wM/ge4lslRotP ng0U27vmLNIto7+/jyU/oWCiP3+WsRAJwtXNJkTuIZ28Urgp/7cW7yU6B2xt5FlBu04dbfXy5qp jNUwTI7QUR4RaKJBkpjXwixLlV7U63AqShvpzpQecV4cyqVXp0WcjLAUWtGi4UKCi6iOR4EzZKw YRh7441z3tpLK6jNXv7/zEHzkXZCtLlQ7mq7PJA+c+WxlyhGEJrfkP/E+d27bkU8+HutDTBu3S5 D+OYzQYn9csjszkTAD1tl2Eo9b38znGcdVUv2993sPfVjOmdGVucWOcl8tGP0eXqSUla5+DWx7J 62oOW5tzOas2CckiY6ndXMk9hw5XJ752KbYmFIxbt1YeX+8TqqAeRshMxBgmvbG0PX1V03XR4lv ysUxpkNi+D0Pn7IkbPxb3QlSvArc3CmTXbChvglgpQc2s8m6c0GR7pD+niVWO2fl5zMLLfx40mi qO5x/PtvzVqwBKRoCtS9rXlnSk9rV1CPDM= X-Received: by 2002:a17:903:4507:b0:2b4:5309:2c14 with SMTP id d9443c01a7336-2bd7e992465mr73561625ad.31.1778992053583; Sat, 16 May 2026 21:27:33 -0700 (PDT) Received: from ryzen ([2601:644:8000:5b5d:7285:c2ff:fe45:8a32]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bd5d23a41fsm107598555ad.83.2026.05.16.21.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 May 2026 21:27:32 -0700 (PDT) From: Rosen Penev To: linux-wireless@vger.kernel.org Cc: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , linux-kernel@vger.kernel.org (open list) Subject: [PATCH ath-next] wifi: ath9k: Clear DMA descriptors without memset Date: Sat, 16 May 2026 21:27:16 -0700 Message-ID: <20260517042716.2218386-1-rosenp@gmail.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Clear ath9k DMA descriptors with explicit status word stores instead of memset(). The descriptor rings are coherent DMA memory, which may be mapped uncached on 32-bit powerpc. The optimized memset() path can use dcbz there and trigger an alignment warning. Use WRITE_ONCE() for the descriptor status words so the compiler keeps the clears as ordinary stores instead of folding them back into bulk memset(). This covers AR9003 TX status descriptors as well as the RX status area cleared when setting up RX descriptors. Assisted-by: Codex:GPT-5.5 Signed-off-by: Rosen Penev --- drivers/net/wireless/ath/ath9k/ar9002_mac.c | 15 +++++++++++++- drivers/net/wireless/ath/ath9k/ar9003_mac.c | 23 +++++++++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ar9002_mac.c b/drivers/net/wire= less/ath/ath9k/ar9002_mac.c index b70cd4af1ae0..e355f94a9390 100644 --- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c +++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c @@ -403,6 +403,19 @@ static int ar9002_hw_get_duration(struct ath_hw *ah, c= onst void *ds, int index) } } =20 +static void ath9k_hw_clear_rxdesc_status(struct ar5416_desc *ads) +{ + WRITE_ONCE(ads->u.rx.status0, 0); + WRITE_ONCE(ads->u.rx.status1, 0); + WRITE_ONCE(ads->u.rx.status2, 0); + WRITE_ONCE(ads->u.rx.status3, 0); + WRITE_ONCE(ads->u.rx.status4, 0); + WRITE_ONCE(ads->u.rx.status5, 0); + WRITE_ONCE(ads->u.rx.status6, 0); + WRITE_ONCE(ads->u.rx.status7, 0); + WRITE_ONCE(ads->u.rx.status8, 0); +} + void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds, u32 size, u32 flags) { @@ -412,7 +425,7 @@ void ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath= _desc *ds, if (flags & ATH9K_RXDESC_INTREQ) ads->ds_ctl1 |=3D AR_RxIntrReq; =20 - memset(&ads->u.rx, 0, sizeof(ads->u.rx)); + ath9k_hw_clear_rxdesc_status(ads); } EXPORT_SYMBOL(ath9k_hw_setuprxdesc); =20 diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wire= less/ath/ath9k/ar9003_mac.c index a8bc003077dc..97027d286317 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c @@ -352,6 +352,19 @@ static bool ar9003_hw_get_isr(struct ath_hw *ah, enum = ath9k_int *masked, return true; } =20 +static void ath9k_hw_clear_txstatus(struct ar9003_txs *ads) +{ + WRITE_ONCE(ads->ds_info, 0); + WRITE_ONCE(ads->status1, 0); + WRITE_ONCE(ads->status2, 0); + WRITE_ONCE(ads->status3, 0); + WRITE_ONCE(ads->status4, 0); + WRITE_ONCE(ads->status5, 0); + WRITE_ONCE(ads->status6, 0); + WRITE_ONCE(ads->status7, 0); + WRITE_ONCE(ads->status8, 0); +} + static int ar9003_hw_proc_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_status *ts) { @@ -370,7 +383,7 @@ static int ar9003_hw_proc_txdesc(struct ath_hw *ah, voi= d *ds, (MS(ads->ds_info, AR_TxRxDesc) !=3D 1)) { ath_dbg(ath9k_hw_common(ah), XMIT, "Tx Descriptor error %x\n", ads->ds_info); - memset(ads, 0, sizeof(*ads)); + ath9k_hw_clear_txstatus(ads); return -EIO; } =20 @@ -427,7 +440,7 @@ static int ar9003_hw_proc_txdesc(struct ath_hw *ah, voi= d *ds, ts->ts_rssi_ext1 =3D MS(status, AR_TxRSSIAnt11); ts->ts_rssi_ext2 =3D MS(status, AR_TxRSSIAnt12); =20 - memset(ads, 0, sizeof(*ads)); + ath9k_hw_clear_txstatus(ads); =20 return 0; } @@ -591,10 +604,12 @@ EXPORT_SYMBOL(ath9k_hw_process_rxdesc_edma); =20 void ath9k_hw_reset_txstatus_ring(struct ath_hw *ah) { + int i; + ah->ts_tail =3D 0; =20 - memset((void *) ah->ts_ring, 0, - ah->ts_size * sizeof(struct ar9003_txs)); + for (i =3D 0; i < ah->ts_size; i++) + ath9k_hw_clear_txstatus(&ah->ts_ring[i]); =20 ath_dbg(ath9k_hw_common(ah), XMIT, "TS Start 0x%x End 0x%x Virt %p, Size %d\n", --=20 2.54.0