Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5290944rdb; Wed, 13 Dec 2023 04:53:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFPhlH754dfpAyNDM3qvY4QGgU1bpWpppw1Rlty+CzIC/WhNiPEMd1Tl7Rl6GCgoC3r0Kd X-Received: by 2002:a17:902:e5ce:b0:1d3:2a94:cb46 with SMTP id u14-20020a170902e5ce00b001d32a94cb46mr3079270plf.31.1702472005268; Wed, 13 Dec 2023 04:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702472005; cv=none; d=google.com; s=arc-20160816; b=VlEQNiTPQUuimupTQiwqBwnduh006To5OMR96OQ7tL8d56hpZcKVFJK0P8b5naenNs ekpVimYhZNHB/ha74xNHhUEsg5q6GwvjFWYJkBa2dknjTTUTzRG6aI7VQ0FG/Ky6q8bK B5wDJ7hnctzKeD6YvJPwbPrkxPyQKtLQJ7YIyND+Yj9TPv32DxubXkfzX8Gokr/ylU6w jDQznAkRn3ipd5tePiCJR3MfGjOzWzko9MSwRcu/twlEvDMmySOkbliny+dx3fzOtSIS QgsNG0+LbZBeNhD4ElEbWjqKWuQwWjgEcRXPnbfs5LDcz4LRFH4WT0EBx1FsHobnau7X TCUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=toielIZHns+JJqGdwW2Er+9+wyZ/FNy7YC4xlMkof/0=; fh=YWIBRcP8cdLYR894sEToaan3lN1VSUITe+B678IO0WY=; b=pXMgo/QAMh0dM034gF3E99whfanjN/kq4yVoTVIa9EcjIbVzTNnNAn6CaJNB1yYRbe I19o+K6eVESWc2414PwywVY9mcd206TdtSjtGagJ/rRbOCru/8DcZWCjr7xY4hFN0mTf kmS/ZPW1N+zs43U3u2OiDnnDVPg4gn2Taf9MFpnXl+HZHLZaPqxAaoTEPW++FmUBaj1S ijXWemXdVhLAcl7MMo7BJoqtDvOjN6ST948y92uDjwgTyZ3ePc23eXRfQwrqeRbwjbCi oBKLYALdU+OZYT+oIL9gcN24FDo8kwa5w7t+t8D4Re81BvjhKX3A/eZaT/u3or/2X+RN +F5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=FuF1YeT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k9-20020a170902c40900b001d0bcb62f98si10037727plk.368.2023.12.13.04.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 04:53:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=FuF1YeT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 445A9803A53A; Wed, 13 Dec 2023 04:53:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379074AbjLMMvT (ORCPT + 99 others); Wed, 13 Dec 2023 07:51:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379161AbjLMMus (ORCPT ); Wed, 13 Dec 2023 07:50:48 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1C6B112; Wed, 13 Dec 2023 04:50:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=toielIZHns+JJqGdwW2Er+9+wyZ/FNy7YC4xlMkof/0=; b=FuF1YeT++Jin3KgRrWcSzJupOG 0HOKnlnAn4rO5PAD2r+eXKtzTLzlJ4inML+s5IXIlItQJWuhjlEz05y1hwOH9KgLBRkHUkaSj+FPh bBjtvh7/mb6icsbs5fcCAwZPVFhBfOKX1oN4jYsTJAAcVzS721QIS3SUDhrfMX9yqKiuEbC/rRB0Y 0tlbZv7aWhdUhiUOXkTBZ9zLDIg527ZWtteePC0ko4AohNoQgmh+g84wwZZcuLSgTicKULYz14oBA C6zvXCmsCE/RFcNtXx9yCnXqfBYeKzKOWLRiQHcmU9zMy1efW24j7stwbuDgpj0vlSho/wQekkF8C mw/KxqHQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:50064 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rDOh0-0008GU-1Q; Wed, 13 Dec 2023 12:50:26 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rDOh2-00Dvl1-H6; Wed, 13 Dec 2023 12:50:28 +0000 In-Reply-To: References: From: Russell King (Oracle) To: linux-pm@vger.kernel.org, loongarch@lists.linux.dev, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, kvmarm@lists.linux.dev, x86@kernel.org, acpica-devel@lists.linuxfoundation.org, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org Cc: Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse Subject: [PATCH RFC v3 15/21] irqchip/gic-v3: Add support for ACPI's disabled but 'online capable' CPUs MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Wed, 13 Dec 2023 12:50:28 +0000 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 13 Dec 2023 04:53:16 -0800 (PST) From: James Morse To support virtual CPU hotplug, ACPI has added an 'online capable' bit to the MADT GICC entries. This indicates a disabled CPU entry may not be possible to online via PSCI until firmware has set enabled bit in _STA. What about the redistributor in the GICC entry? ACPI doesn't want to say. Assume the worst: When a redistributor is described in the GICC entry, but the entry is marked as disabled at boot, assume the redistributor is inaccessible. The GICv3 driver doesn't support late online of redistributors, so this means the corresponding CPU can't be brought online either. Clear the possible and present bits. Systems that want CPU hotplug in a VM can ensure their redistributors are always-on, and describe them that way with a GICR entry in the MADT. When mapping redistributors found via GICC entries, handle the case where the arch code believes the CPU is present and possible, but it does not have an accessible redistributor. Print a warning and clear the present and possible bits. Signed-off-by: James Morse Tested-by: Miguel Luis Tested-by: Vishnu Pajjuri Tested-by: Jianyong Wu Signed-off-by: Russell King (Oracle) ---- Disabled but online-capable CPUs cause this message to be printed if their redistributors are described via GICC: | GICv3: CPU 3's redistributor is inaccessible: this CPU can't be brought online If ACPI's _STA tries to make the cpu present later, this message is printed: | Changing CPU present bit is not supported Changes since RFC v2: * use gicc->flags & (ACPI_MADT_ENABLED | ACPI_MADT_GICC_CPU_CAPABLE) --- drivers/irqchip/irq-gic-v3.c | 14 ++++++++++++++ include/linux/acpi.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index ebecd4546830..6d0f98d3540e 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -2370,11 +2370,25 @@ gic_acpi_parse_madt_gicc(union acpi_subtable_headers *header, (struct acpi_madt_generic_interrupt *)header; u32 reg = readl_relaxed(acpi_data.dist_base + GICD_PIDR2) & GIC_PIDR2_ARCH_MASK; u32 size = reg == GIC_PIDR2_ARCH_GICv4 ? SZ_64K * 4 : SZ_64K * 2; + int cpu = get_cpu_for_acpi_id(gicc->uid); void __iomem *redist_base; if (!acpi_gicc_is_usable(gicc)) return 0; + /* + * Capable but disabled CPUs can be brought online later. What about + * the redistributor? ACPI doesn't want to say! + * Virtual hotplug systems can use the MADT's "always-on" GICR entries. + * Otherwise, prevent such CPUs from being brought online. + */ + if (!(gicc->flags & ACPI_MADT_ENABLED)) { + pr_warn_once("CPU %u's redistributor is inaccessible: this CPU can't be brought online\n", cpu); + set_cpu_present(cpu, false); + set_cpu_possible(cpu, false); + return 0; + } + redist_base = ioremap(gicc->gicr_base_address, size); if (!redist_base) return -ENOMEM; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 19d009ca9e7a..00be66683505 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -238,7 +238,7 @@ void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); static inline bool acpi_gicc_is_usable(struct acpi_madt_generic_interrupt *gicc) { - return gicc->flags & ACPI_MADT_ENABLED; + return gicc->flags & (ACPI_MADT_ENABLED | ACPI_MADT_GICC_CPU_CAPABLE); } /* the following numa functions are architecture-dependent */ -- 2.30.2