Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6330331rwb; Mon, 5 Dec 2022 10:44:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Nw3avcoo5kTrNYenxCMSo3eEF6k4PjZ6c9uY7IwUr2qiOXZaHFwdIcTunltTbXYaygu39 X-Received: by 2002:a17:906:52c8:b0:7ad:ba1e:1bac with SMTP id w8-20020a17090652c800b007adba1e1bacmr71048290ejn.528.1670265872326; Mon, 05 Dec 2022 10:44:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670265872; cv=none; d=google.com; s=arc-20160816; b=iEiKMmKG/T5ASLOzppOq9silIW3mULAhZAvLpxx2BtbwnhwZKcelnIuewAMSD+xz+A h9l2yvN6MR+UO50t0h7dMFGE8CzkFaey5N98nXIU4y1hpfCz9BfyCgQ8VI9VK3+f/5+N fqEdvpr2oflbg3gqG2GMNR8j2BtI/aLBClrdJhHex862GTGCW3y9DK+VQVIlgxiqzolF 6vs7sKPWvLvasT9mgMnF/2ZiM4PcusFf2Fo7xLECZn8QJLufzXmYFgSXOjxks4CNYOrb XlGXJH1JQzRJPhrw76PdT+ppdp6sH4ulm+Oh3A7J7Nba+Z2B6jVsM25NilGJAXbYXGZq P9mw== 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=Xy/eY7p8ZnxfrkLJSoH2eLIlIdhmT47Syyb1yfoOsOI=; b=1B5iTosMmpEZEaO5m8CPafFHqyJiTgphvLiEOQmSvbE4ICpYU0IKNSgAj8OvMoIC+O aOB3Yg0QBQBT8MiZZtKGRjm7y572R/NpwYNZJp2APnYmhg2Q40i22fZg1KtXZPK48CY8 W2zqjZwWR5+RuvciFE5SOScoXvjxraWEh6R0vXkFnIfHIGP9GgbcMNnbHwdNCRgX9+mH vItk+cwdYWdUOrnm/iLqe3H5bmoTVVpwhS2HXz4bw9fl5fVcqacUI4RmC0L+7LwZXKXG tgkcNfDYx+HSBrLwezO08OQq0RzNBYNk5YosLFjqFzq8C8Dac4r7OCTjkJeaK7711FK2 ROBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=RcQgM4gV; dkim=neutral (no key) header.i=@linutronix.de; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dk15-20020a0564021d8f00b0046ac358ed89si174889edb.219.2022.12.05.10.44.13; Mon, 05 Dec 2022 10:44:32 -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=RcQgM4gV; dkim=neutral (no key) header.i=@linutronix.de; 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 S232245AbiLES1I (ORCPT + 81 others); Mon, 5 Dec 2022 13:27:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232459AbiLESZT (ORCPT ); Mon, 5 Dec 2022 13:25:19 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5919520F50; Mon, 5 Dec 2022 10:25:18 -0800 (PST) Date: Mon, 05 Dec 2022 18:25:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670264716; 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=Xy/eY7p8ZnxfrkLJSoH2eLIlIdhmT47Syyb1yfoOsOI=; b=RcQgM4gVr72xhN3aWYc7EnlxQz/RFLGYZea2iklTlev+1bApitfjDKoS/s63kuFAN+JLgW ctURZr2frrCYTT1GhrSv8Ow9o3Dw6eFWgf4CuQqSTRCNkhZmkfKUosUGSrTWmLRgnR86bD 2QOlJITe9B+QCBMT3DOSD7cIWyijsZYKk7lcPFbRGHx66N6tfE87E2CgHT9wtQxWIYDUx6 qwDG0UWHjtvy+TnW4JfYL+mdx5QI32Wi5TdiaiBzNXZRm43/dAZrcWsQKqU1tuYGtDSO9E i68SXq2NCKIw6b47jXGjTy5zRHz4rWjLwq/QLY1o6FUDmlMtTlPF7aPwpYrw6w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670264716; 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=Xy/eY7p8ZnxfrkLJSoH2eLIlIdhmT47Syyb1yfoOsOI=; b=qetfbYlthlN+KdRxWTX522QTWHB/Bs3h020D+N8rML9IW5rII1DNhnILwHRJIeAjwayhIu aKG2uhYBLkmjOdCA== 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] genirq/msi: Add size info to struct msi_domain_info Cc: Thomas Gleixner , Kevin Tian , Marc Zyngier , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221124232325.501144862@linutronix.de> References: <20221124232325.501144862@linutronix.de> MIME-Version: 1.0 Message-ID: <167026471647.4906.14532697826610598504.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 The following commit has been merged into the irq/core branch of tip: Commit-ID: 61bf992fc618503c910416f28afa0b015838b72b Gitweb: https://git.kernel.org/tip/61bf992fc618503c910416f28afa0b015838b72b Author: Thomas Gleixner AuthorDate: Fri, 25 Nov 2022 00:25:51 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 05 Dec 2022 19:21:01 +01:00 genirq/msi: Add size info to struct msi_domain_info To allow proper range checking especially for dynamic allocations add a size field to struct msi_domain_info. If the field is 0 then the size is unknown or unlimited (up to MSI_MAX_INDEX) to provide backwards compability. Signed-off-by: Thomas Gleixner Reviewed-by: Kevin Tian Acked-by: Marc Zyngier Link: https://lore.kernel.org/r/20221124232325.501144862@linutronix.de --- include/linux/msi.h | 5 +++++ kernel/irq/msi.c | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/msi.h b/include/linux/msi.h index 7fb8737..08a0e2a 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -422,6 +422,10 @@ struct msi_domain_ops { * struct msi_domain_info - MSI interrupt domain data * @flags: Flags to decribe features and capabilities * @bus_token: The domain bus token + * @hwsize: The hardware table size or the software index limit. + * If 0 then the size is considered unlimited and + * gets initialized to the maximum software index limit + * by the domain creation code. * @ops: The callback data structure * @chip: Optional: associated interrupt chip * @chip_data: Optional: associated interrupt chip data @@ -433,6 +437,7 @@ struct msi_domain_ops { struct msi_domain_info { u32 flags; enum irq_domain_bus_token bus_token; + unsigned int hwsize; struct msi_domain_ops *ops; struct irq_chip *chip; void *chip_data; diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index c368116..0a38905 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -772,6 +772,17 @@ struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode, { struct irq_domain *domain; + if (info->hwsize > MSI_XA_DOMAIN_SIZE) + return NULL; + + /* + * Hardware size 0 is valid for backwards compatibility and for + * domains which are not backed by a hardware table. Grant the + * maximum index space. + */ + if (!info->hwsize) + info->hwsize = MSI_XA_DOMAIN_SIZE; + msi_domain_update_dom_ops(info); if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS) msi_domain_update_chip_ops(info);