Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 315A5C433EF for ; Fri, 19 Nov 2021 12:21:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F13361A8C for ; Fri, 19 Nov 2021 12:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234880AbhKSMYO (ORCPT ); Fri, 19 Nov 2021 07:24:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234715AbhKSMYN (ORCPT ); Fri, 19 Nov 2021 07:24:13 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55B0FC06173E for ; Fri, 19 Nov 2021 04:21:11 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id d24so17908761wra.0 for ; Fri, 19 Nov 2021 04:21:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ij7er2470Y2wPBGgkUoSGjBv9MApKpAoPSAbl3vcFGM=; b=JiC1txByfspEffoX8zfmeVfIBE3jhZB/PZ7F1nQhhz92MRm9YRHfoBGSDJGiQTIpOo jVaBi+Bw46dyRupANHaLOawHjD3Wn+t0zHAQh1QQfh+/47uRjDQCgvLuwKlf8jV46Rc4 6jXA2isUv3fxDFTbjHzl1QySpWmSzD0fdCdun4lLxz7kI/YGr81zF+wV7+C0weYrtLjz WWBuZoiAaWCGdK9QFghF9gvtPce1anQ5oos66FK+0eVDq63Rs03vdjESnkn8jdiFmxNS kdbgCM9EWxfBP7LOefkd02EyRq2q1BMkATbyKXdfw/I9J5sKjQ3z42IC8KfTApRmAmcJ GLsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ij7er2470Y2wPBGgkUoSGjBv9MApKpAoPSAbl3vcFGM=; b=s2x7SYxUM5AI9GTqyNk8CYtheNtCYG6KxOGIwo2pehsos4w6HbVXTRB0qH5s06+kq4 G9c9+niFHapohLAueiAbWSyLX/l1a2jGsjUlXeFJrHPh/BjJ9dHlFzfgJyRjzr8JOcUo gbMNhLD05yP26joSYhtvV4mCpFYkDk08zfo6L9LA/1ZP54txF/O7f571fpLXvVy+qRIa pGDr6P7FPNeFnE3kJ8yNRXkbdkDcU2ZmDdtEao6OiVV0xg+g0oUzgq38jgH8H6H1LVvp zQrTnz7aD7cGs30GPfvPGl7Qxsj1AokCtHs7eRKv5HkhS147+3sM8lGQ91M/pBuEauLf V0ww== X-Gm-Message-State: AOAM530zWfOCShBd2u6mmkzHYCYv1tXv4CrERPFupvH61uGCiwcUfGqo PYeyEfAWm0Yw5MpXfqNbHcIl9vDzUWqaus21dTGpxV1eTaU= X-Google-Smtp-Source: ABdhPJwpDih1Nz/ks8ZhQSJ1ATWfx3j/ZKzyQDFL08MT6G9WVQEczM3Z4uSFbhMCXYw9f5AP4oVpWgv71qyALRREcfA= X-Received: by 2002:a05:6000:1a45:: with SMTP id t5mr6835921wry.306.1637324469654; Fri, 19 Nov 2021 04:21:09 -0800 (PST) MIME-Version: 1.0 References: <20211117060241.611391-1-anup.patel@wdc.com> In-Reply-To: From: Anup Patel Date: Fri, 19 Nov 2021 17:50:58 +0530 Message-ID: Subject: Re: [PATCH] RISC-V: KVM: Fix incorrect KVM_MAX_VCPUS value To: Atish Patra Cc: Anup Patel , Palmer Dabbelt , Paul Walmsley , Paolo Bonzini , kvm-riscv@lists.infradead.org, KVM General , linux-riscv , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 18, 2021 at 1:23 PM Atish Patra wrote: > > On Tue, Nov 16, 2021 at 10:03 PM Anup Patel wrote: > > > > The KVM_MAX_VCPUS value is supposed to be aligned with number of > > VMID bits in the hgatp CSR but the current KVM_MAX_VCPUS value > > is aligned with number of ASID bits in the satp CSR. > > > > Fixes: 99cdc6c18c2d ("RISC-V: Add initial skeletal KVM support") > > Signed-off-by: Anup Patel > > --- > > arch/riscv/include/asm/kvm_host.h | 8 +++----- > > 1 file changed, 3 insertions(+), 5 deletions(-) > > > > diff --git a/arch/riscv/include/asm/kvm_host.h b/arch/riscv/include/asm/kvm_host.h > > index 25ba21f98504..2639b9ee48f9 100644 > > --- a/arch/riscv/include/asm/kvm_host.h > > +++ b/arch/riscv/include/asm/kvm_host.h > > @@ -12,14 +12,12 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > > > -#ifdef CONFIG_64BIT > > -#define KVM_MAX_VCPUS (1U << 16) > > -#else > > -#define KVM_MAX_VCPUS (1U << 9) > > -#endif > > +#define KVM_MAX_VCPUS \ > > + ((HGATP_VMID_MASK >> HGATP_VMID_SHIFT) + 1) > > > > #define KVM_HALT_POLL_NS_DEFAULT 500000 > > > > -- > > 2.25.1 > > > > > Reviewed-by: Atish Patra I have queued this patch for fixes. Thanks, Anup > > -- > Regards, > Atish