From nobody Mon Apr 6 08:08:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D89BC54EE9 for ; Thu, 8 Sep 2022 14:56:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232640AbiIHO4L (ORCPT ); Thu, 8 Sep 2022 10:56:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232626AbiIHO4H (ORCPT ); Thu, 8 Sep 2022 10:56:07 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 820A8E291B for ; Thu, 8 Sep 2022 07:56:03 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id bg5-20020a05600c3c8500b003a7b6ae4eb2so1889041wmb.4 for ; Thu, 08 Sep 2022 07:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profian-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=ryNqK5MU3hvexcP0lqXzZYDdmqazm1TBDaWSc1Bec88=; b=A+h3uk/z3zVLJRHckmNM4YxWpnH5mOtpniwEZgYBiShH8dX2ke8mlhluujBLTZaei9 rjyudPZLRVKoqa/kHk9XhTDRWTKV43CDnaG0QLijNIyvSfrtjtiEVrj0kxDbfaY+ExKT S5DCBpVsRIsn3n7OmhoxhBZ2HYrO2tv189HgUJWmO7wCJcpLLgs+TXtdnwB89i7oREl+ bVaCOFRUFvKec6ZZ+32wyYO5lcjci9ktt29wYfSloA1IuJ9BrNjvCjoFwkZh/k/OZ9rQ TWACHfJtoez2REps42w6sKBP7786aGnvKGae62AysmEoW9BUPSijQNuBTaWxzHhysHeb AAdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=ryNqK5MU3hvexcP0lqXzZYDdmqazm1TBDaWSc1Bec88=; b=8BQ1xFfk7+4ZGBa18M0j2WW1j8ChBzZ8+axkvVGsp2YmoioN6lFS8ZuC4dry6ZInpb 3/DV0Oz0rs9LATS8+wUm5n6ZtMcNnrqA1KgMO284j0CsJ4MehVAAf9MxXVHO7PmVkOj2 g3nFq13vFgUdVjZpkIxQMJ40EBRn3ZouElBNg7W2a6VaoHcsKq0/Fk3bF1etKJEnzVyu 8bkzTHDvIp/s8c9nmlIKqP1wC3ZV+zOvvKkvEG5oadg8YMvH80oVrgYpfMU26tCwc7Cw FDrHw8I4ajas81CVNGeL4p/2DvzrYsH399TEK3DTqUQzZVhgQV4FGfBk/u1A2XuhsGcn q1kg== X-Gm-Message-State: ACgBeo21hzC5fkycPfFLi/UgwNobQrSjromz/MHXa35sp9lxZdgQTmuC NfZXBYJ/j0G+WzGd+u2t7dMWFg== X-Google-Smtp-Source: AA6agR60ZmA7z2Rw4x/+vVZJ8ouM6ug3aiG0VoToRr4xXb6X+ui1JU9//Z03osUcjGe8LanO+R1DlA== X-Received: by 2002:a05:600c:1d1e:b0:3a5:4f8d:743f with SMTP id l30-20020a05600c1d1e00b003a54f8d743fmr2501614wms.121.1662648961741; Thu, 08 Sep 2022 07:56:01 -0700 (PDT) Received: from fedora.fritz.box (p200300c1c7162d00e01b57df2fb57c15.dip0.t-ipconnect.de. [2003:c1:c716:2d00:e01b:57df:2fb5:7c15]) by smtp.gmail.com with ESMTPSA id fc15-20020a05600c524f00b003a5260b8392sm3440304wmb.23.2022.09.08.07.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 07:56:01 -0700 (PDT) From: Harald Hoyer To: ashish.kalra@amd.com Cc: ak@linux.intel.com, alpergun@google.com, ardb@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, dgilbert@redhat.com, dovmurik@linux.ibm.com, hpa@zytor.com, jarkko@kernel.org, jmattson@google.com, jroedel@suse.de, kirill@shutemov.name, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, luto@kernel.org, marcorr@google.com, michael.roth@amd.com, mingo@redhat.com, pbonzini@redhat.com, peterz@infradead.org, pgonda@google.com, rientjes@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, seanjc@google.com, slp@redhat.com, srinivas.pandruvada@linux.intel.com, tglx@linutronix.de, thomas.lendacky@amd.com, tobin@ibm.com, tony.luck@intel.com, vbabka@suse.cz, vkuznets@redhat.com, x86@kernel.org, Harald Hoyer Subject: [[PATCH for v6]] KVM: SEV: fix snp_launch_finish Date: Thu, 8 Sep 2022 16:55:57 +0200 Message-Id: <20220908145557.1912158-1-harald@profian.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <6a513cf79bf71c479dbd72165faf1d804d77b3af.1655761627.git.ashish.kalra@amd.com> References: <6a513cf79bf71c479dbd72165faf1d804d77b3af.1655761627.git.ashish.kalra@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The `params.auth_key_en` indicator does _not_ specify, whether an ID_AUTH struct should be sent or not, but, wheter the ID_AUTH struct contains an author key or not. The firmware always expects an ID_AUTH block. Link: https://lore.kernel.org/all/cover.1655761627.git.ashish.kalra@amd.com/ Signed-off-by: Harald Hoyer --- arch/x86/kvm/svm/sev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 85357dc4d231..5cf4be6a33ba 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -2242,17 +2242,18 @@ static int snp_launch_finish(struct kvm *kvm, struc= t kvm_sev_cmd *argp) =20 data->id_block_en =3D 1; data->id_block_paddr =3D __sme_pa(id_block); - } =20 - if (params.auth_key_en) { id_auth =3D psp_copy_user_blob(params.id_auth_uaddr, KVM_SEV_SNP_ID_AUTH= _SIZE); if (IS_ERR(id_auth)) { ret =3D PTR_ERR(id_auth); goto e_free_id_block; } =20 - data->auth_key_en =3D 1; data->id_auth_paddr =3D __sme_pa(id_auth); + + if (params.auth_key_en) { + data->auth_key_en =3D 1; + } } =20 data->gctx_paddr =3D __psp_pa(sev->snp_context); --=20 2.37.1