Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1341650pxb; Thu, 16 Sep 2021 05:34:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzD93fNaNIYYrE5VpabW+L1reydnzbAsyWP3ktCTtPXxePBPGA+JevpIm2KHH22xSAu03jU X-Received: by 2002:a5e:8416:: with SMTP id h22mr4104456ioj.205.1631795643557; Thu, 16 Sep 2021 05:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631795643; cv=none; d=google.com; s=arc-20160816; b=BSXVk0+iH//DvPKiB398TU3JfKNmNNngrY6gtZ9h3yB7PjAqWEWkp1UMtj5OHYoP4z bi3hEvhSyIircMjIrHZCsL0VC5ZCioPwmPAMB1amrW6A5H7FwTKdC9Mvqm44gvfHxP4o cqYAKyg47bD5IWfba2yQdUcei3128LEegGVHa9R7el/C22vDNcgJgGmuKV4zZCTgv3d5 DLDY/XnypFOu6PdplB1+Vt0/uj5EVyJIqWOqSsOjM88s1rW9ei79RC2+dmFK3b/PjPib JzEIb/UqFTBXakzmlr6x1LdaE5LVgBtpzTcq7fED7TR3y1BS9zW/XTAk1DT4O0NboUE7 NXbg== 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 :message-id:date:subject:cc:to:from; bh=9erIVj6FEwDlRH+0TqJi8nRVW6V+kmXPDhYh6EmeDr8=; b=EQKI4b4nHsPsmwzWvDEqqlnqiy99Ba4XCG+cC1AvY6HJtyn2k4uohFETgojTMrBonS Yr29dlelKaMSH8YA/IQklufM5IX6wwozhlro37LIgAmCMwKX6LB4nhak7Nh9yjSGfM6D o97lswpht65skSncCtIpEUo4Vp4xYDRsaj9ioMWXX7YcrJjnrVo0QsmMiX5G17CbzDaZ ++Zq0JtJ1Fnhp0n6zG/WPO17Z/FnbnqN28arXFjQDtwDpH4vW5ka5hLTFZmCTkYZJWKi 0hpO/HuLKF7pv0ys2QJq93IOY1MDhK5j9eWwCy7T/A1+MQD/Mgat1kJwKA4xrD5dre7F 7+UQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q2si2485144jac.2.2021.09.16.05.33.50; Thu, 16 Sep 2021 05:34:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239495AbhIPMeC (ORCPT + 99 others); Thu, 16 Sep 2021 08:34:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:38678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239370AbhIPMeB (ORCPT ); Thu, 16 Sep 2021 08:34:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 753E360231; Thu, 16 Sep 2021 12:32:39 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V5 00/10] irqchip: Add LoongArch-related irqchip drivers Date: Thu, 16 Sep 2021 20:31:28 +0800 Message-Id: <20210916123138.3490474-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). 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). 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). Legacy IRQ model: 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. +---------------------------------------------+ | | | +-----+ +---------+ +-------+ | | | IPI | --> | CPUINTC | <-- | Timer | | | +-----+ +---------+ +-------+ | | ^ | | | | | +---------+ +-------+ | | | LIOINTC | <-- | UARTs | | | +---------+ +-------+ | | ^ | | | | | +-----------+ | | | HTVECINTC | | | +-----------+ | | ^ ^ | | | | | | +---------+ +---------+ | | | PCH-PIC | | PCH-MSI | | | +---------+ +---------+ | | ^ ^ ^ | | | | | | | +---------+ +---------+ +---------+ | | | PCH-LPC | | Devices | | Devices | | | +---------+ +---------+ +---------+ | | ^ | | | | | +---------+ | | | Devices | | | +---------+ | | | | | +---------------------------------------------+ Extended IRQ model: 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. +--------------------------------------------------------+ | | | +-----+ +---------+ +-------+ | | | IPI | --> | CPUINTC | <-- | Timer | | | +-----+ +---------+ +-------+ | | ^ ^ | | | | | | +---------+ +---------+ +-------+ | | | EIOINTC | | LIOINTC | <-- | UARTs | | | +---------+ +---------+ +-------+ | | ^ ^ | | | | | | +---------+ +---------+ | | | PCH-PIC | | PCH-MSI | | | +---------+ +---------+ | | ^ ^ ^ | | | | | | | +---------+ +---------+ +---------+ | | | PCH-LPC | | Devices | | Devices | | | +---------+ +---------+ +---------+ | | ^ | | | | | +---------+ | | | Devices | | | +---------+ | | | | | +--------------------------------------------------------+ 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 Cross-compile tool chain to build kernel: https://github.com/loongson/build-tools/releases Loongson and LoongArch documentations: https://github.com/loongson/LoongArch-Documentation LoongArch-specific interrupt controllers: https://mantis.uefi.org/mantis/view.php?id=2203 V1 -> V2: 1, Remove queued patches; 2, Move common logic of DT/ACPI probing to common functions; 3, Split .suspend()/.resume() functions to separate patches. V2 -> V3: 1, Fix a bug for loongson-pch-pic probe; 2, Some minor improvements for LPC controller. V3 -> V4: 1, Rework the CPU interrupt controller driver; 2, Some minor improvements for other controllers. V4 -> V5: 1, Add a description of LoonArch's IRQ model; 2, Support multiple EIOINTCs in one system; 3, Some minor improvements for other controllers. Huacai Chen: irqchip: Adjust Kconfig for Loongson. irqchip/loongson-pch-pic: Add ACPI init support. irqchip/loongson-pch-pic: Add suspend/resume support. irqchip/loongson-pch-msi: Add ACPI init support. irqchip/loongson-htvec: Add ACPI init support. irqchip/loongson-htvec: Add suspend/resume support. irqchip/loongson-liointc: Add ACPI init support. irqchip: Add LoongArch CPU interrupt controller support. irqchip: Add Loongson Extended I/O interrupt controller. irqchip: Add Loongson PCH LPC controller support. Signed-off-by: Huacai Chen --- drivers/irqchip/Kconfig | 37 +++- drivers/irqchip/Makefile | 3 + drivers/irqchip/irq-loongarch-cpu.c | 89 +++++++++ drivers/irqchip/irq-loongson-eiointc.c | 331 +++++++++++++++++++++++++++++++++ drivers/irqchip/irq-loongson-htvec.c | 142 ++++++++++---- drivers/irqchip/irq-loongson-liointc.c | 198 ++++++++++++-------- drivers/irqchip/irq-loongson-pch-lpc.c | 203 ++++++++++++++++++++ drivers/irqchip/irq-loongson-pch-msi.c | 119 +++++++----- drivers/irqchip/irq-loongson-pch-pic.c | 152 ++++++++++++--- include/linux/cpuhotplug.h | 1 + 10 files changed, 1087 insertions(+), 188 deletions(-) create mode 100644 drivers/irqchip/irq-loongarch-cpu.c create mode 100644 drivers/irqchip/irq-loongson-eiointc.c create mode 100644 drivers/irqchip/irq-loongson-pch-lpc.c -- 2.27.0