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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 22 Feb 2022 19:37:04 -0800
From:   Atish Patra <atishp@...shpatra.org>
To:     Anup Patel <apatel@...tanamicro.com>
Cc:     Paolo Bonzini <pbonzini@...hat.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Alistair Francis <Alistair.Francis@....com>,
        Anup Patel <anup@...infault.org>,
        KVM General <kvm@...r.kernel.org>,
        kvm-riscv@...ts.infradead.org,
        linux-riscv <linux-riscv@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org List" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 6/6] RISC-V: KVM: Implement SBI HSM suspend call

On Tue, Feb 1, 2022 at 12:24 AM Anup Patel <apatel@...tanamicro.com> wrote:
>
> The SBI v0.3 specification extends SBI HSM extension by adding SBI HSM
> suspend call and related HART states. This patch extends the KVM RISC-V
> HSM implementation to provide KVM guest a minimal SBI HSM suspend call
> which is equivalent to a WFI instruction.
>
> Signed-off-by: Anup Patel <apatel@...tanamicro.com>
> ---
>  arch/riscv/kvm/vcpu_sbi_hsm.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/arch/riscv/kvm/vcpu_sbi_hsm.c b/arch/riscv/kvm/vcpu_sbi_hsm.c
> index 1ac4b2e8e4ec..239dec0a628a 100644
> --- a/arch/riscv/kvm/vcpu_sbi_hsm.c
> +++ b/arch/riscv/kvm/vcpu_sbi_hsm.c
> @@ -61,6 +61,8 @@ static int kvm_sbi_hsm_vcpu_get_status(struct kvm_vcpu *vcpu)
>                 return -EINVAL;
>         if (!target_vcpu->arch.power_off)
>                 return SBI_HSM_STATE_STARTED;
> +       else if (vcpu->stat.generic.blocking)
> +               return SBI_HSM_STATE_SUSPENDED;
>         else
>                 return SBI_HSM_STATE_STOPPED;
>  }
> @@ -91,6 +93,18 @@ static int kvm_sbi_ext_hsm_handler(struct kvm_vcpu *vcpu, struct kvm_run *run,
>                         ret = 0;
>                 }
>                 break;
> +       case SBI_EXT_HSM_HART_SUSPEND:
> +               switch (cp->a0) {
> +               case SBI_HSM_SUSPEND_RET_DEFAULT:
> +                       kvm_riscv_vcpu_wfi(vcpu);
> +                       break;
> +               case SBI_HSM_SUSPEND_NON_RET_DEFAULT:
> +                       ret = -EOPNOTSUPP;
> +                       break;
> +               default:
> +                       ret = -EINVAL;
> +               }
> +               break;
>         default:
>                 ret = -EOPNOTSUPP;
>         }
> --
> 2.25.1
>

Reviewed-by: Atish Patra <atishp@...osinc.com>

-- 
Regards,
Atish

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ