Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3794033ybi; Sun, 2 Jun 2019 23:49:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaNjX7AanaLN+dmS4kcShJhKIGwp8Ep+ka4zUh5decHT5TOZsjxUSQU0xCj91+u+Aa3zMG X-Received: by 2002:a17:902:8c94:: with SMTP id t20mr26844164plo.141.1559544558439; Sun, 02 Jun 2019 23:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559544558; cv=none; d=google.com; s=arc-20160816; b=fEQhhc3vgNEQtggY6v4x9k+w6l1ljGSEO91YZm0OQmKtGzPTbEb7LDE4k8EE6dKmLW AVzuICUi7E7bz26PHWZTSPY4BBTPwtGm64nkIgGsOSahLLGsDGgokYQn6h4LARzidol0 NpkJHT/U3DamnvWyV5YnBPNALmFCfoSYv2n+AWsdZk+nTE2aDc7GPLTD6zVuO1SfLnOj KFH3lCJYsz0rg2YgM+HDPdhmCV0+3l9EEEI9R4v9LYryIUuEHbjEgc1wghZJJQEvioCV 5aJtGijaSylGTstcZdBpW4xYXhVFHJMfADFqJXjkZ7XQEzentk9rG9FqTXsHTviTvD3M mh1w== 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=0S2+pEq/uIa3HJu4tSwhnZqsWngQpNFkqFpILbVWlb8=; b=y1uMTxYiDQVvbaqxRTyFEYRVv1U70CRR4M80RmSN5ZCFbHrM6s/evMRS/K8uFvIeIh QvJt7FlmLY8Hx3N1CuNxF/REZc1o6v5ZtYJeezc4Y8U5BoAa6QVJ5DAargSbasEksrIH r5ToIr8nP6h305TXR5ghsCnkg5NjGdHkfR15AyE60S9/kX+9d+Sk+w9Dnu0PHlJhG6vJ N/DHR+JVc4X0T92ZOnZqSVcE+uLaTWQIsyaOrsN8OjOMxjlwc/cFI/2wfakcR9PlXfeo OHk4K4vgq5/td23GwlGNdQK2qslSCMhPWTo/bWgTN8DU4+zi2t2UmUfV/DGE1ZVJMZmq TkSQ== 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 w184si20886625pfw.271.2019.06.02.23.49.02; Sun, 02 Jun 2019 23:49:18 -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 S1727331AbfFCGro (ORCPT + 99 others); Mon, 3 Jun 2019 02:47:44 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:37512 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727269AbfFCGrl (ORCPT ); Mon, 3 Jun 2019 02:47:41 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07611708|-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_---.EglLA8M_1559544454; Received: from localhost(mailfrom:han_mao@c-sky.com fp:SMTPD_---.EglLA8M_1559544454) by smtp.aliyun-inc.com(10.147.40.44); Mon, 03 Jun 2019 14:47:34 +0800 From: Mao Han To: linux-kernel@vger.kernel.org Cc: Guo Ren , Mao Han , Guo Ren , linux-csky@vger.kernel.org Subject: [PATCH V3 5/6] csky: Fixup some error count in 810 & 860. Date: Mon, 3 Jun 2019 14:46:24 +0800 Message-Id: <2263cf331f1a1c6c8afe82134503f41b4477e6ef.1559544301.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 0eb630e..de95005 100644 --- a/arch/csky/kernel/perf_event.c +++ b/arch/csky/kernel/perf_event.c @@ -736,6 +736,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, @@ -745,9 +759,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)] = { @@ -764,6 +779,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, @@ -773,29 +802,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