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 82DC1C636CD for ; Tue, 7 Feb 2023 06:13:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230048AbjBGGNs (ORCPT ); Tue, 7 Feb 2023 01:13:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjBGGNq (ORCPT ); Tue, 7 Feb 2023 01:13:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84DC3F5; Mon, 6 Feb 2023 22:13:45 -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 ams.source.kernel.org (Postfix) with ESMTPS id BC094B81690; Tue, 7 Feb 2023 06:13:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCC92C433D2; Tue, 7 Feb 2023 06:13:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675750422; bh=A8ruLAiuCpN7LMl+nJ9yC0o7pNkD8QVVbmSEd6pFxdw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=szUpQl4DnlNs6jGTa105n7oPvde4TCvfylsRNLjrXMAZzbQGsixOK7SpVLSjGgV/x 5Rsa5KnQjNVZBdIS4/D1k4q8I1Qtb+Ec58YlPBbGBw16G6/IGzI7YGiJVkFEW8UYhN ibp7GJJnIuZqDACYQuHR7X9GPnqkNiQIFVhZjek4= Date: Tue, 7 Feb 2023 07:13:39 +0100 From: Greg KH To: Evan Green Cc: Palmer Dabbelt , Conor Dooley , 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 Message-ID: References: <20230206201455.1790329-1-evan@rivosinc.com> <20230206201455.1790329-3-evan@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230206201455.1790329-3-evan@rivosinc.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 no > system call that quite does this, so let's just provide an arch-specific > one to probe for hardware capabilities. This currently just provides > m{arch,imp,vendor}id, but with the key-value pairs we can pass more in > the future. Ick, this is exactly what sysfs is designed to export in a sane way. Why not just use that instead? The "key" would be the filename, and the value the value read from the filename. 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. 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. thanks, greg k-h