From patchwork Tue Aug 3 09:06:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 12415753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB83BC4338F for ; Tue, 3 Aug 2021 09:15:48 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F86260F01 for ; Tue, 3 Aug 2021 09:15:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9F86260F01 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tWadWttx8MYl+akXpZNtrKRccctxfosacQ+vBFefauI=; b=lI/UXMf4Jfbehg HyceDgCJDyX2RZ/ElmPcqK1xJg76dESGIO7v3mJ4Q0MPJlx/qY21372+gc4clLQ+CXplANl/q5Gqu TOjwpZKmuacrrY16Fepq5xESnzXMXIicTSzaYNVBxi29RlRg4mNopa3+vVxsBUtJjIXx1EhAwX5D5 fh+rrB1Iuxs8GIFYHxsY01EoABLq6tHkxIBFBfSfk2ZmDpEMO4yJfpowcKV8RUViAEzOfZI8Z9d1J ZUnkWDAblCOKyhvaSbmnhD9jOhLtpte3ePQ+6YxoZUDD/LuRxmjEfbJGLnZsneed3Iu8w86b+RIMx ru9bMxiiDolI5W/jdqhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAqU1-001jYI-Gm; Tue, 03 Aug 2021 09:13:10 +0000 Received: from smtp-out2.suse.de ([195.135.220.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAqOJ-001gs6-Ov for linux-arm-kernel@lists.infradead.org; Tue, 03 Aug 2021 09:07:18 +0000 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 61ECC200B6; Tue, 3 Aug 2021 09:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1627981634; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q0MWEmqp/odGDRId4WG7e0QMIj5lLradWee7c+5Zd0I=; b=UiYpQlHi4eKYMfWI8U531tKWTwEIg+m9gdiFTAZfBr3T3OW92J1t1kPDAipOEebQ9BJhCI pu2rMZHJQMUxYVd0VaYhkfgMgNAPOApj5YoHcGINFFjBrpkmrFvipl4/PVF2E3ljB/WFzx szQbpbmP7aWM58VDCj0ogoxybQN07cE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1627981634; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q0MWEmqp/odGDRId4WG7e0QMIj5lLradWee7c+5Zd0I=; b=EVFfDi/Lwuiu6fhU1bwYpigYI5c+Dv0SwPup3+UwHf2UxsxZDdkMUlwfs/V/gVxtmsbI3q sfWL13LUhEgpHwAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8DC2513CCA; Tue, 3 Aug 2021 09:07:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wHlZIUEHCWFVJQAAMHmgww (envelope-from ); Tue, 03 Aug 2021 09:07:13 +0000 From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@linux.ie, alexander.deucher@amd.com, christian.koenig@amd.com, liviu.dudau@arm.com, brian.starkey@arm.com, sam@ravnborg.org, bbrezillon@kernel.org, nicolas.ferre@microchip.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, stefan@agner.ch, alison.wang@nxp.com, patrik.r.jakobsson@gmail.com, anitha.chrisanthus@intel.com, robdclark@gmail.com, edmund.j.dea@intel.com, sean@poorly.run, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, jyri.sarha@iki.fi, tomba@kernel.org, Dan.Sneddon@microchip.com, tomi.valkeinen@ideasonboard.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH v2 09/14] drm/radeon: Convert to Linux IRQ interfaces Date: Tue, 3 Aug 2021 11:06:59 +0200 Message-Id: <20210803090704.32152-10-tzimmermann@suse.de> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210803090704.32152-1-tzimmermann@suse.de> References: <20210803090704.32152-1-tzimmermann@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210803_020716_052976_92B8753C X-CRM114-Status: GOOD ( 18.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers don't benefit from using it. DRM IRQ callbacks are now being called directly or inlined. Signed-off-by: Thomas Zimmermann Reviewed-by: Alex Deucher --- drivers/gpu/drm/radeon/radeon_drv.c | 4 --- drivers/gpu/drm/radeon/radeon_irq_kms.c | 44 +++++++++++++++++++++---- drivers/gpu/drm/radeon/radeon_kms.h | 4 --- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index c8dd68152d65..b74cebca1f89 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -607,10 +607,6 @@ static const struct drm_driver kms_driver = { .postclose = radeon_driver_postclose_kms, .lastclose = radeon_driver_lastclose_kms, .unload = radeon_driver_unload_kms, - .irq_preinstall = radeon_driver_irq_preinstall_kms, - .irq_postinstall = radeon_driver_irq_postinstall_kms, - .irq_uninstall = radeon_driver_irq_uninstall_kms, - .irq_handler = radeon_driver_irq_handler_kms, .ioctls = radeon_ioctls_kms, .num_ioctls = ARRAY_SIZE(radeon_ioctls_kms), .dumb_create = radeon_mode_dumb_create, diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index a36ce826d0c0..3907785d0798 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include @@ -51,7 +51,7 @@ * radeon_irq_process is a macro that points to the per-asic * irq handler callback. */ -irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg) +static irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg) { struct drm_device *dev = (struct drm_device *) arg; struct radeon_device *rdev = dev->dev_private; @@ -118,7 +118,7 @@ static void radeon_dp_work_func(struct work_struct *work) * Gets the hw ready to enable irqs (all asics). * This function disables all interrupt sources on the GPU. */ -void radeon_driver_irq_preinstall_kms(struct drm_device *dev) +static void radeon_driver_irq_preinstall_kms(struct drm_device *dev) { struct radeon_device *rdev = dev->dev_private; unsigned long irqflags; @@ -150,7 +150,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev) * Handles stuff to be done after enabling irqs (all asics). * Returns 0 on success. */ -int radeon_driver_irq_postinstall_kms(struct drm_device *dev) +static int radeon_driver_irq_postinstall_kms(struct drm_device *dev) { struct radeon_device *rdev = dev->dev_private; @@ -169,7 +169,7 @@ int radeon_driver_irq_postinstall_kms(struct drm_device *dev) * * This function disables all interrupt sources on the GPU (all asics). */ -void radeon_driver_irq_uninstall_kms(struct drm_device *dev) +static void radeon_driver_irq_uninstall_kms(struct drm_device *dev) { struct radeon_device *rdev = dev->dev_private; unsigned long irqflags; @@ -194,6 +194,36 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev) spin_unlock_irqrestore(&rdev->irq.lock, irqflags); } +static int radeon_irq_install(struct radeon_device *rdev, int irq) +{ + struct drm_device *dev = rdev->ddev; + int ret; + + if (irq == IRQ_NOTCONNECTED) + return -ENOTCONN; + + radeon_driver_irq_preinstall_kms(dev); + + /* PCI devices require shared interrupts. */ + ret = request_irq(irq, radeon_driver_irq_handler_kms, + IRQF_SHARED, dev->driver->name, dev); + if (ret) + return ret; + + radeon_driver_irq_postinstall_kms(dev); + + return 0; +} + +static void radeon_irq_uninstall(struct radeon_device *rdev) +{ + struct drm_device *dev = rdev->ddev; + struct pci_dev *pdev = to_pci_dev(dev->dev); + + radeon_driver_irq_uninstall_kms(dev); + free_irq(pdev->irq, dev); +} + /** * radeon_msi_ok - asic specific msi checks * @@ -314,7 +344,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi); rdev->irq.installed = true; - r = drm_irq_install(rdev->ddev, rdev->pdev->irq); + r = radeon_irq_install(rdev, rdev->pdev->irq); if (r) { rdev->irq.installed = false; flush_delayed_work(&rdev->hotplug_work); @@ -335,7 +365,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) void radeon_irq_kms_fini(struct radeon_device *rdev) { if (rdev->irq.installed) { - drm_irq_uninstall(rdev->ddev); + radeon_irq_uninstall(rdev); rdev->irq.installed = false; if (rdev->msi_enabled) pci_disable_msi(rdev->pdev); diff --git a/drivers/gpu/drm/radeon/radeon_kms.h b/drivers/gpu/drm/radeon/radeon_kms.h index 9b97bf38acd4..36e73cea9215 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.h +++ b/drivers/gpu/drm/radeon/radeon_kms.h @@ -31,9 +31,5 @@ u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc); int radeon_enable_vblank_kms(struct drm_crtc *crtc); void radeon_disable_vblank_kms(struct drm_crtc *crtc); -irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg); -void radeon_driver_irq_preinstall_kms(struct drm_device *dev); -int radeon_driver_irq_postinstall_kms(struct drm_device *dev); -void radeon_driver_irq_uninstall_kms(struct drm_device *dev); #endif /* __RADEON_KMS_H__ */