Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp434901ybg; Wed, 3 Jun 2020 04:47:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc9kGjOPnHwgpsPp6rP/BJwykg3Z+wqWPThQhBkOqUkNZvn4ZsJics+NM+MUN8lo9rrLV7 X-Received: by 2002:a50:b0c3:: with SMTP id j61mr12964634edd.349.1591184839089; Wed, 03 Jun 2020 04:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591184839; cv=none; d=google.com; s=arc-20160816; b=O38NIEpvr8o7mb1xcPOo3PnIvejaFqsHSQu1RBQ79bXnI3//jhUQ58EuLIlOfB6Rvg D6yXBXTF/xI9evZot2TGoG9RxfeOLyZUbIi19pO/lQZsNVLHjdYae8jBJ1ANTrOPqd4g nRJAUO59j8bEtxDarvZGtr4lUGPab9uJ/wkTmyhe9VPuLmBvBQKEeEG/LT2Tp0PjUaco S1hFNUaUMH437fWj2m14SeWQ5yJHh06McWkiKgw+y/E3deXzWTKSOhSwSVKiJjYPa7Fq oW5aNBz83v/FY4Qq3TGgqxD1SqlwbJPHq5/Z1PMAZGCO9pOP5C9bPdGEnb5lSHXzuzgL gbTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=oGjXYr0dm+cDnn14R8nkvWMkYF1+MiJCzN7squtRWxY=; b=kLEIW69/56ZccGA30FjnaaFBsHdnUvdPgNkZB/pi9BJkum2oL/Fy7ms5SGcVO8pR56 I4mqhx6IlFBHHhO7GYjBwkoBnGvK6CPZhty4rIZth1FQZQA1XrIHypxIWs6p3X82ZQ7w PGTMtWmhn1baMyCno7U1HyTCUekNBTvl4R8CizOkmzqh3EW56xO/hU4KaxycpMHl+vZF tJrAfoj/h8Vr9vZ0zrjBfv4g89yVxBZKF8c5JLQxDKs8NYmRGfTU20VYFSwSzqTJaa70 K/Oz87xefR3sml2ecCi2UMIBmubgOPD2RFt6x9ah1hOM4X2RXZ5hAuyJ+QNKswhOYbiG bewg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v1si1111531ejd.509.2020.06.03.04.46.56; Wed, 03 Jun 2020 04:47:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725937AbgFCLpN (ORCPT + 99 others); Wed, 3 Jun 2020 07:45:13 -0400 Received: from mga18.intel.com ([134.134.136.126]:38373 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbgFCLpN (ORCPT ); Wed, 3 Jun 2020 07:45:13 -0400 IronPort-SDR: nUL+41uTDePePXgHWKniSn+knzhaQMD2ep0OgC+elYossHHmnFW5xkJBTH+Vc/RjU62h6APhfD hsjxKz+XlNtQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2020 04:45:13 -0700 IronPort-SDR: RXaXwBfnEa2vJF7njd9g1r5Z3O+PfhmTiUfJE6RzAMCMCg3LUTk0T+quFPkwVnhZZilZ4B79EU 8zzMOra2kNJw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,467,1583222400"; d="scan'208";a="445083811" Received: from gklab-125-110.igk.intel.com ([10.91.125.110]) by orsmga005.jf.intel.com with ESMTP; 03 Jun 2020 04:45:10 -0700 From: Piotr Stankiewicz To: Bjorn Helgaas , linux-pci@vger.kernel.org Cc: Piotr Stankiewicz , Andy Shevchenko , Logan Gunthorpe , "Rafael J. Wysocki" , Jian-Hong Pan , Greg Kroah-Hartman , linux-kernel@vger.kernel.org Subject: [PATCH v2 01/15] PCI/MSI: Forward MSI-X vector enable error code in pci_alloc_irq_vectors_affinity() Date: Wed, 3 Jun 2020 13:44:24 +0200 Message-Id: <20200603114425.12734-1-piotr.stankiewicz@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200603114212.12525-1-piotr.stankiewicz@intel.com> References: <20200603114212.12525-1-piotr.stankiewicz@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When debugging an issue where I was asking the PCI machinery to enable a set of MSI-X vectors, without falling back on MSI, I ran across a behaviour which seems odd. The pci_alloc_irq_vectors_affinity() will always return -ENOSPC on failure, when allocating MSI-X vectors only, whereas with MSI fallback it will forward any error returned by __pci_enable_msi_range(). This is a confusing behaviour, so have the pci_alloc_irq_vectors_affinity() forward the error code from __pci_enable_msix_range() when appropriate. Signed-off-by: Piotr Stankiewicz Reviewed-by: Andy Shevchenko --- drivers/pci/msi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 6b43a5455c7a..443cc324b196 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1231,8 +1231,9 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, } } - if (msix_vecs == -ENOSPC) - return -ENOSPC; + if (msix_vecs == -ENOSPC || + (flags & (PCI_IRQ_MSI | PCI_IRQ_MSIX)) == PCI_IRQ_MSIX) + return msix_vecs; return msi_vecs; } EXPORT_SYMBOL(pci_alloc_irq_vectors_affinity); -- 2.17.2