Message ID | 20221124230313.806128070@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3659666wrr; Thu, 24 Nov 2022 15:25:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5y+YJsNKfvqF8YQDajNcZmclKw+K6HlK07WUORzn2epBQCK8WoibrkTEJBjwmEZOZ3/A2T X-Received: by 2002:a17:902:7885:b0:17e:c0f0:96a4 with SMTP id q5-20020a170902788500b0017ec0f096a4mr16744253pll.80.1669332345083; Thu, 24 Nov 2022 15:25:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669332345; cv=none; d=google.com; s=arc-20160816; b=O+K6ArdsPxOE/HSrxAssKnikUkof5gvqepB5fc/dsG07wT67UdzXOtnJEztCtPqtPK 1C7cm7HwpAG6ISv0UbXAKT+6dp1KtWk+LEKV21t4GMhwiPWwFrAX9K7XUdAqwjozUKil f4V5JIs0k2XlD78GzlEWZN1HvKSqUNMpnwndlV0C5LX4vq5V3a0bbFcPbxR/wDT0/S3c LUVAh8818fsAHftObTgNUr7650ypq/37U5k4ltdLwcyqAImbk/4D8VIiJvJHvb/2U8nU AOxkMTgiZsyF1SsN/OWDjTFTgA3LCi7I5LKBPwOl5y47v0ZH0rWDKlWOviH7G7V7tqmV kalg== 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=9rEv0ZCHRcbwfGXHvRaB+26Gs3i0vHsf2KEnMS96bjY=; b=WW99LEdaZtkfH4wM7Dc3MR+ePdTgL4SCdwND5NO4b3OORRoF3xsXqOgVSXJAXKRa7X DqV4cG6RwyiztlAE4q+xiMQLrqivCEfq2HrfuXiiq6u1uRubUZwgmEUtKqCDhFYXmdqI +iQfXfgV8k73Nj9CA6B8j0TUGhZKzmMrfbz4V+gCnUnRLULT/WVynPEaRcT8OQXafsnn YU4DU2rZ2I0Zwsp891qtbzLZNzSZi2J7uyvZZpwj4PEV46+lfr8BP7br4VrsiLtEdJtD nNTtRnt5EzES/IrgJgKVq1uympjaWtNT9myD0PM/5fUVYchgv7suPQbGTWMnIUrCQMy9 6kxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vsPAFMCy; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=9Tyg7PWS; 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 r29-20020a63a55d000000b0047063e59929si1541009pgu.836.2022.11.24.15.25.30; Thu, 24 Nov 2022 15:25:45 -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=vsPAFMCy; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=9Tyg7PWS; 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 S229776AbiKXXYk (ORCPT <rfc822;fengqi706@gmail.com> + 99 others); Thu, 24 Nov 2022 18:24:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbiKXXYe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 24 Nov 2022 18:24:34 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81BFC88B4E; Thu, 24 Nov 2022 15:24:21 -0800 (PST) Message-ID: <20221124230313.806128070@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669332259; 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=9rEv0ZCHRcbwfGXHvRaB+26Gs3i0vHsf2KEnMS96bjY=; b=vsPAFMCy1onT5uOAgcfpdCJaq1W7nRGPk5Oovvujiv005FbeclV1d37UGDuBaxg3bAnevx +oMjUxaBs2nufee8n1bjtgj4213C96760kyYDTlsbaePWRnyG8kCZOPrmCrn4wMtxItFdS tFkyFmLs/W4WvILbaYe7YjIVn7TrKXBqXUmOczrvsKpe5mr7q5sEsVABK/8VkHGfHpw3rL /QYeZne8Ys/lLumai1Ju/blYMzYGGMPe1BH9pP9xEIn+JRvzuPNEdg7MzeWNi+iJ2WKAxs zQITEy/Qt+p1Ykcb9TLcx1gfBc1U2gjZ1CgYIHBRtTv3wNy57WqZRzx6gepplg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669332259; 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=9rEv0ZCHRcbwfGXHvRaB+26Gs3i0vHsf2KEnMS96bjY=; b=9Tyg7PWSN9dj4EwqeKIBZ0++IEDFe9b3qoZRvfs2pSLMKkR5ib9qqQv7pwXlvTp72AwZPp iWimgDqkaMlmznDQ== From: Thomas Gleixner <tglx@linutronix.de> To: LKML <linux-kernel@vger.kernel.org> Cc: x86@kernel.org, Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>, linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, Marc Zyngier <maz@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jason Gunthorpe <jgg@mellanox.com>, Dave Jiang <dave.jiang@intel.com>, Alex Williamson <alex.williamson@redhat.com>, Kevin Tian <kevin.tian@intel.com>, Dan Williams <dan.j.williams@intel.com>, Logan Gunthorpe <logang@deltatee.com>, Ashok Raj <ashok.raj@intel.com>, Jon Mason <jdmason@kudzu.us>, Allen Hubbe <allenbh@gmail.com> Subject: [patch V3 07/22] genirq/msi: Check for invalid MSI parent domain usage References: <20221124225331.464480443@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Fri, 25 Nov 2022 00:24:19 +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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750421832985562170?= X-GMAIL-MSGID: =?utf-8?q?1750421832985562170?= |
Series |
[V3,01/22] genirq/msi: Move IRQ_DOMAIN_MSI_NOMASK_QUIRK to MSI flags
|
|
Commit Message
Thomas Gleixner
Nov. 24, 2022, 11:24 p.m. UTC
In the upcoming per device MSI domain concept the MSI parent domains are
not allowed to be used as regular MSI domains where the MSI allocation/free
operations are applicable.
Add appropriate checks.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
V2: Made the error return understandable. (Kevin)
---
kernel/irq/msi.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
--- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -937,13 +937,21 @@ int msi_domain_alloc_irqs_descs_locked(s lockdep_assert_held(&dev->msi.data->mutex); + if (WARN_ON_ONCE(irq_domain_is_msi_parent(domain))) { + ret = -EINVAL; + goto free; + } + + /* Frees allocated descriptors in case of failure. */ ret = msi_domain_add_simple_msi_descs(info, dev, nvec); if (ret) - return ret; + goto free; ret = ops->domain_alloc_irqs(domain, dev, nvec); - if (ret) - msi_domain_free_irqs_descs_locked(domain, dev); + if (!ret) + return 0; +free: + msi_domain_free_irqs_descs_locked(domain, dev); return ret; } @@ -1013,6 +1021,9 @@ void msi_domain_free_irqs_descs_locked(s lockdep_assert_held(&dev->msi.data->mutex); + if (WARN_ON_ONCE(irq_domain_is_msi_parent(domain))) + return; + ops->domain_free_irqs(domain, dev); if (ops->msi_post_free) ops->msi_post_free(domain, dev);