From nobody Fri Sep 25 05:12:02 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hrf2b6XRzz6spRB for ; Fri, 25 Sep 2026 05:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hrf2b4bXSz3NYr for ; Fri, 25 Sep 2026 05:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790313127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XbpsJR6BggdirT/ftOTBB0MstOJYMs2gjS9h3yCYl3I=; b=r6r20zITunYdYIKmCj7bRuonCH4nj+DDWPjpqVuR/fn+v9O8TuchQTVSLzHAKprjp4hWNE j/3HVQV+czu2Mv76oUjsgj6ZPM9z/ZUhWvu5bTtrdUe57ykXcWN5V646Qtv1d0p6hd/VsT UvGhOmA4xpf8xVspDh8P9xjEO/T4/DfzY3jq8ogHY6LZDlZ8JTjIYVwd1NvGftFgzfCtYe uFweNcq2nssqO6uj6hhRhj0ui15uelLqwP/kLHOUzY7xsg07sGzWPpTlDTCmgZjXN+wNpH 3A47FksE3pEYhg86cvnHF6VwGEphX6T4QTZgO6aAEriTF3EdFpEMGSEnp2fnEA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790313127; b=EvegCC3ZmGm50dkINa9ln0encVOxtM0WJCyTTxEmv1s0bXU3sQW99OBSWIDZetmP0EIJdl xRfxL0LZCO4gwlnRtxsvgP8o1wJp83KvF/miZZnslbTWQU64hjY9PheQ0TTXzZIX3dBFZs OowW+Hbld66E6i5948miO2NN1fXmd3HE32SB2kBlH6QVOS2jNIrTFija9Vzjlt7dGPww/5 ix+3KWPGKYkez60qLsS6tnmjSw0+DrHMu5i0KcuxyvpGm1uFRqphYLy5jlX6FUTylcuOjK iC0tHASYqzAbcOCk5huJwsSg5R3mP0R3RH5kl7fdv9hXL1ifbcf+xj8ZXxhIwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790313127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XbpsJR6BggdirT/ftOTBB0MstOJYMs2gjS9h3yCYl3I=; b=O+sW/ZOCcXMyR4OnOTnakxdzzAuLD2OWwoT7kPS8bWvzQaqDRspqjZcuJHPz2Uopx3xXJO amFjeIhNaT3PxJP2DdAIVLMJYUWjwxGfs2kJ5klcm3kduzChjnDva0QO2gNso1YkhnBDFM XVtOIRa2LjbVq1E36YxukOZvkE1txHZ/2fzpUXtSDBXROX7s/3Q/BrD/GkMu8KKvEiBGu1 lCVpNVvYrJq00HXgmrgZQ/cTJkYS5mfzzNpJ33U3wp3tqemX1lUADxl79SJkBJQqrgIOcy l6VR33157zT7rESVl3ywHFMKOBYGMloiUsFPRSPMgmBfXMzZzn9Rj21m7gPxOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hrf2b3dgszx27 for ; Fri, 25 Sep 2026 05:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2311e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 25 Sep 2026 05:12:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 4993c1052f89 - main - aq: Invalidate the descriptor cache after stopping all rings List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4993c1052f899b9a971815df5661ca241641ad8e Auto-Submitted: auto-generated Date: Fri, 25 Sep 2026 05:12:02 +0000 Message-Id: <6ab602a2.2311e.1b2010d@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=4993c1052f899b9a971815df5661ca241641ad8e commit 4993c1052f899b9a971815df5661ca241641ad8e Author: Kevin Bowling AuthorDate: 2026-09-17 02:35:58 +0000 Commit: Kevin Bowling CommitDate: 2026-09-25 05:11:23 +0000 aq: Invalidate the descriptor cache after stopping all rings Atlantic controllers can retain receive descriptors and their data addresses after their rings are disabled. Reusing or releasing those mappings without invalidating the device cache has caused observed IOMMU and SMMU faults in the referenced Linux reports (7a1bb49461b1, ed4d81c4b3f2 and 7526183cfdbe). Move global cache invalidation out of the per-ring stop routine. Disable every ring first, toggle invalidation once, and wait for its completion indication. Exclude Atlantic A0, as in the upstream workaround. Report a completion timeout rather than silently discarding it. Reviewed by: nprice MFC after: 2 weeks Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D59852 --- sys/dev/aq/aq_hw.c | 25 +++++++++++++++++++++++++ sys/dev/aq/aq_hw.h | 2 ++ sys/dev/aq/aq_hw_llh.c | 9 +++++++++ sys/dev/aq/aq_hw_llh.h | 3 +++ sys/dev/aq/aq_hw_llh_internal.h | 5 +++++ sys/dev/aq/aq_main.c | 4 ++++ sys/dev/aq/aq_ring.c | 4 ---- 7 files changed, 48 insertions(+), 4 deletions(-) diff --git a/sys/dev/aq/aq_hw.c b/sys/dev/aq/aq_hw.c index 934543937a57..5c926f2ed960 100644 --- a/sys/dev/aq/aq_hw.c +++ b/sys/dev/aq/aq_hw.c @@ -58,6 +58,31 @@ aq_hw_err_from_flags(struct aq_hw *hw) return (0); } +int +aq_hw_invalidate_descriptor_cache(struct aq_hw *hw) +{ + int error; + + /* Atlantic A0 does not implement this stop workaround. */ + if (IS_CHIP_FEATURE(hw, REVISION_A0)) + return (0); + + /* + * Cached Rx descriptors retain both descriptor and data addresses. + * Toggle the global cache invalidation only after every ring is down. + */ + rdm_rx_dma_desc_cache_init_tgl(hw); + error = aq_hw_err_from_flags(hw); + if (error != 0) + return (error); + + error = AQ_HW_WAIT_FOR(rdm_rx_dma_desc_cache_init_done_get(hw) != 0, + 1000, 10); + if (error != 0) + return (error); + return (aq_hw_err_from_flags(hw)); +} + inline uint32_t aq_hw_read_reg(struct aq_hw *hw, uint32_t reg) { diff --git a/sys/dev/aq/aq_hw.h b/sys/dev/aq/aq_hw.h index bf4925d139f9..67a2ee975888 100644 --- a/sys/dev/aq/aq_hw.h +++ b/sys/dev/aq/aq_hw.h @@ -408,6 +408,8 @@ int aq_hw_set_power(struct aq_hw *hw, unsigned int power_state); int aq_hw_err_from_flags(struct aq_hw *hw); +int aq_hw_invalidate_descriptor_cache(struct aq_hw *hw); + int hw_atl_b0_hw_vlan_promisc_set(struct aq_hw *hw, bool promisc); int hw_atl_b0_hw_vlan_set(struct aq_hw *hw, diff --git a/sys/dev/aq/aq_hw_llh.c b/sys/dev/aq/aq_hw_llh.c index 2369418a3681..d82413a946ea 100644 --- a/sys/dev/aq/aq_hw_llh.c +++ b/sys/dev/aq/aq_hw_llh.c @@ -1728,6 +1728,15 @@ rdm_rx_dma_desc_cache_init_tgl(struct aq_hw *aq_hw) ); } +uint32_t +rdm_rx_dma_desc_cache_init_done_get(struct aq_hw *aq_hw) +{ + return (AQ_READ_REG_BIT(aq_hw, + rdm_rx_dma_desc_cache_init_done_adr, + rdm_rx_dma_desc_cache_init_done_msk, + rdm_rx_dma_desc_cache_init_done_shift)); +} + void tpb_tx_pkt_buff_size_per_tc_set(struct aq_hw *aq_hw, uint32_t tx_pkt_buff_size_per_tc, uint32_t buffer) diff --git a/sys/dev/aq/aq_hw_llh.h b/sys/dev/aq/aq_hw_llh.h index 47011295aa4c..641e53b6da06 100644 --- a/sys/dev/aq/aq_hw_llh.h +++ b/sys/dev/aq/aq_hw_llh.h @@ -934,6 +934,9 @@ void tpb_tx_pkt_buff_size_per_tc_set(struct aq_hw *aq_hw, /* toggle rdm rx dma descriptor cache init */ void rdm_rx_dma_desc_cache_init_tgl(struct aq_hw *aq_hw); +/* get rdm rx dma descriptor cache init done */ +uint32_t rdm_rx_dma_desc_cache_init_done_get(struct aq_hw *aq_hw); + /* set tx path pad insert enable */ void tpb_tx_path_scp_ins_en_set(struct aq_hw *aq_hw, uint32_t tx_path_scp_ins_en); diff --git a/sys/dev/aq/aq_hw_llh_internal.h b/sys/dev/aq/aq_hw_llh_internal.h index fa1c9a83985b..48f3774216d2 100644 --- a/sys/dev/aq/aq_hw_llh_internal.h +++ b/sys/dev/aq/aq_hw_llh_internal.h @@ -395,6 +395,11 @@ /* default value of bitfield rdm_desc_init_i */ #define rdm_rx_dma_desc_cache_init_defaulT 0x0 +/* rdm_desc_init_done_i bitfield definitions */ +#define rdm_rx_dma_desc_cache_init_done_adr 0x00005a10 +#define rdm_rx_dma_desc_cache_init_done_msk 0x00000001 +#define rdm_rx_dma_desc_cache_init_done_shift 0 + /* rx int_desc_wrb_en bitfield definitions * preprocessor definitions for the bitfield "int_desc_wrb_en". * port="pif_rdm_int_desc_wrb_en_i" diff --git a/sys/dev/aq/aq_main.c b/sys/dev/aq/aq_main.c index d5ba995eb493..5aa162e096b0 100644 --- a/sys/dev/aq/aq_main.c +++ b/sys/dev/aq/aq_main.c @@ -873,6 +873,10 @@ aq_if_stop(if_ctx_t ctx) "could not stop RX ring %d\n", i); } + if (aq_hw_invalidate_descriptor_cache(hw) != 0) + device_printf(softc->dev, + "could not invalidate the RX descriptor cache\n"); + if (aq_hw_reset(&softc->hw, true) != 0) device_printf(softc->dev, "could not reset the MAC on stop\n"); memset(&softc->last_stats, 0, sizeof(softc->last_stats)); diff --git a/sys/dev/aq/aq_ring.c b/sys/dev/aq/aq_ring.c index 13b1881d9147..8fef7ae7765d 100644 --- a/sys/dev/aq/aq_ring.c +++ b/sys/dev/aq/aq_ring.c @@ -208,10 +208,6 @@ aq_ring_rx_stop(struct aq_hw *hw, struct aq_ring *ring) AQ_DBG_ENTERA("[%d]", ring->index); rdm_rx_desc_en_set(hw, 0U, ring->index); - /* Invalidate Descriptor Cache to prevent writing to the cached - * descriptors and to the data pointer of those descriptors - */ - rdm_rx_dma_desc_cache_init_tgl(hw); err = aq_hw_err_from_flags(hw); AQ_DBG_EXIT(err); return (err);