From nobody Sun May 24 19:33:55 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 8AD0E47D949; Fri, 22 May 2026 17:26:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470793; cv=none; b=VdeLzocAqXo1Nb9XxU6ULKKdmCxowTgZMBMtrErux5sRJ8j690bj6tBKa/GwG6UBj1tzpD6NbzP6UeDL7QsYi2ZHpGLNQqWWT8Pbi9poswjMnvr7UnD5aLkvzFFxArJEyvHMzA8zTBHntqOmezLSqnhP450LJ5I2nvsLWZw2VlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470793; c=relaxed/simple; bh=0FOxs59AtLluKtyVfz/pHdof83hFqOEvP68/Ocf3f3E=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=X7+bfuZrgfgequcUWVpkxRLiHq7Bt3lj4w9QVWncgDuSRRRGBVfq9OcjOSprxhfU/i2st5FY7sQoDCQebr2KLyfcCV1VtzJ4ddqrsleDZOsn0xzZNE/+gNckym9+HvdRSKZNE7fhd2rGcdfKj6LIl2CCzUaEjSLWsDsxli9vnXs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=UHAaXA57; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=e9WcIve+; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="UHAaXA57"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="e9WcIve+" Date: Fri, 22 May 2026 17:26:28 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779470790; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sGYQhFWuR5v0+gScfbbM+RB1PjMnj5ThyF99MoCryTw=; b=UHAaXA57bwSDqT7lP/gfwBdSY2s2w2IetCujXgmEDakmBkh6TGGDI8okc5E66pMiujsg0G HvYNbeAlfmzaKn3Ag81hbig9EJXCtZMBuGsx53m0kbTeIBhD9MNpr6ejIhhTU1j5Qd9EAl JFJEMgjDftP5HFl5YfFDpUitgIDZU9S4sNhkzqpseYAtpl1hzn1GXDe83h2tMWwZOhkk0n QmgHktsvUaVEzzZJwu5GDcb9MFZveN+ZKh2VygCXnwsim+tYw5wX2IXwBKJQ1v4ZaNOSJV lA7fAEcb9HlRVHMCy9IzfghtUahnBeyugst58uJ2xe8CvBAy+5buOClS5TCStQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779470790; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sGYQhFWuR5v0+gScfbbM+RB1PjMnj5ThyF99MoCryTw=; b=e9WcIve+DFlXOKYU/eI9TQiWxyIbhFn9M6Y9HMiVaD/tFAB20uRLwkemIAEg585M6XVqqb hrdfppRVzuEWkRCA== From: "tip-bot2 for Chao Gao" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/tdx] coco/tdx-host: Introduce a "tdx_host" device Cc: Chao Gao , Dave Hansen , Jonathan Cameron , Tony Lindgren , Xu Yilun , Kai Huang , "Kiryl Shutsemau (Meta)" , Xiaoyao Li , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260520222852.97E04C62@davehans-spike.ostc.intel.com> References: <20260520222852.97E04C62@davehans-spike.ostc.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177947078882.711.16292730781929068334.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/tdx branch of tip: Commit-ID: c6a2ea2cfa6a23a6c5f55bdd6190e772338f63b4 Gitweb: https://git.kernel.org/tip/c6a2ea2cfa6a23a6c5f55bdd6190e7723= 38f63b4 Author: Chao Gao AuthorDate: Wed, 20 May 2026 15:28:52 -07:00 Committer: Dave Hansen CommitterDate: Wed, 20 May 2026 15:37:09 -07:00 coco/tdx-host: Introduce a "tdx_host" device TDX depends on a platform firmware module that runs on the CPU. Unlike other CoCo architectures, TDX has no hardware "device" running the show, just a blob on the CPU. Create a virtual device to anchor interactions with this platform firmware. This lets later code: - expose metadata: TDX module version, seamldr version, to userspace as device attributes - implement firmware uploader APIs (which are tied to a device) to support TDX module runtime updates Use a faux device because the TDX module is singular within the system and has no platform resources. Using a faux device eliminates the need to create a stub bus. The call to tdx_get_sysinfo() ensures that the TDX module is ready to provide services. Note that AMD has a PCI device for the PSP for SEV and ARM CCA will likely have a faux device [1]. Thanks to Dan and Yilun for all the help on this one. [ dhansen: trim changelog ] Signed-off-by: Chao Gao Signed-off-by: Dave Hansen Reviewed-by: Jonathan Cameron Reviewed-by: Tony Lindgren Reviewed-by: Xu Yilun Reviewed-by: Kai Huang Reviewed-by: Kiryl Shutsemau (Meta) Reviewed-by: Xiaoyao Li Link: https://lore.kernel.org/all/2025073035-bulginess-rematch-b92e@gregkh/= # [1] Link: https://patch.msgid.link/20260520133909.409394-7-chao.gao@intel.com Link: https://patch.msgid.link/20260520222852.97E04C62@davehans-spike.ostc.= intel.com --- arch/x86/virt/vmx/tdx/tdx.c | 2 +- drivers/virt/coco/Kconfig | 2 +- drivers/virt/coco/Makefile | 1 +- drivers/virt/coco/tdx-host/Kconfig | 4 ++- drivers/virt/coco/tdx-host/Makefile | 1 +- drivers/virt/coco/tdx-host/tdx-host.c | 43 ++++++++++++++++++++++++++- 6 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 drivers/virt/coco/tdx-host/Kconfig create mode 100644 drivers/virt/coco/tdx-host/Makefile create mode 100644 drivers/virt/coco/tdx-host/tdx-host.c diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c index b329791..5fb0441 100644 --- a/arch/x86/virt/vmx/tdx/tdx.c +++ b/arch/x86/virt/vmx/tdx/tdx.c @@ -1527,7 +1527,7 @@ const struct tdx_sys_info *tdx_get_sysinfo(void) =20 return (const struct tdx_sys_info *)&tdx_sysinfo; } -EXPORT_SYMBOL_FOR_KVM(tdx_get_sysinfo); +EXPORT_SYMBOL_FOR_MODULES(tdx_get_sysinfo, "kvm-intel,tdx-host"); =20 u32 tdx_get_nr_guest_keyids(void) { diff --git a/drivers/virt/coco/Kconfig b/drivers/virt/coco/Kconfig index df1cfaf..f7691f6 100644 --- a/drivers/virt/coco/Kconfig +++ b/drivers/virt/coco/Kconfig @@ -17,5 +17,7 @@ source "drivers/virt/coco/arm-cca-guest/Kconfig" source "drivers/virt/coco/guest/Kconfig" endif =20 +source "drivers/virt/coco/tdx-host/Kconfig" + config TSM bool diff --git a/drivers/virt/coco/Makefile b/drivers/virt/coco/Makefile index cb52021..b323b0a 100644 --- a/drivers/virt/coco/Makefile +++ b/drivers/virt/coco/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_EFI_SECRET) +=3D efi_secret/ obj-$(CONFIG_ARM_PKVM_GUEST) +=3D pkvm-guest/ obj-$(CONFIG_SEV_GUEST) +=3D sev-guest/ obj-$(CONFIG_INTEL_TDX_GUEST) +=3D tdx-guest/ +obj-$(CONFIG_INTEL_TDX_HOST) +=3D tdx-host/ obj-$(CONFIG_ARM_CCA_GUEST) +=3D arm-cca-guest/ obj-$(CONFIG_TSM) +=3D tsm-core.o obj-$(CONFIG_TSM_GUEST) +=3D guest/ diff --git a/drivers/virt/coco/tdx-host/Kconfig b/drivers/virt/coco/tdx-hos= t/Kconfig new file mode 100644 index 0000000..cfe81b9 --- /dev/null +++ b/drivers/virt/coco/tdx-host/Kconfig @@ -0,0 +1,4 @@ +config TDX_HOST_SERVICES + tristate + depends on INTEL_TDX_HOST + default m diff --git a/drivers/virt/coco/tdx-host/Makefile b/drivers/virt/coco/tdx-ho= st/Makefile new file mode 100644 index 0000000..e61e749 --- /dev/null +++ b/drivers/virt/coco/tdx-host/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_TDX_HOST_SERVICES) +=3D tdx-host.o diff --git a/drivers/virt/coco/tdx-host/tdx-host.c b/drivers/virt/coco/tdx-= host/tdx-host.c new file mode 100644 index 0000000..c778853 --- /dev/null +++ b/drivers/virt/coco/tdx-host/tdx-host.c @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * TDX host user interface driver + * + * Copyright (C) 2025 Intel Corporation + */ + +#include +#include +#include + +#include +#include + +static const struct x86_cpu_id tdx_host_ids[] =3D { + X86_MATCH_FEATURE(X86_FEATURE_TDX_HOST_PLATFORM, NULL), + {} +}; +MODULE_DEVICE_TABLE(x86cpu, tdx_host_ids); + +static struct faux_device *fdev; + +static int __init tdx_host_init(void) +{ + if (!x86_match_cpu(tdx_host_ids) || !tdx_get_sysinfo()) + return -ENODEV; + + fdev =3D faux_device_create(KBUILD_MODNAME, NULL, NULL); + if (!fdev) + return -ENODEV; + + return 0; +} +module_init(tdx_host_init); + +static void __exit tdx_host_exit(void) +{ + faux_device_destroy(fdev); +} +module_exit(tdx_host_exit); + +MODULE_DESCRIPTION("TDX Host Services"); +MODULE_LICENSE("GPL");