Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp589811ybb; Wed, 25 Mar 2020 06:00:36 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuaPeskd35ReYfNUg0u98b5iAPig8w6nGCCoRg4mhvf0Mc9t2s6wJdfph8vJyWsvvAtZjK6 X-Received: by 2002:a9d:355:: with SMTP id 79mr2204203otv.174.1585141235829; Wed, 25 Mar 2020 06:00:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585141235; cv=none; d=google.com; s=arc-20160816; b=fDCe0Ce3Ys8+PoRFI0MSNEStmodbj4dyi/WPLCRTICB7CVZoBoZInwGtAAzjD5M2uo QBJg1tFu2EHTOqZZruByAWqp0s7Yjs4VzH60stLL1z0Zh+QLJjuApGMbhBZ23qWMToD3 s2rI80J6Ty7tRrCAhRMytcZpXcK1fkXpCAhJl3S7xU9URf2epl+w6jePIG54hmVZtBEw mXSqt56f/TFUJH9yFUZjH/RvObHhy0N0WUV7mHypBYJpKwmcnbvWCCK6r03tRthacLVm CvTTFWGKEKbi0vjDzyrlz1Dbw10ECSudFpcVzvR+X++Va3ttzuhTEeTPzylX0c4FcIR8 fE7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=ULl3k9Ezbc/CEb88s+3tmXgx/MgvLUGWQ79asuWOIfk=; b=tZ36w09iUiyILkeyNNJE4rrRaBiKCKcXBD3TkjesSbcF9vEv764o3OD1XbdOQc/skW QMFxUeWUs8vp0deo43f7qqaGWItcTRXYvHv081kqWfn2LHR6gfhJS9ADui6pYQOYgADx vhoC/9V/p2I0eP9qH9Tubsde4MhcwQdMx6k6CvPFeZg959/0f1TvtXi3LakP317ma/hr Pa6k6FIMa4PX61aOCod/AJWt7zWpkbrJQlg31wnBHuF/UKYUnOw10yKVsOPGI7PZfB3k N3KUM/WPaJGgC+n+fPvDszommk/mx9QbDVLVqj/LHv5Ow/72aPOjYaligUPASMWso01M rluQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QxNckFLW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t144si10095489oie.129.2020.03.25.06.00.20; Wed, 25 Mar 2020 06:00:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QxNckFLW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727313AbgCYNAE (ORCPT + 99 others); Wed, 25 Mar 2020 09:00:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:44724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726969AbgCYNAE (ORCPT ); Wed, 25 Mar 2020 09:00:04 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9DC2F20772; Wed, 25 Mar 2020 13:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585141203; bh=10BVdmjEkYczxJmcDOG7xNE1dub7UU7afSw9H9CUwv4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QxNckFLWO2LCHbcpQ3NdtWPb9OqvbBXtFecC8lVDZMVbCRhf0mctSW7xZwmrDjA+X VwhdY0C+g0se/lzW0MkO7XkEJY6soI8NMfGX7oeJ2fRJ0+aUcNW4iD8sIBh72sSBUe 6XgF903X3IivBNH7TyM4JERsSb20cnYlIH0+UntA= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jH5dZ-00FZbV-Ma; Wed, 25 Mar 2020 13:00:01 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 25 Mar 2020 13:00:01 +0000 From: Marc Zyngier To: Thomas Bogendoerfer Cc: Jiaxun Yang , linux-mips@vger.kernel.org, Huacai Chen , Thomas Gleixner , Jason Cooper , Rob Herring , Mark Rutland , Mauro Carvalho Chehab , "David S. Miller" , Greg Kroah-Hartman , Jonathan Cameron , Andy Shevchenko , Allison Randal , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v8 06/11] irqchip: mips-cpu: Convert to simple domain In-Reply-To: <20200325123742.GA9911@alpha.franken.de> References: <20200325035537.156911-1-jiaxun.yang@flygoat.com> <20200325035537.156911-7-jiaxun.yang@flygoat.com> <20200325123742.GA9911@alpha.franken.de> Message-ID: X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: tsbogend@alpha.franken.de, jiaxun.yang@flygoat.com, linux-mips@vger.kernel.org, chenhc@lemote.com, tglx@linutronix.de, jason@lakedaemon.net, robh+dt@kernel.org, mark.rutland@arm.com, mchehab+samsung@kernel.org, davem@davemloft.net, gregkh@linuxfoundation.org, Jonathan.Cameron@huawei.com, andriy.shevchenko@linux.intel.com, allison@lohutok.net, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-03-25 12:37, Thomas Bogendoerfer wrote: > On Wed, Mar 25, 2020 at 11:54:59AM +0800, Jiaxun Yang wrote: >> The old code is using legacy domain to setup irq_domain for CPU >> interrupts >> which requires irq_desc to be preallocated. >> >> However, when MIPS_CPU_IRQ_BASE >= 16, irq_desc for CPU IRQs may end >> up >> unallocated and lead to incorrect behavior. >> >> Thus we convert the legacy domain to simple domain which can allocate >> irq_desc during initialization. >> >> Signed-off-by: Jiaxun Yang >> Co-developed-by: Huacai Chen >> Signed-off-by: Huacai Chen >> Reviewed-by: Marc Zyngier >> --- >> drivers/irqchip/irq-mips-cpu.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/irqchip/irq-mips-cpu.c >> b/drivers/irqchip/irq-mips-cpu.c >> index 95d4fd8f7a96..c3cf7fa76424 100644 >> --- a/drivers/irqchip/irq-mips-cpu.c >> +++ b/drivers/irqchip/irq-mips-cpu.c >> @@ -251,7 +251,7 @@ static void __init __mips_cpu_irq_init(struct >> device_node *of_node) >> clear_c0_status(ST0_IM); >> clear_c0_cause(CAUSEF_IP); >> >> - irq_domain = irq_domain_add_legacy(of_node, 8, MIPS_CPU_IRQ_BASE, 0, >> + irq_domain = irq_domain_add_simple(of_node, 8, MIPS_CPU_IRQ_BASE, >> &mips_cpu_intc_irq_domain_ops, >> NULL); > > this breaks at least IP30 and guess it will break every platform where > MIPS_CPU_IRQ_BASE == 0. add_legacy will always do > irq_domain_associate_many(), > while add_simple doesn't do it, if first_irq == 0. > > Marc, what is the reason not doing it all the time ? What's the correct > way here to work with irq_domain_add_simple() in this case ? On a fully DT-ified platform, using non-legacy irqdomains, virtual interrupts are allocated as a "random" number, depending on the order of allocation, and on demand. The first_irq hack in irq_domain_add_simple() is just a way to still allocate descriptors upfront (and I wish we could drop it...). If you have legacy code that "knows" about the relationship between Linux's virtual interrupt and the hwirq (that is only meaningful to the interrupt controller), you're screwed, and need to stick to the legacy irqdomain. It feels like the MIPS code is squarely in the latter case, so I guess this patch is probably the wrong thing to do for this architecture. Thanks, M. -- Jazz is not dead. It just smells funny...