Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2253184rdb; Wed, 21 Feb 2024 01:39:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXNoOxOMKizORI7NMYBCFJ+JFnZnOQGs3sWIsHO/O3XK214OD6ADzR56RA7yFEMEt33RYxGoD9aEEQgqHyzUEZvZsljpBCx1YvHl8RBWQ== X-Google-Smtp-Source: AGHT+IF9cyS7WbJam7Bos9UemZmLzGJpjUqk1iqnR7i2OaxlpgM0K30c/yNvJ3KbxpiTwQYRHABW X-Received: by 2002:a05:620a:a8a:b0:787:4e73:1391 with SMTP id v10-20020a05620a0a8a00b007874e731391mr10405741qkg.53.1708508370308; Wed, 21 Feb 2024 01:39:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708508370; cv=pass; d=google.com; s=arc-20160816; b=k+XOJ7ZrQVkES1trzdrL9sI++jCjzOmJeb3n4n99UBy37hrgOZuhYtWGqRpFtC7ABL bvQx8P76ZjT6v3dj4mw9WgzbsSH6vyEAstNwnnEu9bdTAmWX+lXy6ICDSAWCGHK1dvBF ivcYtnvaXHlVa9obwvr2ERrk5wx76US1tiw/kEM3YYJpx2BEhewZXuywH3LzNwLwrbQP XTUJVX1/nhydOkAeTRxfXbsbY9bwRt9ivhtena+JbZ0aOTjkOsb4EGCGcLfte6MKgw46 kInBgnG3+cHGTSeRq9WrZpDLaV7IkI92nhxoNH/RK0UHzW3lfxPOuIx/u5AYLTDKmW7K m8qQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:to:subject:cc; bh=FMxkESA6fpbtF0X1AzeB+xnmWhyjJFZQT8qMuDMJUm4=; fh=Rc6mzYjn2HjnNLTOi4XsDCkr8V8V0CXqiM4JJrCnJSU=; b=cPU0wZ+CO9ffG/n0NsvDw8EHTzLzqfwGH2Ii5gdl3wd9Np9cXN17cFefPwKads2Eug sRtFbREPyFdnje2sFaJEP90mFlQl2SWpgTIE5kNRPWx01yxtHsAgQF7iIqPvTOCK0EqZ NcpqZUyxesGNxOHNynMr1QOSsd7hpqXwMor/HWziNpgnL1FjzR+PuoCb2AEynsqc+olj +XYf7ytQBZNCYps4oQwrdy0g/DYCq/xSrUQL7B+11wq4DSEHAxryWotXd9rQjXeGAJv/ lTPF/pZ+DAazrMhC4KyvgW38tfZ0/Uf4eII9ftfwsYVki3672E8iBdpA4EK3BaL9uKLj DF9g==; 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-74421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74421-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c1-20020a05620a11a100b007876c164389si5818234qkk.298.2024.02.21.01.39.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 01:39:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::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-74421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74421-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D420E1C22D77 for ; Wed, 21 Feb 2024 09:39:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CB923D3A8; Wed, 21 Feb 2024 09:39:24 +0000 (UTC) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (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 E24173C496 for ; Wed, 21 Feb 2024 09:39:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708508363; cv=none; b=niROAcMoKV06nlIu9eGUmX1HqlZPcvO9DB6ZSSj5O6RuPEygmBWgUr4rGsXg3ip1cmOXcgTeeS31geYnytj/8xCIZ4eHn8BfJuFTxebQ3z/GpOIdcTHdbuV678F84XV0Fz+5IJEO/A5gm158pGBocN5skav4LUIIDpPoeyF2JG4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708508363; c=relaxed/simple; bh=wqv71yyakWWdzpHYlH9OK4dYiSB5s5d3x+wzGlkqaFg=; h=CC:Subject:To:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=HcxoM5TF/RterFQdpI9LReW1kjt6W3QfVNSo50nJsVHrBZejW1cE50M2utpMzUg9nsjQdaglhCxhkUToBWESjXIpIlJbatq6J05caQuvS8PlbEoEEURBfwRiIQH/M4K3GuR+tEakTrO6nmdT8iBZtU/k7D/FqKvlisr816ZjfHM= 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.255 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.194]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Tfrlw2zf3z1Q8sM; Wed, 21 Feb 2024 17:37:32 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id BD029140427; Wed, 21 Feb 2024 17:39:11 +0800 (CST) Received: from [10.67.121.177] (10.67.121.177) 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; Wed, 21 Feb 2024 17:39:11 +0800 CC: , , , , , , , , Subject: Re: [PATCH 1/7] drivers/perf: hisi_pcie: Introduce hisi_pcie_pmu_get_filter() To: Jonathan Cameron References: <20240204074527.47110-1-yangyicong@huawei.com> <20240204074527.47110-2-yangyicong@huawei.com> <20240208120643.000042fa@Huawei.com> <20240208121800.000057a2@huawei.com> From: Yicong Yang Message-ID: <68d4382d-7b1a-f23e-3b33-c2fca708deaf@huawei.com> Date: Wed, 21 Feb 2024 17:39:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240208121800.000057a2@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500009.china.huawei.com (7.192.105.203) On 2024/2/8 20:18, Jonathan Cameron wrote: > On Thu, 8 Feb 2024 12:06:43 +0000 > Jonathan Cameron wrote: > >> On Sun, 4 Feb 2024 15:45:21 +0800 >> Yicong Yang wrote: >> >>> 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 >> >> Reviewed-by: Jonathan Cameron > > On second thoughts, this might benefit from a clearer name. > Perhaps just call it exactly what it is > hisi_pcie_pmu_get_ctrl_reg_val_to_set() > > It incorporates the event code as well as the filter. > Maybe we want to rename pmu_config_filter() as well to > pmu_config_counter() which I think is the real meaning? > make sense to me. we can simply use the reg name as the suffix, it'll be more clearer: hisi_pcie_pmu_get_event_ctrl_val() hisi_pcie_pmu_config_event_ctrl() > >> >>> --- >>> 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); >>> } >>> >> >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > > . >