Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4730592iob; Sun, 8 May 2022 23:33:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy25NXOVz9kHPebG6TDrV9c2DGqF9kZ6Q5MJ9bzYD6K2ACg2+XKml0SKzwSEg+fO72EvwE2 X-Received: by 2002:a63:4e66:0:b0:3c5:74b2:4815 with SMTP id o38-20020a634e66000000b003c574b24815mr12317770pgl.514.1652077986585; Sun, 08 May 2022 23:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652077986; cv=none; d=google.com; s=arc-20160816; b=P6Qp95PRf96VTmzOJfhfqyYHzbV5sp2gqSlUcm7Kw9asKPSO3V4sSyEgkMNLlb1U68 3nNxRcv3cs/GPLacVB7n21M1cUmD8Ogd8xwiaKIinEMwLBsDn8nwyezL4vkA7b2g1tiZ ptAzLnO6PywsaFwaZMS58Zd1bQEMOAEoRtqJWiFqJ38KRYu6gc3VlDtJtgMN3YXkPaAg BjaD62UM42fStBvxgR6pPw4GPx/HgokBoUSgYvqLBBeiBG2pxDBV3LPglc1X2H7DtguG Va1Mr5FDEi9ZDSk5aq/C1QLahBPqOq4mtDUQ/SqeKCfV+uz/NUNiA9JL7L0VnbEI4XC+ qDgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=01ooDg0/xv+bMS156A46slLyZkOLTZUuJqe4aCOEfqY=; b=rScJBP0fkblJXPs8DwxagDr+BXP+VBuJmrbRLwoZh9N+g5ajagcWkRE94GSlDrK5wN HXaB2tlA5e3I1XQWY/z8fNFglLMLspTsXaOLeETTcj65bxEVYnW/9HLr5aCBH3qiEpKW T86UzhNt85P3J2uCAB5assVzQjrUzU4QfiwGku4NKcrlpPZMOEQl6uCJ8dA5T99UQpX+ zfnRDp3DvgO0g9IuJenxWkq2zl55oW+OGKHaupojkAvgh45K6YYi7/j1USUJRW8lXzt1 mb9hdAVyUPQEvdwHSzSE/E+Cm/LWrNXo6vKVf4ZAyKTg13kf+lJYvv6hjEu9/nInyG3u ghYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qCOIjxLr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d23-20020a170902729700b0015ea7c9454bsi10028555pll.572.2022.05.08.23.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 23:33:06 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qCOIjxLr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 116221882D5; Sun, 8 May 2022 23:29:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381100AbiEEQCM (ORCPT + 99 others); Thu, 5 May 2022 12:02:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381514AbiEEQCD (ORCPT ); Thu, 5 May 2022 12:02:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A35755C37F for ; Thu, 5 May 2022 08:58:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 36457B82DFA for ; Thu, 5 May 2022 15:58:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAF60C385A8; Thu, 5 May 2022 15:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651766299; bh=5pUfo2MyeSPtQlJ6/Seg5OB6Y7gWeAVpaImnzVekwvc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qCOIjxLrxR8fGHFTm4B3UA9kitJgBgejRGVpD5ZP/WLMibAbyhozR2f5Gx5XchTNl 6PaNZRUtazu/gNgZru6M4ddDHFKV2jE8D9DWpGPXx+OhK3J6NpGifD5stPzs+8SC/S Il62+gHhnmTmi7leLmnWLn34n4i//ai5x4sBHoOomhSAcOR/7ehCAlx5xY/anNjuW4 ToQtK5PQ2MGcJgapwRrc6Vys6ioywEcfvhaKQOdkylt5jaSKsR1d3cfBWVwRqqhqgp VecqW+ZFA7T6HYD2WKYa+//iiCR0Am1TLRzUa/VMw2gQN7Bi/logg5eh57Xh5MjbtW uzcVJ+ryMAREw== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nmdrt-009FcK-6H; Thu, 05 May 2022 16:58:17 +0100 Date: Thu, 05 May 2022 16:58:17 +0100 Message-ID: <87v8uk6kfa.wl-maz@kernel.org> From: Marc Zyngier To: Huacai Chen Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang Subject: Re: [PATCH V11 00/10] irqchip: Add LoongArch-related irqchip drivers In-Reply-To: <20220430085344.3127346-1-chenhuacai@loongson.cn> References: <20220430085344.3127346-1-chenhuacai@loongson.cn> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: chenhuacai@loongson.cn, tglx@linutronix.de, linux-kernel@vger.kernel.org, lixuefeng@loongson.cn, chenhuacai@gmail.com, jiaxun.yang@flygoat.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 30 Apr 2022 09:53:34 +0100, Huacai Chen wrote: >=20 > LoongArch is a new RISC ISA, which is a bit like MIPS or RISC-V. > LoongArch includes a reduced 32-bit version (LA32R), a standard 32-bit > version (LA32S) and a 64-bit version (LA64). LoongArch use ACPI as its > boot protocol LoongArch-specific interrupt controllers (similar to APIC) > are already added in the next revision of ACPI Specification (current > revision is 6.4). >=20 > Currently, LoongArch based processors (e.g. Loongson-3A5000) can only > work together with LS7A chipsets. The irq chips in LoongArch computers > include CPUINTC (CPU Core Interrupt Controller), LIOINTC (Legacy I/O > Interrupt Controller), EIOINTC (Extended I/O Interrupt Controller), > HTVECINTC (Hyper-Transport Vector Interrupt Controller), PCH-PIC (Main > Interrupt Controller in LS7A chipset), PCH-LPC (LPC Interrupt Controller > in LS7A chipset) and PCH-MSI (MSI Interrupt Controller). >=20 > CPUINTC is a per-core controller (in CPU), LIOINTC/EIOINTC/HTVECINTC are > per-package controllers (in CPU), while PCH-PIC/PCH-LPC/PCH-MSI are all > controllers out of CPU (i.e., in chipsets). These controllers (in other > words, irqchips) are linked in a hierarchy, and there are two models of > hierarchy (legacy model and extended model). >=20 > Legacy IRQ model: >=20 > In this model, the IPI (Inter-Processor Interrupt) and CPU Local Timer > interrupt go to CPUINTC directly, CPU UARTS interrupts go to LIOINTC, > while all other devices interrupts go to PCH-PIC/PCH-LPC/PCH-MSI and > gathered by HTVECINTC, and then go to LIOINTC, and then CPUINTC. >=20 > +---------------------------------------------+ > | | > | +-----+ +---------+ +-------+ | > | | IPI | --> | CPUINTC | <-- | Timer | | > | +-----+ +---------+ +-------+ | > | ^ | > | | | > | +---------+ +-------+ | > | | LIOINTC | <-- | UARTs | | > | +---------+ +-------+ | > | ^ | > | | | > | +-----------+ | > | | HTVECINTC | | > | +-----------+ | > | ^ ^ | > | | | | > | +---------+ +---------+ | > | | PCH-PIC | | PCH-MSI | | > | +---------+ +---------+ | > | ^ ^ ^ | > | | | | | > | +---------+ +---------+ +---------+ | > | | PCH-LPC | | Devices | | Devices | | > | +---------+ +---------+ +---------+ | > | ^ | > | | | > | +---------+ | > | | Devices | | > | +---------+ | > | | > | | > +---------------------------------------------+ >=20 > Extended IRQ model: >=20 > In this model, the IPI (Inter-Processor Interrupt) and CPU Local Timer > interrupt go to CPUINTC directly, CPU UARTS interrupts go to LIOINTC, > while all other devices interrupts go to PCH-PIC/PCH-LPC/PCH-MSI and > gathered by EIOINTC, and then go to to CPUINTC directly. >=20 > +--------------------------------------------------------+ > | | > | +-----+ +---------+ +-------+ | > | | IPI | --> | CPUINTC | <-- | Timer | | > | +-----+ +---------+ +-------+ | > | ^ ^ | > | | | | > | +---------+ +---------+ +-------+ | > | | EIOINTC | | LIOINTC | <-- | UARTs | | > | +---------+ +---------+ +-------+ | > | ^ ^ | > | | | | > | +---------+ +---------+ | > | | PCH-PIC | | PCH-MSI | | > | +---------+ +---------+ | > | ^ ^ ^ | > | | | | | > | +---------+ +---------+ +---------+ | > | | PCH-LPC | | Devices | | Devices | | > | +---------+ +---------+ +---------+ | > | ^ | > | | | > | +---------+ | > | | Devices | | > | +---------+ | > | | > | | > +--------------------------------------------------------+ >=20 > This patchset adds some irqchip drivers for LoongArch, it is preparing > to add LoongArch support in mainline kernel, we can see a snapshot here: > https://github.com/loongson/linux/tree/loongarch-next >=20 > Cross-compile tool chain to build kernel: > https://github.com/loongson/build-tools/releases/latest/download/loongarc= h64-clfs-20211202-cross-tools.tar.xz >=20 > A CLFS-based Linux distro: > https://github.com/loongson/build-tools/releases/latest/download/loongarc= h64-clfs-system-2021-12-02.tar.bz2 >=20 > Loongson and LoongArch documentations: > https://github.com/loongson/LoongArch-Documentation >=20 > LoongArch-specific interrupt controllers: > https://mantis.uefi.org/mantis/view.php?id=3D2203 Nothing to see here, unfortunately (you need a login to access this information). >=20 > LoongArch use ACPI, but ACPI tables cannot describe the hierarchy of > irqchips, so we initilize the irqchip subsystem in this way (from arch > code): >=20 > cpu_domain =3D loongarch_cpu_irq_init(); > liointc_domain =3D liointc_acpi_init(cpu_domain, acpi_liointc); > eiointc_domain =3D eiointc_acpi_init(cpu_domain, acpi_eiointc); > pch_pic_domain =3D pch_pic_acpi_init(eiointc_domain, acpi_pchpic); > pch_msi_domain =3D pch_msi_acpi_init(eiointc_domain, acpi_pchmsi); I said no to this in the past, and I'm going to reiterate: this is *not* acceptable. This obviously doesn't scale and isn't manageable in the long run. Hardcoding the topology and the probing order in the kernel code has repeatedly proved to be a disaster, and yet you refuse to take any input from past experience. This is pretty worrying. > > Upstream irqchip init function return an irqdomain, and this domain > will be used by downstream irqchips as their parent domains. For more > infomation please refer: > https://lore.kernel.org/linux-arch/20210927064300.624279-11-chenhuacai@lo= ongson.cn/T/#u >=20 > Q: Why we don't declare irqchips in ACPI DSDT where hierarchy is possible? > A: This is answered in V8 of this series as below: >=20 > - There are several kinds of irq chips(e.g. pchpic=E3=80=81eiointc=E3= =80=81cpuintc) > for LoongArch. SCI interrupt (Fixed hardware is implemented for > LoongArch in pch such as LS7A1000, and SCI interrupt is used for fixed > event handling.) is an irq input of pch irq chip which routes > interrupts to cpu as following irq chips path: >=20 > sci interrupt->|pchpic| ->|eiointc|->|cpuintc| >=20 > sci_interrupt will be transferred from gsi to irq through > acpi_gsi_to_irq in acpi_enable_subsystem called from acpi_bus_init > before acpi_scan_init where acpi device namespace is created, so we > should build pch irq domain and related upstream irq domains before > acpi_bus_init. >=20 > - PCI bus enumeration is executed from acpi_scan_init, and > pci_set_msi_domain will be called for setting msi_domain of enumerated > pci device. In pci_set_msi_domain, msi domain may be got through > pcibios_device_add, fdt, iort(used for arm64) or inheriting from host > bridge domain. And in each way, the msi domain needs to be found by > calling irq_find_matching_fwnode(fwnode, DOMAIN_BUS_PCI_MSI) to match > one from the registered msi domain before. So we build the msi domain > as x86 and arm64 before acpi_scan_init. The msi domain is hierarchic > as following: >=20 > msi interrupt->|msipic| ->|eiointc|->|cpuintc| >=20 > - Yes, a driver can be deferred probed when get -EPROBE_DEFER on > probing, but both sci interrupt transfer and pci bus enumeration are > common code (not private driver for LoongArch). >=20 > So, declaring pic devices in DSDT for seems not suitable, we can only > select the X86-like way which is a bit ugly. ACPI *can* describe these topologies if you teach it. ARM managed to do it with IORT, which is part of the ACPI specification. Given that you are starting from scratch and that your bindings aren't even in the official ACPI spec, there is zero reason not to do the right thing. Until then, I'm not interested in reviewing more of these patches. Thanks, M. --=20 Without deviation from the norm, progress is not possible.