From patchwork Thu Nov 17 15:08:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 21741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp454576wrr; Thu, 17 Nov 2022 07:13:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf70mEzcC7n+tR1kT8lfp+It/raptmtKSq6QIcvQb2MOkS5yn9+6EegvvZXyITU5ULOUJfoq X-Received: by 2002:a17:906:130b:b0:7ad:92c5:637a with SMTP id w11-20020a170906130b00b007ad92c5637amr2554811ejb.87.1668698021904; Thu, 17 Nov 2022 07:13:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668698021; cv=none; d=google.com; s=arc-20160816; b=qrG18A9XReb7Sa7IQMsA34ISYpLi0GrksQ9YwChxBbMyivcFnxdiQGUrVrtGYPJTp3 5m034y2JY7G/pSBYBTIt01msgBOXlCUlQtyZyESwyRjHULhYqID0esCUo0mHwr1SjwpC wPoboEOTXm8Jkphfg79aXMVKTu5O6VOLtNRrY0yqxTTcfJEthE87HKDUm0yjnAZKpFOI yjEelCZOVOt3svdbNqxj/SbOkTtCVncF8/PeWOcyOZWqBC+9WTHqGlqmiXIveVc0CFx0 7aDNwXd35XpN4LgGfq3BDJGzDRtIOowgo9R6D//FWgUXcmnbBV+XTgGgAlkhuGtNFnkH l4Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=2DCbvnZREnzUo5fScMcpxybop5Pr0Jy09VR2REXWdbc=; b=UyYs8df0RL4q5KETu6ObRVNqxQ3QlMR2z3u85e3wWQfDob+s5yKinoAO2uZLD6ZeCP qYr4/PuTqx3SnOm8OHR3vVCR9gusv1tKz5eyZ0uC0ZGCuXQBGsaXlGnfQIYmu1iFLVeV DWHg6GKIwdgzAnn9GNzhjuV3ufIoLuOCNNPXvjwgni97u+Alwjg37Xk2qIA+qdRBdabq nEkrUuxQ7mkUXLNib1OysQsgAIZKQNTbNkEVPxHs4eSF2Sq9gHQb6qmdiLPxEW0LDJ0G P5oW+Iv5kGKd47BS0AzYXedlJuYbJv97uOYvnBSCeOF0hCna/mBMsS1dmr8ijuTXVyyN gGNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=U4XzJlJI; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=bHeBn8aS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a056402518f00b0044f288e02edsi1190669edd.15.2022.11.17.07.13.17; Thu, 17 Nov 2022 07:13:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=U4XzJlJI; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=bHeBn8aS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240659AbiKQPLs (ORCPT + 99 others); Thu, 17 Nov 2022 10:11:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240250AbiKQPKC (ORCPT ); Thu, 17 Nov 2022 10:10:02 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FB2549096; Thu, 17 Nov 2022 07:08:35 -0800 (PST) Date: Thu, 17 Nov 2022 15:08:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668697714; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2DCbvnZREnzUo5fScMcpxybop5Pr0Jy09VR2REXWdbc=; b=U4XzJlJIL65+kjKWGCcPixK7NgrFc0oGJ7CfUVPrcU1g9Im2Kn5IBBAR2H2wSvq6NgcIdu bYfvBaY/4X6kLBmTqX9R3Rg8qqSVKPerKU9QGz74mFPhirT4ePzbowKp+2Ksv/H1zqnIci xYmzWQU4ok3e5KdQzsXW+EF/AnFvOHRN3nXlADjX/FAFeKPeQrXtwOWheOuIVuidSqGP8s +5+tfLKahOpEpz/INmy6RIFdss8q+bnsaNa8k7ZT+eEHWwDGgyPlbdlYnIw2snT2D0/zPd 8kSXD5u97AxjA8GKQZrTg07ABaHDyO/m21fWBnFXSeDL64E7EISEs2NZbHsAlg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668697714; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2DCbvnZREnzUo5fScMcpxybop5Pr0Jy09VR2REXWdbc=; b=bHeBn8aShG3UR6zp42vSuQbGpSe49fXxY/wmUFHu6p45KekABUlBKd24bC9rc8wLKxfHqW BqspOES0kLnwstCw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] PCI/MSI: Check for MSI enabled in __pci_msix_enable() Cc: Thomas Gleixner , Ashok Raj , Jason Gunthorpe , Bjorn Helgaas , x86@kernel.org, linux-kernel@vger.kernel.org, maz@kernel.org In-Reply-To: <20221111122013.653556720@linutronix.de> References: <20221111122013.653556720@linutronix.de> MIME-Version: 1.0 Message-ID: <166869771276.4906.11341244525719942741.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749208228234037004?= X-GMAIL-MSGID: =?utf-8?q?1749756697265271026?= The following commit has been merged into the irq/core branch of tip: Commit-ID: fe97f59a78fefda6c4a8c8ee6a070b1f769fc801 Gitweb: https://git.kernel.org/tip/fe97f59a78fefda6c4a8c8ee6a070b1f769fc801 Author: Thomas Gleixner AuthorDate: Fri, 11 Nov 2022 14:54:15 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 17 Nov 2022 15:15:18 +01:00 PCI/MSI: Check for MSI enabled in __pci_msix_enable() PCI/MSI and PCI/MSI-X are mutually exclusive, but the MSI-X enable code lacks a check for already enabled MSI. Signed-off-by: Thomas Gleixner Reviewed-by: Ashok Raj Reviewed-by: Jason Gunthorpe Acked-by: Bjorn Helgaas Link: https://lore.kernel.org/r/20221111122013.653556720@linutronix.de --- drivers/pci/msi/msi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index fdd2ec0..160af9f 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -935,6 +935,11 @@ static int __pci_enable_msix_range(struct pci_dev *dev, if (maxvec < minvec) return -ERANGE; + if (dev->msi_enabled) { + pci_info(dev, "can't enable MSI-X (MSI already enabled)\n"); + return -EINVAL; + } + if (WARN_ON_ONCE(dev->msix_enabled)) return -EINVAL;