From patchwork Sat Nov 27 01:20:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12693811 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3EED2C433EF for ; Sat, 27 Nov 2021 01:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:MIME-Version:References:Subject:Cc :To:From:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=GZOomRxTiln95ab2gWsna+i+2hegZjhf3VNGFr0LzZw=; b=QJJORKS7vn95dy lqtqY3/Wu1N2Gsylycn5p4HUmhVUGPMbC1+tVaNRqOfHMIm/PLPyRNzGh7/SAxIoa9MVxBR0cH+GN HATeZt7lmDipSRhGX6D10U5RzaPqDw3W2wlvpIr12CCjDXNGwhvEE+HUmnipaCWHxpk6advGYSCrq G8io3eusWtlFAfgvKUf/qM1ZzSIc0kw8IBEroUISyDRv0MT6/tyPBXUOcTrEtp42w96/SQqM/39cC FkJPA6O1sK/A3WoD3sHEeWt4/kQIVHn2Asyt1Z/BvjwGCAgx9Tdc8zS9PUoYOaazpZ7sMxX60ub34 3yR6BJpaspa+Nw7eHi+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqmlK-00CLrZ-0D; Sat, 27 Nov 2021 01:44:22 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqmOa-00C9pZ-1H for linux-arm-kernel@lists.infradead.org; Sat, 27 Nov 2021 01:20:56 +0000 Message-ID: <20211126230525.548258086@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1637976050; 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: references:references; bh=wJMUpNJgyC/5WRXAWU3ClvJ2/7JlSux0SjtaYWx+PkY=; b=aQ1pSGzf1xljCMjV+A0HzBdj533zrI8Sn8/x78I5JLlzyaGEt2oaQIsa1H+VK1HinYpueS +3myORcpC+LyitSb3vMrxPMq0DdPSeOmr+hwbfxW2AzPhxwb5L2zDvpDENXii3Eq3fARgs moKEGxluXefb305ZDtRjnMujpBvPT5xFMXT0JTPNbH3aMGBKzkStBUqVjhor692Rl+IOBE xCmjzF0+vA/27cY8FjGJpCndjmidTZiuHmk0dsQDSB89lO5FRMUDZPKROlJ/JjU+NGZTPd kT+u92mqPp823zt8fgiXmt8+iJowIP8MdiBGyRV6mE2PiuLN6I3OdDf/9GaWZg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1637976050; 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: references:references; bh=wJMUpNJgyC/5WRXAWU3ClvJ2/7JlSux0SjtaYWx+PkY=; b=+khAQI9uNx8/zRgnV5rYXfaV6JyxSqTfzihC0RwrUHqKrPuQ+rUqH7qGte4yfUVdbfquwh jJs8fClZojrNxQDg== From: Thomas Gleixner To: LKML Cc: Bjorn Helgaas , Marc Zygnier , Alex Williamson , Kevin Tian , Jason Gunthorpe , Megha Dey , Ashok Raj , linux-pci@vger.kernel.org, Greg Kroah-Hartman , Santosh Shilimkar , iommu@lists.linux-foundation.org, dmaengine@vger.kernel.org, Stuart Yoder , Laurentiu Tudor , Nishanth Menon , Tero Kristo , linux-arm-kernel@lists.infradead.org, x86@kernel.org, Vinod Koul , Mark Rutland , Will Deacon , Sinan Kaya Subject: [patch 27/37] powerpc/pseries/msi: Let core code check for contiguous entries References: <20211126224100.303046749@linutronix.de> MIME-Version: 1.0 Date: Sat, 27 Nov 2021 02:20:50 +0100 (CET) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211126_172052_309390_A54C2D8A X-CRM114-Status: GOOD ( 14.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Set the domain info flag and remove the check. Signed-off-by: Thomas Gleixner --- arch/powerpc/platforms/pseries/msi.c | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c @@ -321,27 +321,6 @@ static int msi_quota_for_device(struct p return request; } -static int check_msix_entries(struct pci_dev *pdev) -{ - struct msi_desc *entry; - int expected; - - /* There's no way for us to express to firmware that we want - * a discontiguous, or non-zero based, range of MSI-X entries. - * So we must reject such requests. */ - - expected = 0; - for_each_pci_msi_entry(entry, pdev) { - if (entry->msi_index != expected) { - pr_debug("rtas_msi: bad MSI-X entries.\n"); - return -EINVAL; - } - expected++; - } - - return 0; -} - static void rtas_hack_32bit_msi_gen2(struct pci_dev *pdev) { u32 addr_hi, addr_lo; @@ -380,7 +359,7 @@ static int rtas_prepare_msi_irqs(struct if (quota && quota < nvec) return quota; - if (type == PCI_CAP_ID_MSIX && check_msix_entries(pdev)) + if (type == PCI_CAP_ID_MSIX) return -EINVAL; /* @@ -530,9 +509,16 @@ static struct irq_chip pseries_pci_msi_i .irq_write_msi_msg = pseries_msi_write_msg, }; + +/* + * Set MSI_FLAG_MSIX_CONTIGUOUS as there is no way to express to + * firmware to request a discontiguous or non-zero based range of + * MSI-X entries. Core code will reject such setup attempts. + */ static struct msi_domain_info pseries_msi_domain_info = { .flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | - MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX), + MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX | + MSI_FLAG_MSIX_CONTIGUOUS), .ops = &pseries_pci_msi_domain_ops, .chip = &pseries_pci_msi_irq_chip, };