Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp95978lqp; Fri, 12 Apr 2024 11:26:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSTmh6A9z9mZipAcolMSriMPhB8E9Yejv8CdEWDwSna/x7C06xO9b5HQ0xSdO/WQHKQ3Pe/gUpcXUcZVT4oXnYni1eyGNW7rlDJezhfA== X-Google-Smtp-Source: AGHT+IEJAzwSawGYA0KIYU8CkXhtjG/7ea8zOIHxyI+paTS5sdIIOs+nz+OpD98zlZQodYTMjGg8 X-Received: by 2002:a17:90a:c790:b0:2a2:ddc0:7657 with SMTP id gn16-20020a17090ac79000b002a2ddc07657mr3735755pjb.34.1712946386323; Fri, 12 Apr 2024 11:26:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712946386; cv=pass; d=google.com; s=arc-20160816; b=a1ebn4mZ5ft+1r7sFn40ZeYxXE0hv78PzMoKD5p5EXBfVxfVClcqLhMK+mxwF0ube3 Njjfk7CulH1o89UksuSpBetZVBswtG0fN8dp3thKtWLwZK3NiwWqNC+R0YD8Bgd836En CORwCVEJfdIXL6UaNXXnXFCuHw1juvRXg9g18vx0Bq/g6kRsTUWM53CJ9RoXOLtGfCaa WDf0P/Jgvmb96tzAedS5gUyaGoNFPhjgb9bbTaty8eVP6JcFGKi8VIimUboJnqHUrkSw 5XQF0QridOo9A/2AZs3L+OHSHSrs6rsv2hs1rKOZg8LdpOUV9HR6orLY+hY/RJmMtM/1 Vj6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oMxTHfwmfGngfKcHt9BB7WUlzUr2s5LaZsK/l59Ii3w=; fh=VJGB/rUFlY7G0Abe1FQrX9th2scNWNz/NeJAYX4vJhA=; b=VKm/yXVkJGAZYUqRfeXQxzmZSzv8S5Cc7ODDHfk0/jx5SHCmitpHThBmk6ed+/zfqs xvQ3mrI5djIZMxaNJQ7Sd1JN7bectF+4aBaAOv0m8xYIay/yH41CU9EKbsVv3lmOl0so h9BxHC8LI5uQRUpTWMktw2UYs4SwEKN7EGT0CWNuZXuD1WpDGvEocaXF1JYFS+4ej+fX EbLAKJ3lkozKrTjQNWh6MVAYnOkmm1cw3/iyjhBsc/DM54u1jZOO/sRUi4oTmFyVp0WP 7W3Uo9rcfhkS28D1EVaO5LrjvPgMNxsiVugydAUzy3vjzKj30p5Vyu+QiSuc0U7EznxU 73Mg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=IqYYPFzH; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-143198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143198-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o10-20020a17090a55ca00b002a2a70f148bsi5794134pjm.69.2024.04.12.11.26.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:26:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=IqYYPFzH; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-143198-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143198-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F07CF283D72 for ; Fri, 12 Apr 2024 18:26:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4832214EC79; Fri, 12 Apr 2024 18:26:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="IqYYPFzH" Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8329D14BF9B for ; Fri, 12 Apr 2024 18:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712946377; cv=none; b=sze9pMfiFi7TBStOGiHXYdUux+iaRUMWLTLeoyNfz0aDxSrTGRU0YftzALy2kGQC5yVKu7qcD9w1K3HDLuos/l4+JDGWZSxqzB7tLwhpv0xYum6csMHTaAMpHtHeNyn2yaoJlwBZqD6ssZi38wYao3Jv5HBwxBM5qTIqi3JdFYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712946377; c=relaxed/simple; bh=R6+sR1n2H8lveCws8FYqyXIHci1kpgk6V6NXn8xBGM4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dot5ZS64xkVafd04uDJZ/uDViYGAXaPVoLB1HOot9D8zLd96xSUpPt0y3F8H3p6tNAuNUY76drNq6WeL8tT0yvaoGX4jC8Dol1wK0CKk9KEr+MHt9TxsWJDu0jCOQILTYvROv1Ujwakuh2HzR56ZnQ+ZUieP4xoRZ/RPoYSyXdU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=IqYYPFzH; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6ed054f282aso1027817b3a.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=vger.kernel.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=IqYYPFzHrWkKzXyyATo8fp1XTg/P/PLzPTOf6FPbfGmOsfizXWJwHOrSTXfghPxDBS uZxZcMnR3zzl3bADTURz7NuYbWQOJFK0S0iNWVj69+KYaiyvyB4us/nRTbYRzAd181OT 5a6x6qgLP7BjzcpD6OedSCRQqTCj05WGFhIV3unDBaS9tOklkVeEgfSRbgyfENiBuXPh wWS+fUVE7Gof7SaAcFwpTQVmxEGLDz+yGGe4AWPOLF3W64ibERCH4JQzH3jY6Cg8/Lfa 5972KNx7SEXqYnei1rHtFEhxpLbpVQNikNaUvfhV2w9qoSDCLgJfpvAW6WcEZ/Wz8zTz JKSQ== 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=MWbnrQuw9GDXPmeaGArqEOJ2ttWR+nPQlcMBwQc1fOo4uxfbmQ5A62JFwViRIGBg+e 10d9nzPtAWEBbGljhK90SDvpdHe/hCksu0DhmArm6A41MS1gGVmH1KoDSTGiY2uqIAcR KwsOvdYDAoU0f64lzblwNns+n0jF/PTvQDPrpj11UszkEW1ZQl4G/+C6tDL1iSGsz9HF +Lh/knz03Cye0SMzROYPqDnctca5rTGZoANOiLBvM130QMVmDjOxqYf3bX+gzlB/zXix ClZRzjsvJkPVAK10W1GSYfFxxLprwxdMoOS4IW9OrbW94K9tcY1HVK/UJx3UTiYzEU55 JErQ== X-Forwarded-Encrypted: i=1; AJvYcCVTz0Bgq/NB3MbYivYtxPsD7i/oJ8BXivMdVc/DpwsPI5ljg7giJDh0++Y1jFWAomJ4bjy5v+6eU4x9SZywcUMsice7DyD+Xb1x5DDc X-Gm-Message-State: AOJu0YxBibwy4JqB+R++TFs6ppz8vss8HedtpmTF568sCA8fql04OFX9 6sJPFKG4smfXMimWhYz9YFP2CJjUqaMN4L9SD3lh3ujTiRsmdHknGh5SiczY/CQ= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240412-thrill-amnesty-019897f21466@wendy> 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 > >