From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3AD41891CB; Wed, 26 Jun 2024 15:10:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719414642; cv=none; b=GC6QL2hKCsFSgoVRmLpPjKZkYBnhn6Vv1t2ll4EYUFgUTrNuCkhb+5/KX2yHyvRd64O3OQJQDY73olTJDdLm95Nk0GJlYBDlWM745Gr9AXnvolwurR2okkdaSUhVIS3YaNIWvL+ypqNg7F57i6fzy+bwTuERZ0jrsbhMAIbNkhU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719414642; c=relaxed/simple; bh=ekPNzLzryuR1LD67ikqc01Jk5UMQeCiAfkaRGoSGRzs=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=YjFaWZSySGTlCICCaxbP01qRIR+uF4r0wh1FF1jaM/yaGNuKtvwq0vAwjsbLytGYE6lMbcLKgLWZqyWS49SS+xJto93/dXSihJDHgUbVMn7+drLZRIvn+uceoTGWvjN2TvbS2JSXDrrzBmKv5ncUzKoJLRAnbcXWbGQf/3FLWgs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OHxR4Gl4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OHxR4Gl4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07AD4C116B1; Wed, 26 Jun 2024 15:10:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719414642; bh=ekPNzLzryuR1LD67ikqc01Jk5UMQeCiAfkaRGoSGRzs=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=OHxR4Gl4p5LAIKrmqfWH2GbraItePMGCNEfR+wMu9M4cejZ+RwzM/fPEzl/EKXSWK sDzKGnAERZZgz1NSiXYYZlkO1DPFVgx4KNNXPx53+uES+riMDC4nu3db17Yznmr+1K JvvZGWJ4El3IS8tSUk4OajBfYoCRrfCFRp/3/OJVCXp0y4JmXuvFFAnGRL/9Ba1h/i gKXQBZlHMaQFRmZoZL/BbArG97KotyLM13Drqqqyf1PE4HqhGd0GXk8EIge56Y9E6r H1rK9h1/EmWjmPkNT4I/oWnJZwFXeFxS8tXU6wrkzIopMw1l6Zxz5w6f9b/9eHGtEv GtyqRqd8kZHhw== Date: Wed, 26 Jun 2024 10:10:39 -0500 From: Bjorn Helgaas To: Wei Liu Cc: Linux on Hyper-V List , stable@kernel.org, "K. Y. Srinivasan" , Haiyang Zhang , Dexuan Cui , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Jake Oshins , "open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS" , open list Subject: Re: [PATCH v2] PCI: hv: fix reading of PCI_INTERRUPT_PIN Message-ID: <20240626151039.GA1466747@bhelgaas> Precedence: bulk X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240621210018.350429-1-wei.liu@kernel.org> 1) Capitalize subject to match history 2) Say something more specific than "fix reading ..." Apparently this returns garbage in some case where you want to return zero? On Fri, Jun 21, 2024 at 09:00:18PM +0000, Wei Liu wrote: > The intent of the code snippet is to always return 0 for both > PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN. > > The check misses PCI_INTERRUPT_PIN. This patch fixes that. > > This is discovered by this call in VFIO: > > pci_read_config_byte(vdev->pdev, PCI_INTERRUPT_PIN, &pin); > > The old code does not set *val to 0 because it misses the check for > PCI_INTERRUPT_PIN. > > Fixes: 4daace0d8ce8 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs") > Cc: stable@kernel.org > Signed-off-by: Wei Liu > --- > v2: > * Change the commit subject line and message > * Change the code according to feedback > --- > drivers/pci/controller/pci-hyperv.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c > index 5992280e8110..cdd5be16021d 100644 > --- a/drivers/pci/controller/pci-hyperv.c > +++ b/drivers/pci/controller/pci-hyperv.c > @@ -1130,8 +1130,8 @@ static void _hv_pcifront_read_config(struct hv_pci_dev *hpdev, int where, > PCI_CAPABILITY_LIST) { > /* ROM BARs are unimplemented */ > *val = 0; > - } else if (where >= PCI_INTERRUPT_LINE && where + size <= > - PCI_INTERRUPT_PIN) { > + } else if ((where >= PCI_INTERRUPT_LINE && where + size <= PCI_INTERRUPT_PIN) || > + (where >= PCI_INTERRUPT_PIN && where + size <= PCI_MIN_GNT)) { > /* > * Interrupt Line and Interrupt PIN are hard-wired to zero > * because this front-end only supports message-signaled > -- > 2.43.0 >