Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp391135lqt; Mon, 18 Mar 2024 10:41:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUkbLjmTByBeP9yXO//4ca4XQ9MHW8uqZkyfMhTFkNF4+07KIJuZEEVV0y0kE50CYEWerFXhzEGP3JQjfmyqL9Zh57s2HjRLbIcmYcnmQ== X-Google-Smtp-Source: AGHT+IGh6uQxQGrT2zQC9m5gMtVD0/lc3CKHFdfSYHPNZvqE1VNE521NyvxCO+AkjfEWU/zMkfmv X-Received: by 2002:a05:622a:4287:b0:430:bb3f:cb7b with SMTP id cr7-20020a05622a428700b00430bb3fcb7bmr8140579qtb.64.1710783690769; Mon, 18 Mar 2024 10:41:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710783690; cv=pass; d=google.com; s=arc-20160816; b=vwFVnxS1ssvH3hvdRChnFEBUQtR0WPxuboLIr6LkpZhtzwjvLqzVIAAro0JBEPft8O gyumMEc/zP95K7O813Vqfdz/9gr0ywMtzpYbK6BUNmsKQcFPJwTunE59YrEvscA/MOBV DVh4Z3fYpM6h2DfNxImnLiZcDKPgTn/UrSIeOus/m72TjueG/C/xpWbeeqU/1Bb7C9fp oOZUggiB5oBq047+5qAsErm1U+riaXrFWzQTH9jHS4BTs1V2MzLzMw7CpkvCbzkOz8eT /ZG3Q7QXA9uTJUyckeUlx4eWZWhYv8LOrds60Rpo5FtcbA0IaIfzYuHzQ1iiezPhgKZr Uh0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=rfiCPSlED8oCjvHeegHVrqIQE9l3a2FX38A9GpY/grE=; fh=gIIIA4t9Gr5/HL49o4h3orPi1Vl0nipAkcWFYYS7PvY=; b=OqskYoqSmrQKYPAliHZQp/1Sel4upUdQURu93Dm1I4UXcFY84Zi1jQ/9/iFnAeAT7I JhagZkcmbgZcNeZlHdLpeZvwID73CANPjXQU6+yW80FvzElUwXAkscsLG55Cr9cW1z7W es7+Nz1YgXSxmmkumt9/9fbwP9Q40iwLNter2TuOU7sE9GFWu0IjcPtohIC0HQU6/lfF tmRUwYNsQO9oWWRdks2y8W8LGCjnP2Au3Y5w6vnbd24HrzKmYiUELmfr8ruDTLCUKRIb gQbtlFyG/89aUpxc7MOJvRm3z5ccDVj2CukIfrSkkacU40bqY2BGaDUaxGufGeA/I6Wa U2cA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NBp3bQEc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106471-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106471-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 13-20020ac8570d000000b0042eef41e212si10133092qtw.346.2024.03.18.10.41.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 10:41:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106471-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NBp3bQEc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106471-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106471-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 79ED21C22052 for ; Mon, 18 Mar 2024 17:41:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 91DE955E45; Mon, 18 Mar 2024 17:41:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NBp3bQEc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A1BC23B18D; Mon, 18 Mar 2024 17:41:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710783676; cv=none; b=L7ZFPgEiV/xeZKDSN5rwcHK92JPRDW7jAY5P5T5BMNP4dYhF6see4lNbBTiS2ym8Cw5nH5crf+dDNdvY3PuvTmeDucQpG3a+KHtobsus85gLb59TA9QXYToN8f5NPCP2yxUWHEOahleRMg/jYRCe8iZqDZYoRNebs72M8InpTEo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710783676; c=relaxed/simple; bh=E9X/vXcE+KfbqUnxxDsQCnC6isDz8nMc3x3A5fhOaPY=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=pv24dSbeacilhaYZ/XK7bQo8iCWh2uIQCmW/YiaKXGDpB7Es+kDPcP8hkRaqAflaVAsoexjhVKNmVtoky84Ta++gQ/4QR7ZTjWfBC211xYurw57J38A3QqXzOH6rgSkhBDCBN0ojEjEZsZWbHvdJaBB3Ln637FOGp24ASbRN4KY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NBp3bQEc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 208E6C43390; Mon, 18 Mar 2024 17:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710783676; bh=E9X/vXcE+KfbqUnxxDsQCnC6isDz8nMc3x3A5fhOaPY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NBp3bQEcp/MJFUxlDZZdTRT+zxsK1KhrVvtNTwiqett4hZDhYBEgYGIHpc6UHCEvS EkesHyPTiPyQPuHPBWc3avUjHOjXPt3NkwrF0DsetSTiEtkfzualAki1E+D3pBjcm8 eXdQUP8pYq03mJEPUXChGIOxc2mqGZQroTdoXoB933rxnvhuy6Sw4ne2cIJjdr1+1G 4Aq4xVgsM7VpfafU7r33mRbSswMvvvE27KRCQUQY9WPyk9SO9NyAeeCn8w94lHJ5yi ZRzmAq6ACJNrSOAJlD88wxRiVFOYzqLKEysA6vU9bbD+DKbNkSiUwyXvK+RVEZ4igi H7zgOUD6oUWNw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rmGz2-00DLD7-Q3; Mon, 18 Mar 2024 17:41:12 +0000 Date: Mon, 18 Mar 2024 17:41:12 +0000 Message-ID: <86ttl3zbd3.wl-maz@kernel.org> From: Marc Zyngier To: David Woodhouse Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Paolo Bonzini , Jonathan Corbet , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Mark Rutland , Lorenzo Pieralisi , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Mostafa Saleh , Jean-Philippe Brucker , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-pm@vger.kernel.org Subject: Re: [RFC PATCH v2 0/4] arm64: Add PSCI v1.3 SYSTEM_OFF2 support for hibernation In-Reply-To: References: <20240318164646.1010092-1-dwmw2@infradead.org> <86wmpzzdep.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, pbonzini@redhat.com, corbet@lwn.net, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, lpieralisi@kernel.org, rafael@kernel.org, len.brown@intel.com, pavel@ucw.cz, smostafa@google.com, jean-philippe@linaro.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-pm@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 18 Mar 2024 17:26:07 +0000, David Woodhouse wrote: > > [1 ] > On Mon, 2024-03-18 at 16:57 +0000, Marc Zyngier wrote: > > > > > > > > There *is* a way for a VMM to opt *out* of newer PSCI versions... by > > > setting a per-vCPU "special" register that actually ends up setting the > > > PSCI version KVM-wide. Quite why this isn't just a simple KVM_CAP, I > > > have no idea. > > > > Because the expectations are that the VMM can blindly save/restore the > > guest's state, including the PSCI version, and restore that blindly. > > KVM CAPs are just a really bad design pattern for this sort of things. > > Hm, am I missing something here? Does the *guest* get to set the PSCI > version somehow, and opt into the latest version that it understands > regardless of what the firmware/host can support? No. The *VMM* sets the PSCI version by writing to a pseudo register. It means that when the guest migrates, the VMM saves and restores that version, and the guest doesn't see any change. The host firmware has nothing to do with it, obviously. This is all about KVM's own implementation of the "firmware", as seen by the guest. > Because if not, surely it's just part of the basic shape of the > machine, like "how many vCPUs does it have". You don't need to be able > to query it back again. Nobody needs to do this. > I don't think we ever aspired to be able to hand an arbitrary KVM fd to > a userspace VMM and have the VMM be able to drive that VM without > having any a priori context, did we? Arbitrary? No. This is actually very specific and pretty well documented. Also, to answer your question about why we treat 0.1 differently from 0.2+: 0.1 didn't specify the PSCI SMC/HCR encoding, meaning that KVM implemented something that was never fully specified. The VMM has to provide firmware tables that describe that. With 0.2+, there is a standard encoding for all functions, and the VMM doesn't have to provide the encoding to the guest. M. -- Without deviation from the norm, progress is not possible.