From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796245587; b=0rK13imv61spX4IxF0g93YDImHcPzIQBcN3pAADz1kliUnB2Utlr9TyL2pKtaeP0BGqW 5BDQPLGHNHh5QFCYHgMlfmsJFPJoM8WJbdXZQMjl9hN03FUsqGxhdHJX4/nof1j/JPgk0 Gy9/QCAiCS8UxwTAOcc8RXYZ31evrgR0SlFRhkRBXIFUVhJsmHfBmag5ke796rikva14k 0QI3PAtbvh320m5ILY9ioHEqGoQFTwTrSV6kRDX0zHUD/SuLo8QIrqKPlOa0D5TaJLuqr EDdIzbe2P+33IWLcdoZ0v8cDfvD7yimXIbS4N8WgSnRR1HudaJKPc5gZLAfxJL4qvyg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796245587; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received: X-Received:Received:Message-ID:Subject:From:To:Cc:Date:In-Reply-To: References:Content-Type:Content-Transfer-Encoding:User-Agent: MIME-Version; bh=2xu9RaDgLqibyyJAaFEVfMTeLUU11BWPpUnufl5a5xk=; b=KADjN89F6/LDpLRrotIjpKG1xFWMEFr+3SahXf4k4I7pxN7ZzvurhH6jElfQWlCkeexX t6+r/8uCZEBnSlaSqy9zcruD/8FA2RrwuMcgCGgW0aJ6K2kBO2+gO3ttSXzV/vGcSsAPE Cj9aEhrS093O4ZOP3SZ/dQAfAsmc2A9rojKkGj2Dc0G33O6L8k/VNuBhKqddkPJqcBoDJ qCm2D99+R+r8KUUSrtLZ4pXPrG+a5GNu0b632D0BN9qM/wPJUkxhnVPSNSEtyfotvuHTz uBG9YD9D3yQzPgHwinhvhv+sVugrxDTdhvJOnxKiwP/7AL3nv4nqqeWCS4dNLz1qKvA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RoxOdmFT; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=bZ1PjHga; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B649A606A336 for ; Wed, 2 Dec 2026 21:06:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B649A606A336 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RoxOdmFT; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=bZ1PjHga DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796245585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2xu9RaDgLqibyyJAaFEVfMTeLUU11BWPpUnufl5a5xk=; b=RoxOdmFTveaSoAiIMmzRFkDGg3MVT0wdJvOblI6HyIZl8nG9SB+joRcySNpzjpmc7cKpIb rncbHgv+WC9vtZ/mqZyC3pE3zdknqKGQdflWWpLukAW7n/+/sAJV2Jdd9T1TJsbhQRWDlF neyQwXb7WHEkqOR/aJ39sOg+4uVKkPw= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-436-5iLa-QrDM7SH4_9M5MPjsg-1; Wed, 2 Dec 2026 21:06:23 +0000 X-MC-Unique: 5iLa-QrDM7SH4_9M5MPjsg-1 X-Mimecast-MFC-AGG-ID: 5iLa-QrDM7SH4_9M5MPjsg_1796245582 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-55d62b80650so315404561cf.1 for ; Wed, 02 Dec 2026 13:06:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1796245582; x=1796850382; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to:content-type; bh=2xu9RaDgLqibyyJAaFEVfMTeLUU11BWPpUnufl5a5xk=; b=bZ1PjHgaH6JtGX+phtR83pGVwl05tI2XeBw1iMDb1CfW7Y7yY5zrVe9Qd6eRq2ZKai IoGw7/2J8cuIxXDo0PNc/bnCtnf+O+R245AlquLFf6uxK59xlS35j4IDMh99QG2BePMO qR5lO6aLRTSMjEvhYiJ/fGx41Mg5txwP6AhPqy937jYdMsNzuSyR0TXlL5mqH2W3q/N0 pdBjbh8q5TWu3Z2eQTB9RV/JFlIbl8KszSqcjr0NZrGQrJ/W8oCKGHNiQnz4eE8re3e3 IsKMAKiHjZ72VIVWB7wMYZTy4WCdgoPuQQQ7FfUBgB1Qx7cwZ5ApWMxMPeCpjIBTU+qo TDRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796245582; x=1796850382; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=2xu9RaDgLqibyyJAaFEVfMTeLUU11BWPpUnufl5a5xk=; b=nzd33B1w06qYGp4mj52iBkAoPRIdXamvll3eS0XXCGnkWmUKeXVCYUghxJkIvGdBPL NszvcjAy/F/VTzOERGtADx1JHrX5o1cB6AcGD3WIOl+Thi4J9IDP8AL8nzSDOTSqjN5X ZKMuwT6Q70XgF9ARkeVPs0RDE+D97XZL5EvVTb1W919xNSVhyF4lwMKx+t8Dsoj37UN0 TnL+SvVJkh0QOUx0YK25TSArEcs7IH6NS/fufBJRAhBA0ODuLvXOMy7cNpHll16prC74 pSD8BwsEs3i/zqkWvNzks0USqtIFwQT3STVlqBHkfn4VYnkvo9oGcJcB0/ho4/FyNr2I tIFA== X-Forwarded-Encrypted: i=1; AL+hErGAF2hEBxI6tLqG6XDfq2ytGeI1aqwiBpO52wcd7Nlv8VI7USH1olom7J5zFMjo2H7jUp1rwo8L3VHvtD8=@vger.kernel.org X-Gm-Message-State: APuU4Z/J/0jkshWrbgXbK+MQtPDEoaCZQRwF3u/dzSowG3WTfoZFhZ0E wqiXQE002qAu47RBC1xCFGXgaPbi3Zu3ZX2Tit7XeUKgK6kAMZd1CZTkyRLvVUPMlVpkR896x8g m6O6ayNqf+WCb01K7BddWg5rR3T56gELIwSPOq6EEwOPXWlJO+qyHVOzen4fkaSQmVw== X-Gm-Gg: AZFdTZeobVI+4q5Gllqbju2bOKnAI8upNlceQveI3nKxnN2zbJksY1D8+zPBMaSMtiK MszRMrmP6j5hYzDlH7Xm7sW1fsJNOX0/siVryS85jBibl1aJfYb8DUSq10THvcjX9LlAWECTKDX g7rGPNebfoXD4T6EApqhgJzPtR40bQw3HErvENszb0Gon5nWggZlPeXf00EFHw1N7Opq8hZ12uT 9azNCEd7qT3HCyDhbc2C6CRlsnl4m/QrPnZT+dMaSavMrPX3mLMCZBPh0TW2zMnSTf2P3bKV2kh bIPN/NLzSy8MbtYKEz8aUBhw/Di8a4Wl2oR6Q9hh7KNTOYUo0QVQn+wXQuqZRd6vxyq+GFZSevC If7EcJRQHaVJdB7np3gOkXiB9zPI9ogo53RK/OGiGz9cS+yYPD831oBvtEOzmRMuN4+z4ae5rfj 8fcAuKM/1nWYL9ae9IPTD6A7fvGpYMODS5EJU+v7XRJk07p7GORTaHuqXV+IiEzQB71/p0brk= X-Received: by 2002:ac8:5fcf:0:b0:54b:6814:ffd5 with SMTP id d75a77b69052e-55d76a7d8a2mr791072341cf.48.1796245581902; Wed, 02 Dec 2026 13:06:21 -0800 (PST) X-Received: by 2002:ac8:5fcf:0:b0:54b:6814:ffd5 with SMTP id d75a77b69052e-55d76a7d8a2mr791071381cf.48.1796245581247; Wed, 02 Dec 2026 13:06:21 -0800 (PST) Received: from loberman-thinkpadp16gen3.rmtusma.csb ([2600:6c65:2440:d8c:aa2b:ddff:fe88:da74]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55da87b3ba8sm246392021cf.1.2026.12.02.13.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 13:06:20 -0800 (PST) Message-ID: <5eb3294725c5b0be0d397aa830baec13341320ca.camel@redhat.com> Subject: Re: [PATCH v3] PCI: hv: Hardwire PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN to 0 From: Laurence Oberman To: Hamza Mahfooz , linux-hyperv@vger.kernel.org Cc: Haiyang Zhang , Wei Liu , Dexuan Cui , Lorenzo Pieralisi , Krzysztof =?UTF-8?Q?Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Jake Oshins , linux-pci@vger.kernel.org, Michael Kelley , stable@vger.kernel.org, Asher Kariv , Mukesh R , njavali@marvell.com, GR-QLogic-Storage-Upstream@marvell.com, linux-scsi@vger.kernel.org Date: Wed, 02 Dec 2026 16:06:19 -0500 In-Reply-To: <20261202144345.275647-1-hamza@kernel.org> References: <20261202144345.275647-1-hamza@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.2 (3.60.2-3.fc44) X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 On Wed, 2026-12-02 at 09:43 -0500, Hamza Mahfooz wrote: > Hyper-V Discrete Device Assignment (DDA) does not support legacy > (INTx) > interrupts. >=20 > The current code recognizes PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN > reads and forces a zero value, but only for 8 bit reads. If a 16 or > 32 > bit read overlaps these fields, they may be returned as a non-zero > value. Fix this by recognizing such overlap, and forcing the > PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN bytes to zero while > retaining > the adjacent bytes returned by the host/HW. >=20 > Cc: stable@vger.kernel.org > Fixes: 4daace0d8ce8 ("PCI: hv: Add paravirtual PCI front-end for > Microsoft Hyper-V VMs") > Co-developed-by: Asher Kariv > Signed-off-by: Asher Kariv > Signed-off-by: Mukesh R > Signed-off-by: Wei Liu > Signed-off-by: Hamza Mahfooz > --- > v2: > - Fix a compilation error > v3: > - Capitalize "Hardwire" in the subject. (Michael) > - Add description/comment clarifications. (Michael) > - Also hardwire PCI_INTERRUPT_LINE to 0 for 16 and 32 bit reads. > (Michael) > - Emulate 16 bit reads of PCI_INTERRUPT_LINE/PCI_INTERRUPT_PIN, and > clear > =C2=A0 the low 16 bits of 32 bit reads instead of writing through a char > =C2=A0 pointer. > --- > =C2=A0drivers/pci/controller/pci-hyperv.c | 11 +++++++++-- > =C2=A01 file changed, 9 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/pci/controller/pci-hyperv.c > b/drivers/pci/controller/pci-hyperv.c > index 824cf27e85e6..05a528df7a51 100644 > --- a/drivers/pci/controller/pci-hyperv.c > +++ b/drivers/pci/controller/pci-hyperv.c > @@ -1213,8 +1213,7 @@ static void _hv_pcifront_read_config(struct > hv_pci_dev *hpdev, int where, > =C2=A0 =C2=A0=C2=A0 PCI_CAPABILITY_LIST) { > =C2=A0 /* ROM BARs are unimplemented */ > =C2=A0 *val =3D 0; > - } else if ((where >=3D PCI_INTERRUPT_LINE && where + size <=3D > PCI_INTERRUPT_PIN) || > - =C2=A0=C2=A0 (where >=3D PCI_INTERRUPT_PIN && where + size <=3D > PCI_MIN_GNT)) { > + } else if (where >=3D PCI_INTERRUPT_LINE && where + size <=3D > PCI_MIN_GNT) { > =C2=A0 /* > =C2=A0 * Interrupt Line and Interrupt PIN are hard-wired > to zero > =C2=A0 * because this front-end only supports message- > signaled > @@ -1256,6 +1255,14 @@ static void _hv_pcifront_read_config(struct > hv_pci_dev *hpdev, int where, > =C2=A0 mb(); > =C2=A0 } > =C2=A0 spin_unlock_irqrestore(&hbus->config_lock, flags); > + > + /* > + * Make sure PCI_INTERRUPT_LINE and > PCI_INTERRUPT_PIN are > + * hard-wired to 0, since they may be included in a > 32 bit > + * read, which is skipped by the above emulation. > + */ > + if (where =3D=3D PCI_INTERRUPT_LINE) > + *val &=3D ~0xffff; > =C2=A0 } else { > =C2=A0 dev_err(dev, "Attempt to read beyond a function's > config space.\n"); > =C2=A0 } Hi Hamza, No objection to this change. For the record, it affects qla2xxx under DDA. The driver uses PCI_INTERRUPT_PIN to identify the physical port of a multi-port HBA, which selects that port's NVRAM and WWPN. With the pin reading 0 and every function presented as function 0, all ports get port 0's WWPN. I described this earlier in [1]. Nilesh (Marvell, Cc'd) has a qla2xxx fix that reads the physical port from the ISP control/status register in the HBA's MMIO space instead of from PCI config space, so it is not affected by this patch. I tested it today on an ISP2281 with the DDA conditions simulated (pin and function forced to 0): with the fix each port gets its own WWPN; without it both ports report port 0's WWPN and the second port never comes up on the fabric. Nilesh will post it to linux-scsi. Since this patch is tagged for stable, the qla2xxx fix should go to stable as well. Otherwise multi-port QLogic HBAs in DDA guests on stable kernels will end up with duplicate WWPNs. [1] https://lore.kernel.org/linux-hyperv// Thanks, Laurence