Message ID | 20230220065735.1282809-23-zhaotianrui@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1166718wrn; Sun, 19 Feb 2023 23:01:12 -0800 (PST) X-Google-Smtp-Source: AK7set+ATEwqOlXTuZB7VSFCu55omAyqIt9ldfBn4+knJAZD56OobHaBh7fx2GqL7tZFozkS/dLq X-Received: by 2002:a05:6a20:3421:b0:be:8d91:cb92 with SMTP id i33-20020a056a20342100b000be8d91cb92mr9065327pzd.24.1676876472158; Sun, 19 Feb 2023 23:01:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676876472; cv=none; d=google.com; s=arc-20160816; b=MYxDH4xcOWGO6E3YjA08DPacUvvstgoWYfYpuf8fJI38oNSyTRt+2KcGJKnYukFDEC UuO8wR2j5kNObtopcQhG0e+kclB4Y6qfwKBrCX7rKvOEmpERe7d8VbKpVUyYEVqb+1nK oleegP7/vrQVlrwRad3qsaKcZee4UrJTe7DyjhoFeeziYROIJIApAsb3RtNhAEpTdhEB Q5KhnTJNzaEutrxG37rqV40F27tw/C7p6cZmWFDzRFn6hsj92K6T1M20lH6tOcVBXXMV MdjaXQoUgKtQBai/oCOlpVkHo53UOQ0Yn7XvfflzQB6lQbJ5p8M+N+09r8Tv5/1n0eeR 3q3A== 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; bh=fZx5IZlIZtaY3u4UMj+eKGDfgof2Z9hvNdQxrag+KlE=; b=bxIB2ZL3xvPktx8IFGLCipOeYiHJ++RFasFAq5Lv+hZFszwAs8Kz5OHKMiyHjFMfxH iCgkNFGaVmSpbabNvg161y0UMZnJIGIc558axqLFoAuR2/DJgsrjsuoj6s13Ln1MpgfU FJl5JJ6+MBMAmI7FTgjljSRIJ8GfjHHtOHCUc1LVn6M8fJOIc0aTjqUqdARfKy3HSgkM HBEc0Cfa+YDfGUwLjTdXmNeMKgjXho3Y/vGXzNkvFB63P53lWdjj90J2K1RW+7BCyK5t Z6xX8qXSU1U+CYFOGyTgGR6j5RdqoILzsG19YFksinWV1KVDo0Hb76MxIMDI3jFLDDqj 8zIA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y71-20020a638a4a000000b004fb647a766dsi14197916pgd.7.2023.02.19.23.00.57; Sun, 19 Feb 2023 23:01:12 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230411AbjBTG6X (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Mon, 20 Feb 2023 01:58:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbjBTG5r (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Feb 2023 01:57:47 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0D55410AA7; Sun, 19 Feb 2023 22:57:45 -0800 (PST) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8Ax69noGfNj5rQCAA--.71S3; Mon, 20 Feb 2023 14:57:44 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Ax+73fGfNjFvk2AA--.34690S24; Mon, 20 Feb 2023 14:57:43 +0800 (CST) From: Tianrui Zhao <zhaotianrui@loongson.cn> To: Paolo Bonzini <pbonzini@redhat.com> Cc: Huacai Chen <chenhuacai@kernel.org>, WANG Xuerui <kernel@xen0n.name>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Jens Axboe <axboe@kernel.dk>, Mark Brown <broonie@kernel.org>, Alex Deucher <alexander.deucher@amd.com>, Oliver Upton <oliver.upton@linux.dev>, maobibo@loongson.cn Subject: [PATCH v2 22/29] LoongArch: KVM: Implement handle idle exception Date: Mon, 20 Feb 2023 14:57:28 +0800 Message-Id: <20230220065735.1282809-23-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230220065735.1282809-1-zhaotianrui@loongson.cn> References: <20230220065735.1282809-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Ax+73fGfNjFvk2AA--.34690S24 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvdXoW7JrW5uFykWr43XF43Ww48Zwb_yoW3CwbEqF WfJas3GrWrJ3W5ta4Dt3Z8Ca43Ga1kXFy5ZF17Zry3Gr1DtrW5GrWDWwn5ZryktrWUuF45 t3yvv3s7Aw1UtjkaLaAFLSUrUUUUeb8apTn2vfkv8UJUUUU8wcxFpf9Il3svdxBIdaVrn0 xqx4xG64xvF2IEw4CE5I8CrVC2j2Jv73VFW2AGmfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUY z7CY07I20VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4vEx4A2jsIEc7 CjxVAFwI0_Cr1j6rxdM2kKe7AKxVWUAVWUtwAS0I0E0xvYzxvE52x082IY62kv0487Mc80 4VCY07AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VCjz48v1sIEY2 0_WwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc7CjxVAaw2AFwI0_JF0_ Jw1l42xK82IYc2Ij64vIr41l42xK82IY6x8ErcxFaVAv8VWrMxC20s026xCaFVCjc4AY6r 1j6r4UMxCIbckI1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xv wVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjx v20xvE14v26w1j6s0DMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UMIIF0xvE42xK 8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8Jr0_Cr1UMIIF0xvEx4A2jsIEc7 CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvj4RKpBTUUUUU X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758332423516767959?= X-GMAIL-MSGID: =?utf-8?q?1758332423516767959?= |
Series |
Add KVM LoongArch support
|
|
Commit Message
zhaotianrui
Feb. 20, 2023, 6:57 a.m. UTC
Implement kvm handle loongarch vcpu idle exception, using kvm_vcpu_block
to emulate it.
Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
---
arch/loongarch/kvm/exit.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Comments
On 2/20/23 07:57, Tianrui Zhao wrote: > +int _kvm_emu_idle(struct kvm_vcpu *vcpu) > +{ > + ++vcpu->stat.idle_exits; > + trace_kvm_exit(vcpu, KVM_TRACE_EXIT_IDLE); Please add a separate tracepoint, don't overload trace_kvm_exit(). Likewise for _kvm_trap_handle_gspr(). I think _kvm_trap_handle_gspr() should have a tracepoint whose parameter is inst.word. Paolo > + if (!vcpu->arch.irq_pending) { > + kvm_save_timer(vcpu); > + kvm_vcpu_block(vcpu); > + } > + > + return EMULATE_DONE;
在 2023年02月21日 02:40, Paolo Bonzini 写道: > On 2/20/23 07:57, Tianrui Zhao wrote: >> +int _kvm_emu_idle(struct kvm_vcpu *vcpu) >> +{ >> + ++vcpu->stat.idle_exits; >> + trace_kvm_exit(vcpu, KVM_TRACE_EXIT_IDLE); > > Please add a separate tracepoint, don't overload trace_kvm_exit(). > > Likewise for _kvm_trap_handle_gspr(). > > I think _kvm_trap_handle_gspr() should have a tracepoint whose > parameter is inst.word. Thanks, I will add the tracepoint for _kvm_emu_idle and _kvm_trap_handle_gspr. Thanks Tianrui Zhao > > Paolo > >> + if (!vcpu->arch.irq_pending) { >> + kvm_save_timer(vcpu); >> + kvm_vcpu_block(vcpu); >> + } >> + >> + return EMULATE_DONE;
diff --git a/arch/loongarch/kvm/exit.c b/arch/loongarch/kvm/exit.c index f02e2b940..a6beb83a0 100644 --- a/arch/loongarch/kvm/exit.c +++ b/arch/loongarch/kvm/exit.c @@ -191,3 +191,15 @@ int _kvm_complete_iocsr_read(struct kvm_vcpu *vcpu, struct kvm_run *run) return er; } + +int _kvm_emu_idle(struct kvm_vcpu *vcpu) +{ + ++vcpu->stat.idle_exits; + trace_kvm_exit(vcpu, KVM_TRACE_EXIT_IDLE); + if (!vcpu->arch.irq_pending) { + kvm_save_timer(vcpu); + kvm_vcpu_block(vcpu); + } + + return EMULATE_DONE; +}