linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Haibo Xu <xiaobo55x@gmail.com>
To: Atish Patra <atishp@rivosinc.com>
Cc: Atish Patra <atishp@atishpatra.org>,
	Haibo Xu <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>, Marc Zyngier <maz@kernel.org>,
	Oliver Upton <oliver.upton@linux.dev>,
	 James Morse <james.morse@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	 Zenghui Yu <yuzenghui@huawei.com>,
	Anup Patel <anup@brainfault.org>, Guo Ren <guoren@kernel.org>,
	 Mayuresh Chitale <mchitale@ventanamicro.com>,
	 Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
	Conor Dooley <conor.dooley@microchip.com>,
	 Samuel Holland <samuel@sholland.org>,
	Minda Chen <minda.chen@starfivetech.com>,
	 Jisheng Zhang <jszhang@kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	Peter Xu <peterx@redhat.com>,  Like Xu <likexu@tencent.com>,
	Vipin Sharma <vipinsh@google.com>, Thomas Huth <thuth@redhat.com>,
	 Aaron Lewis <aaronlewis@google.com>,
	 Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>,
	linux-kernel@vger.kernel.org,  linux-riscv@lists.infradead.org,
	kvm@vger.kernel.org,  linux-kselftest@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,  kvmarm@lists.linux.dev,
	kvm-riscv@lists.infradead.org
Subject: Re: [PATCH v5 11/12] KVM: riscv: selftests: Change vcpu_has_ext to a common function
Date: Wed, 21 Feb 2024 21:08:19 +0800	[thread overview]
Message-ID: <CAJve8omCZxsiP1jF0n5SBh0_U6q7Exj5A1ACFahWpdBoxohaMA@mail.gmail.com> (raw)
In-Reply-To: <2c96c61a-2685-4cee-9cef-963ed833bf92@rivosinc.com>

On Wed, Feb 21, 2024 at 4:37 PM Atish Patra <atishp@rivosinc.com> wrote:
>
> On 2/20/24 18:13, Haibo Xu wrote:
> > On Wed, Feb 21, 2024 at 7:03 AM Atish Patra <atishp@atishpatra.org> wrote:
> >>
> >> On Mon, Jan 22, 2024 at 1:48 AM Haibo Xu <haibo1.xu@intel.com> wrote:
> >>>
> >>> Move vcpu_has_ext to the processor.c and rename it to __vcpu_has_ext
> >>> so that other test cases can use it for vCPU extension check.
> >>>
> >>> Signed-off-by: Haibo Xu <haibo1.xu@intel.com>
> >>> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
> >>> ---
> >>>   tools/testing/selftests/kvm/include/riscv/processor.h |  2 ++
> >>>   tools/testing/selftests/kvm/lib/riscv/processor.c     | 10 ++++++++++
> >>>   tools/testing/selftests/kvm/riscv/get-reg-list.c      | 11 +----------
> >>>   3 files changed, 13 insertions(+), 10 deletions(-)
> >>>
> >>> diff --git a/tools/testing/selftests/kvm/include/riscv/processor.h b/tools/testing/selftests/kvm/include/riscv/processor.h
> >>> index b68b1b731a34..bd27e1c67579 100644
> >>> --- a/tools/testing/selftests/kvm/include/riscv/processor.h
> >>> +++ b/tools/testing/selftests/kvm/include/riscv/processor.h
> >>> @@ -42,6 +42,8 @@ static inline uint64_t __kvm_reg_id(uint64_t type, uint64_t idx,
> >>>   #define RISCV_ISA_EXT_REG(idx) __kvm_reg_id(KVM_REG_RISCV_ISA_EXT, \
> >>>                                               idx, KVM_REG_SIZE_ULONG)
> >>>
> >>> +bool __vcpu_has_ext(struct kvm_vcpu *vcpu, int ext);
> >>> +
> >>>   struct ex_regs {
> >>>          unsigned long ra;
> >>>          unsigned long sp;
> >>> diff --git a/tools/testing/selftests/kvm/lib/riscv/processor.c b/tools/testing/selftests/kvm/lib/riscv/processor.c
> >>> index 39a1e9902dec..dad73ce18164 100644
> >>> --- a/tools/testing/selftests/kvm/lib/riscv/processor.c
> >>> +++ b/tools/testing/selftests/kvm/lib/riscv/processor.c
> >>> @@ -15,6 +15,16 @@
> >>>
> >>>   static vm_vaddr_t exception_handlers;
> >>>
> >>> +bool __vcpu_has_ext(struct kvm_vcpu *vcpu, int ext)
> >>> +{
> >>> +       unsigned long value = 0;
> >>> +       int ret;
> >>> +
> >>> +       ret = __vcpu_get_reg(vcpu, RISCV_ISA_EXT_REG(ext), &value);
> >>> +
> >>> +       return !ret && !!value;
> >>> +}
> >>> +
> >>
> >> Not sure what was the base patch on which this was rebased. The actual
> >> commit in the queue branch looks different.
> >>
> >
> > This patch set was based on 6.7-rc8.
> >
> >> https://github.com/kvm-riscv/linux/commit/5563517cc2012e3326411b360c9924d3f2706c8d
> >>
> >> Both seem to have the same bug though the tests fail now and require
> >> the following fix.
> >> The ext id should be uint64_t and we need to pass ext directly so that
> >> SBI extension tests can also pass.
> >>
> >
> > It's weird that 6.7-rc8 has already included Andrew's change on the ISA ext reg,
> > but this patch was not generated against his change.
> >
> > commit bdf6aa328f137e184b0fce607fd585354c3742f1
> > Author: Andrew Jones <ajones@ventanamicro.com>
> > Date:   Wed Dec 13 18:09:58 2023 +0100
> >
> >      RISC-V: KVM: selftests: Treat SBI ext regs like ISA ext regs
> >
> > Anyway, your changes were right. Please go ahead to include them when merging.
> >
>
> I am not sure what happened. Probably, a merge conflict issue.
>
> I just realized I forgot to copy paste another fix in arch timer
>
> +++ b/tools/testing/selftests/kvm/riscv/arch_timer.c
> @@ -85,7 +85,7 @@ struct kvm_vm *test_vm_create(void)
>          int nr_vcpus = test_args.nr_vcpus;
>
>          vm = vm_create_with_vcpus(nr_vcpus, guest_code, vcpus);
> -       __TEST_REQUIRE(__vcpu_has_ext(vcpus[0], KVM_RISCV_ISA_EXT_SSTC),
> +       __TEST_REQUIRE(__vcpu_has_ext(vcpus[0],
> RISCV_ISA_EXT_REG(KVM_RISCV_ISA_EXT_SSTC)),
>

Right Fix!
Please let me know if I need to rebase this patch series on your tree
and resent it.

Thanks,
Haibo

  reply	other threads:[~2024-02-21 13:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22  9:58 [PATCH v5 00/12] RISCV: Add kvm Sstc timer selftests Haibo Xu
2024-01-22  9:58 ` [PATCH v5 01/12] selftests/kvm: Fix issues with $(SPLIT_TESTS) Haibo Xu
2024-01-22  9:58 ` [PATCH v5 02/12] KVM: arm64: selftests: Data type cleanup for arch_timer test Haibo Xu
2024-01-22 12:21   ` Andrew Jones
2024-01-22 13:08     ` Haibo Xu
2024-01-22  9:58 ` [PATCH v5 03/12] KVM: arm64: selftests: Enable tuning of error margin in " Haibo Xu
2024-01-22  9:58 ` [PATCH v5 04/12] KVM: arm64: selftests: Split arch_timer test code Haibo Xu
2024-01-22  9:58 ` [PATCH v5 05/12] KVM: selftests: Add CONFIG_64BIT definition for the build Haibo Xu
2024-01-22  9:58 ` [PATCH v5 06/12] tools: riscv: Add header file csr.h Haibo Xu
2024-01-22  9:58 ` [PATCH v5 07/12] tools: riscv: Add header file vdso/processor.h Haibo Xu
2024-01-22  9:58 ` [PATCH v5 08/12] KVM: riscv: selftests: Switch to use macro from csr.h Haibo Xu
2024-01-22  9:58 ` [PATCH v5 09/12] KVM: riscv: selftests: Add exception handling support Haibo Xu
2024-01-22  9:58 ` [PATCH v5 10/12] KVM: riscv: selftests: Add guest helper to get vcpu id Haibo Xu
2024-01-22  9:58 ` [PATCH v5 11/12] KVM: riscv: selftests: Change vcpu_has_ext to a common function Haibo Xu
2024-02-20 23:03   ` Atish Patra
2024-02-21  2:13     ` Haibo Xu
2024-02-21  8:37       ` Atish Patra
2024-02-21 13:08         ` Haibo Xu [this message]
2024-02-21 20:29           ` Atish Patra
2024-02-26  5:19         ` Anup Patel
2024-02-26  5:47           ` Haibo Xu
2024-01-22  9:58 ` [PATCH v5 12/12] KVM: riscv: selftests: Add sstc timer test Haibo Xu
2024-02-05 13:10 ` [PATCH v5 00/12] RISCV: Add kvm Sstc timer selftests Haibo Xu
2024-02-05 16:24   ` Marc Zyngier
2024-02-06  1:32     ` Haibo Xu
2024-02-12 12:23 ` Anup Patel
2024-02-18  6:41   ` Haibo Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJve8omCZxsiP1jF0n5SBh0_U6q7Exj5A1ACFahWpdBoxohaMA@mail.gmail.com \
    --to=xiaobo55x@gmail.com \
    --cc=aaronlewis@google.com \
    --cc=ajones@ventanamicro.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atishp@atishpatra.org \
    --cc=atishp@rivosinc.com \
    --cc=conor.dooley@microchip.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=guoren@kernel.org \
    --cc=haibo1.xu@intel.com \
    --cc=james.morse@arm.com \
    --cc=jszhang@kernel.org \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=likexu@tencent.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=maz@kernel.org \
    --cc=mchitale@ventanamicro.com \
    --cc=minda.chen@starfivetech.com \
    --cc=oliver.upton@linux.dev \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=samuel@sholland.org \
    --cc=seanjc@google.com \
    --cc=shuah@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=thuth@redhat.com \
    --cc=vipinsh@google.com \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).