Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6463143rwb; Mon, 5 Dec 2022 12:44:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf43QOD/lFM9/ulHjYwYvQhn3wPbNDgRfMpdQeEAdtpNqH1USpF7DfgMME+l5zXu6lPlM201 X-Received: by 2002:aa7:d0cc:0:b0:469:d36e:3213 with SMTP id u12-20020aa7d0cc000000b00469d36e3213mr24928042edo.206.1670273047593; Mon, 05 Dec 2022 12:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670273047; cv=none; d=google.com; s=arc-20160816; b=IXkVlvOxVyu8PXoFBlzKML4PyIbdANk1ckwgNSFbZtWv7xZcX3jDnv51uHOv/qOODL bC6KkFiSr//r0tDHmnBmDOwu67MC5chzRX1oKDng+V7AbDT71wju3s0MOqeMC14qyvK5 LO3bAzxjXv/IGm6+ZyYa0zm2Z8r+pTy+7eTSm7x8q8ypWvQR542ZbwVgtvYAS/EJzD7E hz7wOvA8c+mer5+I0/gZvbgNlFjgw5LeUjzBFKgIksfA2hmsnq3laJB2v0ZKZo86X7MP exkDbI0u1O/HV+ygnwTFXC0YkWW2zA74SxrZGdzw0vzgH+BhW+rYNVUnLTSyXsY7fRmw RMzQ== 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; bh=1VNOOB0OGpays3G5OnI7GUZCtjq/fQNOz+9yV5VHCZU=; b=ZOQLB0pg53YCIIgIPLb8lxVLUGdwrrpjToTw12WH/zorkaRM6kpq8pw2vc1uHqQ6v9 8LJrFTRUNIwwHz6GOqSSEEwMhLHTiy3ezapiNrnAVhEP1m0QurcMoA8xFOX1K0yAN2Hz m/Nl3WtfS4BGeoaob5ILm1Nm5AWxYzkxKzSTxNdRqCBGZFkzR/b1t5t6M3qpO7mKtj3N gQP+IlznWql3vO8kwsgpJcqbbCydVJ2GKmvIOcOOSODrWfF3avKIrV8HlaPymbuxf3F9 aKdnqTCicK2Fj/D7FrpuUZOi2GB5nLUv+i42kPxlS8SoDUSKhz6ZGlwlovdEu+7oM5eh H57g== 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ee14-20020a056402290e00b00469058297afsi355617edb.92.2022.12.05.12.43.49; Mon, 05 Dec 2022 12:44:07 -0800 (PST) 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235208AbiLETtn (ORCPT + 80 others); Mon, 5 Dec 2022 14:49:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235104AbiLETtL (ORCPT ); Mon, 5 Dec 2022 14:49:11 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7825C2AC47 for ; Mon, 5 Dec 2022 11:46:25 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 92279D6E; Mon, 5 Dec 2022 11:46:26 -0800 (PST) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7CF583F71A; Mon, 5 Dec 2022 11:46:16 -0800 (PST) From: Robin Murphy To: will@kernel.org, mark.rutland@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] perf/arm-cmn: Reset DTM_PMU_CONFIG at probe Date: Mon, 5 Dec 2022 19:46:13 +0000 Message-Id: X-Mailer: git-send-email 2.36.1.dirty MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 Although we treat the DTM counters as free-running such that we're not too concerned about the initial DTM state, it's possible for a previous user to have left DTM counters enabled and paired with DTC counters. Thus if the first events are scheduled using some, but not all, DTMs, the as-yet-unused ones could end up adding spurious increments to the event counts at the DTC. Make sure we sync our initial DTM_PMU_CONFIG state to all the DTMs at probe time to avoid that possibility. Signed-off-by: Robin Murphy --- drivers/perf/arm-cmn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index 0b2df72cee9f..81b0dfd511aa 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -1862,6 +1862,7 @@ static void arm_cmn_init_dtm(struct arm_cmn_dtm *dtm, struct arm_cmn_node *xp, i dtm->base = xp->pmu_base + CMN_DTM_OFFSET(idx); dtm->pmu_config_low = CMN_DTM_PMU_CONFIG_PMU_EN; + writeq_relaxed(dtm->pmu_config_low, dtm->base + CMN_DTM_PMU_CONFIG); for (i = 0; i < 4; i++) { dtm->wp_event[i] = -1; writeq_relaxed(0, dtm->base + CMN_DTM_WPn_MASK(i)); -- 2.36.1.dirty