RE: [PATCH v15 12/17] RISC-V: KVM: Add timer functionality

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Jiangyifei <jiangyifei@xxxxxxxxxx>
> Sent: 23 December 2020 09:01
> To: Anup Patel <Anup.Patel@xxxxxxx>; Palmer Dabbelt
> <palmer@xxxxxxxxxxx>; Palmer Dabbelt <palmerdabbelt@xxxxxxxxxx>;
> Paul Walmsley <paul.walmsley@xxxxxxxxxx>; Albert Ou
> <aou@xxxxxxxxxxxxxxxxx>; Paolo Bonzini <pbonzini@xxxxxxxxxx>
> Cc: Alexander Graf <graf@xxxxxxxxxx>; Atish Patra
> <Atish.Patra@xxxxxxx>; Alistair Francis <Alistair.Francis@xxxxxxx>;
> Damien Le Moal <Damien.LeMoal@xxxxxxx>; Anup Patel
> <anup@xxxxxxxxxxxxxx>; kvm@xxxxxxxxxxxxxxx; kvm-
> riscv@xxxxxxxxxxxxxxxxxxx; linux-riscv@xxxxxxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
> Subject: RE: [PATCH v15 12/17] RISC-V: KVM: Add timer functionality
> 
> 
> > -----Original Message-----
> > From: Anup Patel [mailto:anup.patel@xxxxxxx]
> > Sent: Monday, November 9, 2020 7:33 PM
> > To: Palmer Dabbelt <palmer@xxxxxxxxxxx>; Palmer Dabbelt
> > <palmerdabbelt@xxxxxxxxxx>; Paul Walmsley
> <paul.walmsley@xxxxxxxxxx>;
> > Albert Ou <aou@xxxxxxxxxxxxxxxxx>; Paolo Bonzini
> <pbonzini@xxxxxxxxxx>
> > Cc: Alexander Graf <graf@xxxxxxxxxx>; Atish Patra
> > <atish.patra@xxxxxxx>; Alistair Francis <Alistair.Francis@xxxxxxx>;
> > Damien Le Moal <damien.lemoal@xxxxxxx>; Anup Patel
> > <anup@xxxxxxxxxxxxxx>; kvm@xxxxxxxxxxxxxxx;
> > kvm-riscv@xxxxxxxxxxxxxxxxxxx; linux-riscv@xxxxxxxxxxxxxxxxxxx;
> > linux-kernel@xxxxxxxxxxxxxxx; Anup Patel <anup.patel@xxxxxxx>; Daniel
> > Lezcano <daniel.lezcano@xxxxxxxxxx>
> > Subject: [PATCH v15 12/17] RISC-V: KVM: Add timer functionality
> >
> > From: Atish Patra <atish.patra@xxxxxxx>
> >
> > The RISC-V hypervisor specification doesn't have any virtual timer feature.
> >
> > Due to this, the guest VCPU timer will be programmed via SBI calls.
> > The host will use a separate hrtimer event for each guest VCPU to
> > provide timer functionality. We inject a virtual timer interrupt to
> > the guest VCPU whenever the guest VCPU hrtimer event expires.
> >
> > This patch adds guest VCPU timer implementation along with ONE_REG
> > interface to access VCPU timer state from user space.
> >
> > Signed-off-by: Atish Patra <atish.patra@xxxxxxx>
> > Signed-off-by: Anup Patel <anup.patel@xxxxxxx>
> > Acked-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> > Reviewed-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> > Acked-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
> > ---
> >  arch/riscv/include/asm/kvm_host.h       |   7 +
> >  arch/riscv/include/asm/kvm_vcpu_timer.h |  44 +++++
> >  arch/riscv/include/uapi/asm/kvm.h       |  17 ++
> >  arch/riscv/kvm/Makefile                 |   2 +-
> >  arch/riscv/kvm/vcpu.c                   |  14 ++
> >  arch/riscv/kvm/vcpu_timer.c             | 225
> > ++++++++++++++++++++++++
> >  arch/riscv/kvm/vm.c                     |   2 +-
> >  drivers/clocksource/timer-riscv.c       |   8 +
> >  include/clocksource/timer-riscv.h       |  16 ++
> >  9 files changed, 333 insertions(+), 2 deletions(-)  create mode
> > 100644 arch/riscv/include/asm/kvm_vcpu_timer.h
> >  create mode 100644 arch/riscv/kvm/vcpu_timer.c  create mode 100644
> > include/clocksource/timer-riscv.h
> >
> > diff --git a/arch/riscv/include/asm/kvm_host.h
> > b/arch/riscv/include/asm/kvm_host.h
> > index 64311b262ee1..4daffc93f36a 100644
> > --- a/arch/riscv/include/asm/kvm_host.h
> > +++ b/arch/riscv/include/asm/kvm_host.h
> > @@ -12,6 +12,7 @@
> >  #include <linux/types.h>
> >  #include <linux/kvm.h>
> >  #include <linux/kvm_types.h>
> > +#include <asm/kvm_vcpu_timer.h>
> >
> >  #ifdef CONFIG_64BIT
> >  #define KVM_MAX_VCPUS			(1U << 16)
> > @@ -66,6 +67,9 @@ struct kvm_arch {
> >  	/* stage2 page table */
> >  	pgd_t *pgd;
> >  	phys_addr_t pgd_phys;
> > +
> > +	/* Guest Timer */
> > +	struct kvm_guest_timer timer;
> >  };
> >
> 
> ...
> 
> > diff --git a/arch/riscv/include/uapi/asm/kvm.h
> > b/arch/riscv/include/uapi/asm/kvm.h
> > index f7e9dc388d54..00196a13d743 100644
> > --- a/arch/riscv/include/uapi/asm/kvm.h
> > +++ b/arch/riscv/include/uapi/asm/kvm.h
> > @@ -74,6 +74,18 @@ struct kvm_riscv_csr {
> >  	unsigned long scounteren;
> >  };
> >
> > +/* TIMER registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
> > struct
> > +kvm_riscv_timer {
> > +	u64 frequency;
> > +	u64 time;
> > +	u64 compare;
> > +	u64 state;
> > +};
> > +
> 
> Hi,
> 
> There are some building errors when we build kernel by using allmodconfig.
> The commands are as follow:
> $ make allmodconfig ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- $ make
> -j64 ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu-
> 
> The following error occurs:
> [stdout] usr/include/Makefile:108: recipe for target
> 'usr/include/asm/kvm.hdrtest' failed [stderr] ./usr/include/asm/kvm.h:79:2:
> error: unknown type name 'u64'
> [stderr]   u64 frequency;
> [stderr]   ^~~
> [stderr] ./usr/include/asm/kvm.h:80:2: error: unknown type name 'u64'
> [stderr]   u64 time;
> [stderr]   ^~~
> [stderr] ./usr/include/asm/kvm.h:81:2: error: unknown type name 'u64'
> [stderr]   u64 compare;
> [stderr]   ^~~
> [stderr] ./usr/include/asm/kvm.h:82:2: error: unknown type name 'u64'
> [stderr]   u64 state;
> [stderr]   ^~~
> [stderr] make[2]: *** [usr/include/asm/kvm.hdrtest] Error 1
> 
> Is it better to change u64 to __u64?

Okay, I will investigate and replace it.

Regards,
Anup






[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux