Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1968960rda; Tue, 24 Oct 2023 08:30:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFL6/PBoaRo8lZBVeUUP0H8wReDpHJaoqojINH3Kacxk06FzIH9y66Rb2a46ZxHhYal9iQL X-Received: by 2002:a17:90a:aa89:b0:27d:22d7:9787 with SMTP id l9-20020a17090aaa8900b0027d22d79787mr10073412pjq.36.1698161435941; Tue, 24 Oct 2023 08:30:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698161435; cv=none; d=google.com; s=arc-20160816; b=FipCSsdoOi9D6UJgtBQ2Xh1mqshCujtZE82c9ffS3xEk5h/57Xei5U4Wj6zr2cjKXE 9DJiQLLOKe+x07Qwfk+1gfcD1VwolcSrAiCGcinEcFLbTWnTsJUEeCCgFB5C6itD1php QtODcNdPI+//QbfFgSV58dKdoU1FklUtOUXKCrUAl77W/FRsFVFe8S585eFWbBAfk/zy mSp2yc7qNeo0UacskSIW5n5hCrphkD+vmbsd4dTT7EnsFsC9U9CxU+hMBf1ktElOTW6h eetLHrRpwze2/2wXSvUUQwfKFq9/R5k5xEJM3Upc5T6BPz8L9oeHI1owUtPLX0+yVAUe cYlw== 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=oCft4xPi3XDHU0UN3l9OsD70hFFh+BkwY8FvO/LnA90=; fh=meqFOU12RXiu973Rm4nY22DIuBwVKTBEj1JpMrJNCvE=; b=SALKAVhdqh2gK9NuCc3eyOpS+B1sNz9IidmIEbFQCvIwMjxl4IEkU3TpPtAo96l6xb SU6OrzmMGswfbNPMqKVPFSbaP6+30e2R948Nf1N5ZxLFZTqK9T36dF3BnV7x5wVZ3qRC SGJz8iM+M4kHmx5jrlFu3qtaiZuVjcv6V3P6jDGptwBcSTY6qKytgAMY4kR8BtqmVhpY 8IYGBaRPH/PSIa74ntV7i1iAihJL0FSGklw7Ynh5NMxRnHYXLG7OukrPkJ7Al/2OT8fz ZVutrgMR4+KzTZGEaGsM485ZAGRl3JCWz8LvsKcf/GUqE6OtNAYmlwr7XLY+8b/CO7R4 bR8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=WogGkYar; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id kb11-20020a17090ae7cb00b00276571c0d34si9033457pjb.6.2023.10.24.08.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:30:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=WogGkYar; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 8CE4180A79A1; Tue, 24 Oct 2023 08:30:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343746AbjJXP36 (ORCPT + 99 others); Tue, 24 Oct 2023 11:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234941AbjJXP3r (ORCPT ); Tue, 24 Oct 2023 11:29:47 -0400 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 74651173F; Tue, 24 Oct 2023 08:19:21 -0700 (PDT) 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=oCft4xPi3XDHU0UN3l9OsD70hFFh+BkwY8FvO/LnA90=; b=WogGkYar3Xyhom4+CPTJn22CDH Tt5whuXtcSNoiYeoc9S2lZnq5wQoVR8xqbtC0cDpKIBCN2lgOQG8CkaM8Wyzz9/O4xrS5Dr8zE4vd 8EBRz5FqHbEILZTdY2vtmVwK/aJ5PBxxpGBHJJYZgeAeU+G46cf6TiLYioCdbEVg1GBPdhjAQXkyg LNVCwEUkolxbKcCLONfgGj/yf6Pu7XEliLfg6/sYVggJmYv7evUj85xcZIoRyJCWrCOY9wB9CP5Zj bu4yDH29G2hZ8lmxUUipXQh4jwp+SbcvSnnl7N0g7nPIJ+BnuH+ABlwb/rGiQXV2foOL8QFoPQ+dR uZtqbnqw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:60324 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 1qvJBZ-0004Ws-0H; Tue, 24 Oct 2023 16:19:13 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qvJBa-00AqSK-Hb; Tue, 24 Oct 2023 16:19:14 +0100 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, 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 , Catalin Marinas , Will Deacon , Jonathan Corbet Subject: [PATCH 36/39] arm64: document virtual CPU hotplug's expectations MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Tue, 24 Oct 2023 16:19:14 +0100 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Tue, 24 Oct 2023 08:30:23 -0700 (PDT) From: James Morse Add a description of physical and virtual CPU hotplug, explain the differences and elaborate on what is required in ACPI for a working virtual hotplug system. Signed-off-by: James Morse --- Documentation/arch/arm64/cpu-hotplug.rst | 79 ++++++++++++++++++++++++ Documentation/arch/arm64/index.rst | 1 + 2 files changed, 80 insertions(+) create mode 100644 Documentation/arch/arm64/cpu-hotplug.rst diff --git a/Documentation/arch/arm64/cpu-hotplug.rst b/Documentation/arch/arm64/cpu-hotplug.rst new file mode 100644 index 000000000000..76ba8d932c72 --- /dev/null +++ b/Documentation/arch/arm64/cpu-hotplug.rst @@ -0,0 +1,79 @@ +.. SPDX-License-Identifier: GPL-2.0 +.. _cpuhp_index: + +==================== +CPU Hotplug and ACPI +==================== + +CPU hotplug in the arm64 world is commonly used to describe the kernel taking +CPUs online/offline using PSCI. This document is about ACPI firmware allowing +CPUs that were not available during boot to be added to the system later. + +``possible`` and ``present`` refer to the state of the CPU as seen by linux. + + +CPU Hotplug on physical systems - CPUs not present at boot +---------------------------------------------------------- + +Physical systems need to mark a CPU that is ``possible`` but not ``present`` as +being ``present``. An example would be a dual socket machine, where the package +in one of the sockets can be replaced while the system is running. + +This is not supported. + +In the arm64 world CPUs are not a single device but a slice of the system. +There are no systems that support the physical addition (or removal) of CPUs +while the system is running, and ACPI is not able to sufficiently describe +them. + +e.g. New CPUs come with new caches, but the platform's cache toplogy is +described in a static table, the PPTT. How caches are shared between CPUs is +not discoverable, and must be described by firmware. + +e.g. The GIC redistributor for each CPU must be accessed by the driver during +boot to discover the system wide supported features. ACPI's MADT GICC +structures can describe a redistributor associated with a disabled CPU, but +can't describe whether the redistributor is accessible, only that it is not +'always on'. + +arm64's ACPI tables assume that everything described is ``present``. + + +CPU Hotplug on virtual systems - CPUs not enabled at boot +--------------------------------------------------------- + +Virtual systems have the advantage that all the properties the system will +ever have can be described at boot. There are no power-domain considerations +as such devices are emulated. + +CPU Hotplug on virtual systems is supported. It is distinct from physical +CPU Hotplug as all resources are described as ``present``, but CPUs may be +marked as disabled by firmware. Only the CPU's online/offline behaviour is +influenced by firmware. An example is where a virtual machine boots with a +single CPU, and additional CPUs are added once a cloud orchestrator deploys +the workload. + +For a virtual machine, the VMM (e.g. Qemu) plays the part of firmware. + +Virtual hotplug is implemented as a firmware policy affecting which CPUs can be +brought online. Firmware can enforce its policy via PSCI's return codes. e.g. +``DENIED``. + +The ACPI tables must describe all the resources of the virtual machine. CPUs +that firmware wishes to disable either from boot (or later) should not be +``enabled`` in the MADT GICC structures, but should have the ``online capable`` +bit set, to indicate they can be enabled later. The boot CPU must be marked as +``enabled``. The 'always on' GICR structure must be used to describe the +redistributors. + +CPUs described as ``online capable`` but not ``enabled`` can be set to enabled +by the DSDT's Processor object's _STA method. On virtual systems the _STA method +must always report the CPU as ``present``. Changes to the firmware policy can +be notified to the OS via device-check or eject-request. + +CPUs described as ``enabled`` in the static table, should not have their _STA +modified dynamically by firmware. Soft-restart features such as kexec will +re-read the static properties of the system from these static tables, and +may malfunction if these no longer describe the running system. Linux will +re-discover the dynamic properties of the system from the _STA method later +during boot. diff --git a/Documentation/arch/arm64/index.rst b/Documentation/arch/arm64/index.rst index d08e924204bf..78544de0a8a9 100644 --- a/Documentation/arch/arm64/index.rst +++ b/Documentation/arch/arm64/index.rst @@ -13,6 +13,7 @@ ARM64 Architecture asymmetric-32bit booting cpu-feature-registers + cpu-hotplug elf_hwcaps hugetlbpage kdump -- 2.30.2