Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp2058482rdb; Thu, 17 Aug 2023 09:29:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3m4kWDW4Zq4HPYHfim3AGiWksuqBZKQrKKFDJNKyNkJSfIK/LuRLORxBBtYVzOK4SSRch X-Received: by 2002:a17:90b:4a01:b0:26d:2bac:a0bb with SMTP id kk1-20020a17090b4a0100b0026d2baca0bbmr1379659pjb.6.1692289786059; Thu, 17 Aug 2023 09:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692289786; cv=none; d=google.com; s=arc-20160816; b=G+zJ6SKr1qYSbmwBnwwagYgBTXro5Pqqb93/PDFUPMHzZnxj9XGKTSW74jrFuYLAyP wnyYVTDuPxaiI7e1x6BZfXa/A3aiiqtjkZCwEJwjVu8EpnbTBJ4s9Y0yA0URevMoUdXl sJiM7QY+ZFm+4vcwQNTX88J3N4rjTKC+O0Vn6WPmtCUf1LhjA04gq1hV0u/u28P35JOU SuvlklKar0KzDG8LUIWlK4crC1IRpJ0jzhYQ7qDh2NnpMm4QVuBIC8hyvS/aCuGfC5Nn M+NVjxOh8LMgd2ZXrd9pVRcXK4vtIQnxfSnrfw+tfe+V4LLZ/1SBuKsCXYyTsiO0S0fs 22xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=tNFGdf5bGnAwpM8dxCVQ4LZE4pB1vV/6R0t9M9wp28k=; fh=75Fq1IWRC/UTEviLepz3OFplcrQc5kKKCJEgN4mC2OI=; b=wE4m2t2aU1xXHPiio3vfBJpCazwlesUsgvYuE+zMklAI3lm2iGkBIhCmKBR/b5NZN0 d7AKfpKJfzO7DxBkp6ehqOLsgj70hh5gawskKv4mBRse5B8yrMkmIdf1sr5FK8/cd073 6nIrhV3pXPTEDXfPRVWIj7wWpR8SFaGfOnU2DodTkMDj2g3qn858rywT0vOiTREB57u2 3/P1Tfrqn9vm4gCB6lVIA4sw6QeBW8mFHbZ60Mo8WM698Ejsc1wp4gidil1FF+2i/m0+ lIDTQfQddYU/E35Z0N2xiJ1EleJ1JKwtQ6GQr7GQCeYLEhq/MwHJE6P2Q/D3Bx/kGAiw IItw== 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 ik14-20020a170902ab0e00b001bf1d1d99b0si997896plb.568.2023.08.17.09.29.33; Thu, 17 Aug 2023 09:29:46 -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 S236174AbjHONYm (ORCPT + 99 others); Tue, 15 Aug 2023 09:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237440AbjHONYV (ORCPT ); Tue, 15 Aug 2023 09:24:21 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E65FD10C for ; Tue, 15 Aug 2023 06:24:19 -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 F058F143D; Tue, 15 Aug 2023 06:25:01 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.3.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5DCF43F6C4; Tue, 15 Aug 2023 06:24:18 -0700 (PDT) Date: Tue, 15 Aug 2023 14:24:15 +0100 From: Mark Rutland To: Gowthami Thiagarajan Cc: "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Sunil Kovvuri Goutham , Bharat Bhushan , George Cherian , Linu Cherian Subject: Re: [PATCH 3/6] perf/marvell : Odyssey LLC-TAD performance monitor support Message-ID: References: <20230630120351.1143773-1-gthiagarajan@marvell.com> <20230630120351.1143773-4-gthiagarajan@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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 Sat, Aug 12, 2023 at 01:51:00PM +0000, Gowthami Thiagarajan wrote: > > -----Original Message----- > > From: Mark Rutland > > Sent: Friday, July 28, 2023 9:08 PM > > To: Gowthami Thiagarajan > > Cc: will@kernel.org; linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Sunil Kovvuri > > Goutham ; Bharat Bhushan ; George Cherian > > ; Linu Cherian > > Subject: [EXT] Re: [PATCH 3/6] perf/marvell : Odyssey LLC-TAD performance monitor support > > > > External Email > > > > ---------------------------------------------------------------------- > > On Fri, Jun 30, 2023 at 05:33:48PM +0530, Gowthami Thiagarajan wrote: > > > +static int tad_pmu_event_counter_add(struct perf_event *event, int flags) > > > +{ > > > + if (!event->attr.disabled) > > > + return -EINVAL; > > > > Why? > Just checks the default disabled attribute. Why does it matter? What's the problem with opening an event which is *not* disabled? [...] > > > +static int tad_pmu_probe(struct platform_device *pdev) > > > +{ > > > + struct device *dev = &pdev->dev; > > > + struct tad_region *regions; > > > + struct tad_pmu *tad_pmu; > > > + struct resource *res; > > > + u32 tad_pmu_page_size; > > > + u32 tad_page_size; > > > + u32 tad_cnt; > > > + int i, ret; > > > + char *name; > > > + > > > + tad_pmu = devm_kzalloc(&pdev->dev, sizeof(*tad_pmu), GFP_KERNEL); > > > + if (!tad_pmu) > > > + return -ENOMEM; > > > + > > > + platform_set_drvdata(pdev, tad_pmu); > > > + > > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > > + if (!res) { > > > + dev_err(&pdev->dev, "Mem resource not found\n"); > > > + return -ENODEV; > > > + } > > > + > > > + ret = device_property_read_u32(dev, "marvell,tad-page-size", &tad_page_size); > > > + if (ret) { > > > + dev_err(&pdev->dev, "Can't find tad-page-size property\n"); > > > + return ret; > > > + } > > > + > > > + ret = device_property_read_u32(dev, "marvell,tad-pmu-page-size", > > > + &tad_pmu_page_size); > > > + if (ret) { > > > + dev_err(&pdev->dev, "Can't find tad-pmu-page-size property\n"); > > > + return ret; > > > + } > > > > Why do you think these properties are necessary? > > > > These should almost certainly be provided by IO resources, and shouldn't need a > > custom property. > > IO resources don't provide all the information in this case. Need to vary these values > at different boot times. So, kept these custom properties. I think the only rason the information is missing is that your DT binding isn't quite right. Later on you do: + for (i = 0; i < tad_cnt && res->start < res->end; i++) { + regions[i].base = devm_ioremap(&pdev->dev, + res->start, + tad_pmu_page_size); + if (IS_ERR(regions[i].base)) { + dev_err(&pdev->dev, "TAD%d ioremap fail\n", i); + return -ENOMEM; + } + res->start += tad_page_size; + } ... which means you're splitting one reg entry into multiple mappings, whereas you could have multiple reg entries, one per TAD page. Thanks, Mark.