From patchwork Wed Jan 31 11:31:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Huang X-Patchwork-Id: 19726 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1821613dyb; Wed, 31 Jan 2024 03:32:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6kSDM1STqCEhi1sUz+bq3Bzq7jWuo0m0Lz/IqGht1QNxyIHGuuyJW0G+tmtOpdS1B4uGM X-Received: by 2002:a05:690c:e:b0:602:b697:dc60 with SMTP id bc14-20020a05690c000e00b00602b697dc60mr1015954ywb.50.1706700747640; Wed, 31 Jan 2024 03:32:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706700747; cv=pass; d=google.com; s=arc-20160816; b=eAzQipeO9Mt912cf4dOJAM4IB/LhRnkaQIkK4i1se5eQa0mInezTBNQSvvuJU6GeAo c0z+wzYEJiwfGrxik4yi/hljZP9HVeWp4QpGYcshzrty2OH+QulVYQwVy6JI6LAuN5sQ lUw7qpXZSQqxyCpLzOGcrhsanBFfrwNm/xIEIYn8qjCRDkNq7H8xVhM1Y+YLKVPcJDnD Z+QXMbcyJohBxvgvbUGzU0cE1ZRO27Pg+qq1Y4ewlbf9ARj7MufTpDzeJHM3GI9Osc0H f/qQ1U9kJqUEfAgG43c+Y8dcQILiIcd70FYQcgqQugd8qXw/kgSdT9b4GTvWNe10mQta qvJA== 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=wYtUp9FKs8+YKrmv8+g76CiZMxgZYaJq+1RqEi9Lpvk=; fh=d0iCnL05/JofZM9P6OJcCfbOmkWovmTVqDrwFaj785Q=; b=ZGn3giaNQ9Xpe1RaBC3sj64CWPWWqeIldl9jmEUC7QWYEVt864E1hR/ov8ZQIVYMY3 qRqm4abvuYTDWb8F73AL8adg4ytOy2avcMLQ1+kUE2opkLlaFpjrqhblQgOjC8UgzVip Q23yn7SCi/y34VUZdC6dTeZcNCHCiGpfmQtjIcqC5bfzs+bArjS93TAytgS6+rz5rY+u 0T+N0bP8P8zMUsEKX3YHQ09V5xJDug0kHSd22w/P/oBk2x/DSNn63Ph4Kna4oWzg+/lO Q74OzbmN7+PqQWKnrXJ6/VugWQffuhhvaZvQRmFZn7YlVaXIGUXpBp0YIWwoPOo68AWw GXzA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aGo0UW7A; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46349-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46349-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCU55BhN/1pJ6iTux1fRhBPcuB2jQHOtNgrK3IR9MDcOwCG4WRO+fWKu7OM1PVbghqBYwLeZIFv6eNIKA7Pi2O6jul+2RQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e5-20020ac84e45000000b0042a86d14617si10889297qtw.291.2024.01.31.03.32.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 03:32:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46349-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aGo0UW7A; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46349-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46349-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1BBD71C21EF0 for ; Wed, 31 Jan 2024 11:32:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ABEF074E13; Wed, 31 Jan 2024 11:32:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aGo0UW7A" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 951B56D1BA for ; Wed, 31 Jan 2024 11:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706700729; cv=none; b=qnl/+1NsdPKkQMkO1RXlLUnljx0eyuXVPOe/uBDaHXzCuJe3fkpUJGS/Jis1c6/wciVNoTJFeZ6rTxgz+u42YYtwaUo72WdoeV16bgld1a89xAGRGMK1jM0FGsx5tcwRfA6XalbmVHO+8ymwJrlMqea50DuG62kaiCK/+TqRLYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706700729; c=relaxed/simple; bh=BMkblpyoANB3IfYB1c0zr/z+RR3pHfH694CCivKN7dg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=sNWUbGZd7hz6/T/TITOX5Wm+5W2/wtoZ3hXQ8nAfmoN2pWNq/D/0AnIMTTOu1VjiFiaFNISIv+LDdnbHUdpVklvZp54sftglMQRB+IPZUWa9KlR/OF3NYCo65ggzNOjU3CaiOQgddgf22OVcLG5L28hbOKjpiQGGkIASVSZxHp0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aGo0UW7A; arc=none smtp.client-ip=192.198.163.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706700727; x=1738236727; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=BMkblpyoANB3IfYB1c0zr/z+RR3pHfH694CCivKN7dg=; b=aGo0UW7Ad6XOguA/YlPIK5+9ZarWH7pXUdxiywHv/XiUZNT6PSLj8B3F +GrMf/retWTyUMCANBWqGJ8fFvVF4HTQ9Cosss9c2T9Bu34Sx1ahNyiUL UtN5VRw45h9IkKSzjlmg9aLMR5LatU2wh+D/zYdKctfCy9DtyivJk/1s8 G9i8hJ89/DHIJL5DcesDnTyVefCwnL+fT4ZLHR+dsYbArhHO/aVhwCv+X ScVg/9/lXx/VHLQsvRjgx+KC57tE5J7pQQDy5O5hLZNLUn7nfwob7X+gc Ht9iY2syCNCjMjHph6Woci8OQdSuEADeSo0ZWY6mvfU8onPW1rP8vLNPi w==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="3414122" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="3414122" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:32:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="878764784" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="878764784" Received: from server.sh.intel.com ([10.239.53.117]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 03:32:03 -0800 From: "Huang, Kai" To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, dave.hansen@intel.com, kirill.shutemov@linux.intel.com, tglx@linutronix.de, bp@alien8.de, mingo@redhat.com, hpa@zytor.com, luto@kernel.org, peterz@infradead.org, thomas.lendacky@amd.com, chao.gao@intel.com, bhe@redhat.com, nik.borisov@suse.com, pbonzini@redhat.com Subject: [PATCH 0/4] TDX host: kexec() support Date: Wed, 31 Jan 2024 11:31:52 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789605443057037615 X-GMAIL-MSGID: 1789605443057037615 Currently kexec() support and TDX host are muturally exclusive in the Kconfig. This series adds the TDX host kexec support so that they can work together and can be enabled at the same time in the Kconfig. This follows Dave's suggestion to add the CC_ATTR_HOST_MEM_INCOHERENT attribute to unify both Intel and AMD, instead of having Intel/AMD specific checks around [1]. Hi Tom, I've tested on my TDX testig machine but I don't have AMD machine to test. I highly appreciate if you or any AMD guy can help to review and/or test this series to make sure I didn't break anything. Thanks a lot! [1] https://lore.kernel.org/lkml/cbc9c527-17e5-4a63-80fe-85451394cc7c@amd.com/ Kai Huang (4): x86/coco: Add a new CC attribute to unify cache flush during kexec x86/virt/tdx: Advertise the CC_ATTR_HOST_MEM_INCOHERENT for TDX host x86/kexec(): Reset TDX private memory on platforms with TDX erratum x86/virt/tdx: Remove the !KEXEC_CORE dependency arch/x86/Kconfig | 2 +- arch/x86/coco/core.c | 34 +++++++++- arch/x86/include/asm/tdx.h | 2 + arch/x86/kernel/machine_kexec_64.c | 18 ++++- arch/x86/kernel/process.c | 14 +--- arch/x86/mm/mem_encrypt_identity.c | 11 +++- arch/x86/virt/vmx/tdx/tdx.c | 101 +++++++++++++++++++++++++++++ include/linux/cc_platform.h | 16 +++++ 8 files changed, 183 insertions(+), 15 deletions(-) base-commit: a6f0b57202b0ee50dc042bae16494008dc6dc992