Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp2814784rwo; Mon, 24 Jul 2023 01:26:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlGg5k+OLLpLZmFd/NDGayTEF5yaClcBPzcW1FAK2u/6KDxzqpH3K2s3tTwShrC0hVLMeUVa X-Received: by 2002:a17:902:ecc3:b0:1bb:141c:3034 with SMTP id a3-20020a170902ecc300b001bb141c3034mr10096747plh.12.1690187168571; Mon, 24 Jul 2023 01:26:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690187168; cv=none; d=google.com; s=arc-20160816; b=T9YKeNDbWCQsNkvlETh0ZwHI4tRlsluNNOa/G6z8dy6ta+gcFPgccq7JTWJaDZR0s2 DZZwb2q6CjlFD9dlFQCqYCkediH4gzKiK2gqdV4+YRi0LKZasaULht7vjGSQQ3dqCwnK yHOpT4uN7NpekV5E4A1AdsKc9wD+jkhShv0HBrCtYVeRIg4Fk6pJrzLSTbp0rDl7ZgnT wz2BSwQ+AiCQfIxdiq8GjbREJuzChii6cKESrjAy5xwZaORhPbr6BwdJc0xHm6QvYpwI gJuvsuZL6wlT8K2vrmt9ZM2Keb1xzo7c15gCfPc0WKftytehrDVwcLcsx0xJIHGz6CnY a2GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=mnjnEM1q4FaIbu0XLbBMFL7FTXZt/Gd9eRGXpPcG/Vw=; fh=5hntChhDNu16mbFSjUog2B39aaP1oke98PT3hG+wrhQ=; b=ernlhJnHy22yfcQmUycf2q9eX6WC/+0fMFG39VzzjfPxiSU/hlcDfcELsOrQ4HRPfD WQJWcO+moeelOzw5HNwuL6n4zagj1n94g/CRg4yTGJjPY0TpvTAmKjXpmun8TcxHQ/aU 7SDcx0E+hs5JZcetxitsjrzGa2KVTdstZS1JrJiwM5e6tQcJa6W1XqznTZ125cxYUH5q HRabzhMG1oo0z3gLwhep/3vUbu8Zl3g3b7Xrzj/9nZ3O8njoQrKttAy8HPxmbQQNW+/S xNjDLMcGnSFRL29mxP8BrNuitfVhchneQp2sDROe6hdfjk0UrXFpT7X/T7Jybm/ByHZP DYlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=bZQtBrhM; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a1709027e8200b001bb9370760fsi3483221pla.90.2023.07.24.01.25.56; Mon, 24 Jul 2023 01:26:08 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=bZQtBrhM; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231331AbjGXIIg (ORCPT + 99 others); Mon, 24 Jul 2023 04:08:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230451AbjGXIIa (ORCPT ); Mon, 24 Jul 2023 04:08:30 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58BEAFE; Mon, 24 Jul 2023 01:08:29 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1bb84194bf3so7976365ad.3; Mon, 24 Jul 2023 01:08:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690186108; x=1690790908; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mnjnEM1q4FaIbu0XLbBMFL7FTXZt/Gd9eRGXpPcG/Vw=; b=bZQtBrhMr0cUsQ384TewyyuQjYBuSXTgIm7TDluHBqi9F/9gJu1SyBJBqFgfePUGBY oYups6EcndxOA4vxt11LpADG2+NP81YGpJoRJfqR07iUlcOPJBiOepJAHNnfL4kLIkbv F69gSXIbnBnGWEXwt+o2yFLnKXL/Mdu5/fFetjxGbKhPR4Srfr9LtFpI4zSur3R/f4r5 jOil2c8bJG0y4HyY3TFQnS0GAcJu6eXcfSEY8icxdMEEfyuCXbYTt8ux2mZfs6xVkNRY idVmoPyyrOYk1sQ7QeSviuLvQPgVKvC1M/WfBpNtU+srFTHvXfExJ/ZH3BT1kmLwGaD6 L9PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690186108; x=1690790908; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mnjnEM1q4FaIbu0XLbBMFL7FTXZt/Gd9eRGXpPcG/Vw=; b=L0KhHoI9uFWA2Pmt7pL4b7VOJHB6P5tfKjpOGrIHM9UE0TZ0kK3r9EPdhKLTB+Cuny oNAEA0pvmC3jbtACZVeLi9QMfC+S1F5B1inELk/p5CE9l5+OpUo87WB4gB9fGHoeD7fT uKCQn8w4Jh8RGvrqGJQFV47emzr3i/K0aY/TXKLm8lh4jDraGKmywnax6DHJYYtS1+c6 wWgNZUr9LdETaVLsky9tZCl1npgkl5s0QJ69I6rvEC6p/h16sQTaVKRqcihtdKQQcJNz 2y9X3jU5cRgfb2VmYKkz+F7OMkFP5S1ZncAclrVt2zzYjUWA3BWtX8HysvD863zMDfbH ZdHQ== X-Gm-Message-State: ABy/qLbNDLQj+RuJSYfrYRvkx1x4Lf0iCAX1Nias/UBwBdsPYv9oHKN/ 0xg6QfbrgdPIxGIXX3/2yJv1aX2lkwI= X-Received: by 2002:a17:902:c103:b0:1b5:561a:5ca9 with SMTP id 3-20020a170902c10300b001b5561a5ca9mr7113521pli.50.1690186108617; Mon, 24 Jul 2023 01:08:28 -0700 (PDT) Received: from octofox.hsd1.ca.comcast.net ([2601:646:a201:19d0:9f1d:4d2f:6739:324d]) by smtp.gmail.com with ESMTPSA id x14-20020a170902ec8e00b001b8622c1ad2sm8159957plg.130.2023.07.24.01.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 01:08:28 -0700 (PDT) From: Max Filippov To: linux-kernel@vger.kernel.org Cc: Chris Zankel , Max Filippov , stable@vger.kernel.org Subject: [PATCH] xtensa: PMU: fix base address for the newer hardware Date: Mon, 24 Jul 2023 01:08:19 -0700 Message-Id: <20230724080819.2305666-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, FROM_LOCAL_NOVOWEL,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 With introduction of ERI access control in RG.0 base address of the PMU unit registers has changed. Add support for the new PMU configuration. Cc: stable@vger.kernel.org Signed-off-by: Max Filippov --- arch/xtensa/include/asm/core.h | 9 +++++++++ arch/xtensa/kernel/perf_event.c | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/arch/xtensa/include/asm/core.h b/arch/xtensa/include/asm/core.h index 0e1bb6f019d6..3f5ffae89b58 100644 --- a/arch/xtensa/include/asm/core.h +++ b/arch/xtensa/include/asm/core.h @@ -52,4 +52,13 @@ #define XTENSA_STACK_ALIGNMENT 16 #endif +#ifndef XCHAL_HW_MIN_VERSION +#if defined(XCHAL_HW_MIN_VERSION_MAJOR) && defined(XCHAL_HW_MIN_VERSION_MINOR) +#define XCHAL_HW_MIN_VERSION (XCHAL_HW_MIN_VERSION_MAJOR * 100 + \ + XCHAL_HW_MIN_VERSION_MINOR) +#else +#define XCHAL_HW_MIN_VERSION 0 +#endif +#endif + #endif diff --git a/arch/xtensa/kernel/perf_event.c b/arch/xtensa/kernel/perf_event.c index a0d05c8598d0..183618090d05 100644 --- a/arch/xtensa/kernel/perf_event.c +++ b/arch/xtensa/kernel/perf_event.c @@ -13,17 +13,26 @@ #include #include +#include #include #include +#define XTENSA_HWVERSION_RG_2015_0 260000 + +#if XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RG_2015_0 +#define XTENSA_PMU_ERI_BASE 0x00101000 +#else +#define XTENSA_PMU_ERI_BASE 0x00001000 +#endif + /* Global control/status for all perf counters */ -#define XTENSA_PMU_PMG 0x1000 +#define XTENSA_PMU_PMG XTENSA_PMU_ERI_BASE /* Perf counter values */ -#define XTENSA_PMU_PM(i) (0x1080 + (i) * 4) +#define XTENSA_PMU_PM(i) (XTENSA_PMU_ERI_BASE + 0x80 + (i) * 4) /* Perf counter control registers */ -#define XTENSA_PMU_PMCTRL(i) (0x1100 + (i) * 4) +#define XTENSA_PMU_PMCTRL(i) (XTENSA_PMU_ERI_BASE + 0x100 + (i) * 4) /* Perf counter status registers */ -#define XTENSA_PMU_PMSTAT(i) (0x1180 + (i) * 4) +#define XTENSA_PMU_PMSTAT(i) (XTENSA_PMU_ERI_BASE + 0x180 + (i) * 4) #define XTENSA_PMU_PMG_PMEN 0x1 -- 2.30.2