[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJve8omsTQB04dZDCtK=0Fz3ExTuPFVQKvxz9Du5WyfqOwnuSg@mail.gmail.com>
Date: Wed, 6 Sep 2023 17:01:00 +0800
From: Haibo Xu <xiaobo55x@...il.com>
To: Andrew Jones <ajones@...tanamicro.com>
Cc: Haibo Xu <haibo1.xu@...el.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Paolo Bonzini <pbonzini@...hat.com>,
Shuah Khan <shuah@...nel.org>, Marc Zyngier <maz@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>,
James Morse <james.morse@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>,
Anup Patel <anup@...infault.org>,
Atish Patra <atishp@...shpatra.org>,
Guo Ren <guoren@...nel.org>,
Conor Dooley <conor.dooley@...rochip.com>,
Daniel Henrique Barboza <dbarboza@...tanamicro.com>,
Greentime Hu <greentime.hu@...ive.com>,
Sean Christopherson <seanjc@...gle.com>,
Ricardo Koller <ricarkol@...gle.com>,
Vishal Annapurve <vannapurve@...gle.com>,
Aaron Lewis <aaronlewis@...gle.com>,
David Matlack <dmatlack@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Ackerley Tng <ackerleytng@...gle.com>,
Mingwei Zhang <mizhang@...gle.com>,
Vipin Sharma <vipinsh@...gle.com>,
Lei Wang <lei4.wang@...el.com>, Like Xu <likexu@...cent.com>,
Peter Gonda <pgonda@...gle.com>,
Maxim Levitsky <mlevitsk@...hat.com>,
Thomas Huth <thuth@...hat.com>,
Philippe Mathieu-Daudé <philmd@...aro.org>,
David Woodhouse <dwmw@...zon.co.uk>,
Michal Luczaj <mhal@...x.co>, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org, kvm@...r.kernel.org,
linux-kselftest@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev,
kvm-riscv@...ts.infradead.org
Subject: Re: [PATCH v2 2/8] KVM: arm64: selftest: Split arch_timer test code
On Wed, Sep 6, 2023 at 3:01 PM Andrew Jones <ajones@...tanamicro.com> wrote:
>
> On Wed, Sep 06, 2023 at 11:44:26AM +0800, Haibo Xu wrote:
> > On Wed, Sep 6, 2023 at 10:14 AM Haibo Xu <xiaobo55x@...il.com> wrote:
> > >
> > > On Mon, Sep 4, 2023 at 9:24 PM Andrew Jones <ajones@...tanamicro.com> wrote:
> ...
> > > > > +
> > > > > +enum guest_stage {
> > > > > + GUEST_STAGE_VTIMER_CVAL=1,
> > > > > + GUEST_STAGE_VTIMER_TVAL,
> > > > > + GUEST_STAGE_PTIMER_CVAL,
> > > > > + GUEST_STAGE_PTIMER_TVAL,
> > > > > + GUEST_STAGE_MAX,
> > > > > +};
> > > >
> > > > This enum also belongs in aarch64/arch_timer.c
> > > >
> > >
> > > Yes, it should be in aarch64/arch_timer.c
> > >
> >
> > After moving the above enum definition to aarch64/arch_timer.c, the
> > below errors was reported
> > while compiling kvm/arch_timer.o
> >
> > include/timer_test.h:37:26: error: field ‘guest_stage’ has incomplete type
> > 37 | enum guest_stage guest_stage;
> > | ^~~~~~~~~~~
> >
> > Since kvm/arch_timer.c was independent of kvm/aarch64/arch_timer.c
> > during OBJ compiling,
> > I think it may be not possible to move the enum definition to
> > aarch64/arch_timer.c
> >
> > If we keep the definition in this header file, we can enclose it with
> > #ifdef __aarch64__ for aarch64 only.
> >
>
> Let's change struct test_vcpu_shared_data to
>
> struct test_vcpu_shared_data {
> int nr_iter;
> int guest_stage;
> uint64_t xcnt;
> };
>
> and then let the aarch64 code treat guest_stage as an enum and the riscv
> code can completely ignore it (no need to create an unused enum).
>
Good idea! Will fix it in v3.
> Thanks,
> drew
Powered by blists - more mailing lists