From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BC110C3DA4A for ; Fri, 16 Aug 2024 11:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BpxzkK3UKTxghQc+n3gc+K3CuWVs47t1vTAqsGCdLNg=; b=GX5aLsysqheXQL3nFYMEUlk6eO 9NxjtxLxQd2DwmrdLLtqM61ch4HVvbpvub3DgADf0bk5L835rgYmakRO1RmZLoqdApQzx85Kq4MVJ EVyrxVD0kBoahZrUhn/yMVtiSJM325OcfKc3dDZGxv3i+i9BWW7Vr0bA++k+ozYXsL2Tg/YgKwjTE D93kdzxe2yqnTicHxGWhjpP68a+mrhMuNEL+gSxKbvbRxT7hIzP33q7V15PYVJVoqzPbBj73Bw3V1 BPD/8EU4jsblQidqiM8/sYxCXOhlL13cJMJCfp5fLM0ITPsYuTA9Yge1WuwxjXdwEc3F+aNE33ii6 Gq24sD4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sevKc-0000000CmmO-44WY; Fri, 16 Aug 2024 11:41:22 +0000 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sevJx-0000000Cmg5-1JQ8 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 11:40:42 +0000 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2f16d2f2b68so27616661fa.3 for ; Fri, 16 Aug 2024 04:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1723808439; x=1724413239; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=BpxzkK3UKTxghQc+n3gc+K3CuWVs47t1vTAqsGCdLNg=; b=DcwPEZN5U+0mhEUYI2DYEO6fzE/oMa6YfPklrWNGGXGY9Fa0cXVQJMUKo78oeb1a4T 6xQlaD0tFW+coE4GOg9wyTP+nsp+Wjg+hAkBKfvpUn5TT+DP+5g+YwOUVuO34ajzF9N7 CcKi7EZ4UdrKHt7iwnp338OH3dT1dBiaBR1i0wPhvNmJ/m7yl6C2YzT7T823Op77zSMW UDHVD6oUYlqLQkXUzy4CV6uTR5EwsdriKUCJfD/UqG+EbRVgNesuOhwv5HlwX7gbD/YY MbFPFPUc6OT2+w6QEC16U2FrqRZaScwZqBl7Moz4X23V49ePowGoLt5IeRTKUWQb92ra 7g9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723808439; x=1724413239; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BpxzkK3UKTxghQc+n3gc+K3CuWVs47t1vTAqsGCdLNg=; b=VYNHakzxlIj0AEu7axa5ZjatV67627ROk1k77B+9OIeEkrPLi58cWNHVJqTW31U0b8 tZEQIjrCyDw63yddqZRn3v0+cR+dxGZRS8AK4TtEZgt37vkoyqijPYOiIMEunhAqOvlK nq2IO7fEemhHI7yhjCRrHjNh20gqAyKRPtIAinkJZ7I0tKIdb2hol0DlOm/Dlw/bWAry /N4H98Zk9+hWTkJPcpEtaSzCoq5+A2/xeyf90/D7ea/yG25sdwWQu5D2DsigmxgviZNV IxpYyRiq1X08Nn3EiRw7H0RTASXQ1nnkh9jl+V33cwQsHJgFe8c7UJppJtr5JVABIFkG qIVQ== X-Forwarded-Encrypted: i=1; AJvYcCUuQ6po4NpJSmt459Ryc9OUcAvUArxPZTlXOUkY996vuBAhf0rXvm7tpVgsWEdaZ22rqvusB6ZSLBVj+2A12y8CEtQqMkusdXQh2QnckETum0Payyg= X-Gm-Message-State: AOJu0Yzj8D3aquLDJc+Qt9jRI7vXu+eP+WTIbgbrK9kBlu4JyzWnzBgi 9tY/cyt3eS/jGnqJTs7HhlqRUjGgnIMJb3vUVaT4SWCdR9J8TFb7yRev/ZkvmBQ= X-Google-Smtp-Source: AGHT+IFK0XlavC2ASBQwNlu5VWovN1G7tk/Vc3gjrKwPR0rZkWiyoOFZOREKvMWyOZrRdt5yv7L0VQ== X-Received: by 2002:a2e:3809:0:b0:2f0:27da:6864 with SMTP id 38308e7fff4ca-2f3be5851b4mr21142821fa.17.1723808438254; Fri, 16 Aug 2024 04:40:38 -0700 (PDT) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a838393560bsm241591966b.139.2024.08.16.04.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 04:40:37 -0700 (PDT) Date: Fri, 16 Aug 2024 13:40:36 +0200 From: Andrew Jones To: Anup Patel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, maz@kernel.org, mark.rutland@arm.com, robh@kernel.org, saravanak@google.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, Anup Patel Subject: Re: [PATCH] of/irq: Support #msi-cells=<0> in of_msi_get_domain Message-ID: <20240816-e5563ca888e15bb00e2652ab@orel> References: <20240816095520.96348-2-ajones@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_044041_359493_9CA5440F X-CRM114-Status: GOOD ( 31.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 16, 2024 at 04:14:52PM GMT, Anup Patel wrote: > On Fri, Aug 16, 2024 at 3:25 PM Andrew Jones wrote: > > > > An 'msi-parent' property with a single entry and no accompanying > > '#msi-cells' property is considered the legacy definition as opposed > > to its definition after being expanded with commit 126b16e2ad98 > > ("Docs: dt: add generic MSI bindings"). However, the legacy > > definition is completely compatible with the current definition and, > > since of_phandle_iterator_next() tolerates missing and present-but- > > zero *cells properties since commit e42ee61017f5 ("of: Let > > of_for_each_phandle fallback to non-negative cell_count"), there's no > > need anymore to special case the legacy definition in > > of_msi_get_domain(). > > > > Indeed, special casing has turned out to be harmful, because, as of > > commit 7c025238b47a ("dt-bindings: irqchip: Describe the IMX MU block > > as a MSI controller"), MSI controller DT bindings have started > > specifying '#msi-cells' as a required property (even when the value > > must be zero) as an effort to make the bindings more explicit. But, > > since the special casing of 'msi-parent' only uses the existence of > > '#msi-cells' for its heuristic, and not whether or not it's also > > nonzero, the legacy path is not taken. Furthermore, the path to > > support the new, broader definition isn't taken either since that > > path has been restricted to the platform-msi bus. > > > > But, neither the definition of 'msi-parent' nor the definition of > > '#msi-cells' is platform-msi-specific (the platform-msi bus was just > > the first bus that needed '#msi-cells'), so remove both the special > > casing and the restriction. This not only simplifies the code but > > also resolves an issue with PCI devices finding their MSI controllers > > on riscv, as the riscv,imsics binding requires '#msi-cells=<0>'. > > > > Signed-off-by: Andrew Jones > > --- > > drivers/of/irq.c | 37 +++++++++++-------------------------- > > 1 file changed, 11 insertions(+), 26 deletions(-) > > > > diff --git a/drivers/of/irq.c b/drivers/of/irq.c > > index c94203ce65bb..026b52c8ee63 100644 > > --- a/drivers/of/irq.c > > +++ b/drivers/of/irq.c > > @@ -709,8 +709,7 @@ struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 id, > > * @np: device node for @dev > > * @token: bus type for this domain > > * > > - * Parse the msi-parent property (both the simple and the complex > > - * versions), and returns the corresponding MSI domain. > > + * Parse the msi-parent property and returns the corresponding MSI domain. > > * > > * Returns: the MSI domain for this device (or NULL on failure). > > */ > > @@ -718,33 +717,19 @@ struct irq_domain *of_msi_get_domain(struct device *dev, > > struct device_node *np, > > enum irq_domain_bus_token token) > > { > > - struct device_node *msi_np; > > + struct of_phandle_args args; > > struct irq_domain *d; > > + int index = 0; > > > > - /* Check for a single msi-parent property */ > > - msi_np = of_parse_phandle(np, "msi-parent", 0); > > - if (msi_np && !of_property_read_bool(msi_np, "#msi-cells")) { > > - d = irq_find_matching_host(msi_np, token); > > - if (!d) > > - of_node_put(msi_np); > > - return d; > > - } > > Dropping this special case of single msi-parent property breaks > RISC-V KVM guest created using KVMTOOl with AIA available > on the host. Ouch. This is a paperbag moment as I can easily reproduce that. > > Let's not drop this special case. I'll work out a [much better tested] v2 now. Thanks, drew