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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7CBBC636CD for ; Tue, 7 Feb 2023 06:32:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230224AbjBGGca (ORCPT ); Tue, 7 Feb 2023 01:32:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229865AbjBGGc1 (ORCPT ); Tue, 7 Feb 2023 01:32:27 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C56F193EA; Mon, 6 Feb 2023 22:32:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1B3AACE1C78; Tue, 7 Feb 2023 06:32:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A06F5C433D2; Tue, 7 Feb 2023 06:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675751542; bh=BM31iNLFopS5FV6b55CPDvqToJbz28aRbpAuedR3Wg0=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=PaGOfHg8GAh6cLctTj+gwXlACn71B6RQGviIMwip2g/oq7XsohntDT9cHKQLfn0OU ZsWEARVAVvOxE3lZ7MeDaExdM1B9gfE0+mdMugyt9zDF+daBT5sNsBQER1o2ljJ0t1 iycJPdO62eaWALdOvzCeayx4TICusi6vEbbIRprTM8JV5X0QlnwyC/tbI/4EQ9wHdl +e9gldY2f4bmCX3vpWmMF4hqkeIFqQQvHGt8I4nwtSP8WJ0Qqo0MI9g751FujEkjiH v/XUIdIVUNa58m+9jG5U6nWlLf3x5TduQodDtfYkLvfYgY3kpe8aQmWlGRiUBxf7t7 4tqErvkByrhAQ== Date: Tue, 07 Feb 2023 06:32:18 +0000 From: Conor Dooley To: Greg KH , Evan Green CC: Palmer Dabbelt , vineetg@rivosinc.com, heiko@sntech.de, slewis@rivosinc.com, Albert Ou , Andrew Bresticker , Andrew Jones , Anup Patel , Arnd Bergmann , Atish Patra , Bagas Sanjaya , Celeste Liu , Conor Dooley , Dao Lu , Guo Ren , Jonathan Corbet , Palmer Dabbelt , Paul Walmsley , Randy Dunlap , Ruizhe Pan , Sunil V L , Tobias Klauser , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v2 2/6] RISC-V: Add a syscall for HW probing User-Agent: K-9 Mail for Android In-Reply-To: References: <20230206201455.1790329-1-evan@rivosinc.com> <20230206201455.1790329-3-evan@rivosinc.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey Evan, Greg, On 7 February 2023 06:13:39 GMT, Greg KH wr= ote: >On Mon, Feb 06, 2023 at 12:14:51PM -0800, Evan Green wrote: >> We don't have enough space for these all in ELF_HWCAP{,2} and there's n= o >> system call that quite does this, so let's just provide an arch-specifi= c >> one to probe for hardware capabilities=2E This currently just provides >> m{arch,imp,vendor}id, but with the key-value pairs we can pass more in >> the future=2E > >Ick, this is exactly what sysfs is designed to export in a sane way=2E >Why not just use that instead? The "key" would be the filename, and the >value the value read from the filename=2E If the key is not present, the >file is not present and it's obvious what is happening, no fancy parsing >and ABI issues at all=2E https://lore=2Ekernel=2Eorg/linux-riscv/20221201160614=2Expomlqq2fzpzfmcm@= kamzik/ This is the sysfs interface that I mentioned drew suggested on the v1=2E I think it fits ~perfectly with what Greg is suggesting too=2E > >Bonus is that you will also properly document all valid key/value pairs >in Documentation/ABI/ when you do this, so it reinforces what the code >should be doing correctly=2E > >thanks, > >greg k-h