From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.231.40 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796526875; b=WzY4NBQPU+qKIa+N5deV1Zypnhj/Vlz7jIu4pcPOBzm9Pn+SxNcRr8SZvIRo81kM3vzx qjl/+9tF6bvC22miPIo0tbRzRF3BhivI/PgsRax6zeq7qccTptspFifKFqTMvvkyT1fF3 SSdD7E56UbB5nCQjLRMQ0yjVn2Vv7hjeriT1V1Qi0+vCUCwB2PePIjGJ+HjqOnv515Qm6 cPbQR3q3oZ0ez+pCypwYRFUPXfMgEkc4yXQGoEeivyOyK8Aapnsqjcwha4veB2pGJA8j3 DXy227ogt0X5xMcQ7cB1tTrvdY+OwLyb7fBl/Zz+wgs3XjYhHAgds+7jPDysCwV/iYw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796526875; h=DMARC-Filter:DKIM-Signature:From:References:Content-Type:User-Agent: Cc:Message-Id:X-Lms-Return-Path:X-Original-From:To:Subject:Date: Mime-Version:Received:In-Reply-To:Content-Transfer-Encoding; bh=oWHOD+HCU/lwQA6R9hIWYh1UbX7XJj9JdOM5NXanD9o=; b=gz7SGmLXfOI00GAS/6/FtDg7Y+SmSdmlJ4Xd1nX9KW1dHBP/XE4afi5yzNLDfJhndAz+ 3auqJzKOjZmX1XvcS4qE/ffX94YSINx6tqA9hBovTdMRGfZR10JxFN1qFXgqifTOyg7cy xAbwsRvEbzoGWBQyu4JuXNBENtwT+Zb/fCgJwHlPIhJRKEdN3Heyrd3Sn8B8c2/IIrEgP y3IJuY9GuQwhlNuWL7TdqTjGJx0Wc+yPK2Zl0FLidGJaTTffXgjePG6AYzdobp5nFFgUZ bozTfVQoqIaLF3mqw2OSB54Omjq3z+GDH/2nl4nrDnXVMHi43rDgwHPPIIQ82RTcN3Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=yunsilicon.com; spf=pass smtp.mailfrom=yunsilicon.com; dkim=pass header.d=yunsilicon.com header.i=@yunsilicon.com header.a=rsa-sha256 header.s=feishu2403070942 header.b=kBv1naQ3; arc=none smtp.remote-ip=209.127.231.40 Received: from va-2-40.ptr.blmpb.com (va-2-40.ptr.blmpb.com [209.127.231.40]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6936B606A322 for ; Sun, 6 Dec 2026 03:14:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6936B606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=yunsilicon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yunsilicon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=yunsilicon.com header.i=@yunsilicon.com header.a=rsa-sha256 header.s=feishu2403070942 header.b=kBv1naQ3 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1796526868; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=oWHOD+HCU/lwQA6R9hIWYh1UbX7XJj9JdOM5NXanD9o=; b=kBv1naQ321Kx00prN1RBn0TDAfsdXXhtIyZIefJbiipB9wNDgmQe0PAFbfORT0P2HoaQsr lY5v3YXFOBjnCoYchS1P1eiGdrOW0jO6WcbIJXJ7ZJWzD3Cs8ERQyJO7ICxsyAz3mqx2KF vFQ/cqd5fbre8uEjaElliYkyvcOJTzuL3ANVvXxxtG037CUTtv6Rjv6AJmS+h4tvK7p/2/ 0ikTJuV/Xn6IsN00JWfgCeEIqwvU26kltRtmH/kEtUImIVS219jggOgvv2F0kwYbgMvNyQ 0HA3Lm+QDZDpBX+SFVFe5fH9EVXmB3ogirG2eOCF0zf1BIzN9Qm/5eg0kXhqfg== From: "Xin Tian" References: <20261126145715.70868-3-tianx@yunsilicon.com> <179579507051.3135.14726043842081189942@kernel.org> Content-Type: text/plain; charset=UTF-8 User-Agent: Mozilla Thunderbird Cc: , , , , , , , , , , , , Message-Id: <79203797-ecb6-41e9-918b-01ad3d44a770@yunsilicon.com> X-Lms-Return-Path: X-Original-From: Xin Tian To: Subject: Re: [PATCH v2 02/11] net/xsc: add doorbell and cmdq MMIO accessors Date: Sun, 6 Dec 2026 11:14:20 +0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Received: from [127.0.0.1] ([183.193.56.225]) by smtp.feishu.cn with ESMTPS; Sun, 06 Dec 2026 11:14:25 +0800 In-Reply-To: <179579507051.3135.14726043842081189942@kernel.org> Content-Transfer-Encoding: quoted-printable On 11/27/2026 11:57 PM, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 3 potential > issue(s) to consider. > > Critical: 0 =C2=B7 High: 0 =C2=B7 Medium: 1 =C2=B7 Low: 2 > > If you believe none of the issues are legitimate, please reply to each > issue of Medium severity or higher and explain why the AI is wrong. > If any of them are legitimate and you plan to respin, please let patchwor= k > know by including "pw-bot: cr" as a separate line at the end of your repl= y > (one such reply per series is enough). > > - [Medium] xsc_arm_cq(xdev, cqn, next_cid, u8 solicited) in > drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c (lines 62-74) puts= =E2=80=A6 > - [Low] All five doorbell writers in > drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c call a full wmb()= =E2=80=A6 > - [Low] The new file drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c > calls EXPORT_SYMBOL_GPL() four times (xsc_update_tx_db,=E2=80=A6 > > -- > > net/xsc: add doorbell and cmdq MMIO accessors > > This commit adds doorbell writers for TX/RX queues, CQs and EQs, along > with cmdq register accessors. They all operate on fixed offsets in the > device BAR. The helpers are declared in xsc_core.h, and the TX, RX and > CQ helpers are exported for use by other modules. > >> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c b/driver= s/net/ethernet/yunsilicon/xsc/pci/doorbell.c >> new file mode 100644 >> index 0000000000000..5bd64be671646 >> --- /dev/null >> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c >> @@ -0,0 +1,148 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* Copyright (C) 2024 - 2026, Shanghai Yunsilicon Technology Co., Ltd. >> + * All rights reserved. >> + */ >> + >> +#include >> +#include >> + >> +#include "common/xsc_core.h" >> +#include "common/xsc_reg.h" > [Severity: Low] > This isn't a bug, but should this file include directly? > > It uses EXPORT_SYMBOL_GPL() for xsc_update_tx_db(), xsc_update_rx_db(), > xsc_arm_cq() and xsc_update_cq_ci(). With W=3D2, the > check_missing_include_linux_export_h check in scripts/misc-check reports > this for the file: > > EXPORT_SYMBOL() is used, but #include is missing > > The file builds today only because export.h is pulled in indirectly. > > [ ... ] Added the export.h include here and to the other files in the series that export symbols. >> +void xsc_update_tx_db(struct xsc_core_device *xdev, u32 sqn, u32 next_p= id) >> +{ >> + u32 db =3D FIELD_PREP(XSC_TX_DB_DATA0_NEXT_PID_MASK, next_pid) | >> + FIELD_PREP(XSC_TX_DB_DATA0_QP_ID_MASK, sqn); >> + >> + /* Make sure that descriptors are written before >> + * updating doorbell record and ringing the doorbell >> + */ >> + wmb(); >> + >> + writel(db, xdev->bar + TX_DB_FUNC_MEM_ADDR); >> +} > [Severity: Low] > Is the explicit wmb() needed before writel() here? writel() already > orders earlier stores to normal and coherent DMA memory before the MMIO > store: > > include/asm-generic/io.h:writel() { > ... > __io_bw(); > __raw_writel((u32 __force)__cpu_to_le32(value), addr); > __io_aw(); > ... > } > > On arm64, __io_bw() is dma_wmb(), so the extra wmb() adds a dsb st to > every TX doorbell. > > xsc_update_rx_db(), xsc_arm_cq(), xsc_update_cq_ci() and > xsc_update_eq_ci() use the same wmb() plus writel() pattern. Once the > later "net/xsc: add the transmit path" and "net/xsc: add the receive > path" patches call these helpers, they are on the hot path. > xsc_update_cmdq_req_pid() uses a plain writel(), so the barrier usage in > this file is also inconsistent. The code is unchanged at the end of the > series. > > The comments don't seem to match the code either: > > - The TX/RX comments mention "updating doorbell record". > - xsc_arm_cq() mentions "the doorbell record in host memory". > - Only a single MMIO word is written, and there is no doorbell record > in host memory. > - xsc_update_cq_ci() and xsc_update_eq_ci() say "make sure val write to > memory done", but there is no val variable. > > For the CQ/EQ consumer index updates, the intent may be that the > CQE/EQE loads finish before the device can reuse the entry. wmb() only > orders stores, so would a different barrier be needed there? Dropped all five. writel() already orders prior writes, same as idpf. The stale doorbell-record / "val" comments go with them, and with no wmb left in the file. For the CQ/EQ CI doorbells the wmb() ordered nothing: it can't order the CQE reads, and there are no stores to order. The read side is handled by the dma_rmb() after the ownership check in the poll loops. > [ ... ] > >> +void xsc_arm_cq(struct xsc_core_device *xdev, u32 cqn, u32 next_cid, >> + u8 solicited) >> +{ >> + u32 db =3D FIELD_PREP(XSC_CQ_DB_DATA0_NEXT_CID_MASK, next_cid) | >> + FIELD_PREP(XSC_CQ_DB_DATA0_CQ_ID_MASK, cqn) | >> + FIELD_PREP(XSC_CQ_DB_DATA0_ARM, !!solicited); > [Severity: Medium] > Is the solicited argument meant to set the bit named > XSC_CQ_DB_DATA0_ARM? > > The peer helper xsc_update_eq_ci() sets XSC_EQ_DB_DATA0_ARM from an arm > argument. Its callers in eq.c pass 1 to arm the EQ at the end of > xsc_eq_int() and at EQ creation, and 0 for intermediate CI updates. > > Later in the series, every caller of xsc_arm_cq() passes 0. The re-arm > after NAPI completion does this: > > xsc_cq_notify_hw_rearm() > xsc_arm_cq(cq->xdev, cq->xcq.cqn, cq->wq.cc, 0); > > So does the initial arm at CQ creation in net/main.c: > > xsc_arm_cq(pcq->xdev, pcq->xcq.cqn, pcq->wq.cc, 0); > > If BIT(31) is the arm enable bit, as the macro name suggests, do the > CQs ever get armed? Completion interrupts would then stop after the > first napi_complete_done(), and the RX/TX datapath would stall. > > Another reading is that any write to DB_CQ_FUNC_MEM_ADDR arms the CQ, > and BIT(31) only selects solicited-only notification. In that case, > should the macro be renamed so the exported prototype, the > implementation and the EQ helper agree on what this bit means? The write always arms the CQ, the bit only picks arm-next vs arm-solicited, so behavior is fine. Added a comment to make that clear.