From patchwork Thu Feb 15 19:56:57 2024 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: 201738 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp101555dyb; Thu, 15 Feb 2024 12:26:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUQGjhunH4eto7w8wFn8ArBnZ8HBZpDvV/8eUW3y5bFNS0Z2/cuTV22y1yYBSvMPLa4WmjeDccIB/wi9qwYazH2uPvjeQ== X-Google-Smtp-Source: AGHT+IFxmJBwoakOLfvGCDeOToC9LYTriJIs70Rfep/EuQ34eDdqh8yn0uWT6TklC9f042Jz+tAL X-Received: by 2002:a05:6e02:1749:b0:364:6ae:b5d1 with SMTP id y9-20020a056e02174900b0036406aeb5d1mr3640822ill.2.1708028793032; Thu, 15 Feb 2024 12:26:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708028793; cv=pass; d=google.com; s=arc-20160816; b=pbsNG3fHr+TtLDDhwlhihG+OCXjjpHbdR2ojYYwweR48ag/rnkax6keclcKYBBPusC LJt6c5QeAR+C7TuTkG30DdWTXvJqicR4AFRIHr2aYpq0AQRtNBtYCm5oUoB1YO2b04DA UXq6bUInDy3wd5P7M7Rq4J4ierHCsoNJAzUxfQ6IYqT04hhjptZPuyHnAXMbhXxI5Arf cz9ZIrCLadHwTbR9ufzI9aHghffDeUDmee2+jUakTnbveITLHlgGoxwi12k2KBDnyLeu khisFzbGs27zeYhic0McoDaFdzxEc3c2k+RD95YvdLTcdlxjM8t1UunkMpViURK/QxND Q/MA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=+WqI9nPtixyKncAra6ZweS8GANBLUa92oMGDlLFv3rc=; fh=LU6lT0PDYxSjx39eUa7M+LyV2rE4/Fllc4BDCj6L/a8=; b=DSK+oXXAt/Ub2iNu+OLI0dBRznLKAMNajDBiOydbsX8zYojbPcKn3ethljcNSCU9ss O+1brNgRUrjmucds2vAbHjc1RrBT+nDLA+prhCWxCi3vU0AlJP+IbdODcrQzUFuB3sYG hNNM56+g0Wf9jp28Wa+rbFRrdiac/IvyG/t+iz1+vAzyRVyriTYqJoIAmzkJLYjlKjYL 7ocGvQeu4xYdqUQtQJxl+htw38lJdlNKxu1CmKqqapKdZAnWOqAcyZEvFKcdghfgqPcR Bh0GSwJmmwEg/8yyn9SWd2kdtiIb0pWl7w1DRpieS8sJgpn8kgeb2Cayw0TnKUfD8bNN juGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ur49WNr3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-67619-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67619-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id v10-20020a63610a000000b005cf0abea01dsi1600796pgb.114.2024.02.15.12.26.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 12:26:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67619-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ur49WNr3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-67619-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67619-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5E80BB262D2 for ; Thu, 15 Feb 2024 19:57:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66B5A13B2A4; Thu, 15 Feb 2024 19:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ur49WNr3"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="5kmDE60Z" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE30213173A; Thu, 15 Feb 2024 19:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708027021; cv=none; b=ltwcu61pbzrsAHM4jtS515lXMfiaKlHWGGlXqJj5z0ZkuA0yvsIF7pSa2cv6K7C38Xkd/UBfnC+IQhX9zYEsZGIQrdJCjTE0eE4Ldy+C8kAS8qWJslXsWzEianUsSTNCfzaSp9tB6dVssIem35+ZQeluDUVlFi0mD1hKPYtpCJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708027021; c=relaxed/simple; bh=MdkC8XE9kvkmc9XSw3q9ZgPGrZxIlfGqOovweariG3c=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=JP8ziPHNK9e3ik6ZtfKlPR7Pu6C4Q/H8jursQuFSEz/EL2PrkRjsi6Lb5oEKCRijzaec9n7G3tUIHx2p45lMCHn62QKrHA/Hr2mRsK3RgJyPi/aVHqFibr9VYWRMivbeI7MHaE+QDcBT4dGEoJyYhfXjQclx67dDOC0BHXqsK1M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ur49WNr3; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=5kmDE60Z; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Thu, 15 Feb 2024 19:56:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708027018; 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=+WqI9nPtixyKncAra6ZweS8GANBLUa92oMGDlLFv3rc=; b=ur49WNr3upAjaNjQbGrUAsw6vBCWNJAg81hxfTW/umjAvwlFIFbDHFAfhfuFbArO2yGpug xLbUSEspRqTa0qSZDDDZvV3RQcSJbGaItSlPd6tONUNmcdFdC+THDmXkjPL+Z2tn5/c2Zq pa8BEVa9rqajT5Mcykb173sngWCz2+L9ud3fQcyAuUL2dMOu98mFhf8d+T3zX0kIMUdHkY OjkzIFbcwHhFfyJAsGtBw3tHkOnHG5aDshtPkTR3IaVbS+UPACQAN+jZ/XJyGiIK/iYsgV tYgN6aecuegNVFs+2gm42ZhWkckU7lomJSyMK6WP0Ir6vlsb0Wya3tJIOB+80g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708027018; 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=+WqI9nPtixyKncAra6ZweS8GANBLUa92oMGDlLFv3rc=; b=5kmDE60Z9rJB1BLyE5jwsjoXe/mLelQ5D9zzG2W37r0O4cxOsVn1NjExws6JmFfiiZ4ceQ eNAewuWDDXnuHiDQ== 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/msi] genirq/irqdomain: Reroute device MSI create_mapping Cc: Thomas Gleixner , Anup Patel , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240127161753.114685-13-apatel@ventanamicro.com> References: <20240127161753.114685-13-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170802701742.398.8367609943575258696.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789261495412153529 X-GMAIL-MSGID: 1790997999855930291 The following commit has been merged into the irq/msi branch of tip: Commit-ID: e49312fe09df36cc4eae0cd6e1b08b563a91e1bc Gitweb: https://git.kernel.org/tip/e49312fe09df36cc4eae0cd6e1b08b563a91e1bc Author: Thomas Gleixner AuthorDate: Sat, 27 Jan 2024 21:47:40 +05:30 Committer: Thomas Gleixner CommitterDate: Thu, 15 Feb 2024 17:55:41 +01:00 genirq/irqdomain: Reroute device MSI create_mapping Reroute interrupt allocation in irq_create_fwspec_mapping() if the domain is a MSI device domain. This is required to convert the support for wire to MSI bridges to per device MSI domains. Signed-off-by: Thomas Gleixner Signed-off-by: Anup Patel Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240127161753.114685-13-apatel@ventanamicro.com --- kernel/irq/irqdomain.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 8fee379..aeb4165 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -29,6 +29,7 @@ static int irq_domain_alloc_irqs_locked(struct irq_domain *domain, int irq_base, unsigned int nr_irqs, int node, void *arg, bool realloc, const struct irq_affinity_desc *affinity); static void irq_domain_check_hierarchy(struct irq_domain *domain); +static void irq_domain_free_one_irq(struct irq_domain *domain, unsigned int virq); struct irqchip_fwid { struct fwnode_handle fwnode; @@ -858,8 +859,13 @@ unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec) } if (irq_domain_is_hierarchy(domain)) { - virq = irq_domain_alloc_irqs_locked(domain, -1, 1, NUMA_NO_NODE, - fwspec, false, NULL); + if (irq_domain_is_msi_device(domain)) { + mutex_unlock(&domain->root->mutex); + virq = msi_device_domain_alloc_wired(domain, hwirq, type); + mutex_lock(&domain->root->mutex); + } else + virq = irq_domain_alloc_irqs_locked(domain, -1, 1, NUMA_NO_NODE, + fwspec, false, NULL); if (virq <= 0) { virq = 0; goto out; @@ -914,7 +920,7 @@ void irq_dispose_mapping(unsigned int virq) return; if (irq_domain_is_hierarchy(domain)) { - irq_domain_free_irqs(virq, 1); + irq_domain_free_one_irq(domain, virq); } else { irq_domain_disassociate(domain, virq); irq_free_desc(virq); @@ -1755,6 +1761,14 @@ void irq_domain_free_irqs(unsigned int virq, unsigned int nr_irqs) irq_free_descs(virq, nr_irqs); } +static void irq_domain_free_one_irq(struct irq_domain *domain, unsigned int virq) +{ + if (irq_domain_is_msi_device(domain)) + msi_device_domain_free_wired(domain, virq); + else + irq_domain_free_irqs(virq, 1); +} + /** * irq_domain_alloc_irqs_parent - Allocate interrupts from parent domain * @domain: Domain below which interrupts must be allocated @@ -1907,9 +1921,9 @@ static int irq_domain_alloc_irqs_locked(struct irq_domain *domain, int irq_base, return -EINVAL; } -static void irq_domain_check_hierarchy(struct irq_domain *domain) -{ -} +static void irq_domain_check_hierarchy(struct irq_domain *domain) { } +static void irq_domain_free_one_irq(struct irq_domain *domain, unsigned int virq) { } + #endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */ #ifdef CONFIG_GENERIC_IRQ_DEBUGFS