Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1235352rdb; Mon, 19 Feb 2024 08:21:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWP3vR10pSH40+ffHndhygmVVgl9dGX4MfPVwSQNduYDEW73fT3ug3+l+uOvhrCfemhO0s12BQ7Dw1MCwzqmSmPDdpU6FVQuN1XK1w0KA== X-Google-Smtp-Source: AGHT+IHrUAUAHCnpKAm0ECC5YQys4emwDvdD0zSahs2hR4idOTzWMzilEFaxq4rydt2nZuOHIvNq X-Received: by 2002:a05:6512:3ba5:b0:511:2e7c:768f with SMTP id g37-20020a0565123ba500b005112e7c768fmr10618003lfv.46.1708359709466; Mon, 19 Feb 2024 08:21:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708359709; cv=pass; d=google.com; s=arc-20160816; b=OZ5eactNGKvy9D1cb45VZIsaeJiybBI8MrZ/UVT1lnAcl6m9G+Y+d4igxppSHEXFU/ TTIz+FrSnu+iVEcpgJY0b2Lb/MtZMD4QJ4n/EpN9SLNSebLh9F9A3Ljb7DZ/eQJabvfN Nqnroa63JpOpz52banzpC/NO/1TU8b9+f1nGM8RUja8bmTUmn+mA3iUpF62LQEmkFDl7 laEgrg0cnCDCZ8MBwjWDd3wOrD+C9Kc2zwtnFoK8qRrso4oVWgzyW5a6afoqUAMmIbzX j+Pkb/iQ/3Cwq1YYkmhkBBqWglsA3tU5kbG6QOKPnDBsVSeem2KE8R3NOj+vnWNBr2+6 RdJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=R2wt3HoshVyMSpGbBwuw8bsOeM4QsAyrGiOVNmA65O8=; fh=PID3XQKtQF5oCZ7LHuvUnD58z+Ai4S0jYeeqNnqwQeg=; b=wL+teoE8DT3fNQYRxLNfyQCCqSp6AzqW2a2B/ugBufwqX9u8dGlmiIxplm0QpcS2Kk NLLcYw7HYPFd42EGTBchDQPh2ZCb17J+GJwtNL8yEHqvPQZrG8ahALbG0CyKUj50LoK1 TdZyFKbD57ZhF9aIY1p5iw4yvjiFNI7zw7Ck6irTbZcj/vrcizDx7M0OpuEDPlwIVNqR 2Is1rYyD0Ju35sg49NRUj+RXaOHLdTDnXuUlYdrq1mcafCWcqqlZzo2PavHkLqSKESuL FsK8F5jrZgbbJHRDr22KosWmLC5fzt1manATgnwPDKmRkebHrHOT13a0vovj2nrmM8vi cU8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hUed3Kdu; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-71668-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71668-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p24-20020a056402075800b005643a16a1cfsi1797718edy.337.2024.02.19.08.21.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 08:21:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71668-linux.lists.archive=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=@linaro.org header.s=google header.b=hUed3Kdu; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-71668-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71668-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 B83831F236A9 for ; Mon, 19 Feb 2024 16:21:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7CE53399C; Mon, 19 Feb 2024 16:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hUed3Kdu" Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C0FC3CF48 for ; Mon, 19 Feb 2024 16:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708359680; cv=none; b=lGLTVIb1zXicelAndpI/rgcm9LqwEzv8fOaLr8qqvO7SsUjR3ZDsSOSfi8pJwYHt3zTXX8dsEQ6oCn4RK6iyVaPRfUZJHEogsOyIegjipJEVPQuZNoOQTK5v1P7a605RCdP9FKG7blrBJxPhit+5gf0KF3O3zJ5sMsxL/uXPt90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708359680; c=relaxed/simple; bh=gEqc7+mZIizrBsHgqf3iXtCjJRR1NKFgsluQ7BMfYkI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=i3mYI4B/VIWl1H3NTRNmFeFyMV4mdx+oRtaDEYcnwwn9nc9URV/OVVs8hGjIfPjFJZXBz0Blg5UXo9Ryb8ebIOtefw2rl5gHsPpWaSptxgmoItJw3k1eWNCfXl1REJr6SmLHLgxBZq0e/GAVn9ZvNNeOjnsdlqyVkB+ePOL3afw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=hUed3Kdu; arc=none smtp.client-ip=209.85.128.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-60495209415so42408387b3.3 for ; Mon, 19 Feb 2024 08:21:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708359677; x=1708964477; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=R2wt3HoshVyMSpGbBwuw8bsOeM4QsAyrGiOVNmA65O8=; b=hUed3KduHb81mmXzxHPrN1ZMNnt42OSPyvlxqh/elgvkNyaXgjvMJEq3UKmG2dK+F4 ym9e7hh2OakiIB/MTJWc+815GQpENfeWEiYacOqls8HqA5qVlRpSbVuiFTD7Brn+qirY XKb47LivrcvmXdMlL4A80R2VLQyi1y9YkDMr0sEA3YgNLyHw13sCfOw6MnWniAk6Aj5s Bh1UnqY5TsSE03hyMVCTAMRcGd4Uoniv2/L7g2R3MWwS0Oyuhfk/twh/XG7HgrhCrnwH qFTWYhlxu3RNl8uXNBKPaORgEzDpr6I1s1nxERE00dhO03Myh7Pbded5P6VoMcX5DaH5 ivEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708359677; x=1708964477; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R2wt3HoshVyMSpGbBwuw8bsOeM4QsAyrGiOVNmA65O8=; b=a9wTdaDRH3enzjYhRpFJCu5zTzZQkZ5EYfpIl/6vgOLoiHlp7c6O0DHByB7MoaM8lW Z+v4vOZpAG5VJ9DUm+UekvyZGgYH74cUuUjpgosX5hXrEH4TOnKKYZEWkKea0CSgTwyL gQObhwLZ+IEXwE7S5vwG5l6NhRdzb8QZWWrmyCP+xGBa7g9tE5H5HSVIT0Qo9No2PJVW gCDGKyBB5H0++ImgUpj0HLQjC0U0UttdBGfzrlXiiKxsQMkqsM5Gwc7GykhKMoaEYqRa JfL6bbOCPcOqI45KadWn35myZQDvEiINKmc0G3vdhoGbV/zMKoMnHNyPrZ7XTztQS44b 2ing== X-Forwarded-Encrypted: i=1; AJvYcCUrD2YDDLqTKcRj385ykRUpw1HAiw2j9p17TXAVHJ2Rpfo6W4TwWP+cbQANBX33uuEgT+GCVCI9Fun7GxggRGuokshU/ycxEnXBXF4I X-Gm-Message-State: AOJu0YyzzK5DFgaVXZDNx0rHiI5lAR0uRX2ApSWZZ05TC8estctwf2Db ItgFKlebSALz7B7qjynlwwYuxOiH7jwS+yoCiHAmv7xDhXZuGViOLPBsoDEwK7/Lin8NgnTjk62 tx8DVbhcRfE2WZzBE9WHGSOVKTTpqhRMLGdQWmg== X-Received: by 2002:a81:431e:0:b0:607:f785:c5b5 with SMTP id q30-20020a81431e000000b00607f785c5b5mr8604211ywa.22.1708359677335; Mon, 19 Feb 2024 08:21:17 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240219-gic-fix-child-domain-v1-1-09f8fd2d9a8f@linaro.org> <868r3g4fhv.wl-maz@kernel.org> In-Reply-To: <868r3g4fhv.wl-maz@kernel.org> From: Dmitry Baryshkov Date: Mon, 19 Feb 2024 18:21:06 +0200 Message-ID: Subject: Re: [PATCH] irqchip/gic-v3: handle DOMAIN_BUS_ANY in gic_irq_domain_select To: Marc Zyngier Cc: Thomas Gleixner , Anup Patel , Konrad Dybcio , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Mon, 19 Feb 2024 at 17:53, Marc Zyngier wrote: > > On Mon, 19 Feb 2024 14:47:37 +0000, > Dmitry Baryshkov wrote: > > > > Before the commit de1ff306dcf4 ("genirq/irqdomain: Remove the param > > count restriction from select()") the irq_find_matching_fwspec() was > > handling the DOMAIN_BUS_ANY on its own. After this commit it is a job of > > the select() callback. However the callback of GICv3 (even though it got > > modified to handle zero param_count) wasn't prepared to return true for > > DOMAIN_BUS_ANY bus_token. > > > > This breaks probing of any of the child IRQ domains, since > > platform_irqchip_probe() uses irq_find_matching_host(par_np, > > DOMAIN_BUS_ANY) to check for the presence of the parent IRQ domain. > > > > Fixes: 151378251004 ("irqchip/gic-v3: Make gic_irq_domain_select() robust for zero parameter count") > > Fixes: de1ff306dcf4 ("genirq/irqdomain: Remove the param count restriction from select()") > > Signed-off-by: Dmitry Baryshkov > > --- > > drivers/irqchip/irq-gic-v3.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c > > index 6fb276504bcc..e9e9643c653f 100644 > > --- a/drivers/irqchip/irq-gic-v3.c > > +++ b/drivers/irqchip/irq-gic-v3.c > > @@ -1696,7 +1696,8 @@ static int gic_irq_domain_select(struct irq_domain *d, > > > > /* Handle pure domain searches */ > > if (!fwspec->param_count) > > - return d->bus_token == bus_token; > > + return d->bus_token == bus_token || > > + bus_token == DOMAIN_BUS_ANY; > > > > /* If this is not DT, then we have a single domain */ > > if (!is_of_node(fwspec->fwnode)) > > > > I really dislike the look of this. If that's the case, any irqchip > that has a 'select' method (such as imx-intmux) should be similarly > hacked. And at this point, this should be handled by the core code. > > Can you try this instead? I don't have any HW that relies on > behaviour, but I'd expect this to work. > > Thanks, > > M. > > diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c > index aeb41655d6de..3dd1c871e091 100644 > --- a/kernel/irq/irqdomain.c > +++ b/kernel/irq/irqdomain.c > @@ -449,7 +449,7 @@ struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec, > */ > mutex_lock(&irq_domain_mutex); > list_for_each_entry(h, &irq_domain_list, link) { > - if (h->ops->select) > + if (h->ops->select && bus_token != DOMAIN_BUS_ANY) > rc = h->ops->select(h, fwspec, bus_token); > else if (h->ops->match) > rc = h->ops->match(h, to_of_node(fwnode), bus_token); This works. But I wonder if the following change is even better. WDYT? diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index aeb41655d6de..2f0d2700709e 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -449,14 +449,17 @@ struct irq_domain *irq_find_matching_fwspec(struct irq_fwspec *fwspec, */ mutex_lock(&irq_domain_mutex); list_for_each_entry(h, &irq_domain_list, link) { - if (h->ops->select) + if (fwnode != NULL && + h->fwnode == fwnode && + bus_token == DOMAIN_BUS_ANY) + rc = true; + else if (h->ops->select) rc = h->ops->select(h, fwspec, bus_token); else if (h->ops->match) rc = h->ops->match(h, to_of_node(fwnode), bus_token); else rc = ((fwnode != NULL) && (h->fwnode == fwnode) && - ((bus_token == DOMAIN_BUS_ANY) || - (h->bus_token == bus_token))); + (h->bus_token == bus_token)); if (rc) { found = h; -- With best wishes Dmitry