Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6342617rwb; Mon, 5 Dec 2022 10:56:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf54uS6qAadB4IcrhKF4KyANEAg8MaHgWJ8sQ6lq9FIt0tFiNB+DmHgPNCRDlHqlMQnCjyNr X-Received: by 2002:a17:906:b34c:b0:7c0:a6d8:6a6b with SMTP id cd12-20020a170906b34c00b007c0a6d86a6bmr19645719ejb.194.1670266563831; Mon, 05 Dec 2022 10:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670266563; cv=none; d=google.com; s=arc-20160816; b=pPTRFwNqOyNILHX4RDA0IuTt6yRgxjG0l3e+VxJ7F4bCcRJhr4IgSPLdgZvwMm6n5k gmLegsGQvmM6yqi6lTWNmjHIF8FZ/3CID/YP4C+IIIFh8bdcXQ5TulNL8Azoax17t0eQ JNUhE0m8dGHFHMwvyd+10ZGuoFUlJKE5Z1E3IdT71INeczuBAHWhWRmHs6FqjGtWHmXD UJul73zQsOm2laAMsWGCTGOhQwUmT8xIasVPqh0HFqxfM2KGvVKkSTsAcvEIjSLJ0+e/ nZBFZkLJtslGWXlDEqjlya/tCpHs8QRZST0qG2iERKNIXQR1dIxhjdX0C9aWcmIJglPY 3RAQ== 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=aiTByw1Orxq+AsvJlVZrlf8m5TEOn18a/SBeqPXSEw0=; b=lbeZ/bj13ejIs097RA5mUb2WfD1ks0a+BGlVbQWXSmrWAS5n0RYEV6/gXqjkLB8c+F G9svaUEQuLvUuupwUBpfIZOE2GLL9H8NTUtyC7Y0oaZlMoIOMHxfkX15/wdiIjJkIQw1 a//Bt+IUMNekBgQVCN2AChOK29RxJv3w02mTdBe2q3UAPxaOxbRCgbheCugD4a0m8rxy Rr7nXgVigqjVteROuMFzoftR3+pawDlsgnCbE/VA8/TQOKiwHD2kMhv/MfoOWC/ldHnr zdo+0NDKmDt5+2O+dMC1vAYRv3Q27rf1eOV7AXfGEBN+Ksd5BTGHqIgafUGtE92JBaYR LPZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TBX+EEnQ; 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 a34-20020a509ea5000000b0046443638c9esi204457edf.262.2022.12.05.10.55.44; Mon, 05 Dec 2022 10:56:03 -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=TBX+EEnQ; 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 S233443AbiLES23 (ORCPT + 81 others); Mon, 5 Dec 2022 13:28:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232573AbiLESZW (ORCPT ); Mon, 5 Dec 2022 13:25:22 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29EEA2124A; Mon, 5 Dec 2022 10:25:21 -0800 (PST) Date: Mon, 05 Dec 2022 18:25:19 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1670264719; 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=aiTByw1Orxq+AsvJlVZrlf8m5TEOn18a/SBeqPXSEw0=; b=TBX+EEnQaUlh4bA3PttdDN8hN6+U6symYFZ0hDXUbtO+2NT+ZDHCE4qawa56Au4GFI4Mog KMlGRouf8BmP/jH9hZ0sYs+L3Gtxhk+1vWHQtz0Gy7dpoNhu8tx77bLFRJgxSrOxigdqNY HJRTlMhXGV8iA9g4tp67TiddwoWvjFaBzpYMu+fw1ugcUYOVt5wP2AsqrkwpiHO4vH3t3Y YvBgBXuuD622uUEMJCzzvMyCIJAXD7/LWcwc9x2PXaJi3Khb3+RLeKRw7mlgkPr7SjEd5s qFrTIU6QrqJcnoPxIo961IE7iOagGfy0BadSYI6GJk8Guoc8b7+e2ZWfkGu6Qw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1670264719; 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=aiTByw1Orxq+AsvJlVZrlf8m5TEOn18a/SBeqPXSEw0=; b=R1GPAj4NxKgZUt/lZorF2Z5MvUl9+K4CzOW2Xfp79c1WEuTca/YLjVk2IF/I6VsAoudhGm 4vR+M6/5iLL0LGAQ== 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: Make descriptor allocation device domain aware Cc: Thomas Gleixner , Kevin Tian , Marc Zyngier , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221124230314.163043028@linutronix.de> References: <20221124230314.163043028@linutronix.de> MIME-Version: 1.0 Message-ID: <167026471945.4906.11342802513280962827.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: fc8ab388325ddfd848d00f3a3383b4304594546a Gitweb: https://git.kernel.org/tip/fc8ab388325ddfd848d00f3a3383b4304594546a Author: Thomas Gleixner AuthorDate: Fri, 25 Nov 2022 00:24:29 +01:00 Committer: Thomas Gleixner CommitterDate: Mon, 05 Dec 2022 19:20:59 +01:00 genirq/msi: Make descriptor allocation device domain aware Change the descriptor allocation and insertion functions to take a domain id to prepare for the upcoming multi MSI domain per device support. Signed-off-by: Thomas Gleixner Reviewed-by: Kevin Tian Acked-by: Marc Zyngier Link: https://lore.kernel.org/r/20221124230314.163043028@linutronix.de --- include/linux/msi.h | 16 +++++++++++++++- kernel/irq/msi.c | 20 ++++++++++++-------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/include/linux/msi.h b/include/linux/msi.h index f8ba85a..35e9d00 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -286,7 +286,21 @@ static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc, } #endif -int msi_insert_msi_desc(struct device *dev, struct msi_desc *init_desc); +int msi_domain_insert_msi_desc(struct device *dev, unsigned int domid, + struct msi_desc *init_desc); +/** + * msi_insert_msi_desc - Allocate and initialize a MSI descriptor in the + * default irqdomain and insert it at @init_desc->msi_index + * @dev: Pointer to the device for which the descriptor is allocated + * @init_desc: Pointer to an MSI descriptor to initialize the new descriptor + * + * Return: 0 on success or an appropriate failure code. + */ +static inline int msi_insert_msi_desc(struct device *dev, struct msi_desc *init_desc) +{ + return msi_domain_insert_msi_desc(dev, MSI_DEFAULT_DOMAIN, init_desc); +} + void msi_free_msi_descs_range(struct device *dev, unsigned int first_index, unsigned int last_index); /** diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 33b8a6c..e75b07f 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -39,7 +39,7 @@ static inline int msi_sysfs_create_group(struct device *dev); * Return: pointer to allocated &msi_desc on success or %NULL on failure */ static struct msi_desc *msi_alloc_desc(struct device *dev, int nvec, - const struct irq_affinity_desc *affinity) + const struct irq_affinity_desc *affinity) { struct msi_desc *desc = kzalloc(sizeof(*desc), GFP_KERNEL); @@ -64,9 +64,10 @@ static void msi_free_desc(struct msi_desc *desc) kfree(desc); } -static int msi_insert_desc(struct msi_device_data *md, struct msi_desc *desc, unsigned int index) +static int msi_insert_desc(struct msi_device_data *md, struct msi_desc *desc, + unsigned int domid, unsigned int index) { - struct xarray *xa = &md->__domains[MSI_DEFAULT_DOMAIN].store; + struct xarray *xa = &md->__domains[domid].store; int ret; desc->msi_index = index; @@ -77,15 +78,17 @@ static int msi_insert_desc(struct msi_device_data *md, struct msi_desc *desc, un } /** - * msi_insert_msi_desc - Allocate and initialize a MSI descriptor and - * insert it at @init_desc->msi_index + * msi_domain_insert_msi_desc - Allocate and initialize a MSI descriptor and + * insert it at @init_desc->msi_index * * @dev: Pointer to the device for which the descriptor is allocated + * @domid: The id of the interrupt domain to which the desriptor is added * @init_desc: Pointer to an MSI descriptor to initialize the new descriptor * * Return: 0 on success or an appropriate failure code. */ -int msi_insert_msi_desc(struct device *dev, struct msi_desc *init_desc) +int msi_domain_insert_msi_desc(struct device *dev, unsigned int domid, + struct msi_desc *init_desc) { struct msi_desc *desc; @@ -97,7 +100,8 @@ int msi_insert_msi_desc(struct device *dev, struct msi_desc *init_desc) /* Copy type specific data to the new descriptor. */ desc->pci = init_desc->pci; - return msi_insert_desc(dev->msi.data, desc, init_desc->msi_index); + + return msi_insert_desc(dev->msi.data, desc, domid, init_desc->msi_index); } /** @@ -120,7 +124,7 @@ static int msi_add_simple_msi_descs(struct device *dev, unsigned int index, unsi desc = msi_alloc_desc(dev, 1, NULL); if (!desc) goto fail_mem; - ret = msi_insert_desc(dev->msi.data, desc, idx); + ret = msi_insert_desc(dev->msi.data, desc, MSI_DEFAULT_DOMAIN, idx); if (ret) goto fail; }