From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB574C433ED for ; Tue, 11 May 2021 15:09:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A92BB6128E for ; Tue, 11 May 2021 15:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231851AbhEKPKq (ORCPT ); Tue, 11 May 2021 11:10:46 -0400 Received: from mga17.intel.com ([192.55.52.151]:15577 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231646AbhEKPKo (ORCPT ); Tue, 11 May 2021 11:10:44 -0400 IronPort-SDR: 6BLwMu5fiWWSOVqUE7NW3lKqEDp2Gd3vKtJPMXCKVGfzVN1ZhbgNOIBMSFPTtCrR783TyG2xXG u5odva6keotA== X-IronPort-AV: E=McAfee;i="6200,9189,9981"; a="179727686" X-IronPort-AV: E=Sophos;i="5.82,291,1613462400"; d="scan'208";a="179727686" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 08:08:24 -0700 IronPort-SDR: qcWUS6YAnkI8cK04qriPlYzjT66gmkXiVHtyCqzUgPuFVTHQ77uarh4gDSOoLUDu2GzmnQ/6xT OXOsuqaLwhKw== X-IronPort-AV: E=Sophos;i="5.82,291,1613462400"; d="scan'208";a="621848341" Received: from jamtsfi1-mobl2.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.209.177.109]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2021 08:08:23 -0700 Subject: Re: [RFC v2 14/32] x86/tdx: Handle port I/O To: Dave Hansen , Dan Williams Cc: Andi Kleen , Peter Zijlstra , Andy Lutomirski , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , Sean Christopherson , Linux Kernel Mailing List References: <0e7e94d1ee4bae49dfd0dd441dc4f2ab6df76668.1619458733.git.sathyanarayanan.kuppuswamy@linux.intel.com> <9f89a317-11fa-d784-87a8-37124891900c@linux.intel.com> <3059c7d3-8646-2e1a-3c9f-1de67f7ed382@linux.intel.com> <609b1182-5629-0727-d174-849c113a3960@intel.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: Date: Tue, 11 May 2021 08:08:20 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <609b1182-5629-0727-d174-849c113a3960@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 On 5/11/21 7:39 AM, Dave Hansen wrote: > To what you do you refer by "this patch allocates this memory in ASM > code"? Could you point to the specific ASM code that "allocates memory"? We use 40 bytes in stack for storing the output register values. It is in function tdg_inl(). subq $TDVMCALL_OUTPUT_SIZE, %rsp +SYM_FUNC_START(tdg_inl) + io_save_registers + /* Set data width to 4 bytes */ + mov $4, %rsi +1: + mov %rdx, %rcx + /* Set 0 in RDX to select in operation */ + mov $0, %rdx + /* Set TDVMCALL function id in RDI */ + mov $EXIT_REASON_IO_INSTRUCTION, %rdi + /* Set TDVMCALL type info (0 - Standard, > 0 - vendor) in R10 */ + xor %r10, %r10 + /* Allocate memory in stack for Output */ + subq $TDVMCALL_OUTPUT_SIZE, %rsp + /* Move tdvmcall_output pointer to R9 */ + movq %rsp, %r9 + + call do_tdvmcall -- Sathyanarayanan Kuppuswamy Linux Kernel Developer