From patchwork Mon May 27 12:55:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 13675175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1046EC25B74 for ; Mon, 27 May 2024 12:59:27 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.730727.1135917 (Exim 4.92) (envelope-from ) id 1sBZwY-0005es-Sz; Mon, 27 May 2024 12:59:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 730727.1135917; Mon, 27 May 2024 12:59:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sBZwY-0005dw-MT; Mon, 27 May 2024 12:59:14 +0000 Received: by outflank-mailman (input) for mailman id 730727; Mon, 27 May 2024 12:56:20 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sBZtj-0004UW-Ph for xen-devel@lists.xenproject.org; Mon, 27 May 2024 12:56:20 +0000 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 806f077d-1c28-11ef-b4bb-af5377834399; Mon, 27 May 2024 14:56:16 +0200 (CEST) Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2024 05:56:14 -0700 Received: from unknown (HELO localhost) ([10.245.247.139]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2024 05:56:10 -0700 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 806f077d-1c28-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716814576; x=1748350576; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/GjJOKz80/OPeh1IZUhwdO/jTNvJXvgYw28YHmRy+ms=; b=IIMT0WaDdedSP4Lxd8EpFBDtky/oZjEwfIdoNjA+eaVum20oD3cRGT4G 3p3SZp7QYOUjKNT0mS1/pZzVyuKyG4fPhiPhT1xMx9vqJEbLHCt+rifvf Y+/mNMvGv0lNHl3lVcVeP0QoLBjyCSYdblQRTctXFR4R7Z/TGKeaAlfRc ipOvmUHasbO/x/55Eh3GlHUPDLmgBwtBjPKl1f4bL74xVTITQfUwk2UpX +PGRpXfnkp1pSJfin9p2d+5RwufdcVaAm1TwoMVW20525RGfsGAQsm+MH K196RIpakrMrBeNTmHMnbx5IAgmoeSXWCrwo3ZrlpG4yChkr8vcyaxtUh w==; X-CSE-ConnectionGUID: +uXa3yUFT2+riveQYP0R5w== X-CSE-MsgGUID: G164Qc3CQ+qH5BtCEOAweg== X-IronPort-AV: E=McAfee;i="6600,9927,11084"; a="23734146" X-IronPort-AV: E=Sophos;i="6.08,192,1712646000"; d="scan'208";a="23734146" X-CSE-ConnectionGUID: YFWi0+SrQV+rzQS/udVCIg== X-CSE-MsgGUID: ZBHpgWfbTRyNJw3j2NIY2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,192,1712646000"; d="scan'208";a="34643688" From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: Juergen Gross , Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Konrad Rzeszutek Wilk , Ian Campbell , xen-devel@lists.xenproject.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , stable@vger.kernel.org Subject: [PATCH 3/4] x86/pci/xen: Fix PCIBIOS_* return code handling Date: Mon, 27 May 2024 15:55:37 +0300 Message-Id: <20240527125538.13620-3-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240527125538.13620-1-ilpo.jarvinen@linux.intel.com> References: <20240527125538.13620-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 xen_pcifront_enable_irq() uses pci_read_config_byte() that returns PCIBIOS_* codes. The error handling, however, assumes the codes are normal errnos because it checks for < 0. xen_pcifront_enable_irq() also returns the PCIBIOS_* code back to the caller but the function is used as the (*pcibios_enable_irq) function which should return normal errnos. Convert the error check to plain non-zero check which works for PCIBIOS_* return codes and convert the PCIBIOS_* return code using pcibios_err_to_errno() into normal errno before returning it. Fixes: 3f2a230caf21 ("xen: handled remapped IRQs when enabling a pcifront PCI device.") Signed-off-by: Ilpo Järvinen Cc: stable@vger.kernel.org Reviewed-by: Juergen Gross --- arch/x86/pci/xen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c index 652cd53e77f6..0f2fe524f60d 100644 --- a/arch/x86/pci/xen.c +++ b/arch/x86/pci/xen.c @@ -38,10 +38,10 @@ static int xen_pcifront_enable_irq(struct pci_dev *dev) u8 gsi; rc = pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &gsi); - if (rc < 0) { + if (rc) { dev_warn(&dev->dev, "Xen PCI: failed to read interrupt line: %d\n", rc); - return rc; + return pcibios_err_to_errno(rc); } /* In PV DomU the Xen PCI backend puts the PIRQ in the interrupt line.*/ pirq = gsi;