lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 26 Dec 2020 10:26:19 +0000
From:   Anup Patel <Anup.Patel@....com>
To:     Jiangyifei <jiangyifei@...wei.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Palmer Dabbelt <palmerdabbelt@...gle.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Paolo Bonzini <pbonzini@...hat.com>
CC:     Alexander Graf <graf@...zon.com>,
        Atish Patra <Atish.Patra@....com>,
        Alistair Francis <Alistair.Francis@....com>,
        Damien Le Moal <Damien.LeMoal@....com>,
        Anup Patel <anup@...infault.org>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "kvm-riscv@...ts.infradead.org" <kvm-riscv@...ts.infradead.org>,
        "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>
Subject: RE: [PATCH v15 12/17] RISC-V: KVM: Add timer functionality



> -----Original Message-----
> From: Jiangyifei <jiangyifei@...wei.com>
> Sent: 23 December 2020 09:01
> To: Anup Patel <Anup.Patel@....com>; Palmer Dabbelt
> <palmer@...belt.com>; Palmer Dabbelt <palmerdabbelt@...gle.com>;
> Paul Walmsley <paul.walmsley@...ive.com>; Albert Ou
> <aou@...s.berkeley.edu>; Paolo Bonzini <pbonzini@...hat.com>
> Cc: Alexander Graf <graf@...zon.com>; Atish Patra
> <Atish.Patra@....com>; Alistair Francis <Alistair.Francis@....com>;
> Damien Le Moal <Damien.LeMoal@....com>; Anup Patel
> <anup@...infault.org>; kvm@...r.kernel.org; kvm-
> riscv@...ts.infradead.org; linux-riscv@...ts.infradead.org; linux-
> kernel@...r.kernel.org; Daniel Lezcano <daniel.lezcano@...aro.org>
> Subject: RE: [PATCH v15 12/17] RISC-V: KVM: Add timer functionality
> 
> 
> > -----Original Message-----
> > From: Anup Patel [mailto:anup.patel@....com]
> > Sent: Monday, November 9, 2020 7:33 PM
> > To: Palmer Dabbelt <palmer@...belt.com>; Palmer Dabbelt
> > <palmerdabbelt@...gle.com>; Paul Walmsley
> <paul.walmsley@...ive.com>;
> > Albert Ou <aou@...s.berkeley.edu>; Paolo Bonzini
> <pbonzini@...hat.com>
> > Cc: Alexander Graf <graf@...zon.com>; Atish Patra
> > <atish.patra@....com>; Alistair Francis <Alistair.Francis@....com>;
> > Damien Le Moal <damien.lemoal@....com>; Anup Patel
> > <anup@...infault.org>; kvm@...r.kernel.org;
> > kvm-riscv@...ts.infradead.org; linux-riscv@...ts.infradead.org;
> > linux-kernel@...r.kernel.org; Anup Patel <anup.patel@....com>; Daniel
> > Lezcano <daniel.lezcano@...aro.org>
> > Subject: [PATCH v15 12/17] RISC-V: KVM: Add timer functionality
> >
> > From: Atish Patra <atish.patra@....com>
> >
> > 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@....com>
> > Signed-off-by: Anup Patel <anup.patel@....com>
> > Acked-by: Paolo Bonzini <pbonzini@...hat.com>
> > Reviewed-by: Paolo Bonzini <pbonzini@...hat.com>
> > Acked-by: Daniel Lezcano <daniel.lezcano@...aro.org>
> > ---
> >  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

Powered by blists - more mailing lists