Message ID | 20230403093310.2271142-7-apatel@ventanamicro.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2174530vqo; Mon, 3 Apr 2023 02:41:05 -0700 (PDT) X-Google-Smtp-Source: AKy350aaFX7e9iTf2TbdIuBh113l5Uhjh6tshYQDqc/cDvAmIlgk3GAePyjwI3WaT2cHgJPHg7da X-Received: by 2002:a17:907:8e93:b0:948:aac6:7def with SMTP id tx19-20020a1709078e9300b00948aac67defmr1429709ejc.19.1680514865254; Mon, 03 Apr 2023 02:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680514865; cv=none; d=google.com; s=arc-20160816; b=yrWM5JLBEVVHwDLCQhOhfoxP2ekWjWMPTlDnfq0A6BhaMI8GViZ8IYiF31xa4JQmL7 C9WBkEpwqD5bxIwauNIxMAu0kXQ/MlxrfQwT/67L6gHlS8eQkbfYjHJojKaBm/DUOJjh XwMivJrhfQwWI8jKk1nuqjym13i/WAhcYCNGimmE7At96YsSAZ1yjN5h/ATgsWkj1+PM VSFCgIGMmJ9DfVM4CHC9Q6IPD5fpefp6AhgtLL4iUEadiBuTR0rmVuw74/CxycIB1alK lWK6Q30iS3H2JUaFzq7zPqmwZYbueNlsTLcdJq3YnCdmDTqGgu6gWOTxp/8kpwQnU4Zf mucg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DbIL2R4BbWdg8J7OAaKXV5aF5CAjir3TG4QymDLTrYk=; b=SfQsx0AuQaO31cfRIObiFNz6hAqeTVP7LnHJLFTJOcTAf55nwQXeySEjFFjTHfE3+C W78mInk/iiczeyWth6QT98hQDhF1p+dnUZssu9ZyHoMcd3wooIQVgNQKBgHSsd+/xpzJ 0XuSi5kGGi2ywFm7tMq6TAkS6m9vDNVyB6MEIn6TXibAtu4xGZEnhhs9tF7fPhSIVj7L omUCVvV3JSJVJObDH9krB4D0ZcxqN9+p9vXLVs34tlNemLVxRFydFAikGe+IewHkDk1H tUx88XzYLP7HlKvYZPPM2FKQtziqC6cLbUwbIxf0Yx1U20Os6yYtbavf9fHjMFXasZq5 ITUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Cf+4UIIP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a170906914200b009354991f96bsi11762ejw.739.2023.04.03.02.40.41; Mon, 03 Apr 2023 02:41:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Cf+4UIIP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232138AbjDCJey (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Mon, 3 Apr 2023 05:34:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232095AbjDCJeX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Apr 2023 05:34:23 -0400 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDDFC1164F for <linux-kernel@vger.kernel.org>; Mon, 3 Apr 2023 02:34:01 -0700 (PDT) Received: by mail-ot1-x336.google.com with SMTP id k14-20020a9d700e000000b0069faa923e7eso15260060otj.10 for <linux-kernel@vger.kernel.org>; Mon, 03 Apr 2023 02:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1680514438; x=1683106438; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DbIL2R4BbWdg8J7OAaKXV5aF5CAjir3TG4QymDLTrYk=; b=Cf+4UIIPv5TTBiyEN7r8FKIHYeEu53s+lvh9b6LpqOMAIAxQImwsj2/TwR7xTynMkp CK4edr++aEb5J743Bl62h+2m43WjwaUKdvAFViPNLfvw6ajNJDUNHaRuBCQFgn5CZ40s ON69nPkTq7d5cmP0V6MJ1N1GVuLPHsKMXqnX6n8v7l0WPBBmh1BrOdwhwgO4VF8Qjdit N5DT8M/4XqHbIKfAKoD97FU+8DK//cL+T7TANqzJ3T0sSaGUN9pxsNvG47iEgKEn+JA2 1czaUce3UMbB1Ba80BmyvnZ7alOdC7oX8SaNzXzoUm6V/0d05gudHEEZXPhJYsLdtijp IRfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680514438; x=1683106438; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DbIL2R4BbWdg8J7OAaKXV5aF5CAjir3TG4QymDLTrYk=; b=7hHhH3XsdbmFQ76SbYm4UvosDZIhaAAtBdySla/z+dSeyTodigwDQn1vNQOqVLiaMN gAyCXbYezwreyYm2/7UCaRVqF9BJFLHnJOLP+y/JLZXkeC14Oyw17JFWNzZJJTTZ1rWn GIG72YFXdhDitGFHw84S+5tbq1rzIvdmMs+jxarsMQt00i8zLfMUy4TPcmzm1ID4O7/O dHhmKp+hJ5S7Mt8c9J739wShIkIqnDFKR6nDyFCtB+vouX+obhscF1P2pFqggc5y1AJO dJ0cu1alCV2a3JuZ2i7YaSYBJtzZPP3ip32gPTP5M/rkR874F+fngXcLlabVDu2ZrUCz bAtw== X-Gm-Message-State: AAQBX9fpBBgD3nMf+hxYDUsqOkGG0QIC3dXiZ9O1mx+J92xuDyXcHAOT PrAncbdX0kow8ZQdG075D0Zcog== X-Received: by 2002:a05:6830:e12:b0:6a3:60c7:696d with SMTP id do18-20020a0568300e1200b006a360c7696dmr1452661otb.28.1680514438385; Mon, 03 Apr 2023 02:33:58 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id f5-20020a9d6c05000000b006a154373578sm3953953otq.39.2023.04.03.02.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 02:33:57 -0700 (PDT) From: Anup Patel <apatel@ventanamicro.com> To: Paolo Bonzini <pbonzini@redhat.com>, Atish Patra <atishp@atishpatra.org> Cc: Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <paul.walmsley@sifive.com>, Andrew Jones <ajones@ventanamicro.com>, Anup Patel <anup@brainfault.org>, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel <apatel@ventanamicro.com> Subject: [PATCH v3 6/8] RISC-V: KVM: Add ONE_REG interface for AIA CSRs Date: Mon, 3 Apr 2023 15:03:08 +0530 Message-Id: <20230403093310.2271142-7-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230403093310.2271142-1-apatel@ventanamicro.com> References: <20230403093310.2271142-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762147555547829883?= X-GMAIL-MSGID: =?utf-8?q?1762147555547829883?= |
Series |
RISC-V KVM virtualize AIA CSRs
|
|
Commit Message
Anup Patel
April 3, 2023, 9:33 a.m. UTC
We implement ONE_REG interface for AIA CSRs as a separate subtype
under the CSR ONE_REG interface.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
arch/riscv/include/uapi/asm/kvm.h | 8 ++++++++
arch/riscv/kvm/vcpu.c | 8 ++++++++
2 files changed, 16 insertions(+)
Comments
On Mon, Apr 03, 2023 at 03:03:08PM +0530, Anup Patel wrote: > We implement ONE_REG interface for AIA CSRs as a separate subtype > under the CSR ONE_REG interface. > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > arch/riscv/include/uapi/asm/kvm.h | 8 ++++++++ > arch/riscv/kvm/vcpu.c | 8 ++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h > index 182023dc9a51..cbc3e74fa670 100644 > --- a/arch/riscv/include/uapi/asm/kvm.h > +++ b/arch/riscv/include/uapi/asm/kvm.h > @@ -79,6 +79,10 @@ struct kvm_riscv_csr { > unsigned long scounteren; > }; > > +/* AIA CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > +struct kvm_riscv_aia_csr { > +}; > + > /* TIMER registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > struct kvm_riscv_timer { > __u64 frequency; > @@ -107,6 +111,7 @@ enum KVM_RISCV_ISA_EXT_ID { > KVM_RISCV_ISA_EXT_ZIHINTPAUSE, > KVM_RISCV_ISA_EXT_ZICBOM, > KVM_RISCV_ISA_EXT_ZBB, Looks like this patch is also based on "[PATCH] RISC-V: KVM: Allow Zbb extension for Guest/VM" Thanks, drew
On Mon, Apr 3, 2023 at 5:01 PM Andrew Jones <ajones@ventanamicro.com> wrote: > > On Mon, Apr 03, 2023 at 03:03:08PM +0530, Anup Patel wrote: > > We implement ONE_REG interface for AIA CSRs as a separate subtype > > under the CSR ONE_REG interface. > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > --- > > arch/riscv/include/uapi/asm/kvm.h | 8 ++++++++ > > arch/riscv/kvm/vcpu.c | 8 ++++++++ > > 2 files changed, 16 insertions(+) > > > > diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h > > index 182023dc9a51..cbc3e74fa670 100644 > > --- a/arch/riscv/include/uapi/asm/kvm.h > > +++ b/arch/riscv/include/uapi/asm/kvm.h > > @@ -79,6 +79,10 @@ struct kvm_riscv_csr { > > unsigned long scounteren; > > }; > > > > +/* AIA CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > > +struct kvm_riscv_aia_csr { > > +}; > > + > > /* TIMER registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > > struct kvm_riscv_timer { > > __u64 frequency; > > @@ -107,6 +111,7 @@ enum KVM_RISCV_ISA_EXT_ID { > > KVM_RISCV_ISA_EXT_ZIHINTPAUSE, > > KVM_RISCV_ISA_EXT_ZICBOM, > > KVM_RISCV_ISA_EXT_ZBB, > > Looks like this patch is also based on "[PATCH] RISC-V: KVM: Allow Zbb > extension for Guest/VM" Yes, do you want me to change the order of dependency? Regards, Anup
On Mon, Apr 03, 2023 at 05:34:57PM +0530, Anup Patel wrote: > On Mon, Apr 3, 2023 at 5:01 PM Andrew Jones <ajones@ventanamicro.com> wrote: > > > > On Mon, Apr 03, 2023 at 03:03:08PM +0530, Anup Patel wrote: > > > We implement ONE_REG interface for AIA CSRs as a separate subtype > > > under the CSR ONE_REG interface. > > > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > > --- > > > arch/riscv/include/uapi/asm/kvm.h | 8 ++++++++ > > > arch/riscv/kvm/vcpu.c | 8 ++++++++ > > > 2 files changed, 16 insertions(+) > > > > > > diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h > > > index 182023dc9a51..cbc3e74fa670 100644 > > > --- a/arch/riscv/include/uapi/asm/kvm.h > > > +++ b/arch/riscv/include/uapi/asm/kvm.h > > > @@ -79,6 +79,10 @@ struct kvm_riscv_csr { > > > unsigned long scounteren; > > > }; > > > > > > +/* AIA CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > > > +struct kvm_riscv_aia_csr { > > > +}; > > > + > > > /* TIMER registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > > > struct kvm_riscv_timer { > > > __u64 frequency; > > > @@ -107,6 +111,7 @@ enum KVM_RISCV_ISA_EXT_ID { > > > KVM_RISCV_ISA_EXT_ZIHINTPAUSE, > > > KVM_RISCV_ISA_EXT_ZICBOM, > > > KVM_RISCV_ISA_EXT_ZBB, > > > > Looks like this patch is also based on "[PATCH] RISC-V: KVM: Allow Zbb > > extension for Guest/VM" > > Yes, do you want me to change the order of dependency? It's probably best if neither depend on each other, since they're independent, but otherwise the order doesn't matter. It'd be nice to call the order out in the cover letter to give patchwork a chance at automatic build testing, though. To call it out, I believe adding Based-on: 20230401112730.2105240-1-apatel@ventanamicro.com to the cover letter should work. Thanks, drew
On Mon, Apr 03, 2023 at 03:03:08PM +0530, Anup Patel wrote: > We implement ONE_REG interface for AIA CSRs as a separate subtype > under the CSR ONE_REG interface. > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > arch/riscv/include/uapi/asm/kvm.h | 8 ++++++++ > arch/riscv/kvm/vcpu.c | 8 ++++++++ > 2 files changed, 16 insertions(+) > Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
On Mon, Apr 3, 2023 at 3:03 PM Anup Patel <apatel@ventanamicro.com> wrote: > > We implement ONE_REG interface for AIA CSRs as a separate subtype > under the CSR ONE_REG interface. > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > arch/riscv/include/uapi/asm/kvm.h | 8 ++++++++ > arch/riscv/kvm/vcpu.c | 8 ++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h > index 182023dc9a51..cbc3e74fa670 100644 > --- a/arch/riscv/include/uapi/asm/kvm.h > +++ b/arch/riscv/include/uapi/asm/kvm.h > @@ -79,6 +79,10 @@ struct kvm_riscv_csr { > unsigned long scounteren; > }; > > +/* AIA CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > +struct kvm_riscv_aia_csr { > +}; > + > /* TIMER registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > struct kvm_riscv_timer { > __u64 frequency; > @@ -107,6 +111,7 @@ enum KVM_RISCV_ISA_EXT_ID { > KVM_RISCV_ISA_EXT_ZIHINTPAUSE, > KVM_RISCV_ISA_EXT_ZICBOM, > KVM_RISCV_ISA_EXT_ZBB, > + KVM_RISCV_ISA_EXT_SSAIA, > KVM_RISCV_ISA_EXT_MAX, > }; > > @@ -153,8 +158,11 @@ enum KVM_RISCV_SBI_EXT_ID { > /* Control and status registers are mapped as type 3 */ > #define KVM_REG_RISCV_CSR (0x03 << KVM_REG_RISCV_TYPE_SHIFT) > #define KVM_REG_RISCV_CSR_GENERAL (0x0 << KVM_REG_RISCV_SUBTYPE_SHIFT) > +#define KVM_REG_RISCV_CSR_AIA (0x1 << KVM_REG_RISCV_SUBTYPE_SHIFT) > #define KVM_REG_RISCV_CSR_REG(name) \ > (offsetof(struct kvm_riscv_csr, name) / sizeof(unsigned long)) > +#define KVM_REG_RISCV_CSR_AIA_REG(name) \ > + (offsetof(struct kvm_riscv_aia_csr, name) / sizeof(unsigned long)) > > /* Timer registers are mapped as type 4 */ > #define KVM_REG_RISCV_TIMER (0x04 << KVM_REG_RISCV_TYPE_SHIFT) > diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c > index aca6b4fb7519..15507cd3a595 100644 > --- a/arch/riscv/kvm/vcpu.c > +++ b/arch/riscv/kvm/vcpu.c > @@ -58,6 +58,7 @@ static const unsigned long kvm_isa_ext_arr[] = { > [KVM_RISCV_ISA_EXT_I] = RISCV_ISA_EXT_i, > [KVM_RISCV_ISA_EXT_M] = RISCV_ISA_EXT_m, > > + KVM_ISA_EXT_ARR(SSAIA), > KVM_ISA_EXT_ARR(SSTC), > KVM_ISA_EXT_ARR(SVINVAL), > KVM_ISA_EXT_ARR(SVPBMT), > @@ -97,6 +98,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) > case KVM_RISCV_ISA_EXT_C: > case KVM_RISCV_ISA_EXT_I: > case KVM_RISCV_ISA_EXT_M: > + case KVM_RISCV_ISA_EXT_SSAIA: > case KVM_RISCV_ISA_EXT_SSTC: > case KVM_RISCV_ISA_EXT_SVINVAL: > case KVM_RISCV_ISA_EXT_ZIHINTPAUSE: > @@ -520,6 +522,9 @@ static int kvm_riscv_vcpu_get_reg_csr(struct kvm_vcpu *vcpu, > case KVM_REG_RISCV_CSR_GENERAL: > rc = kvm_riscv_vcpu_general_get_csr(vcpu, reg_num, ®_val); > break; > + case KVM_REG_RISCV_CSR_AIA: > + rc = kvm_riscv_vcpu_aia_get_csr(vcpu, reg_num, ®_val); > + break; > default: > rc = -EINVAL; > break; > @@ -556,6 +561,9 @@ static int kvm_riscv_vcpu_set_reg_csr(struct kvm_vcpu *vcpu, > case KVM_REG_RISCV_CSR_GENERAL: > rc = kvm_riscv_vcpu_general_set_csr(vcpu, reg_num, reg_val); > break; > + case KVM_REG_RISCV_CSR_AIA: > + rc = kvm_riscv_vcpu_aia_set_csr(vcpu, reg_num, reg_val); > + break; > default: > rc = -EINVAL; > break; > -- > 2.34.1 > Reviewed-by: Atish Patra <atishp@rivosinc.com>
On Mon, Apr 03, 2023 at 02:23:01PM +0200, Andrew Jones wrote: > On Mon, Apr 03, 2023 at 05:34:57PM +0530, Anup Patel wrote: > > On Mon, Apr 3, 2023 at 5:01 PM Andrew Jones <ajones@ventanamicro.com> wrote: > > > > > > On Mon, Apr 03, 2023 at 03:03:08PM +0530, Anup Patel wrote: > > > > We implement ONE_REG interface for AIA CSRs as a separate subtype > > > > under the CSR ONE_REG interface. > > > > > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > > > --- > > > > arch/riscv/include/uapi/asm/kvm.h | 8 ++++++++ > > > > arch/riscv/kvm/vcpu.c | 8 ++++++++ > > > > 2 files changed, 16 insertions(+) > > > > > > > > diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h > > > > index 182023dc9a51..cbc3e74fa670 100644 > > > > --- a/arch/riscv/include/uapi/asm/kvm.h > > > > +++ b/arch/riscv/include/uapi/asm/kvm.h > > > > @@ -79,6 +79,10 @@ struct kvm_riscv_csr { > > > > unsigned long scounteren; > > > > }; > > > > > > > > +/* AIA CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > > > > +struct kvm_riscv_aia_csr { > > > > +}; > > > > + > > > > /* TIMER registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > > > > struct kvm_riscv_timer { > > > > __u64 frequency; > > > > @@ -107,6 +111,7 @@ enum KVM_RISCV_ISA_EXT_ID { > > > > KVM_RISCV_ISA_EXT_ZIHINTPAUSE, > > > > KVM_RISCV_ISA_EXT_ZICBOM, > > > > KVM_RISCV_ISA_EXT_ZBB, > > > > > > Looks like this patch is also based on "[PATCH] RISC-V: KVM: Allow Zbb > > > extension for Guest/VM" > > > > Yes, do you want me to change the order of dependency? > > It's probably best if neither depend on each other, since they're > independent, but otherwise the order doesn't matter. It'd be nice to call > the order out in the cover letter to give patchwork a chance at automatic > build testing, though. To call it out, I believe adding > > Based-on: 20230401112730.2105240-1-apatel@ventanamicro.com > > to the cover letter should work. I also just noticed that this based on "RISC-V: KVM: Add ONE_REG interface to enable/disable SBI extensions"[1] and it needs to be in order to pick up the KVM_REG_RISCV_SUBTYPE_MASK and KVM_REG_RISCV_SUBTYPE_SHIFT defines. It'd be good to call that patch out with Based-on. [1]: 20230331174542.2067560-2-apatel@ventanamicro.com Thanks, drew
On Tue, Apr 04, 2023 at 01:52:43PM +0200, Andrew Jones wrote: > On Mon, Apr 03, 2023 at 02:23:01PM +0200, Andrew Jones wrote: > > It's probably best if neither depend on each other, since they're > > independent, but otherwise the order doesn't matter. It'd be nice to call > > the order out in the cover letter to give patchwork a chance at automatic > > build testing, though. To call it out, I believe adding > > > > Based-on: 20230401112730.2105240-1-apatel@ventanamicro.com > > > > to the cover letter should work. > > I also just noticed that this based on "RISC-V: KVM: Add ONE_REG > interface to enable/disable SBI extensions"[1] and it needs to be > in order to pick up the KVM_REG_RISCV_SUBTYPE_MASK and > KVM_REG_RISCV_SUBTYPE_SHIFT defines. It'd be good to call that > patch out with Based-on. > > [1]: 20230331174542.2067560-2-apatel@ventanamicro.com I've been waiting for a review on that for a while.. It's been 3 weeks, so just gonna merge it and see what breaks!
On Tue, Apr 04, 2023 at 01:52:43PM +0200, Andrew Jones wrote: > On Mon, Apr 03, 2023 at 02:23:01PM +0200, Andrew Jones wrote: > > On Mon, Apr 03, 2023 at 05:34:57PM +0530, Anup Patel wrote: > > > On Mon, Apr 3, 2023 at 5:01 PM Andrew Jones <ajones@ventanamicro.com> wrote: > > > > > > > > On Mon, Apr 03, 2023 at 03:03:08PM +0530, Anup Patel wrote: > > > > > We implement ONE_REG interface for AIA CSRs as a separate subtype > > > > > under the CSR ONE_REG interface. > > > > > > > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > > > > --- > > > > > arch/riscv/include/uapi/asm/kvm.h | 8 ++++++++ > > > > > arch/riscv/kvm/vcpu.c | 8 ++++++++ > > > > > 2 files changed, 16 insertions(+) > > > > > > > > > > diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h > > > > > index 182023dc9a51..cbc3e74fa670 100644 > > > > > --- a/arch/riscv/include/uapi/asm/kvm.h > > > > > +++ b/arch/riscv/include/uapi/asm/kvm.h > > > > > @@ -79,6 +79,10 @@ struct kvm_riscv_csr { > > > > > unsigned long scounteren; > > > > > }; > > > > > > > > > > +/* AIA CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > > > > > +struct kvm_riscv_aia_csr { > > > > > +}; > > > > > + > > > > > /* TIMER registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ > > > > > struct kvm_riscv_timer { > > > > > __u64 frequency; > > > > > @@ -107,6 +111,7 @@ enum KVM_RISCV_ISA_EXT_ID { > > > > > KVM_RISCV_ISA_EXT_ZIHINTPAUSE, > > > > > KVM_RISCV_ISA_EXT_ZICBOM, > > > > > KVM_RISCV_ISA_EXT_ZBB, > > > > > > > > Looks like this patch is also based on "[PATCH] RISC-V: KVM: Allow Zbb > > > > extension for Guest/VM" > > > > > > Yes, do you want me to change the order of dependency? > > > > It's probably best if neither depend on each other, since they're > > independent, but otherwise the order doesn't matter. It'd be nice to call > > the order out in the cover letter to give patchwork a chance at automatic > > build testing, though. To call it out, I believe adding > > > > Based-on: 20230401112730.2105240-1-apatel@ventanamicro.com > > > > to the cover letter should work. > > I also just noticed that this based on "RISC-V: KVM: Add ONE_REG > interface to enable/disable SBI extensions"[1] and it needs to be > in order to pick up the KVM_REG_RISCV_SUBTYPE_MASK and > KVM_REG_RISCV_SUBTYPE_SHIFT defines. It'd be good to call that > patch out with Based-on. > > [1]: 20230331174542.2067560-2-apatel@ventanamicro.com And "RISC-V IPI Improvements", 20230328035223.1480939-1-apatel@ventanamicro.com, which is required for riscv_get_intc_hwnode() Thanks, drew
On Tue, Apr 04, 2023 at 12:58:41PM +0100, Conor Dooley wrote: > On Tue, Apr 04, 2023 at 01:52:43PM +0200, Andrew Jones wrote: > > On Mon, Apr 03, 2023 at 02:23:01PM +0200, Andrew Jones wrote: > > > > It's probably best if neither depend on each other, since they're > > > independent, but otherwise the order doesn't matter. It'd be nice to call > > > the order out in the cover letter to give patchwork a chance at automatic > > > build testing, though. To call it out, I believe adding > > > > > > Based-on: 20230401112730.2105240-1-apatel@ventanamicro.com > > > > > > to the cover letter should work. > > > > I also just noticed that this based on "RISC-V: KVM: Add ONE_REG > > interface to enable/disable SBI extensions"[1] and it needs to be > > in order to pick up the KVM_REG_RISCV_SUBTYPE_MASK and > > KVM_REG_RISCV_SUBTYPE_SHIFT defines. It'd be good to call that > > patch out with Based-on. > > > > [1]: 20230331174542.2067560-2-apatel@ventanamicro.com > > I've been waiting for a review on that for a while.. It's been 3 > weeks, so just gonna merge it and see what breaks! I did in fact break some stuff, but the output was no worse than if the dependencies had not been specified... I've fixed it (I think!) and told it to ignore the old state, so it'll re-run against the stuff it missed. Cheers, Conor.
diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index 182023dc9a51..cbc3e74fa670 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -79,6 +79,10 @@ struct kvm_riscv_csr { unsigned long scounteren; }; +/* AIA CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ +struct kvm_riscv_aia_csr { +}; + /* TIMER registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */ struct kvm_riscv_timer { __u64 frequency; @@ -107,6 +111,7 @@ enum KVM_RISCV_ISA_EXT_ID { KVM_RISCV_ISA_EXT_ZIHINTPAUSE, KVM_RISCV_ISA_EXT_ZICBOM, KVM_RISCV_ISA_EXT_ZBB, + KVM_RISCV_ISA_EXT_SSAIA, KVM_RISCV_ISA_EXT_MAX, }; @@ -153,8 +158,11 @@ enum KVM_RISCV_SBI_EXT_ID { /* Control and status registers are mapped as type 3 */ #define KVM_REG_RISCV_CSR (0x03 << KVM_REG_RISCV_TYPE_SHIFT) #define KVM_REG_RISCV_CSR_GENERAL (0x0 << KVM_REG_RISCV_SUBTYPE_SHIFT) +#define KVM_REG_RISCV_CSR_AIA (0x1 << KVM_REG_RISCV_SUBTYPE_SHIFT) #define KVM_REG_RISCV_CSR_REG(name) \ (offsetof(struct kvm_riscv_csr, name) / sizeof(unsigned long)) +#define KVM_REG_RISCV_CSR_AIA_REG(name) \ + (offsetof(struct kvm_riscv_aia_csr, name) / sizeof(unsigned long)) /* Timer registers are mapped as type 4 */ #define KVM_REG_RISCV_TIMER (0x04 << KVM_REG_RISCV_TYPE_SHIFT) diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index aca6b4fb7519..15507cd3a595 100644 --- a/arch/riscv/kvm/vcpu.c +++ b/arch/riscv/kvm/vcpu.c @@ -58,6 +58,7 @@ static const unsigned long kvm_isa_ext_arr[] = { [KVM_RISCV_ISA_EXT_I] = RISCV_ISA_EXT_i, [KVM_RISCV_ISA_EXT_M] = RISCV_ISA_EXT_m, + KVM_ISA_EXT_ARR(SSAIA), KVM_ISA_EXT_ARR(SSTC), KVM_ISA_EXT_ARR(SVINVAL), KVM_ISA_EXT_ARR(SVPBMT), @@ -97,6 +98,7 @@ static bool kvm_riscv_vcpu_isa_disable_allowed(unsigned long ext) case KVM_RISCV_ISA_EXT_C: case KVM_RISCV_ISA_EXT_I: case KVM_RISCV_ISA_EXT_M: + case KVM_RISCV_ISA_EXT_SSAIA: case KVM_RISCV_ISA_EXT_SSTC: case KVM_RISCV_ISA_EXT_SVINVAL: case KVM_RISCV_ISA_EXT_ZIHINTPAUSE: @@ -520,6 +522,9 @@ static int kvm_riscv_vcpu_get_reg_csr(struct kvm_vcpu *vcpu, case KVM_REG_RISCV_CSR_GENERAL: rc = kvm_riscv_vcpu_general_get_csr(vcpu, reg_num, ®_val); break; + case KVM_REG_RISCV_CSR_AIA: + rc = kvm_riscv_vcpu_aia_get_csr(vcpu, reg_num, ®_val); + break; default: rc = -EINVAL; break; @@ -556,6 +561,9 @@ static int kvm_riscv_vcpu_set_reg_csr(struct kvm_vcpu *vcpu, case KVM_REG_RISCV_CSR_GENERAL: rc = kvm_riscv_vcpu_general_set_csr(vcpu, reg_num, reg_val); break; + case KVM_REG_RISCV_CSR_AIA: + rc = kvm_riscv_vcpu_aia_set_csr(vcpu, reg_num, reg_val); + break; default: rc = -EINVAL; break;