Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1948965lql; Wed, 13 Mar 2024 12:45:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWy9XYgm+wZlaP+9egirJYzfPWI85Xqx/B58iOMAPjvMhnhHKRjOVPYtOeBRZXBu/I4acxu183ib54vfUsZM37V9WPSzyqQYlk/DY3kXA== X-Google-Smtp-Source: AGHT+IGntgBGcbmcGvqMtsF+prW3aPFSZzudxUNEhjGq+rwi7KGjRI9UVKHVS3yd+ydmPANTz4/Z X-Received: by 2002:a05:6e02:20e3:b0:366:7aac:cbf6 with SMTP id q3-20020a056e0220e300b003667aaccbf6mr1235462ilv.16.1710359142362; Wed, 13 Mar 2024 12:45:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710359142; cv=pass; d=google.com; s=arc-20160816; b=MRwznuT51+e4TKp2Y5QWR/hRXz8xRFZ3TDWnklONEvNpI9UDANt5i/j7UUBPX5y5tW 4p0jNNvbc+GU/0Nz4WL78vNXZwHEGk7jM/6c71Rf5BbObkcZFZCszfCpeSesYeOuP9jE yQtqUzEPNz7kgMrSMuY0F3uyJX19VDBX68UeGgcu+ac9ZUn8/gkbseb2g4uQyfmG+wdR Kn1UJJNjLCiXbGoxsN0IdYyW8lhhchH2pSgVd+hRPwF2yvDLfHiRJnOM3AeGM0Uqn/Iu trzZvpDIT2s8NsLrbMA2/XS0wV1t8TnqK+45Qk2YsU9AUn4CldpnUJH1dMQSFWAH9Iju RUaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:dkim-signature:date; bh=Dk+nf9vh0nOvWNFnphPCv/gkG9LNigZwfhqnSK2cUmQ=; fh=byi0xiEZOPMjiUbS06N6FmxOgCtV/29Ph/uum1HV1cY=; b=hgEr5MiF+QcNWHDK6KI84h97gQHTPd138IvzYEAJdI+vFFRvcEz6Veah0XerkE1KlP 0HvAAwSEddhixLvDwZNRHvXkH/NWyjDIAMFRX6FKz5Bbn1dOrfVNkJeie491nGO9AwRT 0wwFw+k9V5zB/i/M5kadeiS/ZwzEnkL/9CcfyHvNdDAkHmsXy0yYskZIT6AaGzr6cVKT 5NhN531Sjl/CEDBZgbJuAL9hb7E7tZp6Br4N5/6Awp+GHAUw5Edx8AQYvvWJepN8gQRA ZS8zeBqkzskE4TSLmtPlqjf1Ft1FpJv5oTZi0sXCkDT42KEywwBnjFioaMa46H72eU3Q G3hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=jQHCEXmc; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-102445-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102445-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i3-20020a632203000000b005dc82fb4b3bsi12834pgi.742.2024.03.13.12.45.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 12:45:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102445-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=jQHCEXmc; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-102445-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102445-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1DE7D28BD83 for ; Wed, 13 Mar 2024 19:43:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D82204BAA6; Wed, 13 Mar 2024 19:42:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="jQHCEXmc" Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (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 3F50E4D9ED for ; Wed, 13 Mar 2024 19:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710358972; cv=none; b=W1FyP4cj3wDbrYBGoGWa/aOiI2QmBDxiWK/Xzzv19amT/2GsU8P5C0NPgIpANli65V5ePdB9wa7N0dEi+kxC8oQ2OYAOUGUzMB8ghR3HrK9TPZ8GNSfoPB64XrkXqYzGmH0oq65Y8mPvtQ9TX1QZ9dOKwbybozFCCWO02+cqfxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710358972; c=relaxed/simple; bh=E+jLFz1+KAMdfFOIEDPlUwPmAJ/O4s0jS/Ky0Fcqb9c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=na9VDQvn6SxAdoQQMNjN7alHw7FIZCFxPi3096B901a5Vr3i5vCKs7vBDYdApyEUomCkoy5i3sYFYoae3L3AYFulPDMFQuJUWaszojy0mIC6IyxcyPzFk+4A/409mRldR+PKVYAxKrVYc7iqGpIUOMgpGiRzw6UpnxxyQPrMOBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=jQHCEXmc; arc=none smtp.client-ip=95.215.58.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Wed, 13 Mar 2024 12:42:39 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1710358968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dk+nf9vh0nOvWNFnphPCv/gkG9LNigZwfhqnSK2cUmQ=; b=jQHCEXmcdKpEnoJmAzzx7S4DkZ6npgZkz9+EDG59h2VMgjNuBFBiLgcwV1NE2R7OgC0+Cj KTWfhUFQcnFWNNmvdw2IXL8AcJYSVF1X75rL8yZlR6w4e/ppsGqaRzCLaAuqWVuOiR9V8l RQ/hqGQkwmV1rszlm0/Y6IwwDmZzmAI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: David Woodhouse Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Paolo Bonzini , Jonathan Corbet , Marc Zyngier , 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 1/2] KVM: arm64: Add PSCI SYSTEM_OFF2 function for hibernation Message-ID: References: <20240312135958.727765-1-dwmw2@infradead.org> <20240312135958.727765-2-dwmw2@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT On Wed, Mar 13, 2024 at 12:53:45PM +0000, David Woodhouse wrote: > On Tue, 2024-03-12 at 08:47 -0700, Oliver Upton wrote: > > Hi, > > > > On Tue, Mar 12, 2024 at 01:51:28PM +0000, David Woodhouse wrote: > > > From: David Woodhouse > > > > > > The PSCI v1.3 specification (alpha) adds support for a SYSTEM_OFF2 function > > > which is analogous to ACPI S4 state. This will allow hosting environments > > > to determine that a guest is hibernated rather than just powered off, and > > > ensure that they preserve the virtual environment appropriately to allow > > > the guest to resume safely (or bump the hardware_signature in the FACS to > > > trigger a clean reboot instead). > > > > > > The beta version will be changed to say that PSCI_FEATURES returns a bit > > > mask of the supported hibernate types, which is implemented here. > > > > Have you considered doing the PSCI implementation in userspace? The > > SMCCC filter [*] was added for this exact purpose.? > > > > For the purpose of deprecating the in-KVM PSCI implementation and > reimplementing it in VMMs? So we're never going to add new features and > versions to the kernel PSCI? I'm not against the idea of adding features to the in-kernel PSCI implementation when it has a clear reason to live in the kernel. For this hypercall in particular the actual implementation lives in userspace, the KVM code is just boilerplate for migration / UAPI compatibility. > If that's the case then I suppose I can send the patch to clearly > document the in-KVM PSCI as deprecated, and do it that way. There probably isn't an awful lot to be gained from documenting the UAPI as deprecated, we will never actually get to delete it. > But to answer your question directly, no I hadn't considered that. I > was just following the existing precedent of adding new optional PSCI > features like SYSTEM_RESET2. Understandable. And the infrastructure I'm recommending didn't exist around the time of THE SYSTEM_RESET2 addition. > I didn't think that the addition of SYSTEM_OFF2 in precisely the same > fashion would be the straw that broke the camel's back, and pushed us > to reimplement it in userspace instead. I do not believe using the SMCCC filter to take SYSTEM_OFF2 to userspace would necessitate a _full_ userspace reimplementation. You're free to leave the default handler in place for functions you don't care about. Forwarding PSCI_VERSION, PSCI_FEATURES, and SYSTEM_OFF2 would be sufficient to get this off the ground, and the VMM can still advertise the rest of the hypercalls implemented by KVM. That might get you where you want to go a bit faster, since it'd avoid any concerns about implementing a draft ABI in the kernel. -- Thanks, Oliver