From patchwork Thu Jul 10 21:53:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 4528151 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5590C9F3B4 for ; Thu, 10 Jul 2014 23:33:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 510BC201D5 for ; Thu, 10 Jul 2014 23:33:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 771DB2011D for ; Thu, 10 Jul 2014 23:33:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 625FB6E77D; Thu, 10 Jul 2014 16:33:14 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by gabe.freedesktop.org (Postfix) with ESMTP id E4A536E0B0 for ; Thu, 10 Jul 2014 14:55:22 -0700 (PDT) Received: by mail-wg0-f42.google.com with SMTP id l18so188977wgh.25 for ; Thu, 10 Jul 2014 14:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BRzrCG3iKYIYpWJPWwH0AeQSqE6NvZmR1LdhTQZTYr4=; b=GRRyQk9WhCdYzl58YnWYGAcLDGN++vxyP8VVhYDnU1s/DJQgl/cNWWIcCoAkas8vEd ybX0ilTob+kHu2NaeVBvfkxkItmVgRiDCWRdrS7ursynSQp4XV5thLfm8cZqmfgJfp8T q44plp99YyCuBvsr6ZrMZoBiC9tyyXF7rINMb+2VivsuI97wsmqZTWtV0Lsus8NybQxk DeSWANm+GBOYN+cPuHBE9furT+mpqQ5s+l8purQDBKoxkqwv2qQcefB/+5WhTX5abeDf fjVVlHph2sWeUV5JVMwPVJET0Yly7TPp1eizUUxvDPFxbLq/q6Sxh29//z7ljnILJ6Ux skkg== X-Received: by 10.181.8.204 with SMTP id dm12mr145166wid.67.1405029319816; Thu, 10 Jul 2014 14:55:19 -0700 (PDT) Received: from localhost.localdomain ([77.127.59.49]) by mx.google.com with ESMTPSA id pq9sm831097wjc.35.2014.07.10.14.55.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jul 2014 14:55:19 -0700 (PDT) From: Oded Gabbay X-Google-Original-From: Oded Gabbay To: David Airlie , Alex Deucher , Jerome Glisse Subject: [PATCH 39/83] drm/radeon: Extending kfd interface Date: Fri, 11 Jul 2014 00:53:55 +0300 Message-Id: <1405029279-6894-11-git-send-email-oded.gabbay@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405029279-6894-1-git-send-email-oded.gabbay@amd.com> References: <1405029279-6894-1-git-send-email-oded.gabbay@amd.com> X-Mailman-Approved-At: Thu, 10 Jul 2014 16:33:12 -0700 Cc: Andrew Lewycky , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Evgeny Pinchuk , =?UTF-8?q?Christian=20K=C3=B6nig?= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Evgeny Pinchuk Adding new function to the interface used by kfd. The new function retrieves the max engine clock speed. Signed-off-by: Evgeny Pinchuk Signed-off-by: Oded Gabbay --- drivers/gpu/drm/radeon/radeon_kfd.c | 11 +++++++++++ include/linux/radeon_kfd.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c b/drivers/gpu/drm/radeon/radeon_kfd.c index 6dba170..8b6d497 100644 --- a/drivers/gpu/drm/radeon/radeon_kfd.c +++ b/drivers/gpu/drm/radeon/radeon_kfd.c @@ -50,6 +50,8 @@ static void unlock_srbm_gfx_cntl(struct kgd_dev *kgd); static void lock_grbm_gfx_idx(struct kgd_dev *kgd); static void unlock_grbm_gfx_idx(struct kgd_dev *kgd); +static uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd); + static const struct kfd2kgd_calls kfd2kgd = { .allocate_mem = allocate_mem, @@ -64,6 +66,7 @@ static const struct kfd2kgd_calls kfd2kgd = { .unlock_srbm_gfx_cntl = unlock_srbm_gfx_cntl, .lock_grbm_gfx_idx = lock_grbm_gfx_idx, .unlock_grbm_gfx_idx = unlock_grbm_gfx_idx, + .get_max_engine_clock_in_mhz = get_max_engine_clock_in_mhz, }; static const struct kgd2kfd_calls *kgd2kfd; @@ -307,3 +310,11 @@ static uint64_t get_gpu_clock_counter(struct kgd_dev *kgd) return rdev->asic->get_gpu_clock_counter(rdev); } + +static uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd) +{ + struct radeon_device *rdev = (struct radeon_device *)kgd; + + /* The sclk is in quantas of 10kHz */ + return rdev->pm.power_state->clock_info->sclk / 100; +} diff --git a/include/linux/radeon_kfd.h b/include/linux/radeon_kfd.h index 4c7e923..4114c8e 100644 --- a/include/linux/radeon_kfd.h +++ b/include/linux/radeon_kfd.h @@ -93,6 +93,8 @@ struct kfd2kgd_calls { /* GRBM_GFX_INDEX mutex */ void (*lock_grbm_gfx_idx)(struct kgd_dev *kgd); void (*unlock_grbm_gfx_idx)(struct kgd_dev *kgd); + + uint32_t (*get_max_engine_clock_in_mhz)(struct kgd_dev *kgd); }; bool kgd2kfd_init(unsigned interface_version,