Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2080952lqa; Tue, 30 Apr 2024 07:43:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTOEx9f7oPW478Q/STQflH9F/FD4chqoNhR/KnOt4Kf4WjFmX87j0K24rgqT0BgXbhmwHMnnz00nra9BzGM2vA2RrSFGCLoAOJjZeZSA== X-Google-Smtp-Source: AGHT+IEHWr5MkIkS2DmegBmXtqUdRtxaDZa+6pvNuH4kArovmhZPiWahLMCRd2I/KXGZvOx8mwO/ X-Received: by 2002:a50:951c:0:b0:56e:2294:e2e6 with SMTP id u28-20020a50951c000000b0056e2294e2e6mr184eda.26.1714488224213; Tue, 30 Apr 2024 07:43:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714488224; cv=pass; d=google.com; s=arc-20160816; b=T5qHxmkaqv12vK57RnJDmaROyO74mY2A5hGYt+QnteCkJYypBK9iu7jWMx+JegRFJc l1dv72qMhom3UQLgduZ3bgwTP5/gga9dzC1ku/9fuMNdDoiBPN75Jvlo58cUi9jZ/YEm RUa9h1neB0l5AkmYtdsutA7GIufSW554RfpXcgpld7b7aUsD9CKzym/aTQXTl7XHe3p2 izU6QRxe5hv3F8Qa8dNgaPDJomZWboF3fEy3KwegECWWVHIPXqubO3U3pQxygdk7YLHY z2Sd6LxxRRid7o87PySwsbUTus62RfQEJY+UU0kDyNOeH8rm/wbS/pGYnzcPCEXIHgGc pQ1A== 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=cXEEP7pOayXX7GvFNS544R5IA5vlkMalxxH0wxslQs0=; fh=25IklNjpQtm3+ZI4w1ifckV22BkO2b6a/wyTwiBBJrk=; b=ItdX75llr+h+vDZS65bRaaraFYWwKpuDezRmMaATtw33QKWhJYfuN3GT0cs+YxUycU +OO6dDZCj1taJ3UdCDx8XwXl4CZnZGED5ur4gkH2YXKgoG1FQRgyQ3WXz/aCvxhZ9Ut4 X/W2XzxTum2/lx8ziTMVqbFK+VWX1Fv78d8jDXL7a8Ua1jEXY41BEDcaqfC9R2zzJO0j IMPUQEkU3ziVTKv80HtOllW3TPQ/HzJYfkcesSF7xMqrWiJTPw0c46pZ3tgkIRQ0WX1Z YnZN0s66plO7Dn4gPZWtxUfK4fTMh00NPowPWoJu3JV7bNZS+uOhdgJhR75dhjkP27sx l7Uw==; 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-164175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164175-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id u13-20020a50eacd000000b005727ea0eb5bsi2727470edp.216.2024.04.30.07.43.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 07:43:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-164175-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164175-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8581A1F233DF for ; Tue, 30 Apr 2024 14:41:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 283B177102; Tue, 30 Apr 2024 14:33:56 +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 DF53977103; Tue, 30 Apr 2024 14:33:53 +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=1714487635; cv=none; b=tNGIVl5LsDhxRjGSuxP3DY2u9aPZf5y8DSAMXSoJPeip+Z5D3O1QwgLzwBn56Kay1FcAMQavC58CO0thMdqCv3mqxwHTVfBw6MnYE/eorGBUXahGF0/Nhvl1zFf+aifQzv5lbxpfRnAmi/m0p3OxZrCNoutXQAnOkZlErZZ80Sc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714487635; c=relaxed/simple; bh=JZ2gdHjxTZSDkioddp8aZRGRa23qJkly0JMwTmDP9Zc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pkIA4B17qo4FyPXn5lHG6r9F3yaJTHN54zzJbCdJZrhvTg/C0w3GmRzFOJ5Lf04ooiHOYQqprvsKkqZf9E8zMo3HDXcOSAiXsvq875VUe3AZQ4F+4FVyTVkYtneZSgvR4Yo6Qo8QpgZwvltJ9TmQqduros/5MNHL0/rGf+IOgPA= 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.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VTN0y3c9Xz6GD6x; Tue, 30 Apr 2024 22:31:14 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id C111A1400DC; Tue, 30 Apr 2024 22:33:51 +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; Tue, 30 Apr 2024 15:33:50 +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 , Gavin Shan CC: Ingo Molnar , Borislav Petkov , Dave Hansen , , , Subject: [PATCH v9 18/19] arm64: document virtual CPU hotplug's expectations Date: Tue, 30 Apr 2024 15:24:33 +0100 Message-ID: <20240430142434.10471-19-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240430142434.10471-1-Jonathan.Cameron@huawei.com> References: <20240430142434.10471-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: lhrpeml100003.china.huawei.com (7.191.160.210) 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 --- v9: 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