Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3458209ybi; Sun, 26 May 2019 23:59:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHwHk9R9rK3EfIpaKS2xBPJcHblpK/3HAFJp4cZhFhqp+3fjr43v087KcEVEnaBTe7bJqm X-Received: by 2002:a17:90a:f98d:: with SMTP id cq13mr29315161pjb.41.1558940399032; Sun, 26 May 2019 23:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558940399; cv=none; d=google.com; s=arc-20160816; b=mZ4OnB4r9wVOpfkIrEDSGKwPIAgZUGLzz6980NdmVd9AA/XHjQpZpQn/hK4nfXLFzp weJQqscYGEtMSrqlCwbVLS6PZGBATXnJBKvXepLL7zqqIEqreZfOGhJtEMXv6Ol+wiRK 754jf5Y88kvFBDQHhPP+9XQXzg7fS1X3C/NgI0n1NQHjeQNua+75imKm8e8iQfaqXx0N eFcOTGmrvzJnf2GfbGbohY9hOeZlY3tYI27kOidzSaTqCEQ+Ybpf9j17sc8+19kCvr9O H8t9nNhTc7OcCq2SvtMucXIR7YIAbcIa7goruw4hz9jxpkDkVxWDJDZCQh9EFSmqSCxb U0JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from; bh=v7MO7qBaoRmMJ1NHP3QxgI87uueLfbKxw4NY3wyjBUM=; b=zG8h0T8fToHxKceKsPvqyGhpy5lzr6ql0G2/MgRA0U9cHhAPDvzCZX1mRPVKirsXVa KFaXE7Oc3kp3+quOkp8vyR3t4sxlB3Bwk+jpw7OupZ3G3Fgidvh6LsxardONbMuPAwJQ QXnRuiFzyAObTUhPtBbpE5v0HCARVR9fTlpq2CjZzxczXL9UOXrtBPOa9BtjHDFWIqSR 27trylmINy+NT9w/fb0teieDJvQyvVy0zLWlPNCiw7hkDknjWWDX5PBYikqAs3wfww8R DoyOoxjvJRdA9rbP+Df01H0hVUDQrL5gpLvtPOeHDUWP/oOiljMmz4Sqt0sj+r3i5NyE HylQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n88si16592132pjc.7.2019.05.26.23.59.44; Sun, 26 May 2019 23:59:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726454AbfE0G6i (ORCPT + 99 others); Mon, 27 May 2019 02:58:38 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:32872 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbfE0G6c (ORCPT ); Mon, 27 May 2019 02:58:32 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07612007|-1;CH=green;DM=CONTINUE|CONTINUE|true|0.136347-0.00582676-0.857826;FP=0|0|0|0|0|-1|-1|-1;HT=e01a16378;MF=han_mao@c-sky.com;NM=1;PH=DS;RN=5;RT=5;SR=0;TI=SMTPD_---.Edg12hD_1558940309; Received: from localhost(mailfrom:han_mao@c-sky.com fp:SMTPD_---.Edg12hD_1558940309) by smtp.aliyun-inc.com(10.147.41.120); Mon, 27 May 2019 14:58:29 +0800 From: Mao Han To: linux-kernel@vger.kernel.org Cc: Guo Ren , Mao Han , Guo Ren , linux-csky@vger.kernel.org Subject: [PATCH V2 5/5] csky: Fixup some error count in 810 & 860. Date: Mon, 27 May 2019 14:57:21 +0800 Message-Id: <2dfbabdcc60d4b5fa6a1595a1ca64102cfe06f05.1558939831.git.han_mao@c-sky.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guo Ren ck810 pmu only support event with index 0-8 and 0xd; ck860 only support event 1~4, 0xa~0x1b. So do not register unsupport event to hardware cache event, which may leader to unknown behavior. Signed-off-by: Guo Ren Signed-off-by: Mao Han CC: Guo Ren CC: linux-csky@vger.kernel.org --- arch/csky/kernel/perf_event.c | 60 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/arch/csky/kernel/perf_event.c b/arch/csky/kernel/perf_event.c index a6a1582..bb5033f 100644 --- a/arch/csky/kernel/perf_event.c +++ b/arch/csky/kernel/perf_event.c @@ -735,6 +735,20 @@ static const int csky_pmu_hw_map[PERF_COUNT_HW_MAX] = { #define CACHE_OP_UNSUPPORTED 0xffff static const int csky_pmu_cache_map[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { [C(L1D)] = { +#ifdef CONFIG_CPU_CK810 + [C(OP_READ)] = { + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, + }, + [C(OP_WRITE)] = { + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, + }, + [C(OP_PREFETCH)] = { + [C(RESULT_ACCESS)] = 0x5, + [C(RESULT_MISS)] = 0x6, + }, +#else [C(OP_READ)] = { [C(RESULT_ACCESS)] = 0x14, [C(RESULT_MISS)] = 0x15, @@ -744,9 +758,10 @@ static const int csky_pmu_cache_map[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { [C(RESULT_MISS)] = 0x17, }, [C(OP_PREFETCH)] = { - [C(RESULT_ACCESS)] = 0x5, - [C(RESULT_MISS)] = 0x6, + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, }, +#endif }, [C(L1I)] = { [C(OP_READ)] = { @@ -763,6 +778,20 @@ static const int csky_pmu_cache_map[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { }, }, [C(LL)] = { +#ifdef CONFIG_CPU_CK810 + [C(OP_READ)] = { + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, + }, + [C(OP_WRITE)] = { + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, + }, + [C(OP_PREFETCH)] = { + [C(RESULT_ACCESS)] = 0x7, + [C(RESULT_MISS)] = 0x8, + }, +#else [C(OP_READ)] = { [C(RESULT_ACCESS)] = 0x18, [C(RESULT_MISS)] = 0x19, @@ -772,29 +801,48 @@ static const int csky_pmu_cache_map[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { [C(RESULT_MISS)] = 0x1b, }, [C(OP_PREFETCH)] = { - [C(RESULT_ACCESS)] = 0x7, - [C(RESULT_MISS)] = 0x8, + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, }, +#endif }, [C(DTLB)] = { +#ifdef CONFIG_CPU_CK810 [C(OP_READ)] = { - [C(RESULT_ACCESS)] = 0x5, - [C(RESULT_MISS)] = 0xb, + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, }, [C(OP_WRITE)] = { [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, }, +#else + [C(OP_READ)] = { + [C(RESULT_ACCESS)] = 0x14, + [C(RESULT_MISS)] = 0xb, + }, + [C(OP_WRITE)] = { + [C(RESULT_ACCESS)] = 0x16, + [C(RESULT_MISS)] = 0xb, + }, +#endif [C(OP_PREFETCH)] = { [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, }, }, [C(ITLB)] = { +#ifdef CONFIG_CPU_CK810 + [C(OP_READ)] = { + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, + }, +#else [C(OP_READ)] = { [C(RESULT_ACCESS)] = 0x3, [C(RESULT_MISS)] = 0xa, }, +#endif [C(OP_WRITE)] = { [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, -- 2.7.4