Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp955671pxw; Sat, 9 Apr 2022 06:25:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaGiZF+aUndsKZzUUyTC1ou+TX1g/22QLOfDIvJSzF6+zpNXaxNKjeJ8SS+TMSvUL7Ne+6 X-Received: by 2002:a17:902:8483:b0:156:a18b:59ca with SMTP id c3-20020a170902848300b00156a18b59camr23784562plo.122.1649510719940; Sat, 09 Apr 2022 06:25:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649510719; cv=none; d=google.com; s=arc-20160816; b=w1PAKsmC6rj/pzemDbcaePMWdPYArIeow/3RVQ+grjBvPpY2Nbkh1ZRN7OTQaoOmv8 SBkxJX1bFU8oX8oS/PwHL5ks2dphnDvK6afn51rW/iKHdvOdcJmMElqaeyfbIw9lg/Ec bq0bJoXwqPEJr3Z0ubvdTwNo+s+PBPb7tA1kpcT6szyGpDaJfsPWCccfeIEW3B5+yOff C1ScE54DGTOAQs6xhwhJ7Ay6cGVPGQnirtw9hU0pJbwG+x+y461OJW0uWOcwJrHBiB7l LUMiAKiumtJdTuLiu/zEEsV1nn5bYl6J06RGqhVr9+q4R44bi9f4/m3gKKUM9+MUHHoO H4UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eWqSaaArcKpWGewd/PpIagLrNxnVfrX7eeJw2V+0bsU=; b=Shq9i2PJmLHf3uhVfsV8RKT2CYQb/pjNt4ZQckh/T2EEwhYe38mzrirErdaP3mScvi 5WjO47Tu9BsS540v8FtKW7s89S/ST2l8SjTPJGaIj5Sxlg7hB4XGxsT/ADdLbmANMKsA es+z4izbBGCpHjSjwfaL+8R7b4zFS5izXdMFEfWxgOagDTeXcqQt3un3oRvZxSAk/+N0 8sFv6wndTLkm/YQu9CaOG9rXO1VHZ4lBnjdxUEh5TfD6jJeAwo3SLwmyx6VVDFn9+F6v xz75RYhWXr5G6knX4TP9ypVrm6EtW7dZoq69+LG2VG1vOnTAqM3ecKIZO94z0/ucneZE jWXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="e/45W54v"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v19-20020a62a513000000b005056613c606si3637703pfm.173.2022.04.09.06.25.05; Sat, 09 Apr 2022 06:25:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="e/45W54v"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237537AbiDHRDb (ORCPT + 99 others); Fri, 8 Apr 2022 13:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231248AbiDHRDa (ORCPT ); Fri, 8 Apr 2022 13:03:30 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 779261A6E59 for ; Fri, 8 Apr 2022 10:01:26 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id y8so3709148pfw.0 for ; Fri, 08 Apr 2022 10:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eWqSaaArcKpWGewd/PpIagLrNxnVfrX7eeJw2V+0bsU=; b=e/45W54vRn2wXoqJKapVjNEBlsEKPzVALK2ZnAsyFTU2/VLcvfFN2z/PxuDrnf5yYr wzIZFXscKl8tHOtv/5026QUqf5dZEVpW5xXL+BJhaMbKHsMcXaLbg3UDu/MPSYtSCJpD NStDS1RhCtWJEloYe2nnA9d03udZ98pC6ACDsUDlQiTQARKIv5X7uaNW5SFBVwO/MRUA le3GLs6AS9o+aCulMgFQ/uPSlx88/hkf0J7s+PGqEP08qCYcHxEd+xmJzW+0539J/wiV XZmLF7RhSiYxp0yJxVQXu2Fh70FpHZTcMsLNb16H5o5qr/tR61TwEg60MtEePoW/jwCf t7qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eWqSaaArcKpWGewd/PpIagLrNxnVfrX7eeJw2V+0bsU=; b=ZdSFCug4q9Msap9O8iiJWyyTBcx+eY0bUUEZgyeiQin8OGic3vE9rP3cAfvIrt+A2L rd13cHs2K5Vctk1gFEXS3s2S7oaQv/i4Ew4xrLTLKrZPRoYtaEy4PAtU4Pu4TVk9uanI ISRhYf4+fUXJn4ZX3+IWugmfexkDaB6OwRcUKB0n9UH2Uq0K/y42VGQrEGe2z8IxUbM2 B1y5/5auOY1U37BlnkwirmDd5OCFebqV3p77Tlz7rpqD/F27Z8Af6VDwxRvhiTE+IRB2 rbm1WDWxwVZfYV11Xy124u+/vkILyL72vTzOCNU6QQdfaW2AjdkjejdBDmoaRZKJQJJO JOGA== X-Gm-Message-State: AOAM533vigMijZXVCdF/wJU95qMXmkep7skbMhWjEjuzcLcq6SQqMnAB 9aPvTtm+KlpnV8Sf3JjBZ3mWdiIVambcNw== X-Received: by 2002:a05:6a00:1312:b0:4e1:58c4:ddfd with SMTP id j18-20020a056a00131200b004e158c4ddfdmr20443717pfu.65.1649437285741; Fri, 08 Apr 2022 10:01:25 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id e19-20020a637453000000b003821bdb8103sm22268448pgn.83.2022.04.08.10.01.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 10:01:25 -0700 (PDT) Date: Fri, 8 Apr 2022 17:01:21 +0000 From: Sean Christopherson To: Peter Gonda Cc: kvm list , Paolo Bonzini , LKML , Anup Patel , Will Deacon Subject: Re: [PATCH v4.1] KVM, SEV: Add KVM_EXIT_SHUTDOWN metadata for SEV-ES Message-ID: References: <20220407210233.782250-1-pgonda@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Anup and Will On Fri, Apr 08, 2022, Peter Gonda wrote: > On Thu, Apr 7, 2022 at 8:55 PM Sean Christopherson wrote: > > > > On Thu, Apr 07, 2022, Peter Gonda wrote: > > > If an SEV-ES guest requests termination, exit to userspace with > > > KVM_EXIT_SYSTEM_EVENT and a dedicated SEV_TERM type instead of -EINVAL > > > so that userspace can take appropriate action. > > > > > > See AMD's GHCB spec section '4.1.13 Termination Request' for more details. > > > > Maybe it'll be obvious by the lack of compilation errors, but the changelog should > > call out the flags => ndata+data shenanigans, otherwise this looks like ABI breakage. > > Hmm I am not sure we can do this change anymore given that we have two > call sites using 'flags' > > arch/arm64/kvm/psci.c:184 > arch/riscv/kvm/vcpu_sbi.c:97 > > I am not at all familiar with ARM and RISC-V but some quick reading > tells me these archs also require 64-bit alignment on their 64-bit > accesses. If thats correct, should I fix this call sites up by > proceeding with this ndata + data[] change and move whatever they are > assigning to flags into data[0] like I am doing here? It looks like > both of these changes are not in a kernel release so IIUC we can still > fix the ABI here? Yeah, both came in for v5.18. Given that there will be multiple paths that need to set data, it's worth adding a common helper to the dirty work. Anup and Will, system_event.flags is broken (at least on x86) due to the prior 'type' field not being propery padded, e.g. userspace will read/write garbage if the userspace and kernel compilers pad structs differently. struct { __u32 type; __u64 flags; } system_event; Our plan to unhose this is to change the struct as follows and use bit 31 in the 'type' to indicate that ndata+data are valid. struct { __u32 type; __u32 ndata; __u64 data[16]; } system_event; Any objection to updating your architectures to use a helper to set the bit and populate ndata+data accordingly? It'll require a userspace update, but v5.18 hasn't officially released yet so it's not kinda sort not ABI breakage.