Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38041345rwd; Wed, 12 Jul 2023 02:02:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlE4rUWtD5zohqag/s4myfqdRB0Q3Ii9bQpBbRjw+6MydEBtI76X1YK0wi/UpFU1BrqYzPpg X-Received: by 2002:a05:6512:2103:b0:4f8:66a1:a31b with SMTP id q3-20020a056512210300b004f866a1a31bmr13927421lfr.30.1689152567179; Wed, 12 Jul 2023 02:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689152567; cv=none; d=google.com; s=arc-20160816; b=Mm4khUsdfqC0fi7x4ZD/lWDpO9B2ypoXSf9yp3Fih7SLD/62hI3ETmWvElQtcaHOef S5XX7ynn+88twKh+RxwAnRZ+0z9j/FzbbM5/0rMwmhj5DgPqFNwkKwJoG79ff3HzjBMX sMJ1DobGCbizPqSki7uwnsZeeckGKzBZhtOwz9iYmJL5JJ7ZkFuKPd8edMaXevbAhv3o 84bTdJH/ANC+o5P/Diez8WbN0EqB1IkiojDQQ6cetqgLhkPW1XQpk/WPQeMSJaCQzMNM p15vZ4Lmopsh6cmrPumOnfdLvsAmxpIGF7pmKx7ZXeUYY/iKCG6wSB/P6szjuTrDLx7n hdPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E/srK9v0RVQgQcG3bY+25uLdxZLIeHuYbETJN8yRgH8=; fh=edBx5P/zffK2H8fHqIB7+dmlz60K6YmM7EnWiorgzxE=; b=HVypx05u6/eQKwR3Nckfwo99qyfNpR5MSc5cyh5eck89SN8YaO/FRrhHC+9IIwpc9t JQX8wzH+QQdwZ7POa2VCkUyup9ykk/na5RZY3MiO1SrzHHskQQAv3STBu8ljSSUAxzee slL5iN8y7YNNnjZexgis+kCfSsmrJXf4Rm9lZxuFaLaWnCtW6570ma0r7twkxTR6+zmn wtE93OeuHL5zXKUsLEMWQEBXfE0BNgEaqDbP/ZLtDAhpk6nEjP2JbYdpj0jPLL3LVZzE kjx1hjWoPuheSbNhRiOoju3iC/dpJnJ47Q9q+PcKj/SPO+F7lfjxzo6yhvV0VhhgA6A/ 0Nmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WF8CDGOl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e3-20020a50ec83000000b0051e247f2828si4247967edr.91.2023.07.12.02.02.22; Wed, 12 Jul 2023 02:02:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WF8CDGOl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233083AbjGLI4W (ORCPT + 99 others); Wed, 12 Jul 2023 04:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232971AbjGLI4F (ORCPT ); Wed, 12 Jul 2023 04:56:05 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 778A0E4F; Wed, 12 Jul 2023 01:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689152155; x=1720688155; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ikkpu51RPvWM8vb5NBADQ78CpgdFlbX493VUa4jw8tw=; b=WF8CDGOl1UXAE1kyTaMBj3dJs02tu3I1VO+luNP9eO5tL/eX5L3NbLid Z7I1neXn87uNb8aAImbgs4j5V10EZq6YaTqZRY/gtWQ1KU+pJPJpzu5Wl w5u0Hy8SA3SuIMCxOd3yPBWGh87CWJTYsIiWIrQagJUp8r1BhQgKLCAco g3uknjZ+oLnwajHs6vbv2T4r/hMGd1vu+jLbo7IS7mIQQ0l+6XRcG8RsC l//To1AiYYKt4wOn02PykNybpIcJuQ6lojUzMj7dLa5I+O2SqdcMtfPDD a/uoipxc40tICBgcWH1Y7mZPm3KYYoTNufjbB6/SAGYRfsVaChGcW62G4 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="344439196" X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="344439196" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 01:55:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="845573381" X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="845573381" Received: from mjamatan-mobl2.amr.corp.intel.com (HELO khuang2-desk.gar.corp.intel.com) ([10.209.168.102]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 01:55:51 -0700 From: Kai Huang To: peterz@infradead.org, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org Cc: dave.hansen@intel.com, tglx@linutronix.de, bp@alien8.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, seanjc@google.com, pbonzini@redhat.com, kvm@vger.kernel.org, isaku.yamahata@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, kai.huang@intel.com Subject: [PATCH 05/10] x86/tdx: Rename __tdx_module_call() to __tdcall() Date: Wed, 12 Jul 2023 20:55:19 +1200 Message-ID: <445bf6aa2f2c068bc542734f2b4bd18f1fee6d1d.1689151537.git.kai.huang@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __tdx_module_call() is only used by the TDX guest to issue TDCALL to the TDX module. Rename it to __tdcall() to match its behaviour, e.g., it cannot be used to make host-side SEAMCALL. Also rename tdx_module_call() which is a wrapper of __tdx_module_call() to tdcall(). No functional change intended. Signed-off-by: Kai Huang --- arch/x86/coco/tdx/tdcall.S | 10 +++++----- arch/x86/coco/tdx/tdx.c | 20 ++++++++++---------- arch/x86/include/asm/tdx.h | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/arch/x86/coco/tdx/tdcall.S b/arch/x86/coco/tdx/tdcall.S index e5d4b7d8ecd4..6aebac08f2bf 100644 --- a/arch/x86/coco/tdx/tdcall.S +++ b/arch/x86/coco/tdx/tdcall.S @@ -40,8 +40,8 @@ .section .noinstr.text, "ax" /* - * __tdx_module_call() - Used by TDX guests to request services from - * the TDX module (does not include VMM services) using TDCALL instruction. + * __tdcall() - Used by TDX guests to request services from the TDX + * module (does not include VMM services) using TDCALL instruction. * * Transforms function call register arguments into the TDCALL register ABI. * After TDCALL operation, TDX module output is saved in @out (if it is @@ -62,7 +62,7 @@ * *------------------------------------------------------------------------- * - * __tdx_module_call() function ABI: + * __tdcall() function ABI: * * @fn (RDI) - TDCALL Leaf ID, moved to RAX * @rcx (RSI) - Input parameter 1, moved to RCX @@ -77,9 +77,9 @@ * * Return status of TDCALL via RAX. */ -SYM_FUNC_START(__tdx_module_call) +SYM_FUNC_START(__tdcall) TDX_MODULE_CALL host=0 -SYM_FUNC_END(__tdx_module_call) +SYM_FUNC_END(__tdcall) /* * TDX_HYPERCALL - Make hypercalls to a TDX VMM using TDVMCALL leaf of TDCALL diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c index de021df92009..268f812ff595 100644 --- a/arch/x86/coco/tdx/tdx.c +++ b/arch/x86/coco/tdx/tdx.c @@ -98,10 +98,10 @@ EXPORT_SYMBOL_GPL(tdx_kvm_hypercall); * should only be used for calls that have no legitimate reason to fail * or where the kernel can not survive the call failing. */ -static inline void tdx_module_call(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9, - struct tdx_module_output *out) +static inline void tdcall(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9, + struct tdx_module_output *out) { - if (__tdx_module_call(fn, rcx, rdx, r8, r9, out)) + if (__tdcall(fn, rcx, rdx, r8, r9, out)) panic("TDCALL %lld failed (Buggy TDX module!)\n", fn); } @@ -123,9 +123,9 @@ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport) { u64 ret; - ret = __tdx_module_call(TDG_MR_REPORT, virt_to_phys(tdreport), - virt_to_phys(reportdata), TDREPORT_SUBTYPE_0, - 0, NULL); + ret = __tdcall(TDG_MR_REPORT, virt_to_phys(tdreport), + virt_to_phys(reportdata), TDREPORT_SUBTYPE_0, + 0, NULL); if (ret) { if (TDCALL_RETURN_CODE(ret) == TDCALL_INVALID_OPERAND) return -EINVAL; @@ -184,7 +184,7 @@ static void tdx_parse_tdinfo(u64 *cc_mask) * Guest-Host-Communication Interface (GHCI), section 2.4.2 TDCALL * [TDG.VP.INFO]. */ - tdx_module_call(TDG_VP_INFO, 0, 0, 0, 0, &out); + tdcall(TDG_VP_INFO, 0, 0, 0, 0, &out); /* * The highest bit of a guest physical address is the "sharing" bit. @@ -626,7 +626,7 @@ void tdx_get_ve_info(struct ve_info *ve) * Note, the TDX module treats virtual NMIs as inhibited if the #VE * valid flag is set. It means that NMI=>#VE will not result in a #DF. */ - tdx_module_call(TDG_VP_VEINFO_GET, 0, 0, 0, 0, &out); + tdcall(TDG_VP_VEINFO_GET, 0, 0, 0, 0, &out); /* Transfer the output parameters */ ve->exit_reason = out.rcx; @@ -768,7 +768,7 @@ static bool try_accept_one(phys_addr_t *start, unsigned long len, } tdcall_rcx = *start | page_size; - if (__tdx_module_call(TDG_MEM_PAGE_ACCEPT, tdcall_rcx, 0, 0, 0, NULL)) + if (__tdcall(TDG_MEM_PAGE_ACCEPT, tdcall_rcx, 0, 0, 0, NULL)) return false; *start += accept_size; @@ -870,7 +870,7 @@ void __init tdx_early_init(void) cc_set_mask(cc_mask); /* Kernel does not use NOTIFY_ENABLES and does not need random #VEs */ - tdx_module_call(TDG_VM_WR, 0, TDCS_NOTIFY_ENABLES, 0, -1ULL, NULL); + tdcall(TDG_VM_WR, 0, TDCS_NOTIFY_ENABLES, 0, -1ULL, NULL); /* * All bits above GPA width are reserved and kernel treats shared bit diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h index 28d889c9aa16..f19e329c4044 100644 --- a/arch/x86/include/asm/tdx.h +++ b/arch/x86/include/asm/tdx.h @@ -56,8 +56,8 @@ struct ve_info { void __init tdx_early_init(void); /* Used to communicate with the TDX module */ -u64 __tdx_module_call(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9, - struct tdx_module_output *out); +u64 __tdcall(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9, + struct tdx_module_output *out); void tdx_get_ve_info(struct ve_info *ve); -- 2.41.0