Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6801600rdb; Fri, 15 Dec 2023 08:39:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IH965OQVeDBSKl5oa69u1PcB2tPJjhRMIKb+DoOlxRiK12BuHuRRXG9GPQc1ypM1cz8mFgS X-Received: by 2002:a05:6a21:6da1:b0:18f:97c:9792 with SMTP id wl33-20020a056a216da100b0018f097c9792mr14668148pzb.122.1702658345861; Fri, 15 Dec 2023 08:39:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702658345; cv=none; d=google.com; s=arc-20160816; b=U9H6c+nXJJitR6pGvrycM2A20NTZ0zZsvIxm8qNIrLlnbaWwycIfFuKYmEn2EaRZoX xoMvHL/aj42QoCWZMCIGz95cMWFWT52I5CPE91ceWNEAj/JO2InvX4kD6jP6RK+B3/9w ImKkp3LYAfZfkgb8mvvRwbic+tXDZS3nHIsFa7Q4jUYFd68hTiSVushdfQDFehEXqcHk HP7q+OBmt+SbDNYYs+HIcJxORzOrok8t4e27WJi31sfeKMl2kOgGfVT+EUTPN0jRFSV7 4QQ3p+fGS8af0X/iHvb3ZuSWtyphGQxQlZd70iAEY2WE375oiy7S50papehfVIgKc7e/ McOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=DHd4JSAw/sKkeRb+9na2LQFzymqtP9pef+gCrq1HW4U=; fh=4iHbZ733mqZc4Bx83AV0konbWC9aXbRvmPAEmCiuGYk=; b=bnuzpUj43x95xutQoqaZYpe/byo+1mF+PhjNW9zhT5LFB8LZvDBK4Y8MbK7tP8hoBf OCjsQlyDJ5QlJUBefrXEC5i763PH85zNBCK+NJwpT8x1ewasfEK8MTclorjRKl0nS2wl VW+0EVfJIhEID31nDWcQa90SJx6SMbYPfDzEtyGhgQwfr51oKu8GqYQSn6yS+ZGzayJi jT2CInetx98KzyuCyR0iIMlWPKti8EawaqSqHQ/wW5cop6M11TpyV6pjcxrDw0/94lUD Ew3EAsEi4mTAlUImk3UpYGWwzpSVhA6Ajx8AIbKMLYNffQcq32x0r/qFBWkccFMAO1JE krpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1313-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1313-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id v7-20020a655687000000b00589884fef91si13175290pgs.740.2023.12.15.08.39.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 08:39:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1313-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1313-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1313-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3766EB234F8 for ; Fri, 15 Dec 2023 16:38:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6152D3EA66; Fri, 15 Dec 2023 16:38:42 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 641613D396; Fri, 15 Dec 2023 16:38:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SsFGt2jlqz67LyQ; Sat, 16 Dec 2023 00:36:38 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 3075A1400D4; Sat, 16 Dec 2023 00:38:37 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 15 Dec 2023 16:38:36 +0000 Date: Fri, 15 Dec 2023 16:38:35 +0000 From: Jonathan Cameron To: "Russell King (Oracle)" CC: , , , , , , , , , , , , , , Salil Mehta , Jean-Philippe Brucker , , , James Morse Subject: Re: [PATCH RFC v3 15/21] irqchip/gic-v3: Add support for ACPI's disabled but 'online capable' CPUs Message-ID: <20231215163835.00005d02@Huawei.com> In-Reply-To: References: Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To lhrpeml500005.china.huawei.com (7.191.163.240) On Wed, 13 Dec 2023 12:50:28 +0000 Russell King (Oracle) wrote: > 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) Seems resonable, but this contains the blob that makes the change I called out in the previous patch relevant. With a forwards reference in that patch. Reviewed-by: Jonathan Cameron > ---- > 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); This is where the change is made that broke the code path in the previous patch. No problem with splitting that across patches but maybe call out why in the patch intro for previous patch. > } > > /* the following numa functions are architecture-dependent */