From patchwork Thu Jul 10 21:50:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 4528131 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 2E8EF9F37C for ; Thu, 10 Jul 2014 23:33:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4ED97201DE for ; Thu, 10 Jul 2014 23:33:26 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8A33B201D5 for ; Thu, 10 Jul 2014 23:33:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DBC1A6E78E; 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-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by gabe.freedesktop.org (Postfix) with ESMTP id 7DF656E3C0 for ; Thu, 10 Jul 2014 14:51:01 -0700 (PDT) Received: by mail-wi0-f178.google.com with SMTP id f8so407288wiw.17 for ; Thu, 10 Jul 2014 14:51:00 -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=8cQR/9PsCciTJJ4Fw/tLLhccHVIDS8FJhsLHUR8pA2g=; b=b1t/ZBtF9+jdDNT5oD5lbK0DkLGdP4oHmJcTaJdVMVmdcq44dXMUgnco1lKnjNNyWV Z/tMfo5SpsoHwYRWncvdjKdir9YbwQHy2LOZOrKpMlNHIvcLE78YXbfFqGPiBn3f66Op OZwPzBGkftNcMnVj8As3tAcuwAyWKFKm4gKljr1lylQNsCw5VxAk0hLPI4WAuFs9CEuN A5LRVZ2ds4rpgYf9wGQLtxRnVLyFZx/m70Y9cSo/oVK95WmuoS3cSWsR8k7Nf5+tvQfp yK81ktJwGvpKTIBVfpNCEjDcXRSc/P/hUvY0Q+7TxnSCskL/ZEAVQAaIqDqcU53CYOym 3PbA== X-Received: by 10.194.234.1 with SMTP id ua1mr936468wjc.42.1405029060302; Thu, 10 Jul 2014 14:51:00 -0700 (PDT) Received: from localhost.localdomain ([77.127.59.49]) by mx.google.com with ESMTPSA id n2sm805353wjf.40.2014.07.10.14.50.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jul 2014 14:50:59 -0700 (PDT) From: Oded Gabbay X-Google-Original-From: Oded Gabbay To: David Airlie , Alex Deucher , Jerome Glisse Subject: [PATCH 08/83] drm/radeon: Add calls to initialize and finalize kfd from radeon Date: Fri, 11 Jul 2014 00:50:08 +0300 Message-Id: <1405029027-6085-7-git-send-email-oded.gabbay@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405029027-6085-1-git-send-email-oded.gabbay@amd.com> References: <1405029027-6085-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, =?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 The KFD driver should be loaded when the radeon driver is loaded and should be finalized when the radeon driver is removed. This patch adds a function call to initialize kfd from radeon_init and a function call to finalize kfd from radeon_exit. If the KFD driver is not present in the system, the initialize call fails and the radeon driver continues normally. This patch also adds calls to probe, initialize and finalize a kfd device per radeon device using the kgd-->kfd interface. Signed-off-by: Oded Gabbay Reviewed-by: Jérôme Glisse --- drivers/gpu/drm/radeon/radeon_drv.c | 6 ++++++ drivers/gpu/drm/radeon/radeon_kms.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index cb14213..88a45a0 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -151,6 +151,9 @@ static inline void radeon_register_atpx_handler(void) {} static inline void radeon_unregister_atpx_handler(void) {} #endif +extern bool radeon_kfd_init(void); +extern void radeon_kfd_fini(void); + int radeon_no_wb; int radeon_modeset = -1; int radeon_dynclks = -1; @@ -630,12 +633,15 @@ static int __init radeon_init(void) #endif } + radeon_kfd_init(); + /* let modprobe override vga console setting */ return drm_pci_init(driver, pdriver); } static void __exit radeon_exit(void) { + radeon_kfd_fini(); drm_pci_exit(driver, pdriver); radeon_unregister_atpx_handler(); } diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 35d9318..0748284 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -34,6 +34,10 @@ #include #include +extern void radeon_kfd_device_probe(struct radeon_device *rdev); +extern void radeon_kfd_device_init(struct radeon_device *rdev); +extern void radeon_kfd_device_fini(struct radeon_device *rdev); + #if defined(CONFIG_VGA_SWITCHEROO) bool radeon_has_atpx(void); #else @@ -63,6 +67,8 @@ int radeon_driver_unload_kms(struct drm_device *dev) pm_runtime_get_sync(dev->dev); + radeon_kfd_device_fini(rdev); + radeon_acpi_fini(rdev); radeon_modeset_fini(rdev); @@ -142,6 +148,9 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) "Error during ACPI methods call\n"); } + radeon_kfd_device_probe(rdev); + radeon_kfd_device_init(rdev); + if (radeon_is_px(dev)) { pm_runtime_use_autosuspend(dev->dev); pm_runtime_set_autosuspend_delay(dev->dev, 5000);