Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp86111rwb; Mon, 26 Sep 2022 09:36:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72ix8ybg1yH42EyUa98BSLE2h7gStIQUOh0eyAKxAYMUh8IpQvUaWxz7bMQe1Hq7hzeCbf X-Received: by 2002:a17:907:16a7:b0:783:9b2a:e2ea with SMTP id hc39-20020a17090716a700b007839b2ae2eamr4274411ejc.521.1664210167335; Mon, 26 Sep 2022 09:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664210167; cv=none; d=google.com; s=arc-20160816; b=L9Y2KwVPpCViVWjpmurQtMmVJo825ThwdH1I4fS/FTVxzzefWuI4dJzEGsd6ZeHg+c CztNEmkXbE5X6winz/uLD2Qz2ti6LaCiuh6v+2ewVl2EvSn61avQfFn551zNXypPzDxC hI+HHmAu+RhWxwYUKw4bYlWGNodr9wkhySWuq1ClnEErMzcp7k90diWPO6kyOzeF0cfW icj/TAhhG2x1tAAtyrLrt0KHNBclDHDOc/X2I0Lm2sRAv8ic2eJD+UQZwfYhgtGSRCMv HE1uXj8Df+13E9A5wPMbjHTtORcSKB88c7GS5JPVXhr3eXu45EChClJftBjpMzCYAgRs ljiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=1ZhYQHFk38GdY3+YMWTd5/NmetMUo3gc9HGOklWMKlI=; b=cdHHC+EnOP0MAKVI+mh2krE8tckbjem8gfXZsoocwgrFvxOa0Z+uJevvmsWuEiTmGQ CF7qmykPZNXgw+Q+dosUUk2dwIEgzhX8cIcG1ZUQM6v9qm1QEjQWv/TtduQX7rBlTE14 HU2QDPh56SvcBtfeszePmgdYiUytWcLOfAziR2MqfqhYeybPyzjL725ByO0iKSzpifg4 ikfd4LgKga56PkCIxdbkG8rIGZWt0ctuxp8NWVTgboJYLKncolkkDwaK5WvlkzSiWYN7 HbiFSVOaowjydKvfykHv1qTZmbh1N9O1GHF4b5wqV7ocla+hdpT5kEz0xfcz39crrtHx XOjA== 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 cs20-20020a170906dc9400b0074172ed562dsi288871ejc.813.2022.09.26.09.35.41; Mon, 26 Sep 2022 09:36:07 -0700 (PDT) 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 S234543AbiIZPsE (ORCPT + 99 others); Mon, 26 Sep 2022 11:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233734AbiIZPrd (ORCPT ); Mon, 26 Sep 2022 11:47:33 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 826A84BA53; Mon, 26 Sep 2022 07:32:53 -0700 (PDT) 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 E01461042; Mon, 26 Sep 2022 07:32:59 -0700 (PDT) Received: from [10.57.65.170] (unknown [10.57.65.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9D5083F73B; Mon, 26 Sep 2022 07:32:51 -0700 (PDT) Message-ID: Date: Mon, 26 Sep 2022 15:32:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH v1 2/3] drivers/perf: add DesignWare PCIe PMU driver Content-Language: en-GB To: Shuai Xue , Jonathan Cameron , Bjorn Helgaas Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, rdunlap@infradead.org, mark.rutland@arm.com, baolin.wang@linux.alibaba.com, zhuo.song@linux.alibaba.com, linux-pci@vger.kernel.org References: <20220917121036.14864-1-xueshuai@linux.alibaba.com> <20220917121036.14864-3-xueshuai@linux.alibaba.com> <20220922165820.000017b6@huawei.com> <20220923165423.00007dc6@huawei.com> <89efd20f-65f2-c082-1eb4-4e308957ff59@linux.alibaba.com> From: Robin Murphy In-Reply-To: <89efd20f-65f2-c082-1eb4-4e308957ff59@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 On 2022-09-26 14:31, Shuai Xue wrote: > + Bjorn Helgaas > > 在 2022/9/23 PM11:54, Jonathan Cameron 写道: >> >>> >>>> >>>>> +#define RP_NUM_MAX 32 /* 2die * 4RC * 4Ctrol */ >>>> >>>> This driver is 'almost' generic. So if you an avoid defines based on a particular >>>> platform that's definitely good! >>> >>> Good idea. How about defining RP_NUM_MAX as 64? As fars as I know, >>> some platfrom use 2 sockets, 2 die per socket. >>> Then 2 sockets * 2 dies * 4 Root Complex * 4 root port. >> >> Setting a reasonable maximum is fine - but make sure the code then fails with >> a suitable error message if there are more! > > OK, I will add a discovery logic here and count PMU number at runtime. > >> >> >>>>> +#define DWC_PCIE_LANE_SHIFT 4 >>>>> +#define DWC_PCIE_LANE_MASK GENMASK(9, 4) >>>>> + >>>>> +#define DWC_PCIE_EVENT_CNT_CTRL 0x8 >>>>> +#define DWC_PCIE__CNT_EVENT_SELECT_SHIFT 16 >>>> >>>> Why double __? If point is , then >>>> naming works better >>>> DWC_PCIE_EVENT_CNT_CTRL_REG >>>> DWC_PCIE_EVENT_CNT_CTRL_EV_SELECT_MSK etc >>> >>> Yes, I point to use double `__` to indicate it is a field of register, >>> as CMN and CCN drivers do. I also considered naming with REG explicitly, >>> but the macro is so long that I often have to wrap code into multilines. >>> Any way, it's fine to rename if you still suggest to do so. >> >> I don't particularly mind. This convention was new to me. > > Haha, then I will leave the double `__` as CMN and CCN drivers do. FWIW I'm not sure there's really any convention. CCN seems to use double-underscores as distinct separators in a consistent CCN_REG_NAME__FIELD_NAME__SUFFIX pattern. Conversely in CMN I used it as an indication of the usual CMN_REG_NAME_FIELD_NAME_VALUE pattern being abbreviated where it would have been uncomfortably long otherwise (and particularly where the field name reflects the register name anyway); it just seemed like a good visual cue to imply that something was missing. Robin.