From patchwork Fri Oct 28 23:07:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 12591 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1088522wru; Fri, 28 Oct 2022 16:12:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6n+UQq34jHX47WzBpDMCUkW/blsY/ejeWN5emmNj1b/N8FSb/x2smu6ikxNKTfyQHW/ULy X-Received: by 2002:a17:907:9602:b0:780:8c9f:f99a with SMTP id gb2-20020a170907960200b007808c9ff99amr1480306ejc.465.1666998768318; Fri, 28 Oct 2022 16:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666998768; cv=none; d=google.com; s=arc-20160816; b=C0p9CAu2rJlcBGVmb3TbQGEYHjkcTPq7ldb+gy3WiJGQIQm5LEHlMx+eKMjiuvsznd U7xY19HfvHKVxWagpmFbDBc9+wWmWCgQ3C5bXXSo4RPyGHUm7PHDOK3KGhAYhJqRbr+r eAWAAvzQpXkum7PnqYcswI7fKqXkAPNA+ugGjT5OEMMASXQ5z9tQKJ6r+ZqVFWS/2HwF UnUIckpIlUx13pLeWDG+W+VT+EL3d9MHec1crLRaeDzDJu6E89VtS+jL6pwCEEfIhay+ LUas7JwA928IkAR8EeQtKCYJsNanXQmkqlBi+Kac30CtM1CSfPPTA40PblcoBPtHv0fc geYQ== 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=YGfDYy2FKRGq+kLUF8iKroe6+TjvZzPPI1zHdOCFjiw=; b=AQ5b3fLhsXmt9mpGcimEksoIOZ4d0u1dlXWd/K3cWTU3rIB8/P+SsPML3v834Q3uao cAYW16eB2HjymWsvBj5YHQowObWxf3Kzuo8uL598GfLAvWFb3r5b/+2tsolazfjGOT3q qIQAoFhl6MpTILM+TH751G8TEuHwdzCKbiWvf/Ce99DT4VbHcaLfWFFb0vioNyoAgdBI /39YcXJQH94cQEoE8klEeQQphXqpkcC+d5u6TuAD9QDS2OOkk1PPYJ75wLgCu1uS+qSq Hf7XOPRqzadyOkqcKop7j+cD6qG4PCp3iNH2AWUig1k5qS6A2aJG+PssKCswSDCL7hnR KJMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a3nNTTPj; 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=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc15-20020a170907168f00b007982c5e6ec8si23776ejc.89.2022.10.28.16.12.24; Fri, 28 Oct 2022 16:12:48 -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=@redhat.com header.s=mimecast20190719 header.b=a3nNTTPj; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbiJ1XJC (ORCPT + 99 others); Fri, 28 Oct 2022 19:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbiJ1XIw (ORCPT ); Fri, 28 Oct 2022 19:08:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0361237F83 for ; Fri, 28 Oct 2022 16:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666998474; 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=YGfDYy2FKRGq+kLUF8iKroe6+TjvZzPPI1zHdOCFjiw=; b=a3nNTTPjKWynn6/OqhPXf3QJEkDdhjN+BhciK2HFmmoQKW1xsS4qg0EoouQZdPyOEgWfeh tu58bHJmM0jAYR/0YVTcHshhMc6VFXgFPeTNpb+aaddU79+VGWnXwSQFK3v30bUTYclLFa Jnx4WP3CpEczEzMzJNMV5o9tSoL7s+M= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-312-nipQUrsKOqmwOy47cmzw3w-1; Fri, 28 Oct 2022 19:07:50 -0400 X-MC-Unique: nipQUrsKOqmwOy47cmzw3w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 21412858282; Fri, 28 Oct 2022 23:07:50 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0926340C94EE; Fri, 28 Oct 2022 23:07:38 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jmattson@google.com, seanjc@google.com, jpoimboe@kernel.org Subject: [PATCH 5/7] KVM: SVM: adjust register allocation for __svm_vcpu_run Date: Fri, 28 Oct 2022 19:07:21 -0400 Message-Id: <20221028230723.3254250-6-pbonzini@redhat.com> In-Reply-To: <20221028230723.3254250-1-pbonzini@redhat.com> References: <20221028230723.3254250-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747974900166194654?= X-GMAIL-MSGID: =?utf-8?q?1747974900166194654?= In preparation for moving SPEC_CTRL access to __svm_vcpu_run, keep the pointer to the struct vcpu_svm in %rdi, which is not used by rdmsr/wrmsr. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/svm/vmenter.S | 39 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/arch/x86/kvm/svm/vmenter.S b/arch/x86/kvm/svm/vmenter.S index 8fac744361e5..51a63a47d74f 100644 --- a/arch/x86/kvm/svm/vmenter.S +++ b/arch/x86/kvm/svm/vmenter.S @@ -53,30 +53,31 @@ SYM_FUNC_START(__svm_vcpu_run) /* Save @vmcb. */ push %_ASM_ARG1 - /* Move @svm to RAX. */ - mov %_ASM_ARG2, %_ASM_AX + /* Move @svm to RDI. */ + mov %_ASM_ARG2, %_ASM_DI - /* Load guest registers. */ - mov VCPU_RCX(%_ASM_AX), %_ASM_CX - mov VCPU_RDX(%_ASM_AX), %_ASM_DX - mov VCPU_RBX(%_ASM_AX), %_ASM_BX - mov VCPU_RBP(%_ASM_AX), %_ASM_BP - mov VCPU_RSI(%_ASM_AX), %_ASM_SI - mov VCPU_RDI(%_ASM_AX), %_ASM_DI -#ifdef CONFIG_X86_64 - mov VCPU_R8 (%_ASM_AX), %r8 - mov VCPU_R9 (%_ASM_AX), %r9 - mov VCPU_R10(%_ASM_AX), %r10 - mov VCPU_R11(%_ASM_AX), %r11 - mov VCPU_R12(%_ASM_AX), %r12 - mov VCPU_R13(%_ASM_AX), %r13 - mov VCPU_R14(%_ASM_AX), %r14 - mov VCPU_R15(%_ASM_AX), %r15 -#endif /* "POP" @vmcb to RAX. */ pop %_ASM_AX + /* Load guest registers. */ + mov VCPU_RCX(%_ASM_DI), %_ASM_CX + mov VCPU_RDX(%_ASM_DI), %_ASM_DX + mov VCPU_RBX(%_ASM_DI), %_ASM_BX + mov VCPU_RBP(%_ASM_DI), %_ASM_BP + mov VCPU_RSI(%_ASM_DI), %_ASM_SI +#ifdef CONFIG_X86_64 + mov VCPU_R8 (%_ASM_DI), %r8 + mov VCPU_R9 (%_ASM_DI), %r9 + mov VCPU_R10(%_ASM_DI), %r10 + mov VCPU_R11(%_ASM_DI), %r11 + mov VCPU_R12(%_ASM_DI), %r12 + mov VCPU_R13(%_ASM_DI), %r13 + mov VCPU_R14(%_ASM_DI), %r14 + mov VCPU_R15(%_ASM_DI), %r15 +#endif + mov VCPU_RDI(%_ASM_DI), %_ASM_DI + /* Enter guest mode */ sti