Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2683783lqo; Mon, 20 May 2024 13:11:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWH888alBYrC+UikzfmhoVIIZKbnWXlVPfS3M1oPTmaqWHnLFqBNTq+YEvoziYGJe7cm9aqu63ba0RTBfZn7THi+Vx9/UQvNHWEpLXojA== X-Google-Smtp-Source: AGHT+IGvbhSf4a9NDvrWXxS/ETZ2zpPnlHB3LUfTcIuKnZJqyGHQcfak+anxy7eLeNo6w+g4c6Pf X-Received: by 2002:ac2:4c31:0:b0:523:8ada:9440 with SMTP id 2adb3069b0e04-5238ada9732mr9979739e87.57.1716235914695; Mon, 20 May 2024 13:11:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716235914; cv=pass; d=google.com; s=arc-20160816; b=F14cy2muS+j7356TpdHFE2XT+l8ZMJENvPhHFnQi2Q+ZiWEmpFvms5SmOJUm3WVQZr QwtEhRx6QNkoYF/CtccW/OAYBYW2llPqatOWZ0MEDhO/PW2SEOVMeOs1GkAUJGtT9AWo qjJ71RsFaJaRlOc9TCRHR0v//+jG/D7CpSe38xRSWrs9ONSWfA6oYq+FfIt1Ye5W5QT1 fTKdce10pHPax0b61IY6V08h0HziQu6kFYuMQWq8RdecCG/Bl7YnkeHsD/pY22B3NXgC r4qkb3l337rH3nId+nP90xBBzqtp19R1COfoL8ooVER4lM55GdZ3z4UxLy+QySgAp8Ro 6kQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9PM2o5jNXfuRUuP6TxEIEBudbQR4NtCgVAI1O+sTf7U=; fh=+t3iNPjYN1MCAEju2elYPlvI/SQdYjSN3eaLeZeLJMI=; b=vWMoLNxFy5eYx8Df5yHcSbKs2J2Wkr+3qYxm3Km3cACdKSc0ycr9Q3/+HyGE+Jtz4C 6kgzo66eIfSekvquRnbXeLQY+u0c5bD9jEoUpFm2Lp0efZYS1bQinABxl65DtT9EAo8k +bu8E6tF75s6/5r2Ht2UQxtfBPnn0LQg4fqSD6XB4zeBQ1qxfMjE8bODFOoIYTa2QApn 4Ci1e+daUFmgZL54YjxXjSGjo9vBzL5bShywCsi1tTmebWGxlqmzY/VnXYM6ZiJdjgHV ecAuujcXukPU1SoX2L16zmngBX9rEJU12v24eqkIGih+lvL6Xx1PQLL9rQ1ChM2a74Qe 5PVQ==; 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="Xf3/A3yu"; 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-184146-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184146-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17ba6330si1329026066b.623.2024.05.20.13.11.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 13:11:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184146-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="Xf3/A3yu"; 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-184146-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184146-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 3A3A41F21933 for ; Mon, 20 May 2024 20:11:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D9A41386BD; Mon, 20 May 2024 20:11:46 +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="Xf3/A3yu" Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 992C31CD39 for ; Mon, 20 May 2024 20:11:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716235905; cv=none; b=XrkiRAGDzEBGyuFZoH5AR3sOiCqGexVOmBdvKKRDPuAbfAnroCT8WZvJMQQ4j40TJr0ZrH4clEU+u2/kDvekZWKJ1EJZ/EmJd7rY8o3vC/QrQ686XdIkgkh8D2L6b1rQx7hBmhD50YNXcvXP3etd2kaSwbmNwlGrF6G3i/WAtBw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716235905; c=relaxed/simple; bh=3mK/XupUfbYiEhVWmSK+krmIhOz4u5ZP0yn/RTc9hLU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=o//mNXdTNHOiO2Gil2d00QyPrLxgd/60hInh5sNEU/soubCeAPMGS4cRR/+NlMRR1H3Ejucsb9o46slQA0uFQw0Eg5+UbTjFudSNYa9rireuAcxBMu/BkFNIkmnwtjpWZQHE107jsGyJr27iPNzMKW3YOLkb9YvCrVsF6jNp+fM= 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=Xf3/A3yu; arc=none smtp.client-ip=209.85.214.170 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-pl1-f170.google.com with SMTP id d9443c01a7336-1f0537e39b3so84238855ad.3 for ; Mon, 20 May 2024 13:11:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1716235903; x=1716840703; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=9PM2o5jNXfuRUuP6TxEIEBudbQR4NtCgVAI1O+sTf7U=; b=Xf3/A3yuqqkAKOCO9daG3tXGDreCYNT054DCLigkb7sSdPafCb4tqmTSUABdoiayP7 2IS5/1PNjM+/gW0TjiWwO1qHJtEhb6X2wTSFzMwb9KMVQUYPhy5h35tOANl67t3DHqo8 KM4fZTTzj23+UryKu1tyCIxXErixdm2v9RTDRoNNOVzq1eHw54R8fbq4tDX6DyQqMN6q qvRCzs83iDdXrPX6qljisZPmjlFC9HmMaP/BViMIb2c/08uzH9wgt4uf5juvcutkE11L Y95kLIdJ7tVn0y5UGQk3S8rmSWooyWjRjCgF5rDb4TjHQDX8YCf4TiDarGpU8o0X73T0 PoMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716235903; x=1716840703; h=in-reply-to:content-transfer-encoding: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=9PM2o5jNXfuRUuP6TxEIEBudbQR4NtCgVAI1O+sTf7U=; b=I84dYJG35cyv1ZNN+SKYsAQalk2tCCP5Y/Z3lMlHSSaPFEqPHjvdLrE4uZVZusj53F bhdJQ8t8Cc08xHHjGnd8qqyZSykcyjz9IwR30bkz4WO+naVZuCtIuN/zos1F1C7+toD3 BzIImRLqszdC065TIOaKPWdfDbRKVa2rAsWtAEBrf2Lz4/nzuFkML/8stx6IFLf11rEC QQXJkyvfntzrDgydl9lcWvXp20imN6Crty8AMDOnu2W174SkYv0iaXvTVGPgyXaONl/i fByPxR7OI6qFQGo8DKYEi/1IcWSQW6Hoy9Gbc2GYRyrlU3lRuAhE3LOStOVhJgeGHFKp ZowA== X-Forwarded-Encrypted: i=1; AJvYcCWi7d+quu/8LQfoj5zU36hHcCQqWGSyo553YPGLw5QRgQ4MD7Yjt6VAQgo9AyiUOVj0WloAlVbfqiJwqWXrvkQhmkLM1FtGIp2nBFmT X-Gm-Message-State: AOJu0YxcTh5eflRoCRRtYvItg2vr2EfFVtKkFFa25J/ZXn6C1cK3eOv5 3hGkJYIBtsT8vpiIxnb43wfrQ3o7nw7UQVt9OqBsPx0gLDKRECJKHlQZwzT9P18= X-Received: by 2002:a05:6a20:3c90:b0:1ad:9394:2d30 with SMTP id adf61e73a8af0-1afde139a99mr33701775637.37.1716235902866; Mon, 20 May 2024 13:11:42 -0700 (PDT) Received: from ghost ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2a9d94csm20112830b3a.95.2024.05.20.13.11.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 13:11:42 -0700 (PDT) Date: Mon, 20 May 2024 13:11:39 -0700 From: Charlie Jenkins To: Jessica Clarke Cc: Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Palmer Dabbelt , linux-riscv , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , LKML , Conor Dooley Subject: Re: [PATCH 0/2] riscv: Allow vlenb to be probed from DT Message-ID: References: <20240515-add_vlenb_to_dt-v1-0-4ebd7cba0aa1@rivosinc.com> <6DDF33DF-07D6-4230-8674-F91A91660686@jrtc27.com> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6DDF33DF-07D6-4230-8674-F91A91660686@jrtc27.com> On Thu, May 16, 2024 at 01:58:29AM +0100, Jessica Clarke wrote: > On 16 May 2024, at 00:08, Charlie Jenkins wrote: > > > > On Wed, May 15, 2024 at 11:25:16PM +0100, Jessica Clarke wrote: > >> On 15 May 2024, at 22:50, Charlie Jenkins wrote: > >>> > >>> The kernel currently requires all harts to have the same value in the > >>> vlenb csr that is present when a hart supports vector. In order to read > >>> this csr, the kernel needs to boot the hart. Adding vlenb to the DT will > >>> allow the kernel to detect the inconsistency early and not waste time > >>> trying to boot harts that it doesn't support. > >> > >> That doesn’t seem sufficient justification to me. If it can be read > >> from the hardware, why should we have to put it in the FDT? The whole > >> point of the FDT is to communicate the hardware configuration that > >> isn’t otherwise discoverable. > > > > Yes you are correct in that vlenb is discoverable on any conforming > > chip. However, the motivation here is for making decisions about how to > > boot a hart before it is booted. By placing it in the device tree, we > > are able to disable vector before the chip is booted instead of trying > > to boot the chip with vector enabled only to disable it later. In both > > cases when there is different vlenb on different harts, all harts still > > boot and the outcome is that vector is disabled. The difference is that > > with the DT entry, no vector setup code needs to be ran on a booting > > hart when the outcome will be that vector is not enabled. > > Why does vlen get this special treatment? You could make exactly the > same argument for the number of asid bits. The precedent in the kernel, > whether RISC-V or other architectures, is to not do this. You can > detect it, so you should, especially since optimising for an > exceptional, unexpected error case is not worthwhile. > > >> As for T-HEAD stuff, if they need it they can have a custom property. > >> Though naively I’d assume there’s a way to avoid it still... > > > > T-Head does not expose vlenb on all of their chips so I do not know of > > any other way of getting the vlenb without having it be provided in a > > DT. That was the motivation for this patch in the first place, but > > making this available to all vendors allows optimizations to happen > > during boot. > > How does userspace read it then? But if T-HEAD need it, that means it > should be a thead,vlen, not a riscv,vlen. > > Jess > I'll let Palmer decide if it is reasonable to have vlenb allowed to be placed in the device tree to support cores like ones made by thead which don't support vlenb. Otherwise I will replace it with a thead-specific binding. - Charlie