From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 DFC1414F121 for ; Fri, 12 Apr 2024 18:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712947588; cv=none; b=ntglQv826AtTpoAfzNzrC6bC8K01Sxs1xrtGaRHT1Iv96I685E4lFDTYVAjSF3U6Uah61KC3fB3n876OGJXmaQoiL+XLaoGHZElgN6oOuXUBuyoWwXBa/3iQOMiPfCAdUJfhM7DBQL1tiaUqnN1hl1nqkjs9vhj4d0HeNljfeCU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712947588; c=relaxed/simple; bh=qKkswK18vpnSN345O9M11lS7tdby0F+ByaBIolhUUXA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HSVib03jPkJtzVqxSUp3Tw3T1FMtzXuEetXeHiIiqqhCjWERLWPExBu/Yyds1PZ7e1Wi+Qea87z41wCW3wGdJ3e9nVdITGb2JSmBbj9JalgYh/O6IWHoW79HfjMhyPeNXSgLTmHh81/fTc0fcrry4SjKymhTUyYoXwawnx2ofo4= 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=h8TgWeSQ; arc=none smtp.client-ip=209.85.214.175 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="h8TgWeSQ" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1e3e84a302eso9378615ad.0 for ; Fri, 12 Apr 2024 11:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712947586; x=1713552386; darn=lists.linux.dev; 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=jhdmuDh97ehxPhYQBh/JW7pvCSTVsjtJJK5Y5QDdmM8=; b=h8TgWeSQ1dYYM+WfL9bOBa7Yl/jow7cfMXHQ/N4ez2AEBvKvhFFB0jFL0TMed8W11d KhDazYtWZr3ufDh1/rt7z9fQyfFfapdAOSfQ+aFzBM4kEm2QNsU6aFakKrHw4f6aZV24 B1rAFtR8j6TPNvY3u0GsTvaLxsRyy73+kM7J512scwyZvLrlvZNFWSmKNx+uqMXlJswO bm9TWafpfbWBFeT/dA79/0OJFS3zayIev2g2x28ap6+/uEokHQ5RW3UTRKWgiLhMLVR+ 2A1NLkPCNACCPuOOpRhIJvW4SJA3gE98Oe9rAOXyH9p5biDA+5ktgT1uPuWrfbLNSWwK IX0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712947586; x=1713552386; 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=jhdmuDh97ehxPhYQBh/JW7pvCSTVsjtJJK5Y5QDdmM8=; b=g8RBigIHbAbve6FEQdqaAr0Ae6DJJK2cBAo0TRm4wadwV5Xkc9GAsNZnHXjgqR0Lcw 0pH7mQziPWYLyvKm9R17gosbRhsz9wQNASvszKnDddV0dlAD6frwR0xH78Qx8IGQzQ1W /oE7ysWG4zaLONE5EO6LB5V4qlz/vhetBGG4JLCrV/pBEUfI/ywRHGdHXQDeWvKaGGAs bRDTQfhvboEDmtviOjcyaE+0LgaLxx5v5m/z4LSUb06FYiL4y/akvZu7SSrpidjc6alK zvqiB2I6u9MiBoNimNfsc2FtDny69kHJs9b1KBgWOs0EhV+u4/venDv9cxVB12HzDfIc hRJQ== X-Forwarded-Encrypted: i=1; AJvYcCUP1poY040tterTSe4RX6FE5Zk2cZisP2AwA6vWPZKKageIJvwKVJwinjwJnpOnl86McrclOGvGGGOUm7KsqCIYNTE/Ta3xBx0z2Fc= X-Gm-Message-State: AOJu0YzVQaTsUXojJtZM+hmRWEppQZTDPS+pWwRUSPZn6cDdoIfo0vEr XgQMJcOm2uYR+BzplPtH5XqEI7Xb2NUVuBFAHNDnUorUlXgGKz3/bngwmeZoAs8= X-Google-Smtp-Source: AGHT+IFwxybYzCqREDQlA4G/991sEd0Qsau4lgiSO1q7Go2BFR9+aFqtd2m1c15qUgSnxQTpows9RQ== X-Received: by 2002:a17:903:8ce:b0:1e4:70d0:9333 with SMTP id lk14-20020a17090308ce00b001e470d09333mr4440423plb.9.1712947586221; Fri, 12 Apr 2024 11:46:26 -0700 (PDT) Received: from ghost ([107.84.152.28]) by smtp.gmail.com with ESMTPSA id y2-20020a17090322c200b001e447bf336esm3300373plg.282.2024.04.12.11.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:46:25 -0700 (PDT) Date: Fri, 12 Apr 2024 11:46:21 -0700 From: Charlie Jenkins To: Conor Dooley Cc: Evan Green , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Guo Ren , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , =?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-employer-crier-c201704d22e3@spud> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev 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: <20240412-employer-crier-c201704d22e3@spud> On Fri, Apr 12, 2024 at 07:38:04PM +0100, Conor Dooley wrote: > On Fri, Apr 12, 2024 at 10:04:17AM -0700, Evan Green wrote: > > On Fri, Apr 12, 2024 at 3:26 AM 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. > > > 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. > > > > > > 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. > > > > It's possible I'm misinterpreting, but is the suggestion to apply the > > marchid/mvendorid we find on the boot CPU and assume it's the same on > > all other CPUs? Since we're reporting the marchid/mvendorid/mimpid to > > usermode in a per-hart way, it would be better IMO if we really do > > query marchid/mvendorid/mimpid on each hart. The problem with applying > > the boot CPU's value everywhere is if we're ever wrong in the future > > (ie that assumption doesn't hold on some machine), we'll only find out > > about it after the fact. Since we reported the wrong information to > > usermode via hwprobe, it'll be an ugly userspace ABI issue to clean > > up. > > You're misinterpreting, we do get the values on all individually as > they're brought online. This is only used by the code that throws a bone > to people with crappy vendor dtbs that put "v" in riscv,isa when they > support the unratified version. Not quite, the alternatives are patched before the other cpus are booted, so the alternatives will have false positives resulting in broken kernels. - Charlie