Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp106852lqp; Fri, 12 Apr 2024 11:46:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+obcl8e6fgfELgkhvgSKhIERVZuPphDrM8OVhFU/ZaT51ujb98C3lkNG+Y/bOVxovJ5KzOzve4f2cPUiIfgj93AQmFtw1JxL4zrNNpQ== X-Google-Smtp-Source: AGHT+IEH1J44IU6XUFGvgNGj2YX5cy6YR1QDvBsxEgvUZZKK1ldNZLqP78v07pYzMnlQhqWKFL4J X-Received: by 2002:a17:907:94c1:b0:a51:e5c7:55b7 with SMTP id dn1-20020a17090794c100b00a51e5c755b7mr2529929ejc.47.1712947608345; Fri, 12 Apr 2024 11:46:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712947608; cv=pass; d=google.com; s=arc-20160816; b=QGaEyz9CAhaK7duFtyDrSGaGeeO51QsOrcpO9bj3lkCiaztmJA5UbQKU122YO3MALY zotlr1qvUi9dk3z947FoCK38ULjhJjpAoTHMRbrwG4xdWLZq8b7E4IKZTA4rgA/r5KvW /E8WtzbDBbf+lowlh0WjlC4VJpAYzWhVVPdtnYBV2qdWjFRsiyPwuzi1ZY44r7OKdHuP sBkAKZD5xGID7k0rj/vuE9L1XtNMl590nRkH1uPfZjB8naRpiXIN7Bspb2o0SbTf1pth tdp2B6N1NndJqsQz5kxg9d3aT53WBShZ/HtjxFz4PNiZ3gWpX7mHm/p/Nnv61QzdQ/M0 Mzmg== 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=jhdmuDh97ehxPhYQBh/JW7pvCSTVsjtJJK5Y5QDdmM8=; fh=B8ZFB3/xxmbmSJWvnxjtd+E3Zb8YMUeIwwTWxfx2ZBM=; b=d4ZUqcfq6nPDNvj4E06kFGcEYcfUUVIl85vj9XrVL1M0/t7V8PkkQr0RIJLityuMAN CRZ7g2UMT9k9ETdr34VH6jB9T2oujnoMzTPTgRqY0DV5DBWkmnP+woVT28V9kDyASSWn eKCrdhIk07ly7EMFReL7OrzRx7LzEKr7u+S4TzeJ7ikTVDJQeb6g0wVSQLmulnpHE/kK k2cdd0TKaG80hQeNVBJIyTp6znC93dUTiossVXPxpb7Fgy3MW5dfzx/xLIKoiZEEy+O7 I9JoQiFXSa+4hTKbM+0QgZ2iFpeL3lWiFVXt/NpiRIIU1tx+HcR5ns7U5ntzvYs9upKz kK6A==; 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=NJpSzMgO; 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-143226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143226-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 h13-20020a1709063c0d00b00a4e483fc949si1830335ejg.946.2024.04.12.11.46.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:46:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143226-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=NJpSzMgO; 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-143226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143226-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 930431F217E2 for ; Fri, 12 Apr 2024 18:46:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F48F14F124; Fri, 12 Apr 2024 18:46:29 +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="NJpSzMgO" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 D340714E2DA for ; Fri, 12 Apr 2024 18:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712947588; cv=none; b=ptiJoMcw0iDemUP2qwT1anydYcEoR+TTVnCCBajEo8P6tmK08DAAp1oUMa3OLdIKHzOHLqzZqmsdj5C/Lu6vAQ9wyg0Q334kfDnjJoDodB3xZ0nZr46R9U5dc0He5GTrusTgSWip4fk362rYNwZi5xDl5FBgOImDxXEJMHIUQlI= 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=NJpSzMgO; arc=none smtp.client-ip=209.85.214.169 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-f169.google.com with SMTP id d9443c01a7336-1e5ebb30129so468575ad.3 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=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=jhdmuDh97ehxPhYQBh/JW7pvCSTVsjtJJK5Y5QDdmM8=; b=NJpSzMgO2NM1CljmTV21oKb+kmm/SZHqXiDfvfccELH/SOEs7LEzkEvsb+4qYM3vor tc5dpUplGL0hrzgmIr6cUzgu7DdjlhvGYRQyEfpvK/vcY+xeEs+r0jrh+ZmxnKMaOjxP fvXvex5wT0a35qa/W0E0GPNGAburVs8VktwlJEVe9eLVdgfZY+LiCLry4V4brkD864+t PRGJZY4gr4U8Ts6AuCSOGFV/QXYQbLLn/Banboqtkf3tlq0m714BaV8l4e1Ya33IJCRs XOR20todyiga2MsVgVNrnCm81n7gRgm5UfxM6em6f8b4uPm6nVO3Af9NST9YbXk6Wl4X ivww== 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=SSPxeux9JwE/RNM6QSMktdAWbtVwf526e2DoPpXneNsM7a6FekLkRV1pL7CSTxIFNe PFxfsBapOKQ+A+hsMSM3iBwXH6CSidqWwlrGlLr8CIQH1EiYHA7/d6qLreQgbbdXWoEf SpPAse2pXAT0aqMZoAO6uWZmMz4Li2CS/51XnaXgF1FchU764e0YGjYE/6G8VMSMM+9v qe8bzn8lZ79ShhVGhoRrA48WKajhfW3EuBppoWz/wGQJ0YMe4CeVg6aElN6mqz4rk2aZ bL3Pt0Z6rD31m2gTAtiqTKiLc1GF3lFQCq3XSTV8xjFXLZ+W3bb5eGGJisYEHJnGZMLS 8dkw== X-Forwarded-Encrypted: i=1; AJvYcCWYtpRh07+dUJyYO/iHMDLhX1dWg8YKZIDIfm00oEVq0CipZW874IfC3kYKolsFwT0gdJH90Qnm0lF52H6DAMiByCtFDSzBsk8DTa68 X-Gm-Message-State: AOJu0YxHqSvY9Hcvaw68DthUWIo0B41Y6iFBXwnhfWyfyThplfUJ2dsl BJ4Zv2sKHNWSrruAYFX2TjjBXbr2a3S3XSazoPC+99kO7lTyRxF42n+JiFKNTF4= 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-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: <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