Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4775809pxy; Tue, 27 Apr 2021 12:19:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/pZNrhycX5vpuRXkOvfwcW6Cf91YQPlzjSt5pTh2xejIa9Z6nMYzl5a0MVD1LanN6gyZz X-Received: by 2002:a17:90a:fc92:: with SMTP id ci18mr6321713pjb.130.1619551145224; Tue, 27 Apr 2021 12:19:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619551145; cv=none; d=google.com; s=arc-20160816; b=OIBLFIIeTcVC/AbYjc5MXVGLvWFcT5Z/7HUbLbfgq7ikzw1ravuLAIF51bQTDuCACv DJQQfNBfp+sM1caT//G/OjE5U8h5FImm+PfZSmpGdklJ56yGlbLqvI0puLT7tREIiHIu oS7+mAufADu+vIh4zUo1RrJuMf6eVJT8UqQxZ4OLMDJvwb1Jbi4+1jP+o15oFNQyS+CZ ka+2MS1NHZheyY+zQLHml6lWYcvlwa4tFgsxv3hjU9YwpR7DPLbxtzFoBJR/bckpFk6u LX+eOmOMtkgydjPfqkFuR3XiBDtgYROA7upclrmV9kJbCHwnsezM5Ilu1GbfWHYJsH9N DRxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=Vy/fU+9lFOFTH0z2cSZTbHLdePPA6uBFtWfXu+M0Odw=; b=IedFqmf9qtR2Wz+DLF16HjUurlxJ52uqW/AjRSO4/t/YKsFtbRQvbWpLhYJy1tix16 TyRQfjU/6KUp8/kcsKv53rAQyyt/Cr3arKSX8zHg/+a7ZRQORugPn6DnAqoDRM9DkAdk PWQe4HWxLq/9nSLhCDgg0f6BVsGochADEN3n/kDy9pLB9moukHZE30vPh0ButAPo4uyJ Em9TGcSo4gqzJ8fBW8DUBXKyaHrtEdKgH9OlfUf23jdBEOvtIA/SptdwrmHI3pEFuY81 +uuI0hovKzJCE6IR6ahWPOLwmL+1s3IW1V9y5xbAjGLXCk6ROveqXNPWzAwq/3s+eHwJ jGSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si3479904pfh.174.2021.04.27.12.18.51; Tue, 27 Apr 2021 12:19:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236571AbhD0TS4 (ORCPT + 99 others); Tue, 27 Apr 2021 15:18:56 -0400 Received: from mga02.intel.com ([134.134.136.20]:9028 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236327AbhD0TS4 (ORCPT ); Tue, 27 Apr 2021 15:18:56 -0400 IronPort-SDR: kyvqSWjgEsfoAviJaFODORTyNV/woCFsfsWX60DzQD3ds5PjKzbeqksMTw3AfuVPlXMYvLowlZ AjPtbf8h4ZZA== X-IronPort-AV: E=McAfee;i="6200,9189,9967"; a="183714965" X-IronPort-AV: E=Sophos;i="5.82,255,1613462400"; d="scan'208";a="183714965" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2021 12:18:11 -0700 IronPort-SDR: hhiPByXCUgJ0qam0xQ08fAXfcR2Ud0vR8cbsAe5q03nrfz4tphEq1KZDQgLdgDF+onkmXKKG2F 1OhUwdw+jCSw== X-IronPort-AV: E=Sophos;i="5.82,255,1613462400"; d="scan'208";a="386253902" Received: from mchintha-mobl.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.254.5.143]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2021 12:18:10 -0700 Subject: Re: [RFC v2 05/32] x86/tdx: Add __tdcall() and __tdvmcall() helper functions To: Dave Hansen , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck Cc: Andi Kleen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , Sean Christopherson , linux-kernel@vger.kernel.org References: <2f81f67efdf8c68838cdfbb2314e98747cf70120.1619458733.git.sathyanarayanan.kuppuswamy@linux.intel.com> <33af5bd4-7ada-8450-5a86-90023145d481@intel.com> <849d8039-b43c-0790-be1c-aaac8c06608a@linux.intel.com> <2f26e352-99e4-8531-221a-eb9641c67ec0@intel.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: <95444e56-a674-1152-3039-4e425e5f5a72@linux.intel.com> Date: Tue, 27 Apr 2021 12:18:07 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <2f26e352-99e4-8531-221a-eb9641c67ec0@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dave, On 4/27/21 7:29 AM, Dave Hansen wrote: >> Do we need to rename the helper functions ? >> >> tdvmcall(), tdvmcall_out_r11() > Yes. > >> Also what about output structs? >> >> struct tdcall_output >> struct tdvmcall_output > Yes, they need sane, straightforward names which are not confusing too. > Following is the rename diff. Please let me know if you agree with the names used. diff --git a/arch/x86/include/asm/tdx.h b/arch/x86/include/asm/tdx.h index 6c3c71bb57a0..95a6a6c6061a 100644 --- a/arch/x86/include/asm/tdx.h +++ b/arch/x86/include/asm/tdx.h -struct tdcall_output { +struct tdx_module_output { u64 rcx; u64 rdx; u64 r8; @@ -19,7 +19,7 @@ struct tdcall_output { u64 r11; }; -struct tdvmcall_output { +struct tdx_hypercall_output { u64 r11; u64 r12; u64 r13; @@ -33,12 +33,12 @@ bool is_tdx_guest(void); void __init tdx_early_init(void); /* Helper function used to communicate with the TDX module */ -u64 __tdcall(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9, - struct tdcall_output *out); +u64 __tdx_module_call(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9, + struct tdx_module_output *out); /* Helper function used to request services from VMM */ -u64 __tdvmcall(u64 fn, u64 r12, u64 r13, u64 r14, u64 r15, - struct tdvmcall_output *out); +u64 __tdx_hypercall(u64 fn, u64 r12, u64 r13, u64 r14, u64 r15, + struct tdx_hypercall_output *out); --- a/arch/x86/kernel/tdx.c +++ b/arch/x86/kernel/tdx.c @@ -8,11 +8,11 @@ /* * Wrapper for use case that checks for error code and print warning message. */ -static inline u64 tdvmcall(u64 fn, u64 r12, u64 r13, u64 r14, u64 r15) +static inline u64 tdx_hypercall(u64 fn, u64 r12, u64 r13, u64 r14, u64 r15) { u64 err; - err = __tdvmcall(fn, r12, r13, r14, r15, NULL); + err = __tdx_hypercall(fn, r12, r13, r14, r15, NULL); if (err) pr_warn_ratelimited("TDVMCALL fn:%llx failed with err:%llx\n", @@ -24,13 +24,14 @@ static inline u64 tdvmcall(u64 fn, u64 r12, u64 r13, u64 r14, u64 r15) /* * Wrapper for the semi-common case where we need single output value (R11). */ -static inline u64 tdvmcall_out_r11(u64 fn, u64 r12, u64 r13, u64 r14, u64 r15) +static inline u64 tdx_hypercall_out_r11(u64 fn, u64 r12, u64 r13, + u64 r14, u64 r15) -- Sathyanarayanan Kuppuswamy Linux Kernel Developer