Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp194723lql; Fri, 12 Apr 2024 07:46:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJwLjhQup9yPrAsqJSWuZFx4+E/sH8ega41k2z0VvSP5hop7RmgeUrMWRMP6EqY1bRhhzdisVlXCKUefWwxWoq6On7DfLq9ScnjWQCLg== X-Google-Smtp-Source: AGHT+IEcemzKb3ipVRQFSG0QIj8iRw5UZKEj+phsHd1VzdssFsmKLXOlNTESaKS5P/QeSc2QeY8C X-Received: by 2002:a05:6808:178e:b0:3c5:fcc1:b15a with SMTP id bg14-20020a056808178e00b003c5fcc1b15amr3227966oib.56.1712933174314; Fri, 12 Apr 2024 07:46:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712933174; cv=pass; d=google.com; s=arc-20160816; b=e5/rQE2Vb0WkhQgcpBvBe9GdI0SX4n85yjzVTBFrty2uDhXgpWHjQoqv/ZcvgeKqNM kgHXpusMlvxf97oRABsQtkMslBISH6AslWbCtY6K3X1HBqMYoRsj/aMqMiuhq9pjEr6d ETMQlx9s6NOwdRDi4vc/1mlI87zf9f/nVqnlg+b0cv3R0bn98CneG8kuI/hVeYGodJix zt8RHtU0VD2qTVOjxEVmdEQjzIIRxqEvlYEhzZlKGsOFVVTr2U5eFc6Jk694yng9MQeZ O8HTRqt7vzNBElQmtcjBxgf9klsTUmKo80OY2FakMrHdc+JjvEMYTvRei1yLFONf12KZ kpMQ== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=E4duPpkqjmqGq09HjEljHWcGYkd69XjNh0DY3/79F8g=; fh=8XQHdFtte3XOHSEIytMgmfctfSZlTmw2q6RqB5HTTCI=; b=Ic7NwmhICI/ZSzGruC4Hz9fJltLRqoj5fg/zkKwxZlMmXszCfy4gsynplnU0ONyWKN 3vg5t5Fs2D6J5JLLGGjlVkW0wzswci3wxCf6LFjpB3dS7N2HC1wvRMbUIgvU0ayE6FU1 Q/bnsPAb36xRI2mJN3OGCikVlYN7DddcArby0/Xx6voFMfi48E5iGxWG+j3pAHCwT6NO tQaXJDZ+6iMNrpxq6ERnLy/gfmEBTOgFbLsSDaCRulIk8aWunFf7lBSvl+g1cL/M0vdY y0Q0i6hed1FBhLkpDyEB2S8H99pRySy3QI2y8sVvthgPJOF6e6yMMIp2goUlRK6XKv9O JiHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-142871-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d9-20020ac85d89000000b004347cb4add1si3507023qtx.809.2024.04.12.07.46.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 07:46:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142871-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-142871-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142871-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E378F1C20DEA for ; Fri, 12 Apr 2024 14:46:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39DB914199C; Fri, 12 Apr 2024 14:46:04 +0000 (UTC) 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 A05C31419B0; Fri, 12 Apr 2024 14:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712933163; cv=none; b=svCKIfuaK7zVITKNTyQmSdzQEx2errDGVSGFiYJsGf97b9rpIOWGv77cab/Q/y2MbE9yu30ZGW3R1e657z1g9rHXOihGgLJ2yjGEAxaHFBIB22em99+PzJ7FVShXgN661qgDydfpBDH++1bbIgVMcwctk5sHcwWp1Eoggm0soL8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712933163; c=relaxed/simple; bh=at/D2TnqgbwauUxHhWlbNw1UdgkgeRlnps3s3gggvsQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Fp6O7nN7uN32P9u1Fomb/FE7uxBCslo7vXsSb3kjeSHDjKtSSnrmsdDWQGABoVooL3sLyb0om5FiRF8nt3pd04HGwuSeNOTcPsmothTfTHVFAsc0xb2Y9+8fylGfaz6vq6n1WCkFtA7+WJ3Xdu1EPjlGbz3thx3kTkoZwQo9kkg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 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 4VGK4h0yHRz688p7; Fri, 12 Apr 2024 22:41:08 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 773E31400D4; Fri, 12 Apr 2024 22:45:58 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 12 Apr 2024 15:45:57 +0100 From: Jonathan Cameron To: , , , , , , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Catalin Marinas , Will Deacon CC: , , Subject: [PATCH v5 17/18] arm64: document virtual CPU hotplug's expectations Date: Fri, 12 Apr 2024 15:37:18 +0100 Message-ID: <20240412143719.11398-18-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240412143719.11398-1-Jonathan.Cameron@huawei.com> References: <20240412143719.11398-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: lhrpeml500006.china.huawei.com (7.191.161.198) To lhrpeml500005.china.huawei.com (7.191.163.240) 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 Reviewed-by: Jonathan Cameron Signed-off-by: Russell King (Oracle) Signed-off-by: Jonathan Cameron --- v5: No change. --- Documentation/arch/arm64/cpu-hotplug.rst | 79 ++++++++++++++++++++++++ Documentation/arch/arm64/index.rst | 1 + 2 files changed, 80 insertions(+) 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.39.2