Message ID | cover.1690364259.git.haibo1.xu@intel.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp921409vqo; Thu, 27 Jul 2023 00:37:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlEAnwjuKCID1N3ty4DwE4KXx7ggyzLpfLq0O+BkxVfKRDYxlJFjs9PmDvwc++k6WxoOIxhG X-Received: by 2002:a05:6a21:3389:b0:131:6464:217b with SMTP id yy9-20020a056a21338900b001316464217bmr4432240pzb.16.1690443458619; Thu, 27 Jul 2023 00:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690443458; cv=none; d=google.com; s=arc-20160816; b=Ox5ZS4XuA1Y6WItbUsPijI1TNyCEUj66nppYMvqWVb/+lf+rU50I+8zq3pA9M4aajY raRHwAvx1176XMb9lANxhSwdhB4hg0P+kmcy+Rx7LlV9/D0fTlaYjY5OgK/b0WmEb0P0 qtmIdpFl9pZdogTg8uSag8fx0/70tGrg+u5dxxkUlHMRk4UjJ9zX+PerIVU/QHS1n5gu 5vlzif8hlET4ER4ibuRCm0CB26rULy9ZLhZFzyd/2OsDaLTkzD2tY5NcRkP5YE+yzv+w urHY+znFbEcIgWr/Z00JYToYjxCuf5ofpst9WaPi44g5XaUUrS9NF4qwCOmr6t4wZEtq m9wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=AFAir8P+qd6OOVypdfXY9ucqytO167f+E2+ziRisjQs=; fh=WoDkCPClHY1BxT+HuXaYYmUcPmzWf0zE3QNsc7zMQlg=; b=q4zIbCaE2eHTovbBgvyckJCR5BwszCobalTIsdwxuaVXEa0i+XlqZ8IBnt4vPZtdrj q0BSsBmLF39auPJ+PcXxXVbRud80sd7s+G/aUBUq22yjxj/1PRzTm5LHVoHSfIISzdHh fBs7pTmKrzlCXNtB/ekZKqpIhUgTRph5j6O2f/eli4TjgB2PNiRIgVYJ2U2uKLrVi90X qjz0rOSvf5BCqWG450BHNApzRcKcc8WaW0Z9AkpFp+tDjEU7LD20l5xIOMea0aDBSHsL cCKeH0dN+z/IWPT8KAeEDlJg4Roc/SomvpzDQ3O55aO4elYdJZORXQ3glbMQDZ1+FNjY 4yVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=Q8zGkq7P; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p28-20020a637f5c000000b0053eee173733si449579pgn.227.2023.07.27.00.37.25; Thu, 27 Jul 2023 00:37:38 -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=fail header.i=@intel.com header.s=Intel header.b=Q8zGkq7P; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233330AbjG0HZr (ORCPT <rfc822;hanasaki@gmail.com> + 99 others); Thu, 27 Jul 2023 03:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233290AbjG0HYN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 27 Jul 2023 03:24:13 -0400 Received: from mgamail.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22E336591; Thu, 27 Jul 2023 00:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690442122; x=1721978122; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=BAACILCTxyqMs2Tae391dkKNJN/XDjDizeOYFsgg42A=; b=Q8zGkq7PeQe9jti7KiHDsDYNAF+jBh6svKrMNGuu0AM2TlHU682TY/Qz Buc61xQWaMJzC3fez9Wvk9wI7rLcMeRogtuoRyvoj8G539E7nsSIdMlKU SMEBX6TW5XFVJdImSu6ln15HZ9wqi14NuKqPvk1J7KpL6QtuNmgoTZP/E Sz5Vel6uXnFGu2u99ikIhqGWfmSPiO3bLOjmejo7/hw75YVdhXXf26fw9 nc9aXrAJAdG5VY7pfIm0k2srzdKumSSkGRFKJmfqavsHKoEJwS9x5qJTp 36lNyizwrVAjOUGypbAt1cdFqCIoxXpTHNFN4J/HmHWeft+Q3/iv1GdoR w==; X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="367102049" X-IronPort-AV: E=Sophos;i="6.01,234,1684825200"; d="scan'208";a="367102049" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 00:14:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="720785797" X-IronPort-AV: E=Sophos;i="6.01,234,1684825200"; d="scan'208";a="720785797" Received: from haibo-optiplex-7090.sh.intel.com ([10.239.159.132]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 00:14:08 -0700 From: Haibo Xu <haibo1.xu@intel.com> Cc: xiaobo55x@gmail.com, haibo1.xu@intel.com, ajones@ventanamicro.com, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Paolo Bonzini <pbonzini@redhat.com>, Shuah Khan <shuah@kernel.org>, Anup Patel <anup@brainfault.org>, Atish Patra <atishp@atishpatra.org>, Sean Christopherson <seanjc@google.com>, Vipin Sharma <vipinsh@google.com>, Colton Lewis <coltonlewis@google.com>, Marc Zyngier <maz@kernel.org>, Andrew Jones <andrew.jones@linux.dev>, Vishal Annapurve <vannapurve@google.com>, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, kvm-riscv@lists.infradead.org Subject: [PATCH 0/4] RISCV: Add kvm Sstc timer selftest Date: Thu, 27 Jul 2023 15:20:04 +0800 Message-Id: <cover.1690364259.git.haibo1.xu@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772558440062037241 X-GMAIL-MSGID: 1772558440062037241 |
Series | RISCV: Add kvm Sstc timer selftest | |
Message
Haibo Xu
July 27, 2023, 7:20 a.m. UTC
The sstc_timer selftest is used to validate Sstc timer functionality in a guest, which sets up periodic timer interrupts and check the basic interrupt status upon its receipt. This KVM selftest was ported from aarch64 arch_timer and tested with Linux v6.5-rc3 on a Qemu riscv64 virt machine. Haibo Xu (4): tools: riscv: Add header file csr.h KVM: riscv: selftests: Add exception handling support KVM: riscv: selftests: Add guest helper to get vcpu id KVM: riscv: selftests: Add sstc_timer test tools/arch/riscv/include/asm/csr.h | 127 ++++++ tools/testing/selftests/kvm/Makefile | 2 + .../selftests/kvm/include/riscv/processor.h | 76 ++++ .../selftests/kvm/include/riscv/sstc_timer.h | 70 ++++ .../selftests/kvm/lib/riscv/handlers.S | 101 +++++ .../selftests/kvm/lib/riscv/processor.c | 74 ++++ .../testing/selftests/kvm/riscv/sstc_timer.c | 382 ++++++++++++++++++ 7 files changed, 832 insertions(+) create mode 100644 tools/arch/riscv/include/asm/csr.h create mode 100644 tools/testing/selftests/kvm/include/riscv/sstc_timer.h create mode 100644 tools/testing/selftests/kvm/lib/riscv/handlers.S create mode 100644 tools/testing/selftests/kvm/riscv/sstc_timer.c
Comments
On Thu, Jul 27, 2023, Haibo Xu wrote: > The sstc_timer selftest is used to validate Sstc timer functionality > in a guest, which sets up periodic timer interrupts and check the > basic interrupt status upon its receipt. > > This KVM selftest was ported from aarch64 arch_timer and tested > with Linux v6.5-rc3 on a Qemu riscv64 virt machine. Would it be possible to extract the ARM bits from arch_timer and make the bulk of the test common to ARM and RISC-V? At a glance, there is quite a bit of copy+paste.
On Thu, Jul 27, 2023 at 11:14 PM Sean Christopherson <seanjc@google.com> wrote: > > On Thu, Jul 27, 2023, Haibo Xu wrote: > > The sstc_timer selftest is used to validate Sstc timer functionality > > in a guest, which sets up periodic timer interrupts and check the > > basic interrupt status upon its receipt. > > > > This KVM selftest was ported from aarch64 arch_timer and tested > > with Linux v6.5-rc3 on a Qemu riscv64 virt machine. > > Would it be possible to extract the ARM bits from arch_timer and make the bulk of > the test common to ARM and RISC-V? At a glance, there is quite a bit of copy+paste. Sure, I will have a try to consolidate the common code for ARM and RISC-V in v2. Thanks, Haibo
On Fri, Jul 28, 2023 at 09:37:36AM +0800, Haibo Xu wrote: > On Thu, Jul 27, 2023 at 11:14 PM Sean Christopherson <seanjc@google.com> wrote: > > > > On Thu, Jul 27, 2023, Haibo Xu wrote: > > > The sstc_timer selftest is used to validate Sstc timer functionality > > > in a guest, which sets up periodic timer interrupts and check the > > > basic interrupt status upon its receipt. > > > > > > This KVM selftest was ported from aarch64 arch_timer and tested > > > with Linux v6.5-rc3 on a Qemu riscv64 virt machine. > > > > Would it be possible to extract the ARM bits from arch_timer and make the bulk of > > the test common to ARM and RISC-V? At a glance, there is quite a bit of copy+paste. > > Sure, I will have a try to consolidate the common code for ARM and RISC-V in v2. > Yes, afaict, we should be able to make aarch64/arch_timer.c another "split test", like we did for aarch64/get-reg-list.c, but before we do that, I'd like to get an ack from the Arm maintainers on the get-reg-list split to be sure that approach is acceptable. Thanks, drew
On Fri, Jul 28, 2023 at 5:57 PM Andrew Jones <ajones@ventanamicro.com> wrote: > > On Fri, Jul 28, 2023 at 09:37:36AM +0800, Haibo Xu wrote: > > On Thu, Jul 27, 2023 at 11:14 PM Sean Christopherson <seanjc@google.com> wrote: > > > > > > On Thu, Jul 27, 2023, Haibo Xu wrote: > > > > The sstc_timer selftest is used to validate Sstc timer functionality > > > > in a guest, which sets up periodic timer interrupts and check the > > > > basic interrupt status upon its receipt. > > > > > > > > This KVM selftest was ported from aarch64 arch_timer and tested > > > > with Linux v6.5-rc3 on a Qemu riscv64 virt machine. > > > > > > Would it be possible to extract the ARM bits from arch_timer and make the bulk of > > > the test common to ARM and RISC-V? At a glance, there is quite a bit of copy+paste. > > > > Sure, I will have a try to consolidate the common code for ARM and RISC-V in v2. > > > > Yes, afaict, we should be able to make aarch64/arch_timer.c another "split > test", like we did for aarch64/get-reg-list.c, but before we do that, I'd > like to get an ack from the Arm maintainers on the get-reg-list split to > be sure that approach is acceptable. > Yes, we can re-use the split method. Since there is less configuration data that should be handled, I think it may be easier for the timer test to consolidate the code, since most of the operations can be overloaded for different ARCH. I'll have a try and send the v2 soon! Thanks! > Thanks, > drew
On Thu, Jul 27, 2023, Haibo Xu wrote: > The sstc_timer selftest is used to validate Sstc timer functionality > in a guest, which sets up periodic timer interrupts and check the > basic interrupt status upon its receipt. > > This KVM selftest was ported from aarch64 arch_timer and tested > with Linux v6.5-rc3 on a Qemu riscv64 virt machine. > > Haibo Xu (4): > tools: riscv: Add header file csr.h > KVM: riscv: selftests: Add exception handling support > KVM: riscv: selftests: Add guest helper to get vcpu id > KVM: riscv: selftests: Add sstc_timer test FYI, patch 4 will conflict with the in-flight guest printf changes[*], as will reworking the existing arch_timer test. My plan is to create an immutable tag later this week (waiting to make sure nothing explodes). I highly recommend basing v2 on top of that. [*] https://lore.kernel.org/all/20230729003643.1053367-1-seanjc@google.com
On Thu, Aug 3, 2023 at 6:16 AM Sean Christopherson <seanjc@google.com> wrote: > > On Thu, Jul 27, 2023, Haibo Xu wrote: > > The sstc_timer selftest is used to validate Sstc timer functionality > > in a guest, which sets up periodic timer interrupts and check the > > basic interrupt status upon its receipt. > > > > This KVM selftest was ported from aarch64 arch_timer and tested > > with Linux v6.5-rc3 on a Qemu riscv64 virt machine. > > > > Haibo Xu (4): > > tools: riscv: Add header file csr.h > > KVM: riscv: selftests: Add exception handling support > > KVM: riscv: selftests: Add guest helper to get vcpu id > > KVM: riscv: selftests: Add sstc_timer test > > FYI, patch 4 will conflict with the in-flight guest printf changes[*], as will > reworking the existing arch_timer test. My plan is to create an immutable tag > later this week (waiting to make sure nothing explodes). I highly recommend basing > v2 on top of that. > > [*] https://lore.kernel.org/all/20230729003643.1053367-1-seanjc@google.com Sure, thanks for the info!