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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AC28C38142 for ; Fri, 27 Jan 2023 12:40:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234286AbjA0MkO (ORCPT ); Fri, 27 Jan 2023 07:40:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234427AbjA0Mju (ORCPT ); Fri, 27 Jan 2023 07:39:50 -0500 Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B3012007A for ; Fri, 27 Jan 2023 04:38:32 -0800 (PST) Received: by mail-vs1-xe2a.google.com with SMTP id j7so5107427vsl.11 for ; Fri, 27 Jan 2023 04:38:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=76/Qo0p/UxKI75yKdBSKj64ShK7ggokQHoWD6X+9VHg=; b=Hszngf222LTCIZHcJU1fcQ3FtMpp0R2eOQm3OvoYjsDNqUd9DWcmWOy+/4fg78+HsO 8XFpqun0Ueoj6fmd17AWt7K/6W2VW1sD/tmGPEQcv4nIf9Gt3HuB0Vnhk/IwXI1pSYGJ BPZXC2Km1XXz633t+U9T88H2NhD1Xhj19dWgOmKi0Ec6TgvVDAHSMWw0oEdfg5mMiwUp QFM3/gIYS3j1sl3Pz9WOlt/pZg66CUZmDctaZTQiyqh4feNu+YQconFv4gttY67JPn67 yOiZvxB6QYbnHv4Q60G40Qo4FX7HK0lwkbFRczhuBipr3M3bs+35aM8GDrCkk65hkX7y amzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=76/Qo0p/UxKI75yKdBSKj64ShK7ggokQHoWD6X+9VHg=; b=RinvG35yI0VbQBwnCcR81lYz3j7RlYLvn5ja4eTFhNqpPznuuYF1ZCwoaS/pMGYEzf o3PlP5V/aMGAJMQpjxoXsxe7PM7MoKbNKdiznNPYuzKEBRPHmFdyAOnpSNxhZx9ZOPhG LCyyTToIZjxjLkQuMnGqbUbmLkuRtwQFcNNrripvtm/sx1hWR8wAgc1eutXOxvHiRHhh FdG2yAj68VUHopF2scvyHyaBX7k1GRsSI8yOsz1SpzPH9yI6AniPvl6cpT/gc2R2uXxO 2LSAKPRLGBKf7sYIpYZFGXUXfrvnyuLZiqFU6Ed2vmIbKGgLlkx/Rklbk/uypdWUfwWH eSqQ== X-Gm-Message-State: AFqh2kqt1Z8XYoUV1xgs/l5H/8lGkiCpr7Wg8RPqc75QPRUPM/Svenl+ j5INJ4fqShX7Hv2jgEDCjUpSUuW0X/KU9L6sT+cfzg== X-Google-Smtp-Source: AMrXdXvc0q+iLQCnU6T6GYjXCaxLciz1aBj2XVRZ5Wl7IH4DhMufJ5y3L690UwNsvqdwM9Ay5ls2J7TzC6BW9BtSReM= X-Received: by 2002:a05:6102:3134:b0:3d3:d816:c798 with SMTP id f20-20020a056102313400b003d3d816c798mr4972887vsh.59.1674823110815; Fri, 27 Jan 2023 04:38:30 -0800 (PST) MIME-Version: 1.0 References: <20230112140304.1830648-1-apatel@ventanamicro.com> <20230112140304.1830648-3-apatel@ventanamicro.com> <20230126160234.pkx4socjv3fcxpmn@orel> In-Reply-To: <20230126160234.pkx4socjv3fcxpmn@orel> From: Anup Patel Date: Fri, 27 Jan 2023 18:08:19 +0530 Message-ID: Subject: Re: [PATCH 2/7] RISC-V: Detect AIA CSRs from ISA string To: Andrew Jones Cc: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 26, 2023 at 9:32 PM Andrew Jones wrote: > > On Thu, Jan 12, 2023 at 07:32:59PM +0530, Anup Patel wrote: > > We have two extension names for AIA ISA support: Smaia (M-mode AIA CSRs) > > and Ssaia (S-mode AIA CSRs). > > > > We extend the ISA string parsing to detect Smaia and Ssaia extensions. > > > > Signed-off-by: Anup Patel > > --- > > arch/riscv/include/asm/hwcap.h | 8 ++++++++ > > arch/riscv/kernel/cpu.c | 2 ++ > > arch/riscv/kernel/cpufeature.c | 2 ++ > > 3 files changed, 12 insertions(+) > > > > diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h > > index 86328e3acb02..c649e85ed7bb 100644 > > --- a/arch/riscv/include/asm/hwcap.h > > +++ b/arch/riscv/include/asm/hwcap.h > > @@ -59,10 +59,18 @@ enum riscv_isa_ext_id { > > RISCV_ISA_EXT_ZIHINTPAUSE, > > RISCV_ISA_EXT_SSTC, > > RISCV_ISA_EXT_SVINVAL, > > + RISCV_ISA_EXT_SSAIA, > > + RISCV_ISA_EXT_SMAIA, > > These will change a couple different ways due other other patches in > flight, but let's put the pair in alphabetical order now so they get > moved together that way. Okay, I will update. > > > RISCV_ISA_EXT_ID_MAX > > }; > > static_assert(RISCV_ISA_EXT_ID_MAX <= RISCV_ISA_EXT_MAX); > > > > +#ifdef CONFIG_RISCV_M_MODE > > +#define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SMAIA > > +#else > > +#define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SSAIA > > +#endif > > This isn't used in this patch, so should probably be introduced in a later > patch when it is. Okay, I will move this to the patch where it is used. > > > + > > /* > > * This enum represents the logical ID for each RISC-V ISA extension static > > * keys. We can use static key to optimize code path if some ISA extensions > > diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c > > index 1b9a5a66e55a..a215ec929160 100644 > > --- a/arch/riscv/kernel/cpu.c > > +++ b/arch/riscv/kernel/cpu.c > > @@ -162,6 +162,8 @@ arch_initcall(riscv_cpuinfo_init); > > * extensions by an underscore. > > */ > > static struct riscv_isa_ext_data isa_ext_arr[] = { > > + __RISCV_ISA_EXT_DATA(smaia, RISCV_ISA_EXT_SMAIA), > > + __RISCV_ISA_EXT_DATA(ssaia, RISCV_ISA_EXT_SSAIA), > > __RISCV_ISA_EXT_DATA(sscofpmf, RISCV_ISA_EXT_SSCOFPMF), > > __RISCV_ISA_EXT_DATA(sstc, RISCV_ISA_EXT_SSTC), > > __RISCV_ISA_EXT_DATA(svinval, RISCV_ISA_EXT_SVINVAL), > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > > index 93e45560af30..3c5b51f519d5 100644 > > --- a/arch/riscv/kernel/cpufeature.c > > +++ b/arch/riscv/kernel/cpufeature.c > > @@ -228,6 +228,8 @@ void __init riscv_fill_hwcap(void) > > SET_ISA_EXT_MAP("zihintpause", RISCV_ISA_EXT_ZIHINTPAUSE); > > SET_ISA_EXT_MAP("sstc", RISCV_ISA_EXT_SSTC); > > SET_ISA_EXT_MAP("svinval", RISCV_ISA_EXT_SVINVAL); > > + SET_ISA_EXT_MAP("smaia", RISCV_ISA_EXT_SMAIA); > > + SET_ISA_EXT_MAP("ssaia", RISCV_ISA_EXT_SSAIA); > > } > > #undef SET_ISA_EXT_MAP > > } > > -- > > 2.34.1 > > > > Otherwise, > > Reviewed-by: Andrew Jones > Thanks, Anup