From patchwork Fri Nov 11 13:55:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 18783 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp753896wru; Fri, 11 Nov 2022 05:59:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf5XAwysllyfScqhPMtTizu7lKd8zRhDYxeBjhJ+OsFHM+FK/YBUoHVBuSwKurzOjyVDROpV X-Received: by 2002:a17:906:2888:b0:78d:4b9f:c32 with SMTP id o8-20020a170906288800b0078d4b9f0c32mr1762195ejd.499.1668175176796; Fri, 11 Nov 2022 05:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668175176; cv=none; d=google.com; s=arc-20160816; b=KZ4TRcIMocrHAz3CO1PUz6EcfWOgL/dIvHT//I0ayyGbsOwJkScASUemcOATTY+ctG RnGqYvcbRZaKs78V6+bKhqGCp86K9EOPXW919FooARV5wYQHEgBHlf4GvLVht2HVgxn9 5vFjVzQ81rjDjeCvxm7CHBz6kZqkBk5ecrD+b9ZXUkrw+su52NamJL6GlvB6V+BzlW9T cX8zPH4Rnz+z1Fk57gEMr+FRzmxA33vuup7AZj//jcDas71/qSH9G1q6jQf4W/vTO46Z ZAGEX10/FuN5lYCl/BPm6celkegMumtL/pK1qP4plLgtSj6znig2a1xAsz399JGIcwJS rBcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=+6oBh3Odymqoh23rvdka2IMdSMoyZzzr0/UBN1qNnTk=; b=sKiKUFAlUF3d5I0B01JTf6U1+xqQOZoK+8pNEEpMF6BhdSnCtSsm4NlJfqR5LahSMD FwHEyj/L9ujvH4Fb5jezkZubiOIYwrADnXeqf/M0r9lssWjMz9v264PtWZehhKnKJvLR g5Xla9ablJkurf3gEdSXTLyisWf+hW4k1oUDVf8h7vbYSqhBejxckgiTZMjUIFRsr/Tj pCb4jhA9URFXlGAyCruZhzysMXv55nxgnWwtiI5vltpJH3zl2mo1P8xqSzGJNdOeayR0 iwOd6sr0U843sL04EP0Bo8RZwpHqZLH5Go5veMjZSBY6RBmuYDVAzVJGRmWAL4masySx HC3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=O3tsMqs0; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=RaGdX6Bh; 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 g2-20020a056402428200b00461d60a86casi2400884edc.135.2022.11.11.05.59.12; Fri, 11 Nov 2022 05:59:36 -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=O3tsMqs0; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=RaGdX6Bh; 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 S234098AbiKKN5t (ORCPT + 99 others); Fri, 11 Nov 2022 08:57:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234030AbiKKN46 (ORCPT ); Fri, 11 Nov 2022 08:56:58 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2F3F83BBD; Fri, 11 Nov 2022 05:55:12 -0800 (PST) Message-ID: <20221111122015.631728309@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668174911; 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=+6oBh3Odymqoh23rvdka2IMdSMoyZzzr0/UBN1qNnTk=; b=O3tsMqs0BMeeR+sixFB4gZJapU/NxK4ghDKAVQPqDhnTZ1IBPbK56iDtMw7jiD/yvC0Vms vf+roT7vboCo/D68gqgyuCWbdKslCGJJlnagz5NYC84Fa+4muHYwvI8A/twTqrfeUBk4vq qOa5boM9ecDRIvlv/Ne3aj00R/KskvzhltFrU+g0Dwj09t1ZkfM5eE1QNWW8iR655FotRi SVw1neM3UJcaXYj5CYqZj6zgC6RP/mbHOygnVJyedVo6fh9IVUba5cbNVdgGznNBm/s8sV hI/fb/i3XF/r1foTj/UHFgkIBx8je8kZVkZCQzlLRfgqN9hBwDdlt7py4prVNw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668174911; 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=+6oBh3Odymqoh23rvdka2IMdSMoyZzzr0/UBN1qNnTk=; b=RaGdX6Bhz2QV0LIWcWTdx/Y0fm6Co1H4cRb08fHDA9pCZ6wSQ+pfMSrQ7MxAFpkbWFifhD 9ql635EreUgGQKBA== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Joerg Roedel , Will Deacon , linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Marc Zyngier , Greg Kroah-Hartman , Jason Gunthorpe , Dave Jiang , Alex Williamson , Kevin Tian , Dan Williams , Logan Gunthorpe , Ashok Raj , Jon Mason , Allen Hubbe , Michael Ellerman , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, "Ahmed S. Darwish" , Reinette Chatre Subject: [patch 35/39] PCI/MSI: Reject MSI-X early References: <20221111120501.026511281@linutronix.de> MIME-Version: 1.0 Date: Fri, 11 Nov 2022 14:55:11 +0100 (CET) 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?1749208454418919210?= X-GMAIL-MSGID: =?utf-8?q?1749208454418919210?= Similar to PCI multi-MSI reject MSI-X enablement when a irq domain is attached to the device which does not support MSI-X. Signed-off-by: Thomas Gleixner Acked-by: Bjorn Helgaas Reviewed-by: Jason Gunthorpe --- drivers/pci/msi/msi.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -760,6 +760,10 @@ int __pci_enable_msix_range(struct pci_d if (WARN_ON_ONCE(dev->msix_enabled)) return -EINVAL; + /* Check MSI-X early on irq domain enabled architectures */ + if (!pci_msi_domain_supports(dev, MSI_FLAG_PCI_MSIX, ALLOW_LEGACY)) + return -ENOTSUPP; + if (!pci_msi_supported(dev, nvec) || dev->current_state != PCI_D0) return -EINVAL;