Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp873667rdb; Fri, 23 Feb 2024 02:52:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUD4lsh79dh4PUHgYIbQRIm+JbXMrQRH4MYuVHfH2fepXL4FRQsdZoTx+weWDLY9D2HBN+bIElagdvgOfR9IGYZGyPA5Rny0H55dH1MAw== X-Google-Smtp-Source: AGHT+IHk0gFPIwyxm6qDYHWQozkIbZEg5q/LUz8vq/Pz30BuJjQ/5JmRcWMG3v+qMcDeg16CiF0e X-Received: by 2002:a05:6a20:66a9:b0:19b:56f0:c880 with SMTP id o41-20020a056a2066a900b0019b56f0c880mr1226355pzh.39.1708685546976; Fri, 23 Feb 2024 02:52:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708685546; cv=pass; d=google.com; s=arc-20160816; b=x2x1xVuCS6tx07Qe1TSqOWwHNn1hdWL6nlHytBTqCf2cbTJqO+FpizYuZrQjKUQBA7 MGZ3BhvC+GmCgRusNL43c6DddJDxtwcCGPreduqoaCEcPuYnk+VyBA9ppElQq3BxwGE4 vt+0+2Phvg3bpCDrqpXcceQN5U3cVmIuwoR7v39h/WulrfzZbvEc70qSEB6gTVH07ySy oOGAlxymDr5aEDncLbi3OmODcKwB4d9+9fiKCyPP/ISpZzitKa8zgVhKG9zN2CBJrYvd g6Xa7qoFd/Eu3YCF/xsGKfomimnsK1VszIdtEqtNApGlPoFbJtiMyqKquUh1sYZZMEO6 eWVg== 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=+gDrgGwdmEHIpshF7X4SrsOjxHc8YHu/MWs6E52hbRY=; fh=jersQh8TE0KFZCA3V8poDAKHKQ+owT+1iuzuvpXietI=; b=y+tRhprZjNF6c6rzSE/78BPvSCVNUkhB28Mv/NW09pow8+9ESSH2M5j2XdZFPu17BM EWZ4veZRB/LQVlxGk1jC4oPC7O7pqAWQIxDSPZgUpUiWKOpZTGch2zqtQMpMkgIZRSOt mqjcBUL0WkEosBbtEzeLYBwe8pYe3X4m9zFmI4unYW7zWbRHh9Jk9hGrgZxGq0PwITWq Hjj2mo5PKo7ewPjf4v/L0EQuiNT2CzEBPvHNGwPzZ1yUHY351WkSX4CiqxjMALzdxwzI 98up1YgKrn7YzLYc9amWBoOrfLixL3PAu/GKVzSkEBRyRb6GqvFwG/GUjpOKXNOL9dPs Gz0g==; 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-78142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78142-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lb24-20020a056a004f1800b006e4d42c205dsi2175257pfb.374.2024.02.23.02.52.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 02:52:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; 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-78142-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78142-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 9D3B2B21DB5 for ; Fri, 23 Feb 2024 10:38:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCEF365189; Fri, 23 Feb 2024 10:38:23 +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 9EC005DF25 for ; Fri, 23 Feb 2024 10:38:21 +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=1708684703; cv=none; b=fREwX9CJngV7uWNoATIYGIkKxM6cSkwP9LPKCvPbfxk/1lpCq44+p0asyCI2638LKlpksFUW4wfuXBpmfEJmFN5cJhWORGw6LQKGqADfKLw8oopE/oaflaGSvYNIRAjukU2WTL/k2fz2z37rlTzxT9uI2ekfxdRN30Svng5OUOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708684703; c=relaxed/simple; bh=2aGsE8mFtWNm5k18rp6bVdMp20XjRknEP+SUteZ5vfo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ry3Ni0NF4ofcH09oThhpOVnMWi6uZHHVACc7vnrcR2vlpcdNc5cRD2AAGabv4YaE6UYjlIluGM+ymBVWMKgcxPHsaDO7jh9fGRnfNorTQOtzzEcdOJZ0ijOlAw16zREPQRlvBqaYG5hvfPYIIW6ZwAqcjQlNKcsfgCxGDbfXMZo= 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.88.214]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Th5yc31stz2BdPS; Fri, 23 Feb 2024 18:36:08 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id 1385C1A016B; Fri, 23 Feb 2024 18:38:19 +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_256_GCM_SHA384) id 15.1.2507.35; Fri, 23 Feb 2024 18:38:18 +0800 From: Yicong Yang To: , , , , , CC: , , , Subject: [PATCH v2 2/8] drivers/perf: hisi_pcie: Introduce hisi_pcie_pmu_get_event_ctrl_val() Date: Fri, 23 Feb 2024 18:33:53 +0800 Message-ID: <20240223103359.18669-3-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20240223103359.18669-1-yangyicong@huawei.com> References: <20240223103359.18669-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: dggems705-chm.china.huawei.com (10.3.19.182) 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_event_ctrl() into a new function hisi_pcie_pmu_get_event_ctrl_val() allowing future reuse. Signed-off-by: Yicong Yang Reviewed-by: Jonathan Cameron --- 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 9760ddde46fd..2468cf3b007c 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_event_ctrl(struct perf_event *event) +static u64 hisi_pcie_pmu_get_event_ctrl_val(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_event_ctrl(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_event_ctrl(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_event_ctrl_val(event); + hisi_pcie_pmu_writeq(pcie_pmu, HISI_PCIE_EVENT_CTRL, hwc->idx, reg); } -- 2.24.0