Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp132486lqo; Wed, 27 Mar 2024 08:46:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZ7ri64JXAeXjAgVn7WPAP/VKhmNEexC/EYtP7Qr0vvs0OMfiCkTi84SPE0kwTf0wjIBn+TGizmRjNsMsYYNBBCvRcOmU85GrZpg+/VA== X-Google-Smtp-Source: AGHT+IFKjsc+nZRGYuUAUsF4YlOQG6QvRWzSVVwM2xsUOjExewVyZFkivNGr8Ml+bTODc5RzpUZQ X-Received: by 2002:a50:ba8c:0:b0:566:13a2:3008 with SMTP id x12-20020a50ba8c000000b0056613a23008mr147710ede.6.1711554359930; Wed, 27 Mar 2024 08:45:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711554359; cv=pass; d=google.com; s=arc-20160816; b=dVJKThOkSUFTHTyx04CZ4cHewh884txBnOFPm1Kfv5EvITT/ZS407N29z7nU1/QSkn PeL0Ok76muESjuD678IQOvV3WJjkv9+P3mn3oYkzl0dxZizaGUzvok8dA0nalUR185CL LqfaImg0fAa+BhRqFGNT0lAYscm9tfsqrcqEoaXydP+81Pf24i69OshIgLCgTpffeJ7O VvRTFnpizF/fEDVxo3U3+yTFayF+69ofud9+uyq/bv7HAA/NJzaj0jf5X/lD4FqIg41M riKZ4WRXQxhjQgHG7TpJkY33BMiUECVHsRWPe46Rl1MQOKztPK8/4BFve8VJNrihjO7h YZ8w== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=4tRalu8FOta6Y/r2B8r45fT9b9+dbekZse8M+vViylo=; fh=NOzzcwpGCCVd3KhMilQXeBbCRmtNVEnUdr1sER8Xt9E=; b=Nh+bfGNni/vR9dWSN3HTEvxwO74uNwL4TXZCYx5hG6KA/ZMOZTo1BE2MXdU0Qu04t3 U83ufGOMuFly3QaqzNFsWww8vrR6pXNynRmgS1MP97MPZWuldY2Yq9pVGZChkzSIKTFh fUszqGDWc7q021PKthziYdWdiPh4FATs7+Cm0R+rfq38hOSGGRWhUanhG0ixVUkXOzqh Q9Fu9P7RQifnNMvNhKi7p87mRFczWoKeT0peQAehMoyRfas0DsCbtAD9b9bHPwE2GPrt YslGKPiwbTDeGkYNL5rgKm+XSyzHTLyNmC/B48bYOw0oE3lfnjRcr01KYwpzni9TagaX mWXA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=neutral (body hash did not verify) header.i=@alien8.de header.s=alien8 header.b=Zb53IOBN; arc=pass (i=1 spf=pass spfdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-121554-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121554-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t23-20020a508d57000000b00568d3c2a337si4619391edt.692.2024.03.27.08.45.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 08:45:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121554-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=neutral (body hash did not verify) header.i=@alien8.de header.s=alien8 header.b=Zb53IOBN; arc=pass (i=1 spf=pass spfdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-121554-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121554-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alien8.de 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 7C96A1F32CD7 for ; Wed, 27 Mar 2024 15:45:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9238A130A43; Wed, 27 Mar 2024 15:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="Zb53IOBN" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (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 607BC12FF93; Wed, 27 Mar 2024 15:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711554226; cv=none; b=Jmj9FutFo4/Z1hRg4sWqu9WuXALE9QabuK2bNuUXTdDkW3G/1Qcpvn1WroRCzinzGHRfS1Bpjj2ZewNmppHFi21tgGI88l4cUkSo10/GBxKe3gnzHzSlflRX6y5UOsJTb/Qfrvoab6W7TqcV7UFLjXpVQMbMowfEW6k+2gbLyVU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711554226; c=relaxed/simple; bh=CwLgVLbFhdWZlf6OpWoWmOPSI+MJO8D+fJmBdVcWK00=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=koWXjHz/HHyVO4iGBhosR48jteyVlKr5+ppER7WXdy7ZFgC15PP4cgPIQmYpLg5HKhDwyF8sn/Mb9HhDNSe+tesZZ0goeLDMdAuBt1I7C9zrwGZUnfNbebZ0BkReZC3+iXnjIaWjIxAJ2/OH+uVpZ0pvQn+qBwvxh7iHfdzn/1Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=fail (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=Zb53IOBN reason="signature verification failed"; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id 0ACEC40E016C; Wed, 27 Mar 2024 15:43:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 4MF7391Yt6C3; Wed, 27 Mar 2024 15:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1711554212; bh=NBcRvx/bwn4OFth+fx2rkp+KytsfIQknXzG4/vs/N2U=; h=From:To:Cc:Subject:Date:From; b=Zb53IOBNca+6CXTKcM+KRd6Jc913BYVkCD5R4jNgC2g7Y8BL3jOIAd6P49eHdnZ8A fDXJrHIbpZgY75xN5QnUNuR0IU+yh8djTL8wE1nvn3NKGnCdFFWYTaMajc/C1KCCJP /6uGqGY6Hif0Hs02iEX8V/nxXA5X4ApexNXG27XR8F059A+RytqKWlqqMUTtXnXowj ROJAYXnjcqQZ14FX7PSQ4/1uiQWvTOGZ5+0AiJD/kuG1uuhfj4fslN1BwZ3GLhiGtK Mjs9mgtG1KXnb6QwYtpyHiIEZqIANlSRMqmqAJrmaUjbpD10E30cpfwFyk1nvi8R/8 fdFAbsV4PM1XDMvBDtnoTEsW37HaQPYg58IDfpCeY9rA2Le4PjJ4YDSCIAyeyHpjls W7n6h7IINBEmDVOUYnPGhwlt2ZFWqFKurfDWwsVa633YFjh/fwpS08Y7jEQ7Y2S4Ke oGJbtfcbZX0/F8XKe2L40wmS9EppxnpZA4Jjd1KNHLDeYcjSLZM9f9Q7+17tJKoZN+ OtFLOD+yP5o/YUF9UbUOAjf2LGlJQOkjiAIKaPTHkck/ViQXGdNVdvcGbFfZpj/19s 35deHR57RRHo7au5LcO7x4sYZR+24P8/I4dz4PE/iWCGh691hja2JA6nkCYYrCj9pO CeM538tsNMW3MD0ygJe5p4sE= Received: from zn.tnic (p5de8ecf7.dip0.t-ipconnect.de [93.232.236.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 4EC8B40E02A5; Wed, 27 Mar 2024 15:43:25 +0000 (UTC) From: Borislav Petkov To: X86 ML Cc: LKML , KVM , Ashish Kalra , Joerg Roedel , Michael Roth , Tom Lendacky Subject: [PATCH 0/5] x86/sev: Fix SNP host late disable Date: Wed, 27 Mar 2024 16:43:12 +0100 Message-ID: <20240327154317.29909-1-bp@alien8.de> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: "Borislav Petkov (AMD)" Hi, the intention to track SNP host status with the CPU feature bit X86_FEATURE_SEV_SNP was all fine and dandy but that can't work if stuff needs to be disabled late, after alternatives patching - see patch 5. Therefore, convert the SNP status tracking to a cc_platform*() bit. The first two are long overdue cleanups. If no objections, 3-5 should go in now so that 6.9 releases fixed. Thx. Borislav Petkov (AMD) (5): x86/alternatives: Remove a superfluous newline in _static_cpu_has() x86/alternatives: Catch late X86_FEATURE modifiers x86/kvm/Kconfig: Have KVM_AMD_SEV select ARCH_HAS_CC_PLATFORM x86/cc: Add cc_platform_set/_clear() helpers x86/CPU/AMD: Track SNP host status with cc_platform_*() arch/x86/coco/core.c | 52 ++++++++++++++++++++++++++++++ arch/x86/include/asm/cpufeature.h | 11 ++++--- arch/x86/include/asm/sev.h | 4 +-- arch/x86/kernel/cpu/amd.c | 38 +++++++++++++--------- arch/x86/kernel/cpu/cpuid-deps.c | 3 ++ arch/x86/kernel/cpu/mtrr/generic.c | 2 +- arch/x86/kernel/sev.c | 10 ------ arch/x86/kvm/Kconfig | 1 + arch/x86/kvm/svm/sev.c | 2 +- arch/x86/virt/svm/sev.c | 26 ++++++++++----- drivers/crypto/ccp/sev-dev.c | 2 +- drivers/iommu/amd/init.c | 4 ++- include/linux/cc_platform.h | 12 +++++++ 13 files changed, 124 insertions(+), 43 deletions(-) --=20 2.43.0