From patchwork Tue Nov 7 12:04:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: maobibo X-Patchwork-Id: 16335 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp184420vqo; Tue, 7 Nov 2023 04:04:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9QY91en3S0X1UO08KdKHmKnV82XbAJcKnGQaZsGtlI854q1gab/rQ+gJdnXkr60MYhdvW X-Received: by 2002:a05:6870:5d90:b0:1ea:85b6:99e4 with SMTP id fu16-20020a0568705d9000b001ea85b699e4mr3244080oab.13.1699358694737; Tue, 07 Nov 2023 04:04:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699358694; cv=none; d=google.com; s=arc-20160816; b=u+GK5zuq8smkbQ5QxpGpwt09ERZ0YuBG6spCH9JWeQq0tGJOXtdfMUjPc7Os5sSJiQ WWTAXGo3403Xhs2vATRLOvy+8h8sxBaC+R+UFIRIxSVKsJTGKP0ndPO/pLRZOAWZAosn SJ++wm/PaLR9aYz6CxhpaC/Tc94VOTuX56ZoPEs8VBXgCT0PrBPqGRZUI6nO3Gm5Bd4/ TOhnZMameuWBYwdZnqA/dIqLCiD8ciXFLQT1CFUJ4uMTTkvDO2Tz69RrZB+u0JT3GuX8 VqD9j1gvgCBUrhWcDQG/IiRQ5kaeApWKO0vLVpXNP/5uh6qWoSLzCUtp1kAxx/tOXazo 6oRw== 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 :message-id:date:subject:cc:to:from; bh=yp8olO8b/8Hb0wXJrkB+ngeUSxRMaR/B5h0NbFXikE0=; fh=JOrDXAv7dX9lqUsWenmIinruxsV5NNS7FV+l4Q4onAY=; b=aajeod4dsTv4GjFwyrt5d8M76wfZZ6+qsBhtt0qqIz0JBsz7wiV5V/N2Fqnd8WYeRk F55lD2XnOKUs6lRPsd0GdFxMSHS6p5ND1O/M93ys8b4hgdxFkxzboczB60/NS/K84J/z KMg6YbZSy6Wa0iZGcVCRaurW+evQXSfTdXxV7GjALiES050tbidUx1UpPN/jB3ju8xKb 53qwt69Qfa3f9fy0CSITdX3s1N6YfyLISrVnGF8LcgGVKV3/TxpX81i+jFgIdsTn959m +3CgToMOjOi7PjQcGbE/akPj64sKMkdg5awGMhkpldtq6FhJej/MRV3cncoVztf86WXJ 2yPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id e186-20020a6369c3000000b0058bc1c85714si1975694pgc.467.2023.11.07.04.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 04:04:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id B24F88096A66; Tue, 7 Nov 2023 04:04:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232731AbjKGME0 (ORCPT + 32 others); Tue, 7 Nov 2023 07:04:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbjKGMEY (ORCPT ); Tue, 7 Nov 2023 07:04:24 -0500 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B84A5113; Tue, 7 Nov 2023 04:04:19 -0800 (PST) Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8CxruvAJ0pl2qw3AA--.40974S3; Tue, 07 Nov 2023 20:04:16 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Axji+_J0plPBo7AA--.63299S2; Tue, 07 Nov 2023 20:04:15 +0800 (CST) From: Bibo Mao To: Tianrui Zhao , Huacai Chen Cc: WANG Xuerui , kvm@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/3] LoongArch: KVM: Remove SW timer switch when vcpu is halt polling Date: Tue, 7 Nov 2023 20:04:11 +0800 Message-Id: <20231107120414.1927261-1-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Axji+_J0plPBo7AA--.63299S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW7JF1xtr45WFWfAryDCry7CFX_yoW8JrWUpF ZxCFnxXr4FkrWFq3W7ta1DXrnrX34fKFy7XwnFkFyrCr47Aw1FvFW8Kr95XFy3J393ArWI vryrt3W5uFyUAacCm3ZEXasCq-sJn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkYb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVWxJr0_GcWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27w Aqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE 14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x 0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E 7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcV C0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF 04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7 CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8j-e5UUUUU== X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 07 Nov 2023 04:04:50 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781906738634345765 X-GMAIL-MSGID: 1781906742847286616 This patches removes SW timer switch during vcpu block stage. VM uses HW timer rather than SW PV timer on LoongArch system, it can check HW timer pending interrupt status directly, rather than switch to SW timer and check injected SW timer interrupt. When SW timer is not used in vcpu block polling status, the relative SW timer handling before entering guest can be removed also. Timer emulation is simpler than before, SW timer emuation is only used in vcpu thread context switch. --- Changes in v2: Add halt polling support for idle instruction emulation, using api kvm_vcpu_halt rather than kvm_vcpu_block in function kvm_emu_idle. --- Bibo Mao (3): LoongArch: KVM: Remove SW timer switch when vcpu is halt polling LoongArch: KVM: Allow to access HW timer CSR registers always LoongArch: KVM: Remove kvm_acquire_timer before entering guest arch/loongarch/include/asm/kvm_vcpu.h | 1 - arch/loongarch/kvm/exit.c | 13 +------- arch/loongarch/kvm/main.c | 1 - arch/loongarch/kvm/timer.c | 48 ++++++++------------------- arch/loongarch/kvm/vcpu.c | 38 +++++---------------- 5 files changed, 22 insertions(+), 79 deletions(-) base-commit: d2f51b3516dade79269ff45eae2a7668ae711b25