From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 83074E7D0AF for ; Thu, 21 Sep 2023 22:01:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 081DD10E61E; Thu, 21 Sep 2023 22:01:44 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 30E0210E61E for ; Thu, 21 Sep 2023 22:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695333702; x=1726869702; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=8axbYUbAsR+1UMP5pbpEF4HqIZguDcJObmosS1WXsi0=; b=GH4UD6SVAKyLQx6blKjSE/RB/hzSsgktqSwFQWX8f3zmJV6jWu3K4DQ6 X155MZZw6g9PhlHbzmPwCq+KwtODUOADSLgcPXhcpvnN+SeGjiCLzCUjy KvT/mDbQXsa912wI2Nmd30rapqSZfOGwPxOJbd4nMYOwP1Vomc1/1NRcA SM/FMBlL4rN2e3uVQUvVXCvjV9OZ7hI4AHnwDJfqSGkEGTfHhfSzMkhK0 6OeNHCIuainU6UuoHk+Vt6OPjo/LwaJ2hPd/u8xzL0As3womVd31enElB BklPLUeErVvnf6INA95TjVx0ZyNA0kWUnTVYQeFWILQUdsWy+iX63b45/ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10840"; a="466980195" X-IronPort-AV: E=Sophos;i="6.03,166,1694761200"; d="scan'208";a="466980195" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2023 15:01:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10840"; a="696919500" X-IronPort-AV: E=Sophos;i="6.03,166,1694761200"; d="scan'208";a="696919500" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.251.19.132]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2023 15:01:41 -0700 Date: Thu, 21 Sep 2023 14:58:14 -0700 Message-ID: <87a5tfi3yh.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Rodrigo Vivi In-Reply-To: References: <20230919161049.2307855-1-ashutosh.dixit@intel.com> <20230919161049.2307855-17-ashutosh.dixit@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Subject: Re: [Intel-xe] [PATCH 16/21] drm/xe/oa: Make xe_oa_timestamp_frequency per gt X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-xe@lists.freedesktop.org Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Thu, 21 Sep 2023 13:45:54 -0700, Rodrigo Vivi wrote: > Hi Rodrigo, > On Tue, Sep 19, 2023 at 09:10:44AM -0700, Ashutosh Dixit wrote: > > Clock freq's can be different for different gt's. > > > > Suggested-by: Umesh Nerlige Ramappa > > Signed-off-by: Ashutosh Dixit > > --- > > drivers/gpu/drm/xe/xe_oa.c | 44 +++++++++++++++++------------------ > > drivers/gpu/drm/xe/xe_oa.h | 2 +- > > drivers/gpu/drm/xe/xe_query.c | 2 +- > > 3 files changed, 24 insertions(+), 24 deletions(-) > > > > diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c > > index d49debe732bbd..8648652e05aa5 100644 > > --- a/drivers/gpu/drm/xe/xe_oa.c > > +++ b/drivers/gpu/drm/xe/xe_oa.c > > @@ -1496,7 +1496,7 @@ xe_oa_stream_open_ioctl_locked(struct xe_oa *oa, > > * platforms OA unit ignores the CTC_SHIFT and the 2 timestamps differ. In such > > * cases, return the adjusted CS timestamp frequency to the user. > > */ > > -u32 xe_oa_timestamp_frequency(struct xe_device *xe) > > +u32 xe_oa_timestamp_frequency(struct xe_gt *gt) > > { > > u32 reg, shift; > > > > @@ -1505,26 +1505,26 @@ u32 xe_oa_timestamp_frequency(struct xe_device *xe) > > * Wa_14015568240:pvc > > * Wa_14015846243:mtl > > */ > > - switch (xe->info.platform) { > > + switch (gt->tile->xe->info.platform) { > > case XE_DG2: > > case XE_PVC: > > case XE_METEORLAKE: > > - xe_device_mem_access_get(xe); > > - reg = xe_mmio_read32(xe_root_mmio_gt(xe), RPM_CONFIG0); > > - xe_device_mem_access_put(xe); > > + xe_device_mem_access_get(gt->tile->xe); > > + reg = xe_mmio_read32(gt, RPM_CONFIG0); > > + xe_device_mem_access_put(gt->tile->xe); > > > > shift = REG_FIELD_GET(RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK, reg); > > - return xe_root_mmio_gt(xe)->info.clock_freq << (3 - shift); > > + return gt->info.clock_freq << (3 - shift); > > > > default: > > - return xe_root_mmio_gt(xe)->info.clock_freq; > > + return gt->info.clock_freq; > > } > > } /snip/ > > diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c > > index 4a3a9c11e8cc4..ad280bac9eed4 100644 > > --- a/drivers/gpu/drm/xe/xe_query.c > > +++ b/drivers/gpu/drm/xe/xe_query.c > > @@ -244,7 +244,7 @@ static int query_gts(struct xe_device *xe, struct drm_xe_device_query *query) > > gts->gts[id].type = XE_QUERY_GT_TYPE_MAIN; > > gts->gts[id].instance = id; > > gts->gts[id].clock_freq = gt->info.clock_freq; > > first look it here ^ > > > - gts->gts[id].oa_timestamp_freq = xe_oa_timestamp_frequency(xe); > > + gts->gts[id].oa_timestamp_freq = xe_oa_timestamp_frequency(gt); > > Then please notice that we are trying to kill the duplications on the uapi [1] > and now notice that this series is adding yet another duplication: > > +u32 xe_oa_timestamp_frequency(struct xe_gt *gt) > + return gt->info.clock_freq; > (copied from above) > > [1] - https://lore.kernel.org/all/20230920192940.135004-20-rodrigo.vivi@intel.com/ Well it's duplicated on some platforms but not on others. If it helps, there is another proposal which will move all OA related information (including oa_timestamp_freq) into a separate drm_xe_query_oa_info struct (so out of the current uapi struct's into drm_xe_query_oa_info). See: https://patchwork.freedesktop.org/patch/558367/?series=121084&rev=6 Thanks. -- Ashutosh