From nobody Mon Feb 9 09:51:47 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (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 6028651021 for ; Sat, 9 Mar 2024 21:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710018171; cv=none; b=ZhCpIECpOTeg5FVb7/sGWndUsIS+WkHsoB8mHifxcuZnQ33zeACuGaV/oiowMER8BMBb3GZBRhZHB4JAgk0z7ruxPd2S2SpDtpoKSY4CmZDFsBfAMekBwYZFlX2hn9aAdkCy1sNUugqE7pPxLtuw/DbxY1cTswpDiy4+lxQfCaw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710018171; c=relaxed/simple; bh=l1JZHNfw4NSUSsC+y2v9OCYY6Ndd0+Cz/FPtWPxp0a4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BHlGQ6XvxnRkeqh6cvA/uM8UnHoLUiGfauK8Vw3HkRpIby5edKeP+84inQbCT0k3IhZgWeE04mDrMuAsqNKkOc1bDGJ/R1Xs51DWTXkpmHnB01ObdYtTM8VeJmkAH1hbVPlb0FgzsbuQygJ+K5hO9QMax4GTkhRNcF6lKAb20hU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.helo=mgamail.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Q8nwSujk; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.helo=mgamail.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Q8nwSujk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710018170; x=1741554170; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l1JZHNfw4NSUSsC+y2v9OCYY6Ndd0+Cz/FPtWPxp0a4=; b=Q8nwSujkO18uW3ickIbrqqgoycyV614yNkdxSB0H0py42jFedVQIuN4/ n5lttgOuqCe+qxxCj+XuzqNlFiyDwFsxCJtTYTy/q5rvo0swYthoYmw3x AP1YwnSOaoxj+Jg3mcpKOvNzj2PyeMMroSOY3hojFSbg7QNVB/FoDKWz0 9Ka5BOHaKAjOrFeR5R0V9uh2e5EsIlngVqwJjrWPDPIv/RZ0UKS5Y5M38 mBFzN5sv23h07xXDCXmMcHmiSIxLlrQiUjCvS3TQuPHgBxQEPOLKR1+fi IE5T6Xi+DR1+8TewqLgUwRddFILFNmUkbgeRzOHufRLfftrWtzZMiynO2 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11008"; a="4861582" X-IronPort-AV: E=Sophos;i="6.07,113,1708416000"; d="scan'208";a="4861582" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2024 13:02:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,11008"; a="937048395" X-IronPort-AV: E=Sophos;i="6.07,113,1708416000"; d="scan'208";a="937048395" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 09 Mar 2024 13:02:43 -0800 Received: by black.fi.intel.com (Postfix, from userid 1000) id 48B5536D; Sat, 9 Mar 2024 23:02:42 +0200 (EET) From: "Kirill A. Shutemov" To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@intel.com Cc: sathyanarayanan.kuppuswamy@linux.intel.com, hpa@zytor.com, seanjc@google.com, ele.reshetova@intel.com, rick.p.edgecombe@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH 2/4] x86/tdx: Rename tdx_parse_tdinfo() to tdx_setup() Date: Sat, 9 Mar 2024 23:02:28 +0200 Message-ID: <20240309210230.239045-3-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240309210230.239045-1-kirill.shutemov@linux.intel.com> References: <20240309210230.239045-1-kirill.shutemov@linux.intel.com> 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 Content-Type: text/plain; charset="utf-8" Rename tdx_parse_tdinfo() to tdx_setup() and move setting NOTIFY_ENABLES there. The function will be extended to adjust TD configuration. Signed-off-by: Kirill A. Shutemov Reviewed-by: Kuppuswamy Sathyanarayanan --- arch/x86/coco/tdx/tdx.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c index 5ffe5ef99536..afdaf46cabb9 100644 --- a/arch/x86/coco/tdx/tdx.c +++ b/arch/x86/coco/tdx/tdx.c @@ -181,7 +181,7 @@ static void __noreturn tdx_panic(const char *msg) __tdx_hypercall(&args); } =20 -static void tdx_parse_tdinfo(u64 *cc_mask) +static void tdx_setup(u64 *cc_mask) { struct tdx_module_args args =3D {}; unsigned int gpa_width; @@ -206,6 +206,9 @@ static void tdx_parse_tdinfo(u64 *cc_mask) gpa_width =3D args.rcx & GENMASK(5, 0); *cc_mask =3D BIT_ULL(gpa_width - 1); =20 + /* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */ + tdg_vm_wr(TDCS_NOTIFY_ENABLES, 0, -1ULL); + /* * The kernel can not handle #VE's when accessing normal kernel * memory. Ensure that no #VE will be delivered for accesses to @@ -930,11 +933,11 @@ void __init tdx_early_init(void) setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE); =20 cc_vendor =3D CC_VENDOR_INTEL; - tdx_parse_tdinfo(&cc_mask); - cc_set_mask(cc_mask); =20 - /* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */ - tdg_vm_wr(TDCS_NOTIFY_ENABLES, 0, -1ULL); + /* Configure the TD */ + tdx_setup(&cc_mask); + + cc_set_mask(cc_mask); =20 /* * All bits above GPA width are reserved and kernel treats shared bit --=20 2.43.0