Message ID | 20230328123119.3649361-23-zhaotianrui@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2188711vqo; Tue, 28 Mar 2023 05:49:46 -0700 (PDT) X-Google-Smtp-Source: AKy350YHctzeRlFQsQpc5eXPOLA1ho/vQMTzTIV2wjtkuFOG67ImdFMYRQNaVzqPQ8b1k5AGBLiC X-Received: by 2002:a05:6402:45:b0:4ea:a9b0:a511 with SMTP id f5-20020a056402004500b004eaa9b0a511mr15296127edu.37.1680007786273; Tue, 28 Mar 2023 05:49:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680007786; cv=none; d=google.com; s=arc-20160816; b=BuNrpHH2KFgoRL7rJ6leL/q8eqm2C9awm5tO6qIfWmpnWnLIDZZnrgodaHszdhKJGR gOldP4BU3bFWr2EF9IJBLqMR/Hmi/j/DJhaBWWnOyrHd9x4DIdR02qiqe61fsck9t0MB ICvmshfzHpI9yNrUg64jrG8DKW0sQPLtzSRja0P3R1013Cv5GxoKNJiRD6GVMYAuoo+s 0XO0DM/IEMQNsqqBYk372mPuM06aB55ps0uji8y0vtrsDiKyjRMSeRtnJ/iihogI70z3 gAMByFQ3iVnaj9j+AgHLCIrP91V5NC6sf5+riQH1x1TmPCgdAbcZWJklsJVirzIdh3TV Qr2g== 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=MrmTWWrme99dZ7MmDRIJHoBz+470PwQiNPdy5DA5Zh4=; b=QLa/4Jer5n2mbY0DSZe3eToyyXAr5IQlSLK/4lbiy/Dkop9CoMv+1rqhtdwiC3NmAi 3yEqmBzVIbqav3AV6w2N5PWYWCE+916fbjEXNOqX4JUP4DiClQGHtKkTsM7Rvi9UXvNe l4U/0ti3N4j9IrZBO8c+kQQ2AOQy89Pk8yRNF9ePlkUBCbqeKFY4BpadZK9CU1ZLuBhH 63oq0jYKQUsnBqCaBTzX7/ykQDVpNXXkBTuMHUz95jblJkGB4+IHW9xlxEFxJYeSD4zv gadryt8Im5nqE6DPpVdRW4NzsOD0N1StoSWAraL6gA541eHtmDWfELmWyiNoZ9yu2FrJ 6eTQ== 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 sd17-20020a170906ce3100b0092b61cd26fesi21151707ejb.492.2023.03.28.05.49.22; Tue, 28 Mar 2023 05:49:46 -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; 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 S232642AbjC1Mpe (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Tue, 28 Mar 2023 08:45:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232500AbjC1Mp3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Mar 2023 08:45:29 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 88B49AD2D; Tue, 28 Mar 2023 05:45:06 -0700 (PDT) Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8Dx3tod3iJkgxkTAA--.17879S3; Tue, 28 Mar 2023 20:31:25 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxPL4X3iJku2cPAA--.12046S24; Tue, 28 Mar 2023 20:31:25 +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, Xi Ruoyao <xry111@xry111.site>, zhaotianrui@loongson.cn Subject: [PING PATCH v4 22/29] LoongArch: KVM: Implement handle idle exception Date: Tue, 28 Mar 2023 20:31:12 +0800 Message-Id: <20230328123119.3649361-23-zhaotianrui@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230328123119.3649361-1-zhaotianrui@loongson.cn> References: <20230328123119.3649361-1-zhaotianrui@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8CxPL4X3iJku2cPAA--.12046S24 X-CM-SenderInfo: p2kd03xldq233l6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvdXoW7JrW5uFykWr43XF43Ww48Zwb_yoW3ZrX_XF Z7tas3WrWrX3W5Kas8t3Z8Ca43Ga1kXFy5ZF12vry3Gr1qyrW5GrWDWwn5ZryktrWUuF4Y q3yvv3s7Aw1UtjkaLaAFLSUrUUUUeb8apTn2vfkv8UJUUUU8wcxFpf9Il3svdxBIdaVrn0 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=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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?1761615844582564988?= X-GMAIL-MSGID: =?utf-8?q?1761615844582564988?= |
Series |
Add KVM LoongArch support
|
|
Commit Message
zhaotianrui
March 28, 2023, 12:31 p.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(+)
diff --git a/arch/loongarch/kvm/exit.c b/arch/loongarch/kvm/exit.c index f151cc2dd..6618a410a 100644 --- a/arch/loongarch/kvm/exit.c +++ b/arch/loongarch/kvm/exit.c @@ -190,3 +190,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_idle(vcpu, KVM_TRACE_EXIT_IDLE); + if (!vcpu->arch.irq_pending) { + kvm_save_timer(vcpu); + kvm_vcpu_block(vcpu); + } + + return EMULATE_DONE; +}