From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796290860; b=JL5ubpb93jksN+5/O1xw6vwdoXeXTSb2H76Gv6OOufFnWNpSAHCUiSo0888sw1qNAaVp rS/MkTrBu0htUWdazs9cPs5P3Uwl2KeAxEQZbIaHN8doFfXLfF4U6Ekx+bVzJ3SVr584t 5VOK1cEdOl2IgNP5ol2RqqKzeyl/TUOjWLTL1xROOpVWsOpytQy+2/iM4vuUZoWHoq24G M9ZrYQOGAWnREq2AzrLmnN8ji7qvX1z0P/1uJyyi1TpIqKkIH71pofKSGnq6sWD9xc0+n sNJN6I9mOouWjoMMHxjqrLZ3zkchrQgdM8B6wVPRzDIqUlOCo9Y2fcddtacEIO6n1rg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290860; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=yKd23z9Z4o3ryuqQtf764ToacR+Ol3MLllFvoT7RdW8=; b=f2wIyiRjvoDrAd3zx6zm+Ph242JwVkYfwsnt41GdeQKZuLWr9bRPFIAh2IqSk+BMUmDj ipvyFWYTo06dXGGifeT2+UrAAym0qtzRmRneG2aK8uYawyc0gtjVV5FmY+MmEnjkyvEAU 7m2ouYyo11pAawWqFZ8h6N2gIb/ulYhqG0TCxtcTzLbXGFRbk4W84Whvqj7W78BayqSy3 eFthuLSNODKNbl/YrzVPkBUvbdu3bTXpsiASTi/svLNKsP/1sD0xo3XhzRC0Ro2wimMHX aGC+tqxKUDlB350P4LNIEjnWphCB8cTAjIDXsChIBPm6Ivhj5ZMO9mylYicgJxx8dAw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=R9bBEspO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE714606A322 for ; Thu, 3 Dec 2026 09:41:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=R9bBEspO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6336A1F000C1; Thu, 3 Dec 2026 09:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796290860; bh=yKd23z9Z4o3ryuqQtf764ToacR+Ol3MLllFvoT7RdW8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=R9bBEspO28VtD1ntJfj8WOOI5MwQw0NIL+W6n89EX59QF78SjxrBZZC0iEfFhjc+u j9jaNkOP5iEn8Y2tmgM90MGPmUp0gCuCk0KldC2ethucfdlVaYUCiWDSmSkbaSX7Rb VTDE9SlwswHh2ayNUBspU3dIhcCGUJCBOKZaGrlPNPr+uJUnh1uR0Nc83bX4FOGUaJ i4QD2vakOoGZvTxWjpvW9jp0NeYVhUyzIrA7g9q2xSKWN0Z5gBZHmbv+RuneneEotN ey5WPep3KR0UohlFW0kWdOkFfrjyw7+uKztC0VKfV6mKpOgY5yPvik58k6DtPZ+pvU DpMqHT8XweVCw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] scsi: qla2xxx: Take the port from ISP control/status Reply-To: sashiko-reviews@lists.linux.dev To: "Nilesh Javali" Cc: linux-scsi@vger.kernel.org In-Reply-To: <20261203091740.6044-1-njavali@marvell.com> References: <20261203091740.6044-1-njavali@marvell.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 09:40:59 +0000 X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [Medium] scsi: qla2xxx: qla2x00_port_no_from_csrx() sets wrong portnum on ISP8031 - [Medium] scsi: qla2xxx: PCI_FUNC() gate in qla2x00_port_no_from_csrx() breaks VFIO - [Low] scsi: qla2xxx: missing ISP_REG_DISCONNECT check in qla2x00_port_no_from_csrx() - [Low] scsi: qla2xxx: reused ql_log message IDs in qla2x00_port_no_from_csrx() -- commit 4028d2e2495092c9c8d80dc38a6aef6e800678b4 Author: Nilesh Javali scsi: qla2xxx: Take the port from ISP control/status This commit adds qla2x00_port_no_from_csrx() to derive ha->port_no from the ISP ctrl_status register after iospace_config() when PCI_INTERRUPT_PIN and PCI_FUNC() are both zero, and drops the unused ha->portnum assignment for 27xx/28xx/29xx. > diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c > index 3c412c7fb6fe7..4ca54bc09c58c 100644 > --- a/drivers/scsi/qla2xxx/qla_os.c > +++ b/drivers/scsi/qla2xxx/qla_os.c > @@ -2704,6 +2704,66 @@ static struct isp_operations qla29xx_isp_ops =3D { [ ... ] > +static void > +qla2x00_port_no_from_csrx(struct qla_hw_data *ha) > +{ > + struct device_reg_24xx __iomem *reg; > + u32 csr, port; > + u8 pin =3D 0; > + > + if (!IS_FWI2_CAPABLE(ha) || IS_P3P_TYPE(ha) || !ha->iobase) > + return; > + > + pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &pin); > + if (pin || PCI_FUNC(ha->pdev->devfn)) > + return; [Severity: Medium] Can gating on PCI_FUNC(ha->pdev->devfn) cause port_no collisions under multi-function VFIO passthrough? When vfio_config_init() virtualizes PCI_INTERRUPT_PIN to 0, guest function 0 reads ctrl_status here while non-zero guest functions keep the virtual PCI_FUNC() assigned in qla2x00_set_isp_flags(). If physical ports 1 and 0 are passed as guest .0 and .1, both get ha->port_no =3D=3D 1, read the same NVRAM/VPD, and log in with duplicate WWPNs. On ISP8031 FCoE functions (2 and 3), keeping PCI_FUNC() misses FLT_REG_FCOE_NVRAM_0/1 in qla2xxx_get_flt_info(). Bare-metal adapters have a non-zero PCI_INTERRUPT_PIN, so checking only if (pin) would preserve bare metal while resolving all VFIO functions from ctrl_status consistently. > + > + reg =3D &ha->iobase->isp24; > + csr =3D rd_reg_dword(®->ctrl_status); [Severity: Low] Should csr be checked against ISP_REG_DISCONNECT (0xffffffffU) before decoding the port bits? Under Hyper-V DDA, hv_pci_read_config() emulates PCI_INTERRUPT_PIN as 0, so probe reaches rd_reg_dword(®->ctrl_status) even on a disconnected link. 27xx/28xx/29xx reject 0xffffffffU as out of range, but other FWI2 adapters see CSRX_FUNCTION set and silently set ha->port_no/portnum to 1. > + > + if (IS_QLA27XX(ha) || IS_QLA28XX(ha) || IS_QLA29XX(ha)) { > + port =3D (csr & CSRX_PORT_MASK) >> CSRX_PORT_SHIFT; > + if (port > 3) { > + ql_log_pci(ql_log_warn, ha->pdev, 0x00e2, > + "port %u from ctrl_status=3D0x%x is out of range.\n", > + port, csr); > + return; > + } > + ha->port_no =3D port; > + ql_log_pci(ql_log_info, ha->pdev, 0x00e1, > + "port %u ctrl_status=3D0x%x replaces the INTx pin.\n", > + port, csr); > + return; > + } > + > + ha->port_no =3D (csr & CSRX_FUNCTION) ? 1 : 0; > + ha->portnum =3D ha->port_no; [Severity: Medium] Can setting ha->portnum =3D ha->port_no corrupt shared IDC state on ISP8031? On ISP8031 CNAs, ha->portnum is the physical PCI function ID, not the 0/1 FCoE port index: functions 0 and 1 are NIC functions (qlcnic), while FCoE uses higher functions in QLA83XX_DEV_PARTINFO1/2. Setting ha->portnum =3D 1 collides with NIC function 1 in shared IDC presence and lock registers. When both FCoE ports are passed through without NIC drivers, bits 0 and 1 are set in QLA83XX_IDC_DRV_PRESENCE while qla83xx_reset_ownership() masks only ha->portnum and the real FCoE function, so neither port becomes nic_core_reset_owner and NIC core reset times out into QLA8XXX_DEV_FAILED. Only IS_QLA2031(ha) maps FC ports 0 and 1 to PCI functions 0 and 1, so this assignment should exclude IS_QLA8031(ha). > + if (IS_QLA25XX(ha)) > + ql_log_pci(ql_log_info, ha->pdev, 0x00e1, > + "25xx port %u ctrl_status=3D0x%x replaces the INTx pin.\n", > + ha->port_no, csr); > + else > + ql_log_pci(ql_log_info, ha->pdev, 0x00e1, > + "pin and function are 0; ctrl_status=3D0x%x port=3D%u.\n", > + csr, ha->port_no); > +} [Severity: Low] Do these ql_log_pci() calls reuse already-allocated message IDs 0x00e1 and 0x00e2? Both IDs are already used in drivers/scsi/qla2xxx/qla_mid.c (qla25xx_create_rsp_que()), and the Module Init and Probe table in drivers/scsi/qla2xxx/qla_dbg.c is allocated through 0x0199. New probe messages should use fresh IDs past 0x0199 and update that table. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203091740.6044= -1-njavali@marvell.com?part=3D1