Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1183457lqe; Mon, 8 Apr 2024 00:44:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVv7IaBEFQERSv9O6t5LRRuWXWQsfsAIlA+que37zZ0MDfW2Eo4opVEKMo9iQ0w3jVj3wFiOtdHllgk97LkAPe0TUCma1BuAX3FJ9wpkg== X-Google-Smtp-Source: AGHT+IElwJTGNNzRm9yo09YySbgO+t3EykD0GmTk2giqbEPCVlCTnYQw+9U2agEmHHln1xQQp96o X-Received: by 2002:a50:951c:0:b0:568:32cc:f808 with SMTP id u28-20020a50951c000000b0056832ccf808mr5360858eda.15.1712562287957; Mon, 08 Apr 2024 00:44:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712562287; cv=pass; d=google.com; s=arc-20160816; b=ODAATMwV57SyY+F1nqteyYQP7vnKxpel6X30p3DhcrJMUgw4AF1tfhS+PrOuuFVVDs JLco3cpkatBytiSWUhIyADsUJBH0JSzLi6DYnvAUxsS5Ddu0oR1UAYe/T5N8rTGwbN4k gwxAp1HQU0v8MFgIKfuRY4zOPn85NG7ZNlkRleFDsTCmlNL0dshP9fXYT0zWxopRTs5r g0MwFN1BraE68LiSDJZA8mPJ5egSKhRQAXnrqT+tbw5IJGS30y6vL4TkfTB+4KOT5yxg jkITGryN7TE6fQkKInMBWCci8Iypx+rNkKwsy2/8wMhKndEVAvksrqMdKHc/V9YHfBkh WvEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=vffWxrDfGUfj6Dj40L1W41htTqoat8lNT1P/loOuIyQ=; fh=aKj5Mw63uqZyteD927sEcqhxW9pkRHbFiuAaxBBy3pg=; b=io2D1S/bUki3innb6JHJbO7WMdH8ujG4VZrsLxoqJPw08GqhwMOWrFWCp2MyDG2tHO pKzBtrt3JbmMPKGCP4ZemVoEH0/7JVRmeLhy5+CW5pfi6f8ByNzeWbz+T5Lcx3wU/Dbs WPkYAOWFkmR49brPZ48lsf5C93sT/yTz5c6D2NHnR8vCdKMvDSHJiufCN0m+HMxV4LDs /n5/O1kZhiTG4evvGDopCJzN/nGyJBey1hq6Uver2VR7WM1nxIPDozczjT0Yh6nnvYJT aCur8tOR9/9vYVUzs8bi1OE+0DV8eCMOv4JWNz9Zz3UFoywgjqWujZnf/9kMJKgr4vRu wJyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QI+1jMXt; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-134924-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134924-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h4-20020a056402280400b0056e1f5e3a15si3435345ede.183.2024.04.08.00.44.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 00:44:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134924-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QI+1jMXt; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-134924-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134924-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id AD4371F21A79 for ; Mon, 8 Apr 2024 07:44:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF75C4F1F1; Mon, 8 Apr 2024 07:41:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QI+1jMXt" Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EA824CDEB; Mon, 8 Apr 2024 07:41:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712562084; cv=none; b=AHWAoeyQctD33MMLSgnfKufOw3/q8n8TzRKb69Owij5mTjIRFvZJ+2wLmrecvTDfSWwEDcRt0ktfRJNHfcdtg1FxO846lOiiR6kwujBf/gdzw29ow06KtunJP5ewhZPIG+GXJYQFzL9XRbJVQilz+o03VyIlF6lFhWvJ7xOXPsI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712562084; c=relaxed/simple; bh=nraWtElHPDcy4J/h0QtFNZ3iGaE/9eKaPhhvDhuTS7E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rtp+XXSgKdpxWm1FBW264DLZGx/7rfYWXxBj2Oyyl2Nfst1Jh2wX28c+m1+0JriFv40E2ACXgHcLjKy3mbXfJeUEG9gSiYVcJavh9XILZc1ttlmN8SAZ8QPZaKGO4lr6nyxpvcJdvvKj0N3yxwtStfz3TPr1sp6ZR1LaK0ZVirc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QI+1jMXt; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-343eb6cc46bso1779572f8f.2; Mon, 08 Apr 2024 00:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712562082; x=1713166882; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vffWxrDfGUfj6Dj40L1W41htTqoat8lNT1P/loOuIyQ=; b=QI+1jMXtrOyg9JVBH2Cr6J/COjhVfEtrHoh9D42fi+GJdTGLWU8G1HrxAmlkCJOIFH n6i4/3O4CIDYHW0EJdJy/eFAxxHkxuEsP35TYkc14sgH86e6nSs78jMc6Fx3dHDRKEKU 3EeAhZv7F6RVEY6Aw6Altc4a6Oa/hSVENdtlymy1WSJ1XaG559wvQ7sD2Lm7xIYR0M1x QZJDiON87uPXpA/5FS+eYAM1lON2G1IkXyXjZYgBKOuJnNrVUCSfBTY2rTcW2kRlDNEn 0QkJzK7UALm4SA1Tn0pi7eyWV3JhoOmZFYJYsTUvnw2a9vfm6hH55WauXor6EOlCr+l+ WJvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712562082; x=1713166882; 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:message-id:reply-to; bh=vffWxrDfGUfj6Dj40L1W41htTqoat8lNT1P/loOuIyQ=; b=u9zbfX6TD8Qd9GuCZTgDbrWUIKJTQIBEgJ7nH2cvfGgMUdQplj340sY2ZJlTMy4OpN g2oZYa9shimwebPhyb+I8R/WBQtrAVXdVmIL4JDsYy//Kv+CuAXQDf4EAfb0KL9pEDMM Oj2vdc0/OwQqjzW/LbSOzxfR/stnYOlTnaY1VerxVuEeq48xq7M1HdzXr5dngncpXF+d EjzS7YsdlqUyu6MkOkRSo4k/dT0s2NWCfZ+ybkuHVLgBv/t3N+ljqK0wSw2IOWJaURcc qIoFuKofjl/RH9HkyyYsmgAAeNYEjId/BUY0qqLc0NAwZDNczC/5PX5XCUl4EOChQS99 9iyA== X-Forwarded-Encrypted: i=1; AJvYcCUlu4fKySxUn9i2OqnbXHK3YSd0jIWC7qDrdGGStmPHHIlS4FllXIU6eoKDdl5ak0zzsnp/LFs6HdyEtHKZXQE0O8t/4kX9wYCP1W1lSY6Pl8V6ippgWLIiQlYaMpwqPH/aUPjiVaa1+uTDTgmf3ykD1cqc11jF1fG6 X-Gm-Message-State: AOJu0Yxs4GCzCHHOpigPicUSMkhldcxsl53HkkLmxFP1cU9JHnt5sQXy +arpeWUjFyHvMUbU+iv2UYagqjSb/ZxOeEcE8cIGm473/sSZC4Q+ X-Received: by 2002:a5d:64a2:0:b0:345:b238:534d with SMTP id m2-20020a5d64a2000000b00345b238534dmr1768262wrp.28.1712562081667; Mon, 08 Apr 2024 00:41:21 -0700 (PDT) Received: from vasant-suse.suse.cz ([2001:9e8:ab70:9c00:7f0b:c18e:56a6:4f2]) by smtp.gmail.com with ESMTPSA id j3-20020adfff83000000b00341e2146b53sm8271413wrr.106.2024.04.08.00.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 00:41:20 -0700 (PDT) From: vsntk18@gmail.com To: x86@kernel.org Cc: cfir@google.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, ebiederm@xmission.com, erdemaktas@google.com, hpa@zytor.com, jgross@suse.com, jroedel@suse.de, jslaby@suse.cz, keescook@chromium.org, kexec@lists.infradead.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, luto@kernel.org, martin.b.radev@gmail.com, mhiramat@kernel.org, mstunes@vmware.com, nivedita@alum.mit.edu, peterz@infradead.org, rientjes@google.com, seanjc@google.com, stable@vger.kernel.org, thomas.lendacky@amd.com, virtualization@lists.linux-foundation.org, vkarasulli@suse.de, ashish.kalra@amd.com, michael.roth@amd.com, Borislav.Petkov@amd.com, Dhaval.Giani@amd.com Subject: [PATCH v5 10/10] x86/sev: Exclude AP jump table related code for SEV-SNP guests Date: Mon, 8 Apr 2024 09:40:49 +0200 Message-Id: <20240408074049.7049-11-vsntk18@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240408074049.7049-1-vsntk18@gmail.com> References: <20240408074049.7049-1-vsntk18@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Vasant Karasulli Unlike SEV-ES, AP jump table technique is not used in SEV-SNP when transitioning from one layer of code to another (e.g. when going from UEFI to the OS). Signed-off-by: Vasant Karasulli --- arch/x86/kernel/sev.c | 6 +++++- arch/x86/realmode/init.c | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c index aa53e8eb4cd5..d915d9158926 100644 --- a/arch/x86/kernel/sev.c +++ b/arch/x86/kernel/sev.c @@ -1392,7 +1392,8 @@ STACK_FRAME_NON_STANDARD(sev_jumptable_ap_park); void sev_es_stop_this_cpu(void) { if (!(cc_vendor == CC_VENDOR_AMD) || - !cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT)) + !cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT) || + cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) return; /* Only park in the AP jump table when the code has been installed */ @@ -1468,6 +1469,9 @@ bool sev_kexec_supported(void) if (!cc_platform_has(CC_ATTR_GUEST_STATE_ENCRYPT)) return true; + if (cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) + return false; + /* * KEXEC with SEV-ES and more than one CPU is only supported * when the AP jump table is installed. diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c index f9bc444a3064..ed798939be5d 100644 --- a/arch/x86/realmode/init.c +++ b/arch/x86/realmode/init.c @@ -80,8 +80,9 @@ static void __init sme_sev_setup_real_mode(struct trampoline_header *th) */ th->start = (u64) secondary_startup_64_no_verify; - if (sev_es_setup_ap_jump_table(real_mode_header)) - panic("Failed to get/update SEV-ES AP Jump Table"); + if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) + if (sev_es_setup_ap_jump_table(real_mode_header)) + panic("Failed to get/update SEV-ES AP Jump Table"); } #endif } -- 2.34.1