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=-8.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 44F50C07E9B for ; Tue, 6 Jul 2021 12:57:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F819619AF for ; Tue, 6 Jul 2021 12:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232277AbhGFNAW (ORCPT ); Tue, 6 Jul 2021 09:00:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41968 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231772AbhGFNAU (ORCPT ); Tue, 6 Jul 2021 09:00:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625576261; h=from:from: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=DnLEnBkgsWGks2sHBISFH7oG7rJthzexSBxylFpgy8c=; b=hwEYJs8vFzR90U3gkrpXqxkyDk7phi7KmMRVwj1ayTZytYBX2QTOpbdvQnNo5+b4o3e11T sxyly3Tue65DPH4pwyBq4USz2pMuOZGVj+vLrBVS8BhfaaJhgTRjLNvSqGS1SQk2e71l+M O21rU5+uiVlGn8YBjAvI3pSpFBAEJFw= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-376-7K3utxn8N8qBK5eVBcp0Qg-1; Tue, 06 Jul 2021 08:57:40 -0400 X-MC-Unique: 7K3utxn8N8qBK5eVBcp0Qg-1 Received: by mail-ed1-f71.google.com with SMTP id w1-20020a0564022681b0290394cedd8a6aso10728625edd.14 for ; Tue, 06 Jul 2021 05:57:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DnLEnBkgsWGks2sHBISFH7oG7rJthzexSBxylFpgy8c=; b=bTJUe0RG/XJGqpOKXGtxRRahzUiqgdrNitLRdASpVSEqyBnv2TYFQ6GIc3BzS0plKh p/J3aSiiM5icpR90E5hLGeb+pXBGYHWrU3/nmmS/oTENhtGvURf8Zjzb7jcydeHWL6n4 m51YEmmtdfDH1PIrPtYFeKN7PxfNhh3BGR1VXMG7kOeI1siZnnzE86tFLrrPB6YcRgS/ fs/ZMgrD+dMBY7HnEhw8vw52iOA9zJsB/BX3S9Mlzip46WL+EipIGl0VGdA9xhYKuHbE gjaAm+KcGtvip7+xYxp2GPl2XCLYTHBBJRnVXdXsJYHMLK+1e6/6f5+YitzQFE0PJ07G c8Ng== X-Gm-Message-State: AOAM533TWcgHWMhXjAUlNOqlHYMYaRZS3+iPpgGHJzQkV4b5YkHJhvZt eitld4u3YCzdVFQT/uwn01hT5WVpqVtzSG2P0XAt3LL7zZNfXHH/o+xc7/uXUwAIlvEFMxxnNvT FsCRN76WXm1UDjYKuz075xYxy X-Received: by 2002:a17:906:b41:: with SMTP id v1mr12889603ejg.358.1625576259478; Tue, 06 Jul 2021 05:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLQcQder9RFUtT7E4Nw+mEzCcjU4QaMy7Fr1/rzumUzfDh/6aFBYLjWRGoNaZd0i8PucyR4A== X-Received: by 2002:a17:906:b41:: with SMTP id v1mr12889588ejg.358.1625576259322; Tue, 06 Jul 2021 05:57:39 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id c9sm2891218ejs.28.2021.07.06.05.57.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 05:57:38 -0700 (PDT) To: isaku.yamahata@intel.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , erdemaktas@google.com, Connor Kuehl , Sean Christopherson , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: isaku.yamahata@gmail.com, Xiaoyao Li References: From: Paolo Bonzini Subject: Re: [RFC PATCH v2 06/69] KVM: TDX: add a helper function for kvm to call seamcall Message-ID: <364da5f9-41eb-74b6-db38-397c8a64b538@redhat.com> Date: Tue, 6 Jul 2021 14:57:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/07/21 00:04, isaku.yamahata@intel.com wrote: > + > +.Lseamcall: > + seamcall > + jmp .Lseamcall_ret > +.Lspurious_fault: > + call kvm_spurious_fault > +.Lseamcall_ret: > + > + movq (FRAME_OFFSET + 8)(%rsp), %rdi > + testq %rdi, %rdi > + jz 1f > + > + /* If ex is non-NULL, store extra return values into it. */ > + movq %rcx, TDX_SEAM_rcx(%rdi) > + movq %rdx, TDX_SEAM_rdx(%rdi) > + movq %r8, TDX_SEAM_r8(%rdi) > + movq %r9, TDX_SEAM_r9(%rdi) > + movq %r10, TDX_SEAM_r10(%rdi) > + movq %r11, TDX_SEAM_r11(%rdi) > + > +1: > + FRAME_END > + ret > + > + _ASM_EXTABLE(.Lseamcall, .Lspurious_fault) Please use local labels and avoid unnecessary jmp, for example 1: seamcall movq (FRAME_OFFSET + 8)(%rsp), %rdi testq %rdi, %rdi jz 2f /* If ex is non-NULL, store extra return values into it. */ movq %rcx, TDX_SEAM_rcx(%rdi) movq %rdx, TDX_SEAM_rdx(%rdi) movq %r8, TDX_SEAM_r8(%rdi) movq %r9, TDX_SEAM_r9(%rdi) movq %r10, TDX_SEAM_r10(%rdi) movq %r11, TDX_SEAM_r11(%rdi) 2: FRAME_END ret 3: /* Probably it helps to write an error code in %rax? */ movq $0x4000000500000000, %rax cmpb $0, kvm_rebooting jne 2b ud2 _ASM_EXTABLE(1b, 3b) Paolo