Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2031448lqb; Mon, 27 May 2024 05:56:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX08b5ZL+A00n9IjExhDnfX0N7DD3KVXaXOwXBBFDrafpRkNgcEA8P+FlsLond8T8XZja+DM9x2VVsoUdUw/j0jv+IeQhsQY5vTCXQfCg== X-Google-Smtp-Source: AGHT+IGZ0Jub9lNMKlzI7mtOIPFnGy8+K4Nx/Tzz+HOeCfwfwaqhLZvEvIlBtXKIBIfTJLb6rm49 X-Received: by 2002:a05:6830:6806:b0:6f1:20c0:9388 with SMTP id 46e09a7af769-6f8d0b0761emr13146836a34.23.1716814592645; Mon, 27 May 2024 05:56:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716814592; cv=pass; d=google.com; s=arc-20160816; b=vNWPUseZLtPMmYUBP38ELvvwx+MYRljFz2tPbgGe0CL9rOzmMb8eMdpw0nOX2h/cX1 5mfhJQU+xliJ4CTuFisX/B/FuQKYvQv9sPzM8JoXxRX+yiVdYyB6Ac2jaua8RQ2Dbx1q XW91KsBufNazselcTI4lIED/QjO0dcIQJggvfIm1A+2sCPdHb8Y0gwjYjHUJMktqMA+c pYmJL6vGdGQlK561F5O9Qd51A18V0oqfkXIcqDA70QpZ9l3knz7cHDUf4yvTN2rZTMLI 6DnOVf1zrRgt2jkwSgtJhmizyOgVYKxzuDqFUcrUs6n5tD8vtzBv1dVG5grkMVA2SADk v2XQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OLQc8KuIOoEuvnoeQ4w0PKI2GUfsJ+ISZ6kDNfTVNkE=; fh=gQ8/Wdot7DDF80GZV4f8Uxb2Gtwya9ZKLZZAkCyRp6A=; b=ktXIdklXXmAFxwVxpWr76bx5BSiWeOrcZ0TvL2ndgXxQc/Uh08AK+20aA4yKdteY+C gJu/4/H0rY4+d1CYkd5L776REveoN54U07J26ln2mrxsn8LNbs4e8o+6huJIUJVwKwnn Uh+9I3+yPgj31qlWJjNUawGCSFttuyjmspdrn9aEdWvzh6u+bNpj4Rgn63acAkLPgPmA Cv1z7U/yolykcONINiFclKJrGPaxDJdtnV7r5/u7GuiMJgd8V0k+z9ONivgnAG/k5Fgj YWnWW5y9bOpy9b7n2PD1i6cCxhvsba34Js33UBcGaanu9GfScNyAFfiOFR8BjiSV1rMD JDsQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C6fBQ7AP; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-190619-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190619-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43fb18b50e8si78488971cf.537.2024.05.27.05.56.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 05:56:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190619-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=C6fBQ7AP; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-190619-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190619-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 56FF01C226A6 for ; Mon, 27 May 2024 12:56:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FA9615ECD3; Mon, 27 May 2024 12:56:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="C6fBQ7AP" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 674FC15E5D3; Mon, 27 May 2024 12:56:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716814576; cv=none; b=YR/1HAK4aNJpHguXh3dmUKL60Jbwfr6XitV4Zt18WYyQVvihYpJ3U+tt9bDwWVzh0NENeTwVI+HnMibPxu0x78MVsB5zFr+nocbRtHiD1ZIYfA/Ihh4sb3IJNIoZXULZxgo5Wd2F1wPbpYAa23bTbrJXV5vnGVoRCRKA4WsRhbU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716814576; c=relaxed/simple; bh=/GjJOKz80/OPeh1IZUhwdO/jTNvJXvgYw28YHmRy+ms=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=QNQG7vRekUmJ/uqpUNpYvcICQzrJlU8Y46YcjfLsbOPw2Ioj94/yLhpvqi+VPYHc8OrTO7teAiDHLwPAY6ffEI4TYB0IzmDnVrov/dRj7vB6NfDFAb3/GkyrX4Owz+VvWact6QPmhfVpJWKcR3HLOKmqyTO8ozMCkJyzsb5qr4o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=C6fBQ7AP; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716814575; x=1748350575; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/GjJOKz80/OPeh1IZUhwdO/jTNvJXvgYw28YHmRy+ms=; b=C6fBQ7APfwSBeLJAAHvcER9gRT0GvWewU8VFqqsbX86HwIrziDsbCCmu i2pyXyZq9fgEaY/i4m4Nzvl0TkoivccnEQRrHGLjYGF+8WmMRhexHwTXr mXCgxEcVtfMZC2GfYYnNTz1p/8YIJiLZZJTOZDzUc5AgsyAnzqn7Eh/y+ Yp+zoojyQRXZYftcJGrXUSpUeHLXGbO+op2DBSfe2GkiX1npncBrlhUZM 0HziXJqXlti+SKLS5mWFm4UZu1At0mli9O6L/W02GEmLCMSuIPNo3LdUA nZFNCViqSLsKh2Twn4sxtBEMcCiA5pZtYo5FEwg3LqBNVhypejYSXsT4y A==; X-CSE-ConnectionGUID: 2ld25707RwKfE20KOgWoDw== X-CSE-MsgGUID: DplWkrMzR6yOEunlIGD3cA== X-IronPort-AV: E=McAfee;i="6600,9927,11084"; a="23734142" X-IronPort-AV: E=Sophos;i="6.08,192,1712646000"; d="scan'208";a="23734142" 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 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" 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 From: =?UTF-8?q?Ilpo=20J=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=20J=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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- 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; -- 2.39.2