From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.231.36 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796525820; b=Kqn1baiWMNvxghVzthBMDHlmExd0tbUPaQn7biSJOmDaa/GTCO5ZaRPP4xfT5Zafbu3q 3uIh/eA5fB8M4M7GSzlcwV7tlSAgbiNrhL7ELjmSq9siPIgm192gCtH2Epz96UZomvFy3 A5Vls1a3xkAvvo3kPFbrPb7zVvhmPawPngeHvBGdseYAUEYNx2Q0NiYdTDvS6xTcJNo6J HHGYWYDlVj22lKgK+RRujjnEPf3NYyaBBOMWuzlLNcXxIZbRC8YGjEAEJXEiAO0mIeiHN AOhsbUnv6A6DPlOWiId3gCpbtgiQN1WH7jsBBQEjkKnghFSRnbd5WRFRpB2Uldl/T7Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796525820; h=DMARC-Filter:DKIM-Signature:From:Received:Content-Transfer-Encoding: In-Reply-To:Date:Message-Id:User-Agent:X-Lms-Return-Path:Content-Type: References:To:Cc:Subject:Mime-Version:X-Original-From; bh=Z9UtwOAbHqR9lXZmGStv7SaHwrC57997udWurmBVP7s=; b=1K4sf2nJQV/DvRSuaaft1q5kwD1OLsLNeLSdshDJqvr7jiNN3rnwsvtrx2aeavoFF1PW 4IWYGNtf9WDYxRgyhXIEi2Hxs054wGIfX21FijnnHNg6IH2ReQrkbxg+pO2SIed+IOaqY S1NR4zG0i9LJgZ0uDhUzGKHGbRX5IHz993wE8Ld5C7dIgUZNGLVmU2iegYgvRLi3KqpiX Bgk9KWSPAc/fkXdOeXeu/ML6gYTAz/JHwX74l0OhWwtm+9pifAszjDKk+Hwt+4tj7Fuoz XdW99HdqPNveLlvCUZwKwDZXsmculBWKquzYuvSeEWS1EQzWSg8mtAkJ2WxSnL2j3Vg== 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=OlVpCA0W; arc=none smtp.remote-ip=209.127.231.36 Received: from va-2-36.ptr.blmpb.com (va-2-36.ptr.blmpb.com [209.127.231.36]) (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 35195606A322 for ; Sun, 6 Dec 2026 02:56:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 35195606A322 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=OlVpCA0W DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1796525810; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=Z9UtwOAbHqR9lXZmGStv7SaHwrC57997udWurmBVP7s=; b=OlVpCA0WFUlrbwKVIopHdS3R6Qoow6d5ELhwYQobPfsZCGJCc1wXJEql01vHOk7WbDyh64 F7K9vHT1jbRv6zBs5HaLy3nkmq8dg3JvM1kkoduiiwQz//c70ljQ6B3l0tDWyT5DQJnivF ipKKraWuTOWywsUoHLmlypZcvG0BHxXlC7MYslyuPiXhbr4cDGnRNSx4LlETWq00Pnb2FA BJh2wllOkA9ksEcirrXabuHLT/XndcPhm+Jd5Ccqk9/lOrNzjaoAZJk0yYJI+tQt7c/Ldc IEIRswm73CPEfKSUL4oqy02XwNWoLKSPam1HwV/QRok9cOK1sx7p54mXE0gNdA== From: "Xin Tian" Received: from [127.0.0.1] ([183.193.56.225]) by smtp.feishu.cn with ESMTPS; Sun, 06 Dec 2026 10:56:47 +0800 Content-Transfer-Encoding: quoted-printable In-Reply-To: <179579506923.3135.15582286060392761620@kernel.org> Date: Sun, 6 Dec 2026 10:56:41 +0800 Message-Id: User-Agent: Mozilla Thunderbird X-Lms-Return-Path: Content-Type: text/plain; charset=UTF-8 References: <20261126145711.70868-2-tianx@yunsilicon.com> <179579506923.3135.15582286060392761620@kernel.org> To: Cc: , , , , , , , , , , , , Subject: Re: [PATCH v2 01/11] net/xsc: add Yunsilicon XSC ethernet PCI driver X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 X-Original-From: Xin Tian On 11/27/2026 11:57 PM, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 4 potential > issue(s) to consider. > > Critical: 0 =C2=B7 High: 0 =C2=B7 Medium: 1 =C2=B7 Low: 3 > > 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] In xsc_pci_init(), BAR0 is mapped with pci_ioremap_bar(), > which is a plain ioremap() of pdev->resource[0], but it is unmapped=E2= =80=A6 > - [Low] The subject line is cut short. > - [Low] The new MAINTAINERS entry 'YUNSILICON XSC DRIVERS' has only 'F: > drivers/net/ethernet/yunsilicon/xsc'. > - [Low] xsc_pci_driver.name is "xsc-pci". > > -- > > net/xsc: add Yunsilicon XSC ethernet PCI driver > > This commit adds the Yunsilicon vendor Kconfig/Makefile glue and a > skeleton PCI driver for XSC ethernet devices. The PCI core enables the > device, requests and maps BAR0, and sets the DMA masks. The doorbell, > command queue and netdev layers come in later patches. > >> net/xsc: add Yunsilicon XSC ethernet PCI driver >> >> skeleton > [Severity: Low] > This isn't a bug, but the subject line seems to have been split. The word > "skeleton" is now the first line of the body. > > As a result the shortlog reads "net/xsc: add Yunsilicon XSC ethernet PCI > driver". The commit only adds a PCI skeleton with no netdev. Could > "skeleton" go back into the subject line? The subject is a single line in git, our SMTP relay folded it on the way out. Fixed on that side. >> diff --git a/MAINTAINERS b/MAINTAINERS >> index bde216003f428..1cd2a0a6477c7 100644 >> --- a/MAINTAINERS >> +++ b/MAINTAINERS >> @@ -30909,6 +30909,13 @@ S: Maintained >> F: Documentation/input/devices/yealink.rst >> F: drivers/input/misc/yealink.* >> =20 >> +YUNSILICON XSC DRIVERS >> +M: Honggang Wei >> +M: Xin Tian >> +L: netdev@vger.kernel.org >> +S: Maintained >> +F: drivers/net/ethernet/yunsilicon/xsc > [Severity: Low] > This isn't a bug, but should this F: entry be > drivers/net/ethernet/yunsilicon/ with a trailing slash? > > As written it does not cover the vendor-level files this patch adds, > drivers/net/ethernet/yunsilicon/Kconfig and > drivers/net/ethernet/yunsilicon/Makefile. Changes to those files would no= t > be sent to the listed maintainers. > > The new line in drivers/net/ethernet/Makefile is also out of order: > > obj-$(CONFIG_NET_VENDOR_XILINX) +=3D xilinx/ > obj-$(CONFIG_NET_VENDOR_YUNSILICON) +=3D yunsilicon/ > obj-$(CONFIG_NET_VENDOR_XIRCOM) +=3D xircom/ > > In drivers/net/ethernet/Kconfig the matching source line comes after > xircom. Both issues are still present at the end of the series. > >> + >> ZD1211RW WIRELESS DRIVER >> L: linux-wireless@vger.kernel.org >> S: Orphan Fixed both. F: now points at drivers/net/ethernet/yunsilicon/ so the vendor Kconfig/Makefile are covered, and the obj- line moved to match the Kconfig order. > [ ... ] > >> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/main.c b/drivers/ne= t/ethernet/yunsilicon/xsc/pci/main.c >> new file mode 100644 >> index 0000000000000..c926507a74b04 >> --- /dev/null >> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/main.c > [ ... ] > >> + bar_base =3D pci_ioremap_bar(pdev, bar_num); >> + if (!bar_base) { >> + pci_err(pdev, "failed to ioremap %s bar%d\n", KBUILD_MODNAME, >> + bar_num); >> + err =3D -ENOMEM; >> + goto err_clr_master; >> + } >> + >> + err =3D pci_save_state(pdev); >> + if (err) { >> + pci_err(pdev, "pci_save_state failed: err=3D%d\n", err); >> + goto err_io_unmap; >> + } >> + >> + xdev->bar_num =3D bar_num; >> + xdev->bar =3D bar_base; >> + >> + return 0; >> + >> +err_io_unmap: >> + pci_iounmap(pdev, bar_base); > [Severity: Medium] > Is pci_iounmap() the right call to undo pci_ioremap_bar()? It pairs with > pci_iomap(), while pci_ioremap_bar() is a plain ioremap(). xsc_pci_fini() > uses the same pairing on remove. > > On s390 zPCI without MIO, the two calls are not symmetric. > zpci_map_resources() stores a cookie from pci_iomap_range_fh() in > resource[0].start, and that call takes the only reference. > pci_ioremap_bar() returns that cookie without taking a reference: > > arch/s390/pci/pci.c:ioremap_prot() { > ... > if (!static_branch_unlikely(&have_mio)) > return (void __iomem *)phys_addr; > ... > } > > pci_iounmap() then calls pci_iounmap_fh(), which drops the reference that > zpci_map_resources() holds: > > arch/s390/pci/pci.c:pci_iounmap_fh() { > ... > WARN_ON(!zpci_iomap_start[idx].count); > if (!--zpci_iomap_start[idx].count) { > zpci_iomap_start[idx].fh =3D 0; > zpci_iomap_start[idx].bar =3D 0; > } > ... > } > > After one unbind, or one probe failure that reaches err_io_unmap, would > the next probe get a cookie whose fh is 0? Then every BAR0 readl()/writel= () > would go to the wrong function handle. > > When the device is finally removed, zpci_unmap_resources() calls > pci_iounmap_fh() again. That would trigger WARN_ON(!count) and underflow > the counter. > > Later patches in the series add more ways to reach err_io_unmap, such as > xsc_cmd_init() failing. > > Could this pair pci_ioremap_bar() with iounmap() instead? Another option = is > to use pci_iomap()/pci_iounmap() or pcim_iomap_region(). > >> +err_clr_master: >> + pci_clear_master(pdev); >> + pci_release_region(pdev, bar_num); >> +err_disable: >> + pci_disable_device(pdev); >> +err_out: >> + return err; >> +} >> + >> +static void xsc_pci_fini(struct xsc_core_device *xdev) >> +{ >> + struct pci_dev *pdev =3D xdev->pdev; >> + >> + pci_iounmap(pdev, xdev->bar); >> + pci_clear_master(pdev); >> + pci_release_region(pdev, xdev->bar_num); >> + pci_disable_device(pdev); >> +} Fixed, wrong pairing. Both the init error path and fini now use iounmap() to match the pci_ioremap_bar(). > [ ... ] > >> +static struct pci_driver xsc_pci_driver =3D { >> + .name =3D "xsc-pci", > [Severity: Low] > This isn't a bug, but the driver name here is "xsc-pci". The module is > called xsc_pci per the Kconfig help and the Makefile, and > pci_request_region() in xsc_pci_init() claims BAR0 under KBUILD_MODNAME > ("xsc_pci"). > > So /sys/bus/pci/drivers/xsc-pci and the owner shown in /proc/iomem would > have different names. Later in the series xsc_core.h defines > XSC_PCI_DRV_NAME as "xsc_pci", but .name still uses the hyphenated string= . > > Would .name =3D KBUILD_MODNAME be more consistent? > >> + .id_table =3D xsc_pci_id_table, >> + .probe =3D xsc_pci_probe, >> + .remove =3D xsc_pci_remove, >> +}; Changed to KBUILD_MODNAME so the driver name, module name and the request_region owner all match. Auxiliary matching is unaffected: the device name comes from the auxiliary_device_add() macro, which builds it from the module name (KBUILD_MODNAME, fixed by the Makefile object name) plus the adev name ("eth"); struct pci_driver.name is never consulted. pw-bot: cr