From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5004C4345F for ; Fri, 12 Apr 2024 18:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0oSZVNEXnFYAN1upd3rWhLipmmXax6Od99ur5SwU+F8=; b=g9taYLGoZpC6Dq JuPxb99E+3MVo0BzE6Y2K85Mpv1rSAytLSc3u15xmKaYKQMwiqeCR/3YDDOXllS/3eN6m7PebtUU5 SCIzqkkyuI9b3WoHZgifvmobLX61kMAslLpqqDXiVSDa2Yi/Bpx5fE4LFnbu+EqrFziyZQtGxFn+e jMsijlyn8rrdGXZIEaTPRZa3HCrqqOGcUffVtgWsgzqvJvieTqLSuCN/t2mYc3VC0ha/Q7DpjvXF5 ExOIZAbqZVb6a3yx/hRPdwgsO5CeJHh/azSWIx7EKvff4aMtIzj0LBcoBP/pkFdauYlt2Akp5On1w Qp7IRCB9rAokPxOyGBqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvLbO-00000000rBn-1R9m; Fri, 12 Apr 2024 18:26:18 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvLbM-00000000rAf-07ct for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2024 18:26:17 +0000 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-6ed054f282aso1027816b3a.0 for ; Fri, 12 Apr 2024 11:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712946375; x=1713551175; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=oMxTHfwmfGngfKcHt9BB7WUlzUr2s5LaZsK/l59Ii3w=; b=sF3tLcWINzzU+SOCfFioBX6XcUcbdMkjCJ55b6RvldUql1ZNssS4ZEhiuBVscgExuS NDqUtK4obyqsIY3vc31ZnNQ3XmnAXS7mPEO3Ad/QPF9sZ+XUo1hWhaxIlBOfMFd1XicZ DNfSnQTlzI6C++nQT5+DhN60+jMFsqDPEWBNhqZdgch9B093+nrIWLnJ9HEMyfM9OGFS emYzuhkazjinjx0Q7cmYc0KF/Ylc229tOjFB+ReDrMvrSI70JLsjLv+LX+PTeRRiWE2B BuGn2SN+NyCUWkOl8CqI0ncLH5uoQq0TfGUi9cQGEe7uq1HahH9PQ0KTeydGWTMDFXFX YF3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712946375; x=1713551175; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oMxTHfwmfGngfKcHt9BB7WUlzUr2s5LaZsK/l59Ii3w=; b=f/B5Mykzb/MKW7zijm9okymYw2INeygV+xfa+U/JzqGened3sN8c4G2J6IkUpEpMC8 Rv5Y/EoKgLsy1kwYq8exT5WpOpEckKK9O6VDG/aiaj5ZD44N4LpFPTDe3lCFoZTLaAAm xP2Hx9rz87mvVjislQcj8Q0iIVfEKsSAtGWoQpBpwFivbjD+cWn0L9B//kdngQU7D1Cz KwaGEMU0YaJTIe/b0KiA0S5F+GJVLc6Yljn/pOyAlU2M/dAhTpbgo75mprG/YPcFc+05 PzzU6nBVfnCMGchS95G1K21LD4MoHU0YBJNtJcGTRZyr9/AgpzoC23vg6p2Mn1pS2osU OCGA== X-Forwarded-Encrypted: i=1; AJvYcCVaYBiRABfKRJK1Z7eTwNuTbKFf2odJ9yTYLhcAF7JMbwKzRLQZrlnmzLkBN9GrBy66/QqAH6WRLz9az3pv9qi9phA9IAlE+MKpiocSYjVOkU0c8LA= X-Gm-Message-State: AOJu0Yy6IDDuyLe0LgJ2csBWrb80XWS9eDhbt090g8+mPLejllbtDd+b 01CuyBfZADLzjxqZz4eDfUNtilfXmvQJKaXVPIGZPB6h0lFvuGZKkYx2g3ZHlPc= X-Google-Smtp-Source: AGHT+IF+XDdyB5UuM6N1UjqqE0/VQom0I9Op5dF9IOxOPYX/5ovaNt57ADIRPWe8tJpR7LWz5w/zoQ== X-Received: by 2002:a05:6a20:9717:b0:1a9:8861:9e77 with SMTP id hr23-20020a056a20971700b001a988619e77mr3208395pzc.28.1712946374944; Fri, 12 Apr 2024 11:26:14 -0700 (PDT) Received: from ghost (mobile-166-137-160-039.mycingular.net. [166.137.160.39]) by smtp.gmail.com with ESMTPSA id q18-20020a63d612000000b005dc9ab425c2sm3053438pgg.35.2024.04.12.11.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:26:14 -0700 (PDT) Date: Fri, 12 Apr 2024 11:26:10 -0700 From: Charlie Jenkins To: Conor Dooley Cc: Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Evan Green , =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= , Jonathan Corbet , Shuah Khan , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Palmer Dabbelt , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH 15/19] riscv: hwcap: Add v to hwcap if xtheadvector enabled Message-ID: References: <20240411-dev-charlie-support_thead_vector_6_9-v1-0-4af9815ec746@rivosinc.com> <20240411-dev-charlie-support_thead_vector_6_9-v1-15-4af9815ec746@rivosinc.com> <20240412-thrill-amnesty-019897f21466@wendy> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240412-thrill-amnesty-019897f21466@wendy> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240412_112616_141358_4CE6C40E X-CRM114-Status: GOOD ( 27.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Apr 12, 2024 at 12:37:08PM +0100, Conor Dooley wrote: > On Thu, Apr 11, 2024 at 09:11:21PM -0700, Charlie Jenkins wrote: > > xtheadvector is not vector 1.0 compatible, but it can leverage all of > > the same save/restore routines as vector plus > > riscv_v_first_use_handler(). vector 1.0 and xtheadvector are mutually > > exclusive so there is no risk of overlap. > > I think this not okay to do - if a program checks hwcap to see if vector > is supported they'll get told it is on T-Head system where only the 0.7.1 > is. That's fair. I did remove it from the hwprobe result but this is kind of a gross way of doing it. I'll mess around with this so this isn't necessary. - Charlie > > > > > Signed-off-by: Charlie Jenkins > > --- > > arch/riscv/kernel/cpufeature.c | 17 +++++++++++++++-- > > 1 file changed, 15 insertions(+), 2 deletions(-) > > > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > > index 41a4d2028428..59f628b1341c 100644 > > --- a/arch/riscv/kernel/cpufeature.c > > +++ b/arch/riscv/kernel/cpufeature.c > > @@ -647,9 +647,13 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) > > * Many vendors with T-Head CPU cores which implement the 0.7.1 > > * version of the vector specification put "v" into their DTs. > > * CPU cores with the ratified spec will contain non-zero > > - * marchid. > > + * marchid. Only allow "v" to be set if xtheadvector is present. > > */ > > - if (acpi_disabled && this_vendorid == THEAD_VENDOR_ID && > > + if (__riscv_isa_vendor_extension_available(isavendorinfo->isa, > > + RISCV_ISA_VENDOR_EXT_XTHEADVECTOR)) { > > + this_hwcap |= isa2hwcap[RISCV_ISA_EXT_v]; > > + set_bit(RISCV_ISA_EXT_v, isainfo->isa); > > + } else if (acpi_disabled && this_vendorid == THEAD_VENDOR_ID && > > this_archid == 0x0) { > > this_hwcap &= ~isa2hwcap[RISCV_ISA_EXT_v]; > > clear_bit(RISCV_ISA_EXT_v, isainfo->isa); > > @@ -776,6 +780,15 @@ static int __init riscv_fill_hwcap_from_ext_list(unsigned long *isa2hwcap) > > > > of_node_put(cpu_node); > > > > + /* > > + * Enable kernel vector routines if xtheadvector is present > > + */ > > + if (__riscv_isa_vendor_extension_available(isavendorinfo->isa, > > + RISCV_ISA_VENDOR_EXT_XTHEADVECTOR)) { > > + this_hwcap |= isa2hwcap[RISCV_ISA_EXT_v]; > > + set_bit(RISCV_ISA_EXT_v, isainfo->isa); > > + } > > + > > /* > > * All "okay" harts should have same isa. Set HWCAP based on > > * common capabilities of every "okay" hart, in case they don't. > > > > -- > > 2.44.0 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel