Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp295982lqf; Fri, 26 Apr 2024 07:07:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXGe0PmRQQpcr2AQA4mRVFtre5f+Nlv1PAcdu5WIFOwnkz3EyDUzFVKSX/SCgbWp5BWqQtAPwDhL0GILLGcNNnd3TD7aZzXqlMrGS7Tsg== X-Google-Smtp-Source: AGHT+IFaGw4A7LExO0uOHZHeFt47X0PSwUNcPJj1/vFtwx61SD8E5yooLV7ivokbFs5nBYEEdN6p X-Received: by 2002:a54:4111:0:b0:3c6:f7d9:44ba with SMTP id l17-20020a544111000000b003c6f7d944bamr2765688oic.57.1714140441449; Fri, 26 Apr 2024 07:07:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714140441; cv=pass; d=google.com; s=arc-20160816; b=ZQdtZBTHb+ZRzOcnfIvJ5rDVS/qbuGoSGFOfzjDPFbWldf2XyNUbF9CrdEtPNKWYXu o0e79gtBjiYyV702ecvGtBIx9dxBXM+IfDLiHX0rYjCFEVfSNoGWougxaAxcjKZG+LDN d3HGMy4zPbFn9uK3pJ7M5Ud4qtpQ0aT0rvEGOBc17t0NJvM83tAjPjbuW7goI13OiPWQ TYTw6fwJXy/lQtWxHexVeBJlOwirK9hFQtICXffA2OMH07ITGj8D2e8rL+lqBmaefVhS kyQkGIZzcdYFr3ZIaWZO335P2mslCBxeiSNkjgTwdVQMURvQn+PNnQyP+Ory8X2AdAn4 xPQA== 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=tPdDLCKqm2kZKvlgwWdCLD4fAVRT7JT1JXDEnb2AJgo=; fh=QfGN+Nlycv3VEqD8X65neWxvyXXboUCZUO7iSMK6eUk=; b=QReNIH5+oMluIhJ3AT0rkod/+6SbB+fOWz+SnCESdUMsywcK1RIWv1VmuyTKUesOQM xosZ6Xhz4oMa/to2N+wxozsw/bQVd0iHDz2kr7Az7gR49bVXKEA4udQ/LgzMIMxTNd5/ QEESnrq+ZVizOmiRERZAfT2x6xb8ogX8gxdNY/RCZaUx8iq5rEHVNSyLZCTDPhnLVNmf 93QxIHbr8md0W2whZ3cgsrU7yz4CKMkQ+MKGZURuaMWdOqbmXGZYSuVxTBsl5rcp56lv Hv9OmBDabSMHVM86esOQsHb3ITkhAPW/FUgkYFMZumTnKH8oKkjbBEbnuTpDWwyetzsy FfGw==; 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-160117-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160117-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i6-20020a05610220c600b0047c15a060a3si910356vsr.497.2024.04.26.07.07.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 07:07:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160117-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-160117-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160117-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 62E0F1C23D3A for ; Fri, 26 Apr 2024 14:00:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7479148858; Fri, 26 Apr 2024 13:59:14 +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 AE3A9148317; Fri, 26 Apr 2024 13:59:12 +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=1714139954; cv=none; b=EgzYSxOkuR9ewLV465G2vVIYOzSW1mGHycojR1Gvvj5Ska2OotszrI4VOrwKNhAAwSEc3at6JBgO0X9vK6WwxY+pub/8VjnYh+GXFa7oOJMwyRAUQMbXRvIRNQWwGKVUyPlVu2ttmykF45vM9f1A/hJ00vJYTraBlwrBEYZRXHI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714139954; c=relaxed/simple; bh=6NXwPHxk3D6KF25H3DXcQaX27WN7qNDBDIfY5ii9Z5M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BAPRamQVXifu92fgNLZ8iL45Iy924NICRMDJ/RYJJOlloMz090t13Tv/3ZhgiEgt048p83fN73pv7DKrctD5mGRhZt9eAwlDW/FfjE+UBntNDRrKitTEbG/NrmGkI7zuz/Qbc4uzBX8kl3U147pTlQC1dTtSMZsUUvoELKygBbQ= 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 4VQvR13BKmz6JBCq; Fri, 26 Apr 2024 21:56:45 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id B1E2A140A70; Fri, 26 Apr 2024 21:59:10 +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, 26 Apr 2024 14:59:10 +0100 From: Jonathan Cameron To: Thomas Gleixner , Peter Zijlstra , , , , , , , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Catalin Marinas , Will Deacon , Marc Zyngier , Hanjun Guo CC: Ingo Molnar , Borislav Petkov , Dave Hansen , , , , Lorenzo Pieralisi , Sudeep Holla Subject: [PATCH v8 15/16] arm64: document virtual CPU hotplug's expectations Date: Fri, 26 Apr 2024 14:51:25 +0100 Message-ID: <20240426135126.12802-16-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240426135126.12802-1-Jonathan.Cameron@huawei.com> References: <20240426135126.12802-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: lhrpeml500002.china.huawei.com (7.191.160.78) 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) Tested-by: Miguel Luis Signed-off-by: Jonathan Cameron --- 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