Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1764062rdb; Sat, 3 Feb 2024 23:49:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhaGHYkM3wOQEm19wyC+4yiNoO51jq968btShbocBAO5LsQsj7iTMfD3kwgcOnzzuFqrse X-Received: by 2002:aa7:d8d3:0:b0:560:24e:3ca2 with SMTP id k19-20020aa7d8d3000000b00560024e3ca2mr2501620eds.4.1707032997701; Sat, 03 Feb 2024 23:49:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707032997; cv=pass; d=google.com; s=arc-20160816; b=upDTA1tQFpCOf9gvZN2vi0ZZDKdcnP+3pCNvr0/2T2RcB6SMKP3Mlc0nbf5GAT8AxW cnIPrrxBlM4AzBBt7kUSzK4A4nJt3rHJ6ZKX/nzd1bdlyTkigGAxLxnFMXWglxOUmkXO 7WDOQKljz+XFISB9LhHbevHKxPq0E/6ibfow3q1NNGU2qkzYzfSoaYzzHnYjyxgPDFRP Slb7PpPz8xf2zEsAKU60VCrPqthqELQ+OOkelJEn73VAH1gtTW0pq7rt4ChRWjx/ax63 5SNDT+nU7KfsmNZMl9/if0lwFyfvISTRf6UX2vDozSy10da2s1ChOt/+YUyzTQVcPirg LFUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Pw1ACnPqJMZtyjde+3oCFmYrpdluKa1XcqRYJR+NNmM=; fh=ZN3pMHHyvN+eDOj3eWRsJnxGbuhjqEtpN3d8cO25+RE=; b=yMhc/MITB3dhRdwW0uKUMZwdX54Tg/0ty27mGixXS+cOWCkHtVdQ28VntPzbSrSV0t HCyRv3JEp2joMpnPjvw1qTmtHrkpZcAcCBs+RmNrYQR+S5bzU6xusdT4ydS98XPnVctz XO382GuKv9ARV4YpMeKCl4su3ApckSGemEdVIhNR0/D02/yJVGeaqDIC3XbjzP7pKboo FQBRWVFbAC59YZjwZi/WlBXszdeJ8iVyNPq0jr8TtuzCMb9YL/o6EAiHeMQQFiP/UVES puCa6fsLo9TUV1PThj9t2pZc60Esr16lMrlc2lyodFdUlVxZIPYk1R8ghKnJq+2KhyRV Hc9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-51500-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51500-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCWVhQShQcDrpa0mQ4JgU5mLfiMC7+32tpqc7YNDIzfPWHfeSRJ1ltd9V0UDxFxTMr040R+/CWKh5O3Pc2xqTA0E6ZlEHD4JVA0NJuj+qA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w13-20020aa7cb4d000000b0055f8efcea96si2509821edt.499.2024.02.03.23.49.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 23:49:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51500-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-51500-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51500-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 726891F227E5 for ; Sun, 4 Feb 2024 07:49:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCDC81118D; Sun, 4 Feb 2024 07:49:40 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA700DDCD for ; Sun, 4 Feb 2024 07:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032980; cv=none; b=Lu+E7P601pC3fobjuBa87UCao9herzYhq/9w0ArF+AKaNVc7zyuw30SG2CD5mPFNmWuTC0EdMJUGdLSNs6hHU/8mIH5YLfa6QSeyPEXmNvsvHjL+FfYIk37zRiY3IyEOer0LLcXx28GS66gUVK88W18CVYBJI/nwsRmp4K8K32c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707032980; c=relaxed/simple; bh=sOc43RaryoxfnEBRW0kyQI6mjTChmUA4iigSXM/y/A4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UlmSknwP1Qj0Gl/SZjmuyRF4ojdQiHDwtWA6Mt3yBCgsMWk5kMFn/oFatD1PURET7ZBnOQwRSPp0ohVqWYyK2NYPEvEig3eXzQ8uZPhOvCbq/FYj+l3cfqawIJ+Nl7pNoMu1RGAGywIy65O+mSe+9FpAlIr6gMTUyZOc3JceDO4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TSM7y6sd4z1xnC4; Sun, 4 Feb 2024 15:48:30 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id 1FE591404D8; Sun, 4 Feb 2024 15:49:35 +0800 (CST) Received: from localhost.localdomain (10.50.165.33) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 4 Feb 2024 15:49:34 +0800 From: Yicong Yang To: , , , , , CC: , , , Subject: [PATCH 1/7] drivers/perf: hisi_pcie: Introduce hisi_pcie_pmu_get_filter() Date: Sun, 4 Feb 2024 15:45:21 +0800 Message-ID: <20240204074527.47110-2-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20240204074527.47110-1-yangyicong@huawei.com> References: <20240204074527.47110-1-yangyicong@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500009.china.huawei.com (7.192.105.203) From: Yicong Yang Factor out retrieving of the register value for the corresponding event from hisi_pcie_config_filter() into a new function hisi_pcie_pmu_get_filter() allowing future reuse. Signed-off-by: Yicong Yang --- drivers/perf/hisilicon/hisi_pcie_pmu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c index b90ba8aca3fa..11a819cd07f2 100644 --- a/drivers/perf/hisilicon/hisi_pcie_pmu.c +++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c @@ -216,10 +216,8 @@ static void hisi_pcie_pmu_writeq(struct hisi_pcie_pmu *pcie_pmu, u32 reg_offset, writeq_relaxed(val, pcie_pmu->base + offset); } -static void hisi_pcie_pmu_config_filter(struct perf_event *event) +static u64 hisi_pcie_pmu_get_filter(struct perf_event *event) { - struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu); - struct hw_perf_event *hwc = &event->hw; u64 port, trig_len, thr_len, len_mode; u64 reg = HISI_PCIE_INIT_SET; @@ -256,6 +254,15 @@ static void hisi_pcie_pmu_config_filter(struct perf_event *event) else reg |= FIELD_PREP(HISI_PCIE_LEN_M, HISI_PCIE_LEN_M_DEFAULT); + return reg; +} + +static void hisi_pcie_pmu_config_filter(struct perf_event *event) +{ + struct hisi_pcie_pmu *pcie_pmu = to_pcie_pmu(event->pmu); + struct hw_perf_event *hwc = &event->hw; + u64 reg = hisi_pcie_pmu_get_filter(event); + hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_EVENT_CTRL, hwc->idx, reg); } -- 2.24.0