Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16854892rwd; Mon, 26 Jun 2023 16:32:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5jYwNQMFAOP4Bs6BikeEq3A7XpcsFZ2lGX7a5R5AJfPE9y3uDjkSnVh/DKtWePEsk0Advs X-Received: by 2002:aa7:d882:0:b0:51d:a2d9:85a3 with SMTP id u2-20020aa7d882000000b0051da2d985a3mr2448638edq.8.1687822351556; Mon, 26 Jun 2023 16:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687822351; cv=none; d=google.com; s=arc-20160816; b=o2DFA2+u/aUK0y8BiOxm0jlIac5A9E47X3cjnIVMM7EjcGLSMym50+dGvcGgyDbbLP +ea2Bgm7RvTMbYdfuHn9ZKPjOcHfWmTVGRe6DtfTycZPSrBv8fPCurQqWRNrl6SPvzAw maKbzZygQqnq0agDTRtdMgp60shwlUPWQ6WYg4k1vb86DRzzbQzptaAMvr0+lLISrK01 NYfminYx1Lzs+Pmqvbkmvodun6sIe8HjHOEo8E+FMBmmraQGjmrTQEHvtvQVUYKQH9Ff MRbkFS673T7PS12e8sqjyEtHUwt4B350Lpr9xuJa6kLNiu6KSdYW2lQdNThSHsXuULYd hKKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=z4alHOUGGIhmlz1BVYl1dLSP5d3yu47ZI8dzI3lReI8=; fh=mKT2o892lF1qIFUxDdxIOI5HjndK01hhPlr/zbpOxjo=; b=Ij7I0cXfodvC5hudv4keMuEy9vDr/BrVEk7AJk+5dlOKrCX35HoH3jidHPmJ/O4xHw 7bL9RNxDttw4cg85cbY5yx912in3DeKriwpvwM4lXs6DGQd/VYfgXdnt79gWfVKhjlXD mEI+V79GZlLwR7YqwotgnpTx+yPKCAiYBZRhZ02xXoWhzvaDs+MWetz2hEmd2FndRIwH GuRy2t1hQTdpz7sdB5bDiq6U2+zpkfChNtOP/L7S7FAnVFyQaZOj41aO+IPzOzHb9OoC 5X479TsiteT2nxGtEiwEnCcGLpi5gcRHXS0RBvFMkJLpjKJnaw7Toe5tVcnx3NGM7az6 LKrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o2-20020aa7d3c2000000b0051be93bd984si2967241edr.283.2023.06.26.16.32.06; Mon, 26 Jun 2023 16:32:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbjFZXPA convert rfc822-to-8bit (ORCPT + 99 others); Mon, 26 Jun 2023 19:15:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjFZXO7 (ORCPT ); Mon, 26 Jun 2023 19:14:59 -0400 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB42F10D2; Mon, 26 Jun 2023 16:14:57 -0700 (PDT) Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-5701e8f2b79so41583987b3.0; Mon, 26 Jun 2023 16:14:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687821297; x=1690413297; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kM73dDXJJ2LQE16TI30w/dkhZfJCFiiWEY4v9vd3CAI=; b=LDX72YnIUSr+k4xLstF51E7GaDxYyBd6KxcvBbZNYLVFq/ugCcPmyF7e/qlFrs+Dwl b22mLaJen3XLfYOFittbcOp6jCcq1lOMnNF3ujmJ/YNxntuRoEpnc828EVLyKt3pUL+i gRv+1SqBEijiwFdNt4Pwn5t9/lM3QjolL2MwwbAVokjrizCNr2vUXB8BN6xdjj72bg3N u/iVqTOh1Gk9fJfhzjkGfhUN9Jk5KBDhXDv8c7RcYsWgSmyRmdPZhmWxncb7LvjJZcl3 HdH4JtRM0QbD0S8JrRBcIAPxiM6OMnrZ8WhqwbaxpyywQVLnaik1qKIaY2dsD7gy56eF xLMQ== X-Gm-Message-State: AC+VfDxnXkVzmVdIdpc81pblavP9+yE6qUi04NPzqM+V6bQiRkguUIZ4 dkNIzQek31lUrb98FBHtDGKywk5jT6y8mk3z7wA= X-Received: by 2002:a25:2903:0:b0:bff:d530:f06 with SMTP id p3-20020a252903000000b00bffd5300f06mr14953523ybp.41.1687821296805; Mon, 26 Jun 2023 16:14:56 -0700 (PDT) MIME-Version: 1.0 References: <20230624-supermom-disparity-37546ffed0a4@spud> In-Reply-To: <20230624-supermom-disparity-37546ffed0a4@spud> From: Namhyung Kim Date: Mon, 26 Jun 2023 16:14:45 -0700 Message-ID: Subject: Re: [PATCH V3] perf vendor events riscv: add T-HEAD C9xx JSON file To: Conor Dooley Cc: Inochi Amaoto , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nikita Shubin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-riscv@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Sat, Jun 24, 2023 at 1:54 AM Conor Dooley wrote: > > On Fri, Jun 23, 2023 at 09:35:01PM -0700, Namhyung Kim wrote: > > On Fri, Jun 23, 2023 at 6:33 PM Inochi Amaoto wrote: > > > > > > > As for c9xx wildcard, the T-HEAD provides a `MCPUID` vendor CSR to allow > > > its CKLINK to get the detail CPU info. The format of this CSR are: > > > > > > ------------------------------------------------ > > > |31 28|27 26|25 22|21 18|17 8|7 0| > > > | index | WLRL | family | class | model | WLRL | > > > ------------------------------------------------ > > > > > > And for C9xx series (only index 0000 is vaild for us, as `MCPUID` also > > > provides other index). > > > > > > | 0000 | xx | 0100 | class | xxxxxxxxxx | xxxxxxxx | > > > > > > The class codes are: > > > > > > C910: 0011 > > > c906: 0100 > > > > > > The CSR is a M-mode only CSR, so now I'm exploring a clean way to > > > integrate this CSR into the kernel. Any advice? > > See for example how riscv_cpuinfo_starting() reads mvendorid & Co. > > > I don't know about the details. Is this CSR available from user space? > > If not, you could add it somewhere in the sysfs. > > Machine mode is the highest privilege level, Supervisor mode is next & > User mode is the lowest. Typically the kernel runs in Supervisor mode. Maybe you're interested in this thread for user visible identifiers. https://lore.kernel.org/all/1687245156-61215-1-git-send-email-renyu.zj@linux.alibaba.com/ Thanks, Namhyung