From patchwork Thu Mar 21 02:07:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Sodagudi X-Patchwork-Id: 10862799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0B67139A for ; Thu, 21 Mar 2019 02:08:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ED8129F7B for ; Thu, 21 Mar 2019 02:08:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82E5C29F8F; Thu, 21 Mar 2019 02:08:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2C97E29F7B for ; Thu, 21 Mar 2019 02:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=V4V0gqf0pPH8ELoadQAGpsggY3xnXu9BqUexAHY+qBI=; b=SzA +UrU0f19jy9f9NIGyAyh7ArOTeMUZS0V+BOKUYt67A4y+OHrTx1YhqMaKnVpNoczphpZZGifpqKaw 10y5o/Av0Hht+bnaoMaouqbMAsdIGf9SjNk/9WJM0CGuxzxCxcH4+UoSHTdz3PdwdRhFS7SInNpCI vDAGH5NrX1F8hQfTT7y9GozA//6ZN6WsQ/gZdMAi72cuMo6UlLmn+IJO5RIgEZWeBVYKEZ9Yq6VFI nPKd1DSMYS35ATDCvlLDIhA7drih81Sg5VFmN/y8Tur29JwyiBvjf95EBfPnkv/t8EvUyeKsFQB7A 4yxT6QL0Plr4Y1ZnnWm/E1QsA7lrS0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6n7f-0008Ch-VF; Thu, 21 Mar 2019 02:07:59 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6n7d-0008CO-DX for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2019 02:07:58 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 432C0609F3; Thu, 21 Mar 2019 02:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553134076; bh=CIyV9GkM+pGMGDsQ75GXvsFmmEVC/LMlMKD9BslShRY=; h=From:To:Cc:Subject:Date:From; b=fspeLboBfhYXVfpof/NVs/Z/gW3/7fEpvvFIDLkio84J/r/V4MYSC2v7xmFq4TZWs dkKqRg/QXU76Gs7tSOla6/gWmGD/O9lRGuIVinAKhyzbciAA9lH8P6eMhUrH8Cs0zy BmGzkHdHQz38TDK+3VsBCKu9Mz4L9QjUlAYrnDWc= Received: from psodagud-linux1.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: psodagud@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id CA84F60159; Thu, 21 Mar 2019 02:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1553134074; bh=CIyV9GkM+pGMGDsQ75GXvsFmmEVC/LMlMKD9BslShRY=; h=From:To:Cc:Subject:Date:From; b=IuAAXE1/o4iFStJWbYp0CfjonnFauUisAl4SWw91rctYcfGSmP39QtDThShodFOAs kOqTyYeSD6PqRBXejLsgidJvh4jymIuzk7uebP0euyMzIBXVXrCzn4bQWkWbYGKWwf S39fIQAaF3V5E0bIeWzS9u8C6s+C/bfEZiKfWw9U= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CA84F60159 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=psodagud@codeaurora.org From: Prasad Sodagudi To: will.deacon@arm.com, mingo@redhat.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, peterz@infradead.org Subject: [PATCH] perf: Change PMCR write to read-modify-write Date: Wed, 20 Mar 2019 19:07:46 -0700 Message-Id: <1553134066-20272-1-git-send-email-psodagud@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190320_190757_473837_4D2A31AF X-CRM114-Status: GOOD ( 11.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: psodagud@codeaurora.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Preserves the bitfields of PMCR_EL0(AArch64) during PMU reset. Reset routine should write a 1 to PMCR.C and PMCR.P fields only to reset the counters. Other fields should not be changed as they could be set before PMU initialization and their value must be preserved even after reset. Signed-off-by: Prasad Sodagudi --- arch/arm64/kernel/perf_event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 4addb38..0c1afdd 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -868,8 +868,8 @@ static void armv8pmu_reset(void *info) * Initialize & Reset PMNC. Request overflow interrupt for * 64 bit cycle counter but cheat in armv8pmu_write_counter(). */ - armv8pmu_pmcr_write(ARMV8_PMU_PMCR_P | ARMV8_PMU_PMCR_C | - ARMV8_PMU_PMCR_LC); + armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMU_PMCR_P | + ARMV8_PMU_PMCR_C | ARMV8_PMU_PMCR_LC); } static int __armv8_pmuv3_map_event(struct perf_event *event,