From patchwork Thu Feb 15 19:56:58 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: 201726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp85295dyb; Thu, 15 Feb 2024 11:58:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWbtcn3cPglHNj5JFZS0CJFWd8Na5ZFanqq0Ckh1Bn4vzoNqvDBzk641D0jKplMv50rK+BrPewdlKNZ0VUi7al8E0/44g== X-Google-Smtp-Source: AGHT+IHZsaim7flvPyLL+N7o9MIFPZL0wFcA1wrSP0rPSCuEhqwV2CvWkXfjfL9hX4T3lyymOjpN X-Received: by 2002:a17:906:240e:b0:a3d:b5b0:42c8 with SMTP id z14-20020a170906240e00b00a3db5b042c8mr1063857eja.11.1708027094520; Thu, 15 Feb 2024 11:58:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708027094; cv=pass; d=google.com; s=arc-20160816; b=sXYIRYaI6TkJSjAG9X8FSQTtU/8AVUVXeyaYeZM6dgoaWbs9rSXSOx2nnhAE+J6X+h SLOQuB50upDCFKhsp2NnUfQEeaWfIKVbyYcEAD0R0DgacBWW8tvcndYSFyP098fgwSU2 aLefG/TqrZxa1o08VMPqjCK4rlmEcQ0N2RZm62n+Xyrq+L2GGY5qYH/IxUwg2SrRO9pJ i+LnmLZ7ZcMhEyxZBYQn0CUhVQIJHgL/Q5aY6FnwtbwkWzyE+1IMwh4T6T4UQjv0wFCw Pq5iypezGm/Z5tuz7qUPKN9qdAhVv5xLQ5EeVa8mWj/mcL8mLxK1GB4NOyIQz6iPTNhm izoQ== 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=qfuRlzFEb1d+9o0YAIYrks98Nq9LA7+QAmJ9V+D96To=; fh=LU6lT0PDYxSjx39eUa7M+LyV2rE4/Fllc4BDCj6L/a8=; b=RdU+FB0xjZH8g0/fRLMsmWm4LzRZN4OqsObAebo9TxyyQMC3115MLhZdgdMqFrsqaK 5eUb6jPAxsEBuDsF1hFIDQ955nNXSsRpmrEUMEfEVOCwm2c0hiVU/8Erd6IGg3WMz6cJ F5gYwot/sDptW78CpZIvGYYe9xatihFDyBKetjj+iGyuYBzZO1WZZC+831lX2PK007SH 2ZWQ3E3XEuld4GKYrZGZGOk9Gdc2JAfs3CH8DZEZF/l31GUyvo+aqGbdB7HwWfnvEN4Y 7gPvuz9dThxY7YQsppWI+xbD2HcGIG8ZoPCFm7LXOyt4gRLnVoqM6W1pnEkK6hpBEfbB XM0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="R4d/5917"; 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-67621-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67621-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f18-20020a170906049200b00a3d1caa3625si898368eja.1014.2024.02.15.11.58.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 11:58:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67621-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="R4d/5917"; 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-67621-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67621-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 29A991F2385C for ; Thu, 15 Feb 2024 19:58:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F140E13F006; Thu, 15 Feb 2024 19:57:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="R4d/5917"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LVlXZCl3" 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 2574113A895; Thu, 15 Feb 2024 19:57:00 +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=1708027022; cv=none; b=Kd9TUjaomZQR+cz8Sx3rccOswFmLaINOwcZCfYU8cU/HSxxVAu8/kxieUI0b8YrmGT/Q7K3uF1XloWq/YYdBZUlwjRozTiCjf/IkRFOTPVD2OIYEWHkTKtTOlOf+eh9EI5LXiqihFsH9FZzo4mYIsmrJhhPiHsckUey+tu2fUps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708027022; c=relaxed/simple; bh=3KeM7lfLDa4d6XxZlkuetJlr+Z0HQInto9qLhe1/Z+g=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=srdYWcbCBg6aew6vYU80bZhwvwNUXK5Yft6sRE+Y5BBJbew3BW5i1F14o4GUk8Fw3VAhOAPTtDgABRiUROzsOJQ+DPrDT5jw3afOSG3vBaDAS6wsaAm7sdfVoQ6Lk2gaf4XKyEEoPsKKuxzHW47FDUbz9wP9RI8qQpsHk6yCTlI= 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=R4d/5917; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=LVlXZCl3; 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:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708027019; 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=qfuRlzFEb1d+9o0YAIYrks98Nq9LA7+QAmJ9V+D96To=; b=R4d/5917GbkM+GOB8ytnqCpp7nqUDrwVFx5MaqW3/+HLfKwkhs2HP3Tix4TWGc1KESrNJv NZ9pFhYmWgjZwY9zBbdoiWU0cx9d1uBDf7FPO1oEDjIWY4qYioyQOrVEtSNnQYG0hladxl DOuwyT2fiEKmkHzxj3GuWMksiIWI8oJLzcnInOgyVnQLTtb7Q2TO8b7WB3Vfe0kGPfCd31 MGGATtCVoOWdjZ7317oaOk2lP/QSKKsNUrGyBEJOki0k5i9yj+thSfxsFNftLtLwncpQDH ePiWJcHYUXPZBhxC3CpQUZOSMFwjzKOL7//OCnlUtwBb6siO3R35P7eqoqiwPw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708027019; 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=qfuRlzFEb1d+9o0YAIYrks98Nq9LA7+QAmJ9V+D96To=; b=LVlXZCl3LDh8QYYb+SICl7Fq0LP67xWHI3Fd4XmCVtcYSxILz6eHPZvnmDJrLsUvhGBgOO aWGoh9DA8yZKlMCQ== 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/msi: Optionally use dev->fwnode for device domain Cc: Thomas Gleixner , Anup Patel , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240127161753.114685-11-apatel@ventanamicro.com> References: <20240127161753.114685-11-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: <170802701865.398.5350588074359422240.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: 1789261261468049591 X-GMAIL-MSGID: 1790996218275999155 The following commit has been merged into the irq/msi branch of tip: Commit-ID: 9d1c58c8004653b37721dd7b16f4360216778c94 Gitweb: https://git.kernel.org/tip/9d1c58c8004653b37721dd7b16f4360216778c94 Author: Thomas Gleixner AuthorDate: Sat, 27 Jan 2024 21:47:38 +05:30 Committer: Thomas Gleixner CommitterDate: Thu, 15 Feb 2024 17:55:41 +01:00 genirq/msi: Optionally use dev->fwnode for device domain To support wire to MSI domains via the MSI infrastructure it is required to use the firmware node of the device which implements this for creating the MSI domain. Otherwise the existing firmware match mechanisms to find the correct irqdomain for a wired interrupt which is connected to a wire to MSI bridge would fail. This cannot be used for the general case because not all devices provide firmware nodes and all regular per device MSI domains are directly associated to the device and have not be searched for. Signed-off-by: Thomas Gleixner Signed-off-by: Anup Patel Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20240127161753.114685-11-apatel@ventanamicro.com --- include/linux/msi.h | 2 ++ kernel/irq/msi.c | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/linux/msi.h b/include/linux/msi.h index 24a5424..36ba6a0 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -552,6 +552,8 @@ enum { MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS = (1 << 5), /* Free MSI descriptors */ MSI_FLAG_FREE_MSI_DESCS = (1 << 6), + /* Use dev->fwnode for MSI device domain creation */ + MSI_FLAG_USE_DEV_FWNODE = (1 << 7), /* Mask for the generic functionality */ MSI_GENERIC_FLAGS_MASK = GENMASK(15, 0), diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index 8d46390..5289fc2 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -960,9 +960,9 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid, void *chip_data) { struct irq_domain *domain, *parent = dev->msi.domain; - const struct msi_parent_ops *pops; + struct fwnode_handle *fwnode, *fwnalloced = NULL; struct msi_domain_template *bundle; - struct fwnode_handle *fwnode; + const struct msi_parent_ops *pops; if (!irq_domain_is_msi_parent(parent)) return false; @@ -985,7 +985,19 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid, pops->prefix ? : "", bundle->chip.name, dev_name(dev)); bundle->chip.name = bundle->name; - fwnode = irq_domain_alloc_named_fwnode(bundle->name); + /* + * Using the device firmware node is required for wire to MSI + * device domains so that the existing firmware results in a domain + * match. + * All other device domains like PCI/MSI use the named firmware + * node as they are not guaranteed to have a fwnode. They are never + * looked up and always handled in the context of the device. + */ + if (bundle->info.flags & MSI_FLAG_USE_DEV_FWNODE) + fwnode = dev->fwnode; + else + fwnode = fwnalloced = irq_domain_alloc_named_fwnode(bundle->name); + if (!fwnode) goto free_bundle; @@ -1012,7 +1024,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid, fail: msi_unlock_descs(dev); free_fwnode: - irq_domain_free_fwnode(fwnode); + irq_domain_free_fwnode(fwnalloced); free_bundle: kfree(bundle); return false;