Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3367455rdb; Wed, 13 Sep 2023 09:51:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGenCn35mGI/pWDoiBXa9q+xpln25fOIIGfPZDIEVydATr/AAoc8Vlkkq2Rokk+pOMzA/qs X-Received: by 2002:a05:6a00:2347:b0:68f:cb69:8e6c with SMTP id j7-20020a056a00234700b0068fcb698e6cmr3784482pfj.33.1694623870374; Wed, 13 Sep 2023 09:51:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694623870; cv=none; d=google.com; s=arc-20160816; b=FjiW10itL3w1wH8rf/yXk5eJnqcREVQyvNU52kVnid8VaDPy0i1iiUlEzrHAM6jHCi iPghR0n827LYdtX6SzWaaXtWNdNea+fk8QI6hszY+KQ3FyUUBoF5S9Nqvjsqc7jW4/7F mFK7+20fDaH5QY2ptitV5ui0+xjNuDX9om32PQa2PHlYW/ESLnNUV+2Mn3dSQfRwzl+C b2g82QbaY18WMEGLIRUv4IlqYGUExe2W3ufjdIcLw790ECuunVhZJtQguEbOreiW4uvZ yz7BNfbC5PneDpATZD0DRlO54PyY1bmAZxWv526+avOFt8p40AA3PWw3ShOApliAYeoQ pixQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1mFMZNPY6FPZDVDfRwDpDHNkr7NUFr3wlN3mFPbZfyY=; fh=2nhVWB0fZ+8YH0lLFpnF/Mo8eq+n1VMLe+b+IpvS0g0=; b=mOmqJj7nBEH+0furdm88VLkhMNbQD68JjEq2GmSXpSx0HC0iIPV7RCUQikw3DTCfUX 5gPC5ae+UIs23Br5y6R3BdIIsvTYWdgbHMpJZRLZneXiOZQqyb3WemdmnarKGyPW8Crd +MR6W0filCFvhQSVNhytUDZIWL4zuie5GE1EY5M23Pp9s9EW2OQdFP+XfD1e/yElup6h W4FWGB06uetCnvKbWl3eE+xFQifK2WhI93wYZHx3pO5gCwrs871n39F0cxWXw6HDUHTS lZ/pIuPPwBqVaQDCYfzFLmP2iR16TZ+hdOu0IFWh5p5ipf+sOlTQCXsGwf+4vnTN/jBO foIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id x68-20020a636347000000b00565bf64dc72si10107685pgb.537.2023.09.13.09.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 09:51:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E2F6B82B1E5B; Wed, 13 Sep 2023 09:42:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231297AbjIMQlz (ORCPT + 99 others); Wed, 13 Sep 2023 12:41:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231409AbjIMQlF (ORCPT ); Wed, 13 Sep 2023 12:41:05 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5838219BF; Wed, 13 Sep 2023 09:39:53 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4ED1DFEC; Wed, 13 Sep 2023 09:40:30 -0700 (PDT) Received: from merodach.members.linode.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 53E593F5A1; Wed, 13 Sep 2023 09:39:51 -0700 (PDT) From: James Morse 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 Cc: x86@kernel.org, Salil Mehta , Russell King , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com Subject: [RFC PATCH v2 30/35] irqchip/gic-v3: Add support for ACPI's disabled but 'online capable' CPUs Date: Wed, 13 Sep 2023 16:38:18 +0000 Message-Id: <20230913163823.7880-31-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230913163823.7880-1-james.morse@arm.com> References: <20230913163823.7880-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (morse.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:42:40 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 ---- 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 --- drivers/irqchip/irq-gic-v3.c | 14 ++++++++++++++ include/linux/acpi.h | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 0f54811262eb..f56d064f4aa9 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -2365,11 +2365,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 e3265a9eafae..92cb25349a18 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -258,7 +258,8 @@ 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 || + gicc->flags & ACPI_MADT_GICC_CPU_CAPABLE)); } /* the following numa functions are architecture-dependent */ -- 2.39.2