Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp165104lqp; Fri, 12 Apr 2024 13:49:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUnDqfD3bT/rkW//t7GCQCWu9TW4jrO1v6Rr+ygQiBQ08brDvZx2KV8N4dLBzXD4m0jBzBmWiSqpmHMswd9F+XusZeZbaBoVuQv+5+e2A== X-Google-Smtp-Source: AGHT+IGGIIYeI1LGVdCOmI4oU3qTTDsEvs/kEjzGPcL4rkFkrp2b4xgnlpjf+uEhatUznHiX04dD X-Received: by 2002:a2e:b90a:0:b0:2d4:6a34:97bf with SMTP id b10-20020a2eb90a000000b002d46a3497bfmr2815369ljb.49.1712954941943; Fri, 12 Apr 2024 13:49:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712954941; cv=pass; d=google.com; s=arc-20160816; b=NUtitieygNUTk/H1MhGhIFCL5UQ4QgY0zlQESTOp5vzR35CAsHYSL2nG+7DUKMDwv5 W/yBs5HDQZkGoMgyYMtiLLigm2qy4vZBuBQPqPhj6FmiwRXEO0BV6LggubrXHxRuyHDe yLDTh2YSTGOymypdWIxGbRmDlZmyXvYiI/pezqLYP6qJV2IlS+umoAd6MpwNoqCoOG9R zUeTqNCE3e1Mb2rZ0EbXz8L8Qy2Y+L/XA/xs//ak+g1ZorYDQHa/Pzf3zWjiRFbrHFZb K6kok10nYZ7uljU5LJP04NDZJUFDcLZFQOFlrFubh3CZoJfBEHjCz6gBTFLWAhLLJQht TryA== 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=527J/UVq95aFiyhIuaQGyZZWXZ7DJpQjeKIDhjey1CQ=; fh=C7wJqJtJ8TFhh0IAWroiqSJU6mq0z2HFKVWiSTgSZZ0=; b=1AeoaX7CdZx21F5z+FUCfJZWa7CXOymUYtXIakCRyFAcUnbRZPsQz9UyRpP5yOgIIX IlFVxhLpMyBIynRq2p1rNbIWXtlDsOpQ4FNaWabLPGaOd9OXSKlhxilwgBMmHKrTeM3y Gro0gLEk7CAyXpW7nnaTHIB+1gFtZW1G68qO8SLeJ/ZQCg7lo9iU2l8V0qnU3P5+zyiv 6hs6ComG84IVPfG5HVaL9qzBnzp9cWsEOKAySTdKy9qRUK06qhMWwcZGSgetBhjDf/DU PZvvOexUPEpK3gFwH2hVAaHbi91bfG2nSpWfhT35cuBaFSgSMbfWKV5JAWKv48d4RnPQ +eIQ==; 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=J8bIf7s4; 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-143326-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143326-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 l25-20020a1709061c5900b00a51f971a0e7si2045091ejg.483.2024.04.12.13.49.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 13:49:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143326-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=J8bIf7s4; 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-143326-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143326-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 5B66B1F223CC for ; Fri, 12 Apr 2024 20:49:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BAB8E46537; Fri, 12 Apr 2024 20:48:52 +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="J8bIf7s4" Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 A711B405EB for ; Fri, 12 Apr 2024 20:48:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712954931; cv=none; b=LSIoWqvY1tYwxZiOfPXRMcGZ003YlC6vEG91V9cyx59RsUZjko2yt8gB+49bKmEbrmtaCxL5kpvuCCHRWsnDQ2YaEMXZdt+QAsd9Z27ezUp0+ziDIDjnSaaxzwdlbkyPXXKAtKpAvb1m7jZGRHhEVpBTtFFbwFyUWVPr0vafH/M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712954931; c=relaxed/simple; bh=KzTQ615Mv6vx3Pd26LD1yrwtq3aAn4qXYzo6CfQ2EVM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bcSQp95xPR5v1fZYiIeeRHdgzpUzUPFpai+lexICzqW4Lmu+vd1jnbogd40eLP4+jxXvRC1Csh326D7yGgZVk0gz5CgePQGyCmbQbtwjWe5BI2ifS8gTSiy1pS0yzCsrLbs/O6K1gZkVLB4z59RbTNhL7dlVJiJkfc1yejQMLRY= 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=J8bIf7s4; arc=none smtp.client-ip=209.85.210.172 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-f172.google.com with SMTP id d2e1a72fcca58-6e782e955adso1275072b3a.3 for ; Fri, 12 Apr 2024 13:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712954929; x=1713559729; 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=527J/UVq95aFiyhIuaQGyZZWXZ7DJpQjeKIDhjey1CQ=; b=J8bIf7s4lvzgmuzcNdVo0pREZ3JZTySbXJInXCaPpEJEtiji8ieWThzpdPJCM1HhXl GD7mYWXXhGYCbgf+zwtxCqrnM8carmyyby5J2UsFW3u/PG+mhtrITThCgh5ZLzQysrtx xk2LBw4+W5dSjlc6AGEeYDIej3h5P09kJxzYvDxGIUNULgPzjlHxySDGnMwlJgg5+9lH awVcu9+jAHr4xKWt1f1hVQRW6Bno+ZENsryA0c9Yw/dhZGaOnLKaC7FadViXvPl30ueA jpN5IEEZjPY2VizM46QxHR3wZoFi5TWwr3+U1Pu8StQdEPWGo0HKtdEzMVXd+6VSO4Wo nnHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712954929; x=1713559729; 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=527J/UVq95aFiyhIuaQGyZZWXZ7DJpQjeKIDhjey1CQ=; b=mzgCdqvy2vCMZYeRb8XpEAZ18pH6Cl8A+t4FLWT/sAHddK6mMPyGaQZhl+PQN4yUT1 OjR8GgXOm41lJbMTOJEpckyQiyOFhKk7930QunsBmbnWbD7bHG2/r2Jfvk1+wESvRmXf Nn0yRkHHf9cIIjForX1AzJzBlcOeuUJbbw6LSkexuLTw+c4Ey1/+WFsORJV2qmTQmTsB xplIDgjLn6Hp+8efQDLz3XtBC9iOr13FK+OwmnhVLxfr69xq8Ue7WC22Qm8G7EOrLOdm K+vUHDYpV4V6LN7iRk+YyefvLQQkghtUSsc3WIafNDDh9yt7cdY5/g54dLI0WcCmws7r 7l4Q== X-Forwarded-Encrypted: i=1; AJvYcCXMUEWjElxXC2z/ZgxpFKYsYVnP7DJD6Dn9kCPPgUw+bV+lqVbw+oHEjA2pnBU2JkPEYwuf8EM348Gj9y7+e5Q8JpewY0MSudThK8q+ X-Gm-Message-State: AOJu0YyUfLgL4eqNB/FswEjBF25AU9npzeYqmex41g4YIoX2WL6g6Hz1 o+MuFS82q8OCylm2PEpsUsF9KgA9UoLhdomuAzCOL4gzFTgszI5j1UPjPdhPB6E= X-Received: by 2002:a05:6a21:8802:b0:1a7:2924:7317 with SMTP id ta2-20020a056a21880200b001a729247317mr4794308pzc.49.1712954928983; Fri, 12 Apr 2024 13:48:48 -0700 (PDT) Received: from ghost ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id e15-20020a17090301cf00b001e2a4499352sm3399440plh.262.2024.04.12.13.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 13:48:48 -0700 (PDT) Date: Fri, 12 Apr 2024 13:48:46 -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 02/19] riscv: cpufeature: Fix thead vector hwcap removal 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-2-4af9815ec746@rivosinc.com> <20240412-tuesday-resident-d9d07e75463c@wendy> <20240412-eastcoast-disparity-9c9e7d178df5@spud> 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-eastcoast-disparity-9c9e7d178df5@spud> On Fri, Apr 12, 2024 at 07:47:48PM +0100, Conor Dooley wrote: > On Fri, Apr 12, 2024 at 10:12:20AM -0700, Charlie Jenkins wrote: > > On Fri, Apr 12, 2024 at 11:25:47AM +0100, Conor Dooley wrote: > > > On Thu, Apr 11, 2024 at 09:11:08PM -0700, Charlie Jenkins wrote: > > > > The riscv_cpuinfo struct that contains mvendorid and marchid is not > > > > populated until all harts are booted which happens after the DT parsing. > > > > Use the vendorid/archid values from the DT if available or assume all > > > > harts have the same values as the boot hart as a fallback. > > > > > > > > Fixes: d82f32202e0d ("RISC-V: Ignore V from the riscv,isa DT property on older T-Head CPUs") > > > > > > If this is our only use case for getting the mvendorid/marchid stuff > > > from dt, then I don't think we should add it. None of the devicetrees > > > that the commit you're fixing here addresses will have these properties > > > and if they did have them, they'd then also be new enough to hopefully > > > not have "v" either - the issue is they're using whatever crap the > > > vendor shipped. > > > > Yes, the DT those shipped with will not have the property in the DT so > > will fall back on the boot hart. The addition of the DT properties allow > > future heterogenous systems to be able to function. > > I think you've kinda missed the point about what the original code was > actually doing here. Really the kernel should not be doing validation of > the devicetree at all, but I was trying to avoid people shooting > themselves in the foot by doing something simple that would work for > their (incorrect) vendor dtbs. > Future heterogenous systems should be using riscv,isa-extensions, which > is totally unaffected by this codepath (and setting actual values for > mimpid/marchid too ideally!). > I am on the same page with you about that. > > > If we're gonna get the information from DT, we already have something > > > that we can look at to perform the disable as the cpu compatibles give > > > us enough information to make the decision. > > > > > > I also think that we could just cache the boot CPU's marchid/mvendorid, > > > since we already have to look at it in riscv_fill_cpu_mfr_info(), avoid > > > repeating these ecalls on all systems. > > > > Yeah that is a minor optimization that can I can apply. > > > > > > > > Perhaps for now we could just look at the boot CPU alone? To my > > > knowledge the systems that this targets all have homogeneous > > > marchid/mvendorid values of 0x0. > > > > They have an mvendorid of 0x5b7. > > That was a braino, clearly I should have typed "mimpid". > > > This is already falling back on the boot CPU, but that is not a solution > > that scales. Even though all systems currently have homogenous > > marchid/mvendorid I am hesitant to assert that all systems are > > homogenous without providing an option to override this. > > There are already is an option. Use the non-deprecated property in your > new system for describing what extesions you support. We don't need to > add any more properties (for now at least). The issue is that it is not possible to know which vendor extensions are associated with a vendor. That requires a global namespace where each extension can be looked up in a table. I have opted to have a vendor-specific namespace so that vendors don't have to worry about stepping on other vendor's toes (or the other way around). In order to support that, the vendorid of the hart needs to be known prior. I know a rebuttal here is that this is taking away from the point of the original patch. I can split this patch up if so. The goal here is to allow vendor extensions to play nicely with the rest of the system. There are two uses of the mvendorid DT value, this fix, and the patch that adds vendor extension support. I felt that it was applicable to wrap the mvendorid DT value into this patch, but if you would prefer that to live separate of this fix then that is fine too. - Charlie > > > The overhead is > > looking for a field in the DT which does not seem to be impactful enough > > to prevent the addition of this option. > > > > > > > > > Signed-off-by: Charlie Jenkins > > > > > > > @@ -514,12 +521,23 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap) > > > > pr_warn("Unable to find \"riscv,isa\" devicetree entry\n"); > > > > continue; > > > > } > > > > + if (of_property_read_u64(node, "riscv,vendorid", &this_vendorid) < 0) { > > > > + pr_warn("Unable to find \"riscv,vendorid\" devicetree entry, using boot hart mvendorid instead\n"); > > > > > > This should 100% not be a warning, it's not a required property in the > > > binding. > > > > Yes definitely, thank you. > > > > - Charlie > > > > > > > > Cheers, > > > Conor. > > > > > > > + this_vendorid = boot_vendorid; > > > > + } > > > > > > >