From patchwork Thu Sep 8 14:55:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harald Hoyer X-Patchwork-Id: 12970233 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E537C38145 for ; Thu, 8 Sep 2022 14:56:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6EE716B0072; Thu, 8 Sep 2022 10:56:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6771B6B0073; Thu, 8 Sep 2022 10:56:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F11A8D0001; Thu, 8 Sep 2022 10:56:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 394E96B0072 for ; Thu, 8 Sep 2022 10:56:04 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id DE07F140A24 for ; Thu, 8 Sep 2022 14:56:03 +0000 (UTC) X-FDA: 79889218206.24.BCB6C01 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by imf03.hostedemail.com (Postfix) with ESMTP id 5ADCB20070 for ; Thu, 8 Sep 2022 14:56:03 +0000 (UTC) Received: by mail-wm1-f42.google.com with SMTP id k6-20020a05600c1c8600b003a54ecc62f6so1970835wms.5 for ; Thu, 08 Sep 2022 07:56:02 -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=vg0W66CMrnL7MKzmixCclURL2/dNWuUsEoZDrLCGdsLP0WqZGS39c+yuYevHzW3H/p CIJ5ccs5Aw1H92w8lA/K591r5s+OlxJ35Sjm/iK+yaaOPZ2+zTs4kGO/40kgVjesjXqj 8wKyGQ9S9iefP7UHV3JBZpD7It61qCqHXQLlBdXBg997Ignr57EbM5MgY02+ltBT4DHq uU5mvmsuw1rQRsUodr6Ldhkwfyhu6sDOFlDyz3VwRLJGe/xfLMUSKwoTFjVMBjaX0nxJ /oXjQNcbaeLYi0R9l77Kc8JAuqYnIX2h9RuLj5O48nA4fAkNj6doQWlrQUjeekyQ9bsY zSzA== X-Gm-Message-State: ACgBeo3nZ340e2PwouHLfSULGaTkSiQFTzUZpS79hs7Z8S8cdlHCxUoB DYsmp5QCuSxoYxSTOVlwo50/JA== 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 ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=profian-com.20210112.gappssmtp.com header.s=20210112 header.b="A+h3uk/z"; spf=pass (imf03.hostedemail.com: domain of harald@profian.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=harald@profian.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662648963; a=rsa-sha256; cv=none; b=IXTE7HViLIXSusohD8mSkfok/XM6VRZAUqK0gy0C3oEv0/pBmRvSPbouRqFFF1fG88z9wB kPg7q4v/93S9Cd4A/tIP+cSkN0dT/o9hKRFQ+kziYOsXi2Y7F8mvrj4fibPVwfcyxXvxFw JmkikmvWRK1VD1dqTyLi1BHcKQZDS8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662648963; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ryNqK5MU3hvexcP0lqXzZYDdmqazm1TBDaWSc1Bec88=; b=NhWSxsqjPryBzpprl/qaIGk5tNYoc7KHXHvS3B6tCy1UG9I3PKgz5z1yHdfbGoK3z8z3tO pbQGWDNnPawX423HmGSlvTtUzYkFMsZC+N2G8TZRDCYiF9i/OZiecENw8o0opqbVg62qTj MfQ4JBiNt8teTynqLPakxL1Lz2h/WQE= X-Rspamd-Queue-Id: 5ADCB20070 X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=profian-com.20210112.gappssmtp.com header.s=20210112 header.b="A+h3uk/z"; spf=pass (imf03.hostedemail.com: domain of harald@profian.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=harald@profian.com; dmarc=none X-Rspamd-Server: rspam04 X-Stat-Signature: xgbnqg9o137art6qp38cpeti7yaxakt1 X-HE-Tag: 1662648963-998610 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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, struct kvm_sev_cmd *argp) data->id_block_en = 1; data->id_block_paddr = __sme_pa(id_block); - } - if (params.auth_key_en) { id_auth = psp_copy_user_blob(params.id_auth_uaddr, KVM_SEV_SNP_ID_AUTH_SIZE); if (IS_ERR(id_auth)) { ret = PTR_ERR(id_auth); goto e_free_id_block; } - data->auth_key_en = 1; data->id_auth_paddr = __sme_pa(id_auth); + + if (params.auth_key_en) { + data->auth_key_en = 1; + } } data->gctx_paddr = __psp_pa(sev->snp_context);