Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3135401rdb; Wed, 13 Sep 2023 03:15:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzl7kgYm6wwIlBaBGRhCTqYHoFlodbM4W4I2uvBgbtP5TkPgZyFe7mtocrDu+JhQiSuc57 X-Received: by 2002:a05:6808:309b:b0:3a9:ef9f:c4c1 with SMTP id bl27-20020a056808309b00b003a9ef9fc4c1mr2704054oib.3.1694600123568; Wed, 13 Sep 2023 03:15:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694600123; cv=none; d=google.com; s=arc-20160816; b=qfW3WM8gNYlzONnCNNC5S/yErCyvrSsLfQmk34RLU25pVZ4IKgEnLezE5E3Jz9dPrU KWQ4B2OcdK8E3MKHugXq8e+tbo/VREutcR0dm7FdCX+2T+qUUokmbo8LUqykiwps489D YE63B27/GGsQuuwaZAt7xVCT9SHIknmSmNu3khX8jCeqxx2ybB6Qy35Sggn02mac/e/m /QN+26zFxsTGWrCHr5BATjkk3dtzAqlV8NEywf/uAQwr4yIH+6CMHoPFuYteWFpcN7G6 BAntPhL0UmDCoq3DIQDQ//bkW62iIIiPR76ESqCt+asmggTt+Om+Jkb6bj5aVmFNpUv/ 0bzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=8JXkJ54ClmA2wG5YQlwZEU6gT5TAnLOLKD/j+WbPD1Q=; fh=730UCy3WcDymJHL8c8oZBZGO8L5AGOD3eoL+56yNd5Y=; b=fgqRc0vH9Cr7UgKk/jQa0sOwgJ+6PMJnQUh+ebwXqvR9IgTRtLSsJWzBD9pDkIoI+z rONQdDPoYVB9SnPyIFmFjAHm7EkRtSxEXL1KYa8lZFFjOcRQxUGm0Ms07bU67P1dHdUH gnq0V3gzgD5CrFvuawIG6RU68nMt4qzYqIqlYhL8bbAi87LSeDTQNz9jad3F7WZDvQMB dhpiDhey5fAUfbOyyM7CA8SAlywHd9taV7d+7j3rwvu3TQquiyqXUXVEqoiPLEykC292 38rnwsV5ZgR9OE04tXXBmk9YZXNSDPqhxwczq9upTAFqpXJspqv2vrlrlAAFD1o4oUjM fKpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bs64-20020a632843000000b005653f3c0f7esi9566522pgb.409.2023.09.13.03.15.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 03:15:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0DE08802C664; Tue, 12 Sep 2023 10:02:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231244AbjILRCV (ORCPT + 99 others); Tue, 12 Sep 2023 13:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236687AbjILRCN (ORCPT ); Tue, 12 Sep 2023 13:02:13 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C7A031728; Tue, 12 Sep 2023 10:02:08 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B803CC15; Tue, 12 Sep 2023 10:02:45 -0700 (PDT) Received: from [10.1.197.60] (eglon.cambridge.arm.com [10.1.197.60]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 431A73F738; Tue, 12 Sep 2023 10:02:03 -0700 (PDT) Message-ID: <3ad03f27-1f2b-a79f-130d-afb9e713fa70@arm.com> Date: Tue, 12 Sep 2023 18:01:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [RFC PATCH 30/32] KVM: arm64: Pass PSCI calls to userspace Content-Language: en-GB To: Salil Mehta , "linux-pm@vger.kernel.org" , "loongarch@lists.linux.dev" , "kvmarm@lists.linux.dev" , "kvm@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-ia64@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "x86@kernel.org" Cc: Marc Zyngier , Thomas Gleixner , Lorenzo Pieralisi , Mark Rutland , Sudeep Holla , Borislav Petkov , H Peter Anvin , Dave Hansen , Ingo Molnar , Will Deacon , Catalin Marinas , Huacai Chen , Suzuki K Poulose , Oliver Upton , Len Brown , Rafael Wysocki , WANG Xuerui , Russell King , Jean-Philippe Brucker References: <20230203135043.409192-1-james.morse@arm.com> <20230203135043.409192-31-james.morse@arm.com> <7e182886f20044d09d5b269cb6224af7@huawei.com> From: James Morse In-Reply-To: <7e182886f20044d09d5b269cb6224af7@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 (snail.vger.email [0.0.0.0]); Tue, 12 Sep 2023 10:02:20 -0700 (PDT) Hi Salil, On 23/05/2023 10:32, Salil Mehta wrote: >> From: James Morse >> Sent: Friday, February 3, 2023 1:51 PM >> To: linux-pm@vger.kernel.org; loongarch@lists.linux.dev; >> kvmarm@lists.linux.dev; kvm@vger.kernel.org; linux-acpi@vger.kernel.org; >> linux-arch@vger.kernel.org; linux-ia64@vger.kernel.org; linux- >> kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; >> x86@kernel.org > > [...] > > >> >> When the KVM_CAP_ARM_PSCI_TO_USER capability is available, userspace can >> request to handle PSCI calls. >> >> This is required for virtual CPU hotplug to allow the VMM to enforce the >> online/offline policy it has advertised via ACPI. By managing PSCI in >> user-space, the VMM is able to return PSCI_DENIED when the guest attempts >> to bring a disabled vCPU online. >> Without this, the VMM is only able to not-run the vCPU, the kernel will >> have already returned PSCI_SUCCESS to the guest. This results in >> timeouts during boot as the OS must wait for the secondary vCPU. >> >> SMCCC probe requires PSCI v1.x. If userspace only implements PSCI v0.2, >> the guest won't query SMCCC support through PSCI and won't use the >> spectre workarounds. We could hijack PSCI_VERSION and pretend to support >> v1.0 if userspace does not, then handle all v1.0 calls ourselves >> (including guessing the PSCI feature set implemented by the guest), but >> that seems unnecessary. After all the API already allows userspace to >> force a version lower than v1.0 using the firmware pseudo-registers. >> >> The KVM_REG_ARM_PSCI_VERSION pseudo-register currently resets to either >> v0.1 if userspace doesn't set KVM_ARM_VCPU_PSCI_0_2, or >> KVM_ARM_PSCI_LATEST (1.0). > I just saw the latest PSCI standard issue (Mar 2023 E Non-Confidential > PSCI 1.2 issue E) and it contains the DENIED return value for the CPU_ON. > > Should we *explicitly* check for PSCI 1.2 support before allowing vCPU > Hot plug support? For this we would need KVM changes. The VMM should certainly check which version of PSCI it supports, to make sure it doesn't return an error code that the spec says that version of PSCI doesn't use. Moving the PSCI support to the VMM is a pre-requisite for supporting this mechanism, otherwise KVM will allow the CPUs to come online immediately. Thanks, James