From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (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 9DA1A14A81 for ; Wed, 1 May 2024 17:06:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714583183; cv=none; b=FjvlK03kx5tOp3QEX/h7wOL+viVlSKlsDmGjs7HDkU/MtqB0fL3tVyE8zBBhJEZTgAqp5TP7tMWhP7iOXOFJKKaeHSJvkth/O4ywRBJA+p2wfqLdy7GQz3XazflBomZNbQ0yZ0e+sJ/oHdeqiu660rMZfwg744QvLHO2mNFJfig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714583183; c=relaxed/simple; bh=pqU7oYGJgnj9NuhHq21MW2iYlmXEJsCtkyhRbZQMx0c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tLWMcl9XlAGqlAiIozOXQQzu9Dkym/KBOHR0SRYiXUIaIO6EoK3I2s5Dnx7P6TVMwA3QjPKJs/F0VFU25xT18zcKz0yK/FWv1OJoClyYW38JA6BPqO9Bkdmrn9xEC0tLWzkbO326kFbeUpLgSlF8KcYb5pHQh1rbpU326FqkHI8= 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=pskqzGJO; arc=none smtp.client-ip=209.85.215.178 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 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="pskqzGJO" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-5f80aa2d4a3so5773542a12.0 for ; Wed, 01 May 2024 10:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1714583182; x=1715187982; 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=ulUTnrt0/o6KrpYj4/lKXwggI1Tcz4XFzc+8cliUI0c=; b=pskqzGJOaoD4BIUPmMgmZijLoimhceT6AA89Byuqf5OmPWuyi2gxFvdjI3/X03PuT2 EiwArqrECy9mcOB3xfJJ+1lze8cCIfiwxbuvkiiQsE3reif3c9wshk39vjGz7oRUyVKs oP7nYrbhpvOv4rAj8cgKbAcxJNF8RhsGArvXSW3vW8+IQWd4eqGw04cdmA+n8qwlJF1f +CDjKde9V11tnI0tbFVfymVf39gmimnXqG35VXjWnnYhkZkR+v/7u5DZKNx77prWM36C Gz8sN8tqZ4Tp9hB3twsSbnTOHXhUnx6MkpgfUw134PNlQ6N1Cxf+IqdBWPZZ/LSFngnU jn6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714583182; x=1715187982; 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=ulUTnrt0/o6KrpYj4/lKXwggI1Tcz4XFzc+8cliUI0c=; b=qlzOzzdNvpdo3VUORuWOcjNv8WGXoU6FhRwh1NiB4J/pOfN5PwSCn37jMtbtXYQjTd CvazXkIe0iXyVP9AhbqGRc7uDUnFfDptCQn1hjkmswQwjEJJfUBHiDjEe/hB9aDrF7rU 0RTb1jGXUPE1KHkICliuAmIS3J5KiXVIzOKtrhoDgCxUFKHjkWpHt8CjsBQrGj9eHCoM gIbWuAYA4n62UsD7Iezjsa1M6Y4Qzm0+hc8eTzveoErET1rqDmTvH5rzebjfh0qLodGw mHkdbxhTo/CbDRM78gTqWE71TPaPUzEr5afSF9NTWc6/4I5lDn1BAEUMSbkPnGINtdag dcYg== X-Forwarded-Encrypted: i=1; AJvYcCWFLZJEK15haOPWr4+vUWMCqrHm3Jzklwk2W29MT07sayIW+NbDjNNwuN5xrodmtqDSj6ENQzXJpzf4oLg0Ii/ivJcxEdlsQ9ns X-Gm-Message-State: AOJu0Yxce9aab8yD23Bt8MPfau2PpCKqHKUVotbtaY7Y4d+a/P9DJFSb 5TlvAEGPvnguwzQ1yMtJTkfbuVxU4emQXGPsC9xos3g3AenKXSLG/LEH9+aj750PifVeK1HXeB3 y X-Google-Smtp-Source: AGHT+IGbQ99FfsOuQfbPD1HKb4OFUev7bCmbhruunbIFw2+vddc7cv9+d7D2Uj+7TUiDOOY0K6p1lQ== X-Received: by 2002:a17:90a:f493:b0:2b2:d001:db41 with SMTP id bx19-20020a17090af49300b002b2d001db41mr2837033pjb.40.1714583181995; Wed, 01 May 2024 10:06:21 -0700 (PDT) Received: from ghost ([2601:647:5700:6860:1dcc:e03e:dc61:895d]) by smtp.gmail.com with ESMTPSA id db5-20020a17090ad64500b002a53b33afa3sm1593854pjb.8.2024.05.01.10.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 10:06:21 -0700 (PDT) Date: Wed, 1 May 2024 10:06:18 -0700 From: Charlie Jenkins To: Conor Dooley Cc: Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Conor Dooley , 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 v4 05/16] riscv: Extend cpufeature.c to detect vendor extensions Message-ID: References: <20240426-dev-charlie-support_thead_vector_6_9-v4-0-b692f3c516ec@rivosinc.com> <20240426-dev-charlie-support_thead_vector_6_9-v4-5-b692f3c516ec@rivosinc.com> <20240501-pelican-throwaway-da84be7dac30@spud> Precedence: bulk X-Mailing-List: linux-doc@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: <20240501-pelican-throwaway-da84be7dac30@spud> On Wed, May 01, 2024 at 12:19:34PM +0100, Conor Dooley wrote: > On Fri, Apr 26, 2024 at 02:29:19PM -0700, Charlie Jenkins wrote: > > @@ -353,6 +336,10 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc > > bool ext_long = false, ext_err = false; > > > > switch (*ext) { > > + case 'x': > > + case 'X': > > + pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead."); > > + continue; > > Yeah, so this is not right - you need to find the end of the extension > before containing - for example if I had a system with > rv64imafdcxconorkwe, you get something like: > [ 0.000000] CPU with hartid=0 is not available > [ 0.000000] Falling back to deprecated "riscv,isa" > [ 0.000000] Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead. > [ 0.000000] riscv: base ISA extensions acdefikmnorw > [ 0.000000] riscv: ELF capabilities acdfim > > kwe are all pretty safe letters, but suppose one was a v.. > I think you can just yoink the code from the s/z case: Oh right, I forgot about that. > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > index 20bc9ba6b7a2..4daedba7961f 100644 > --- a/arch/riscv/kernel/cpufeature.c > +++ b/arch/riscv/kernel/cpufeature.c > @@ -338,8 +338,19 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc > switch (*ext) { > case 'x': > case 'X': > - pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead."); > - continue; > + if (acpi_disabled) > + pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead."); > + /* > + * To skip an extension, we find its end. > + * As multi-letter extensions must be split from other multi-letter > + * extensions with an "_", the end of a multi-letter extension will > + * either be the null character or the "_" at the start of the next > + * multi-letter extension. > + */ > + for (; *isa && *isa != '_'; ++isa) > + ; > + ext_err = true; > + break; > case 's': > /* > * Workaround for invalid single-letter 's' & 'u' (QEMU). > > You'll note that I made the dt property error dt only, this function > gets called for ACPI too. I think the skip is pretty safe there though > at the moment, we've not established any meanings yet for vendor stuff > on ACPI. > I think breaking is probably better than using continue - we get the _ > skip from outside the switch statement out of that. And ye, I am lazy > so I kept it as a for loop. Awesome, thanks! - Charlie > > Cheers, > Conor. 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 A5797C4345F for ; Wed, 1 May 2024 17:06:33 +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=F0uPq/ThNK4SBQ0FbR7PZlTGMyrk7cG7H88yZHjYgbE=; b=CLJ7s5gZIH/X8A 3Xgvl1D9+tTmuvhMYW5TuJbuY/v8uoBr2g5ijs/vRRrcJB98Gt8kbuAzVjKU3iys5D+QFLtBpqXYC VINYRgWvG2u9tuCEvXDmuXfKL23vUlEc0BVkvvHN0lS4wvQeQ758GBOwu2yDW7Gmb87kWfQmk/ToT 4HAJQISOUZLQh3LSF06VFoqppezElQqDuHe2IHFbEVEQwzyQSJT6Bm5rIJupx6JgMZnwg6/aBQt2H FvY4sLa164DbnWdj1m9qTOWz/Luiz9kMQjwOYUS0mULl/qac60WDeI+tqFzlCMKKcRZyiQRSQeoBC Z+6qyK7M0fQwcDEB0j4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2DPZ-0000000AGJ5-28cV; Wed, 01 May 2024 17:06:29 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2DPU-0000000AGGo-3X6l for linux-riscv@lists.infradead.org; Wed, 01 May 2024 17:06:26 +0000 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5f80aa2d4a3so5773541a12.0 for ; Wed, 01 May 2024 10:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1714583182; x=1715187982; 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=ulUTnrt0/o6KrpYj4/lKXwggI1Tcz4XFzc+8cliUI0c=; b=yK3Iy/R2MC0JGVHOIpdi7pbfIcAznQFUn9g1qjBL2c4kRdvaee97k405MER6t1Y/AY MwPBlQlifmqXogx9H0swy4eIVPc3Sm97c54fW35rlL/sVrULzvsl1szV8SvFqUS6Kj2C FuAYGsaIfTM/E2plbhXlxqQchKin+Cix8tqduEa415fv7gZO1xhGDN0FSeSN4hTaoAYH pjGDqAJUTKjME97/lE6O/weZsxRcgfLUw0AtsuqhlyvP3DvO1/n++9006H7835m+mKRg nNIHV441GmZd5jPl8L5rynxhQptAJ3OGf1L4k8LNXeliAVaI7OjcE5nDEXz02JLXaMjg cSGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714583182; x=1715187982; 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=ulUTnrt0/o6KrpYj4/lKXwggI1Tcz4XFzc+8cliUI0c=; b=VHkfRw7jrcznSwVLloP3PbYN2pZ686K7qhl6YzaxLCaSv507Q9kYApBXXvZxTb1Rm8 x6an/2tEXtywisyLAONruxM+nwigWe6iTdh4JsHA/3U5HxvW8pPDSFaAxVqIOSw1edtz ePjJ5BL/os9Ix64Fmd5uMsac8ix+40jStoHOXfUql+aDCR1hZflbzAIp6UIlxmGYzRzO 1DT9E+DhHOO4JstlLo2QRqalXqruC6zuU1bxUCSxYgaWyMrWQ0Nnwo8C2JCCAPBgP6Gs gSvG05P3u8RyvQhsCGQHRHlC2QEJj7/iw2WTQ+/LbNuo55k/lt7plIz/7npzH5kuVevK 726Q== X-Forwarded-Encrypted: i=1; AJvYcCXCwOhdGNnAyhCHwQr4gToK2prW3xMtbBejsp0y+bIrjm4xGkQ6lnvdlpdtGcDZDnp7gDFBz556BVOpPY4aAmjsFvSJahHOrXm3Gnw5BMQS X-Gm-Message-State: AOJu0YxxatutQZtuK25pVDdiRd0vbsZevFDDGPTzC7eUwr8zaxdZfkm0 Go5vn1SPSO1TAbooH5tAjhfku/13SGLX0ihXWf6LkXiYgMWRB5BUMhjPDj/OWH0= X-Google-Smtp-Source: AGHT+IGbQ99FfsOuQfbPD1HKb4OFUev7bCmbhruunbIFw2+vddc7cv9+d7D2Uj+7TUiDOOY0K6p1lQ== X-Received: by 2002:a17:90a:f493:b0:2b2:d001:db41 with SMTP id bx19-20020a17090af49300b002b2d001db41mr2837033pjb.40.1714583181995; Wed, 01 May 2024 10:06:21 -0700 (PDT) Received: from ghost ([2601:647:5700:6860:1dcc:e03e:dc61:895d]) by smtp.gmail.com with ESMTPSA id db5-20020a17090ad64500b002a53b33afa3sm1593854pjb.8.2024.05.01.10.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 10:06:21 -0700 (PDT) Date: Wed, 1 May 2024 10:06:18 -0700 From: Charlie Jenkins To: Conor Dooley Cc: Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Conor Dooley , 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 v4 05/16] riscv: Extend cpufeature.c to detect vendor extensions Message-ID: References: <20240426-dev-charlie-support_thead_vector_6_9-v4-0-b692f3c516ec@rivosinc.com> <20240426-dev-charlie-support_thead_vector_6_9-v4-5-b692f3c516ec@rivosinc.com> <20240501-pelican-throwaway-da84be7dac30@spud> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240501-pelican-throwaway-da84be7dac30@spud> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240501_100624_969902_A62DD784 X-CRM114-Status: GOOD ( 28.08 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Wed, May 01, 2024 at 12:19:34PM +0100, Conor Dooley wrote: > On Fri, Apr 26, 2024 at 02:29:19PM -0700, Charlie Jenkins wrote: > > @@ -353,6 +336,10 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc > > bool ext_long = false, ext_err = false; > > > > switch (*ext) { > > + case 'x': > > + case 'X': > > + pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead."); > > + continue; > > Yeah, so this is not right - you need to find the end of the extension > before containing - for example if I had a system with > rv64imafdcxconorkwe, you get something like: > [ 0.000000] CPU with hartid=0 is not available > [ 0.000000] Falling back to deprecated "riscv,isa" > [ 0.000000] Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead. > [ 0.000000] riscv: base ISA extensions acdefikmnorw > [ 0.000000] riscv: ELF capabilities acdfim > > kwe are all pretty safe letters, but suppose one was a v.. > I think you can just yoink the code from the s/z case: Oh right, I forgot about that. > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > index 20bc9ba6b7a2..4daedba7961f 100644 > --- a/arch/riscv/kernel/cpufeature.c > +++ b/arch/riscv/kernel/cpufeature.c > @@ -338,8 +338,19 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc > switch (*ext) { > case 'x': > case 'X': > - pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead."); > - continue; > + if (acpi_disabled) > + pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead."); > + /* > + * To skip an extension, we find its end. > + * As multi-letter extensions must be split from other multi-letter > + * extensions with an "_", the end of a multi-letter extension will > + * either be the null character or the "_" at the start of the next > + * multi-letter extension. > + */ > + for (; *isa && *isa != '_'; ++isa) > + ; > + ext_err = true; > + break; > case 's': > /* > * Workaround for invalid single-letter 's' & 'u' (QEMU). > > You'll note that I made the dt property error dt only, this function > gets called for ACPI too. I think the skip is pretty safe there though > at the moment, we've not established any meanings yet for vendor stuff > on ACPI. > I think breaking is probably better than using continue - we get the _ > skip from outside the switch statement out of that. And ye, I am lazy > so I kept it as a for loop. Awesome, thanks! - Charlie > > Cheers, > Conor. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 2F00DC4345F for ; Wed, 1 May 2024 17:06:42 +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=2uLEw9CTOk2Tfb5wdUjevIwgkFgOEJu/uVZaa4apiP4=; b=N3kkXFy0Gim1g6 LEfmFK9f2QkFbK6vnCB5U/t3kvIw+SyVkY8tmk4uSWNI5CPbyLZ15z7TgqWl0w3uKImxLFX/ksTVG h/WDG/+QjCGiYDyHktAm+rkWcisrJGRrF3qbHyNbwmb8UUkvfZ7i5BlQNzfKyMwJ8uI6x51z2RYeP DPS8tN22bT30WKDrUdIKGgc0kvBQ8FkQLFhOlP5MMK0ptwZufMH9YS9qgphR/CkjliEwiw5NB+P4P YrF1IdjEPC4nwPPyPT0Lq4qjph22CncMMDBBZdZPNOO5k6ATNan1TvSB3VmE7+VF11VAGIR+SJNGW J1zdy1CZobQBdU0LWVtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2DPY-0000000AGIo-2Den; Wed, 01 May 2024 17:06:28 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s2DPU-0000000AGGn-3jCS for linux-arm-kernel@lists.infradead.org; Wed, 01 May 2024 17:06:26 +0000 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2b276bf78a4so1559671a91.3 for ; Wed, 01 May 2024 10:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1714583182; x=1715187982; 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=ulUTnrt0/o6KrpYj4/lKXwggI1Tcz4XFzc+8cliUI0c=; b=yK3Iy/R2MC0JGVHOIpdi7pbfIcAznQFUn9g1qjBL2c4kRdvaee97k405MER6t1Y/AY MwPBlQlifmqXogx9H0swy4eIVPc3Sm97c54fW35rlL/sVrULzvsl1szV8SvFqUS6Kj2C FuAYGsaIfTM/E2plbhXlxqQchKin+Cix8tqduEa415fv7gZO1xhGDN0FSeSN4hTaoAYH pjGDqAJUTKjME97/lE6O/weZsxRcgfLUw0AtsuqhlyvP3DvO1/n++9006H7835m+mKRg nNIHV441GmZd5jPl8L5rynxhQptAJ3OGf1L4k8LNXeliAVaI7OjcE5nDEXz02JLXaMjg cSGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714583182; x=1715187982; 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=ulUTnrt0/o6KrpYj4/lKXwggI1Tcz4XFzc+8cliUI0c=; b=ifdaejlekNH7L1pxbPpqbszUfT9CaAUj0HyNm0FeWYvkLCmq+EKKIuqXcKUocv5+Lv eASxU89pbYzrg4BNaLlbMThMLg/e92Lme1QF5wmrjRz3hBzJVqhxGs1vkzhthhZBlsGl 3CYW+lSDXRhmGeVnbBv2CkyHBhKDzy/1o42hgva6tIKSg6s0r6WbZHJkdy9YuDVt+xOU 73z2B4adn6tcv58EEp6EXPDl7+oIBZfQLJXtttZrTL4+Lm5ZM6YkyJ3uyzBMFY/7p4rC Mf9gupfCHOta9n+Aa6Ed12WA4LMimOkfXfKDbDzMt1rF9+P4K2QkbvmFXSugbG2m9rNC zThA== X-Forwarded-Encrypted: i=1; AJvYcCXOJZwsBdnTJVTYe1ImgCcKJXC6uCuGoaUd0wNEO8Zvj9YQG+vMrxqXKxFv+FkoEgzqHA03etbQJBeot7oa+oDZJLkGYmFFT5Qlb62Ria8Wtitfnsk= X-Gm-Message-State: AOJu0Yybu36IqebAaLEmLkjbuOh26Jn94WVD4gEN3/JtiQjoVpFhzSZM SVi8YKwV8r9WFhkEzf+RALCYsnHTC/xtI4kkPJ4FUhjnAl7dbnjzTDOyeSc555s= X-Google-Smtp-Source: AGHT+IGbQ99FfsOuQfbPD1HKb4OFUev7bCmbhruunbIFw2+vddc7cv9+d7D2Uj+7TUiDOOY0K6p1lQ== X-Received: by 2002:a17:90a:f493:b0:2b2:d001:db41 with SMTP id bx19-20020a17090af49300b002b2d001db41mr2837033pjb.40.1714583181995; Wed, 01 May 2024 10:06:21 -0700 (PDT) Received: from ghost ([2601:647:5700:6860:1dcc:e03e:dc61:895d]) by smtp.gmail.com with ESMTPSA id db5-20020a17090ad64500b002a53b33afa3sm1593854pjb.8.2024.05.01.10.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 10:06:21 -0700 (PDT) Date: Wed, 1 May 2024 10:06:18 -0700 From: Charlie Jenkins To: Conor Dooley Cc: Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Conor Dooley , 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 v4 05/16] riscv: Extend cpufeature.c to detect vendor extensions Message-ID: References: <20240426-dev-charlie-support_thead_vector_6_9-v4-0-b692f3c516ec@rivosinc.com> <20240426-dev-charlie-support_thead_vector_6_9-v4-5-b692f3c516ec@rivosinc.com> <20240501-pelican-throwaway-da84be7dac30@spud> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240501-pelican-throwaway-da84be7dac30@spud> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240501_100624_978054_7A6558A4 X-CRM114-Status: GOOD ( 29.61 ) 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 Wed, May 01, 2024 at 12:19:34PM +0100, Conor Dooley wrote: > On Fri, Apr 26, 2024 at 02:29:19PM -0700, Charlie Jenkins wrote: > > @@ -353,6 +336,10 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc > > bool ext_long = false, ext_err = false; > > > > switch (*ext) { > > + case 'x': > > + case 'X': > > + pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead."); > > + continue; > > Yeah, so this is not right - you need to find the end of the extension > before containing - for example if I had a system with > rv64imafdcxconorkwe, you get something like: > [ 0.000000] CPU with hartid=0 is not available > [ 0.000000] Falling back to deprecated "riscv,isa" > [ 0.000000] Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead. > [ 0.000000] riscv: base ISA extensions acdefikmnorw > [ 0.000000] riscv: ELF capabilities acdfim > > kwe are all pretty safe letters, but suppose one was a v.. > I think you can just yoink the code from the s/z case: Oh right, I forgot about that. > > diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c > index 20bc9ba6b7a2..4daedba7961f 100644 > --- a/arch/riscv/kernel/cpufeature.c > +++ b/arch/riscv/kernel/cpufeature.c > @@ -338,8 +338,19 @@ static void __init riscv_parse_isa_string(unsigned long *this_hwcap, struct risc > switch (*ext) { > case 'x': > case 'X': > - pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead."); > - continue; > + if (acpi_disabled) > + pr_warn_once("Vendor extensions are ignored in riscv,isa. Use riscv,isa-extensions instead."); > + /* > + * To skip an extension, we find its end. > + * As multi-letter extensions must be split from other multi-letter > + * extensions with an "_", the end of a multi-letter extension will > + * either be the null character or the "_" at the start of the next > + * multi-letter extension. > + */ > + for (; *isa && *isa != '_'; ++isa) > + ; > + ext_err = true; > + break; > case 's': > /* > * Workaround for invalid single-letter 's' & 'u' (QEMU). > > You'll note that I made the dt property error dt only, this function > gets called for ACPI too. I think the skip is pretty safe there though > at the moment, we've not established any meanings yet for vendor stuff > on ACPI. > I think breaking is probably better than using continue - we get the _ > skip from outside the switch statement out of that. And ye, I am lazy > so I kept it as a for loop. Awesome, thanks! - Charlie > > Cheers, > Conor. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel