Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp247723lqn; Thu, 11 Apr 2024 23:10:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+KLh+YIMf5LA1WBkv4NKiWw0wtQG+CUB/BkbunnkiJ6vQQfaxG0T7I4GuXmhlE0GlOU/yH3KaAd3n5F1Yz03ta7GM3p6rPJPMJA8lzA== X-Google-Smtp-Source: AGHT+IGxS7YDNi3YeL18v6jAg8hfBS4flbkL25pUFmCGXq29gHknIiZKmWpCcPqY2UZrxYgWwW9G X-Received: by 2002:a05:6a00:4b55:b0:6ec:f566:6eb0 with SMTP id kr21-20020a056a004b5500b006ecf5666eb0mr1991801pfb.17.1712902212398; Thu, 11 Apr 2024 23:10:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712902212; cv=pass; d=google.com; s=arc-20160816; b=h2+epJovKoGkx1pU6kOcOf+Hw3H9En0n1+NiOyunyvC7BIRO2IKMFe+Ayx9hRAp6ah sKIJZ0H2LDpmZDbkZLe5jKORWjbr2o9ccFsyVj83WrR9wKuZ2l7vMizsyZnuWbkpwsTo Gcl1d4CFKcZ0+y+4hC0102mpqT5Cb58279JIepDVmSYvUC0gOtCBRS3ipRlJ7VrzKFwQ YPYQP1hjBvYMZmJS2Frlgnd+oAgxufppSnkFpZT06lx3QZ53JNPrMLnkwZgDaEZYlF0X gWPeTuwiaE2ucAFyjZDVXAvUAu/jIexZPrfchp4OgVszSAoqEIJJF/AS/krcma9I9wSE H0zg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=RCpuUG8Y6qQzCbQ/bfUjCb8eAFDKLZHys2TWAmXqEP8=; fh=qe4K4Rfs+qJ+GWsFOM576ZWHVeLK8csOPP7R/Q6wm54=; b=nETn7vL60H5Hqa/Zf5Dk7rlJbe9G4in76A15wu/3ciFb42JIJRNvT//kyEgGmdXfL/ m/XxgFaSQqhVayLeWY0aevpVUn4VIUitDbXXF0KbXEmjb7T1E3RkcaOa+4xFOO4aEyj9 X4r6ChWLNce1vJ+KfGOH/For8CMak+mY1P0fnPx2yGV9+GLTfQ4VesqUlll3pL40l6Bv aW+GO42ZCIG/I5er81Kw2vZ6jj1n5Tgvk2oqIBTXLAmqlFfbkxqCUga9Z5HO+uSSSS7p QG11gNcnU96PAbDRDjJQYN5Qj4eHP8M9n/kW+n3cz43ovT+GHgFIzPEPjw3x3I2+OklY sbfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=roV5U5VO; arc=pass (i=1 dkim=pass dkdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-142018-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142018-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id gr25-20020a056a004d1900b006ed188b5381si2699404pfb.130.2024.04.11.23.10.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 23:10:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142018-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=roV5U5VO; arc=pass (i=1 dkim=pass dkdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-142018-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142018-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 14C0728758D for ; Fri, 12 Apr 2024 06:10:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 180183D0B8; Fri, 12 Apr 2024 06:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="roV5U5VO" Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D7D93AC0F for ; Fri, 12 Apr 2024 06:10:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.57.252 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712902206; cv=none; b=ZpQWQsQ2L5ouHgitOMuMn09TGxZk+p+2FcLEUq84cn4myPy8w5GgXixxx3e6Jy0RVTVWXKV0y7aR4vM8TlTCktj3996wPz0LrvbVJaBXrbN3SLP8QeiGwtHfGay0J69bMbbF9hOJ4yo+p4ejoAZgGT0ggH/PZTg+lDlqubqmjOE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712902206; c=relaxed/simple; bh=pu5bR8rdLoq0iRIp20p+6r46EKUPixnjEP8Se9MViEk=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=bxnnm8fYzg13XM+bCJPDqnj2l1dZBTn0vJhjurhfmxe0VyoC1oAQV8RfP7PYVDbhLbVLCXYo/2cVETF0yHyVXXUq88E/w6HmyQHR06992nIzovdBUCoDv0mi3E8viC+Oj+jB9fdritgI1r0qRVrMGWBOT2y38J2qImB5SaF4eR4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cyyself.name; spf=none smtp.mailfrom=cyyself.name; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=roV5U5VO; arc=none smtp.client-ip=162.62.57.252 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cyyself.name Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=cyyself.name DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1712902187; bh=RCpuUG8Y6qQzCbQ/bfUjCb8eAFDKLZHys2TWAmXqEP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=roV5U5VOLfFFuSA66RHFtd7DlpW3fjYMRUPDqFI4aOTdWqGNrZmfcg+iP+kqcYPgK cqvz9pn0atBRzLHYoRMhzQDWoHZzVYmYZZPKbtb7OjkXAlhZdP65CGaIJE8Z0CFZQX ExGcMlD8wmaHdaiDpWKLKNy91li4bIYIreA0kzVc= Received: from Yangyus-MBP-2.lan ([219.141.235.82]) by newxmesmtplogicsvrszb9-1.qq.com (NewEsmtp) with SMTP id 26A92058; Fri, 12 Apr 2024 14:09:42 +0800 X-QQ-mid: xmsmtpt1712902182tfspx6bgu Message-ID: X-QQ-XMAILINFO: M1rD3f8svNzn35bFmb+L32haCejewhnm0tL5u10kQJA0x4jKl0RKQqRqKkkeFJ Fg4gmNCDe9dtErpMNgMglLVMZeDwgKhv10ZTSliNR+2NMa8JAbCF0xv12hwnluevmQ4Ge7phRXsZ /2rYdrKJI/DEc0yHHFHhQ4moVMMw/wmXOX1ZrHs5hhs8SdJUzEWIz+PNwA4RhF2zwVnfjAKS7KnO Z0n6//9rIarmviIB3JOPsBb7dSVuQlk6FtbMV6XIJC8vypa/q3gleY5sb+DH1pRgA2KWpaVN8j77 aBkOdU4T5xXQj5Etw0BQqVrDOxGSKN3fYR78BBIU84T1gRqgMugeE72Go1rOberoZ37eQ7uIdmKz N9SQs7tJfFtF7k/f+nKcpSnDFaCEWEf97tMvT+jjd5TJeSuoT6gl6CDLUGGhi1ccdTttrtvXW+Qt CfoTK9dBQnVuxRDicMrlZ/S9aOuc9f1IrJLUpBGyPz+bTPK/pb2x0x91ucYqyesit/RY33Ng3yFn /c2bMA6gXgPAluy0foT7SdgFNAySkZB5Nl5bsSPPh14TpWNC1UgcasoG9QX9d9IDMawfWupZPOfl zr9dUwduoqBmqBDGccZGBEwUExeo6roCmbf5QGL48QabybjdZZmCaeJmmBGoZLBafqWcrqdBff26 XIlamWmtbC3OxqHc6ZLHiKnAuI/HMvHhUTXXY2DeEzDPq+T4z8LWYb1S0kFUximiTerLFZHk1scS 3cSwnU8EGT0lD6fbVSk4m8ps24y7TMDp7jlunjfICDXdxYBXZ3gL9s/nR7cx/FtnrVsvgV2V83qq zEgGEfC8uoYZi12qJ3TD2FNOFtAzu4YRevGxh5eJkbBS6ImpuWw3kgZvRwB3hU2ZkeOqrnX8PG9u FfYmxxe4PKvsoAC8DnnDXmFi73XXOuwc3JlOqSWxrJgHKYlGyk+jsNwguo5ClA6+RV9X/FR0eGdg L5SDlkNDyREWq6BKtawErREgOUpddUKcm5wxCKYO0Bq99DzZHYZTs1Fwv7hfXnRWUIQZ6JOFbUdq WxhJqAcpgZVYYEiBVl X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: Yangyu Chen To: dqfext@gmail.com Cc: ajones@ventanamicro.com, anup@brainfault.org, aou@eecs.berkeley.edu, atishp@atishpatra.org, conor.dooley@microchip.com, heiko@sntech.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, mark.rutland@arm.com, palmer@dabbelt.com, paul.walmsley@sifive.com, will@kernel.org, guoren@kernel.org, Yangyu Chen Subject: Re: [PATCH] perf: RISC-V: fix IRQ detection on T-Head C908 Date: Fri, 12 Apr 2024 14:09:32 +0800 X-OQ-MSGID: <20240412060932.54327-1-cyy@cyyself.name> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20240311063018.1886757-1-dqfext@gmail.com> References: <20240311063018.1886757-1-dqfext@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On 2024/3/11 14:30, Qingfang Deng wrote: > T-Head C908 has the same IRQ num and CSR as previous C9xx cores, but > reports non-zero marchid and mimpid. Remove the ID checks. > > Fixes: 65e9fb081877 ("drivers/perf: riscv_pmu_sbi: add support for PMU variant on T-Head C9xx cores") > Signed-off-by: Qingfang Deng > --- > arch/riscv/errata/thead/errata.c | 4 ---- > drivers/perf/riscv_pmu_sbi.c | 4 +--- > 2 files changed, 1 insertion(+), 7 deletions(-) > > diff --git a/arch/riscv/errata/thead/errata.c b/arch/riscv/errata/thead/errata.c > index b1c410bbc1ae..49ccad5b21bb 100644 > --- a/arch/riscv/errata/thead/errata.c > +++ b/arch/riscv/errata/thead/errata.c > @@ -125,10 +125,6 @@ static bool errata_probe_pmu(unsigned int stage, > if (!IS_ENABLED(CONFIG_ERRATA_THEAD_PMU)) > return false; > > - /* target-c9xx cores report arch_id and impid as 0 */ > - if (arch_id != 0 || impid != 0) > - return false; > - > if (stage == RISCV_ALTERNATIVES_EARLY_BOOT) > return false; > > diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c > index 452aab49db1e..87b83184383a 100644 > --- a/drivers/perf/riscv_pmu_sbi.c > +++ b/drivers/perf/riscv_pmu_sbi.c > @@ -811,9 +811,7 @@ static int pmu_sbi_setup_irqs(struct riscv_pmu *pmu, struct platform_device *pde > riscv_pmu_irq_num = RV_IRQ_PMU; > riscv_pmu_use_irq = true; > } else if (IS_ENABLED(CONFIG_ERRATA_THEAD_PMU) && > - riscv_cached_mvendorid(0) == THEAD_VENDOR_ID && > - riscv_cached_marchid(0) == 0 && > - riscv_cached_mimpid(0) == 0) { > + riscv_cached_mvendorid(0) == THEAD_VENDOR_ID) { > riscv_pmu_irq_num = THEAD_C9XX_RV_IRQ_PMU; > riscv_pmu_use_irq = true; > } > -- 2.34.1 Tested-by: Yangyu Chen With this patch and T-Head C908 PMU being probed by OpenSBI, I can now use the perf record to profile RVV 1.0 software on Canaan Kendryte K230. This will speed up many RVV 1.0 software developments now and even for better performance. However, as Inochi said, the newer version, C908 may support Sccofpmf. We should ask Guo Ren to clarify this so we can have the cleanest way to probe what to use between THEAD_PMU and Sscofpmu. I added CC to Guo Ren. Please clarify about this. Some off-topic things: I need this feature recently since I am implementing a pure RVV chacha20 algorithm. I have already sent PR to openssl to speed up the crypto performance on RVV without Zvkb support and maybe ported to kernel crypto sometimes. To speed up TLS or other applications for many chips that may come this year with RVV 1.0 but without Zvkb. Link: https://github.com/openssl/openssl/pull/24069 However, the performance evaluation on K230 is not well compared to pure C implementation. I will need this PMU driver to do some profiling. Thanks, Yangyu Chen