From patchwork Wed Sep 5 01:55:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuansheng Liu X-Patchwork-Id: 1405651 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 679F43FC71 for ; Wed, 5 Sep 2012 07:07:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 42A86A0883 for ; Wed, 5 Sep 2012 00:07:58 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id D04569E9BE for ; Tue, 4 Sep 2012 18:56:19 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 04 Sep 2012 18:56:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,371,1344236400"; d="scan'208";a="217859045" Received: from fmsmsx108.amr.corp.intel.com ([10.19.9.228]) by fmsmga002.fm.intel.com with ESMTP; 04 Sep 2012 18:56:01 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX108.amr.corp.intel.com (10.19.9.228) with Microsoft SMTP Server (TLS) id 14.1.355.2; Tue, 4 Sep 2012 18:56:01 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.239]) by SHSMSX102.ccr.corp.intel.com ([169.254.2.92]) with mapi id 14.01.0355.002; Wed, 5 Sep 2012 09:56:00 +0800 From: "Liu, Chuansheng" To: "'linux-kernel@vger.kernel.org' (linux-kernel@vger.kernel.org)" , "dri-devel@lists.freedesktop.org" Subject: [Patch 1/1]drm_irq: Introducing the irq_thread support Thread-Topic: [Patch 1/1]drm_irq: Introducing the irq_thread support Thread-Index: Ac2LCY8ha6WXHek1SUy+D7Bmou+cuA== Date: Wed, 5 Sep 2012 01:55:59 +0000 Message-ID: <27240C0AC20F114CBF8149A2696CBE4A17731A@SHSMSX101.ccr.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 05 Sep 2012 00:03:41 -0700 Cc: "alexander.deucher@amd.com" , "airlied@redhat.com" , "Shi, Yang A" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: liu chuansheng Subject: [PATCH] drm_irq: Introducing the irq_thread support For some GPUs, the irq handler need >1ms to handle the irq action. And it will delay the whole system irq handler. This patch is adding the irq thread support, it will make the drm_irq interface more flexible. The changes include: 1/ Change the request_irq to request_thread_irq, and add new callback irq_handler_t; 2/ Normally we need IRQF_ONESHOT flag support for irq thread, so add this option in drm_irq; Cc: Shi Yang Signed-off-by: liu chuansheng --- drivers/gpu/drm/drm_irq.c | 8 ++++++-- include/drm/drmP.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 03f16f3..bc105fe 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -345,13 +345,17 @@ int drm_irq_install(struct drm_device *dev) if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) sh_flags = IRQF_SHARED; + if (drm_core_check_feature(dev, DRIVER_IRQ_ONESHOT)) + sh_flags |= IRQF_ONESHOT; + if (dev->devname) irqname = dev->devname; else irqname = dev->driver->name; - ret = request_irq(drm_dev_to_irq(dev), dev->driver->irq_handler, - sh_flags, irqname, dev); + ret = request_threaded_irq(drm_dev_to_irq(dev), + dev->driver->irq_handler, dev->driver->irq_handler_t, + sh_flags, irqname, dev); if (ret < 0) { mutex_lock(&dev->struct_mutex); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index d6b67bb..b28be4b 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -152,6 +152,7 @@ int drm_err(const char *func, const char *format, ...); #define DRIVER_GEM 0x1000 #define DRIVER_MODESET 0x2000 #define DRIVER_PRIME 0x4000 +#define DRIVER_IRQ_ONESHOT 0x8000 #define DRIVER_BUS_PCI 0x1 #define DRIVER_BUS_PLATFORM 0x2 @@ -872,6 +873,7 @@ struct drm_driver { /* these have to be filled in */ irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); + irqreturn_t(*irq_handler_t) (DRM_IRQ_ARGS); void (*irq_preinstall) (struct drm_device *dev); int (*irq_postinstall) (struct drm_device *dev); void (*irq_uninstall) (struct drm_device *dev);