From patchwork Wed Dec 15 06:57:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1568058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JDR0R61NXz9sVq for ; Wed, 15 Dec 2021 17:58:15 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mxOEo-0002kf-7G; Wed, 15 Dec 2021 06:58:06 +0000 Received: from mail-pg1-f169.google.com ([209.85.215.169]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mxOEg-0002M1-3Q for kernel-team@lists.ubuntu.com; Wed, 15 Dec 2021 06:57:58 +0000 Received: by mail-pg1-f169.google.com with SMTP id f125so19478664pgc.0 for ; Tue, 14 Dec 2021 22:57:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oFCYE1fp6W8La3YxfbXi+yIcEIb8X4U1zb//V6yHDGI=; b=UNXEYZHy53+AfZnMRv7G/fRTRLoFJcKopQ3IWMwyhskAQUSc3+DqPdq5s3zfvAZzN6 h5yBnsFsr68WI/ytv5NonngJ9tYXBfKD4p93fBq/JJKh8S16+9W+4molqpmZA4Wql0x6 O6jUdbzuks55uc5xzWfojbXeKLNSi1CKO6f/ixOPKXBrAjTTdTdrmaSOCmEvYVbYNyg4 flq39nXqmuNc06Fthub3zKMy9McO4k60vFz5uXbaf2Cs6r4jAhWBvGdsdbQ2QAWEv0WL fEcca/sFpBYgW2b5G8cCkTnN7ArRH2pznmjkSBDD8E+Ua8GZEs2mZuGV9Tf1yH+5b6LP yGkw== X-Gm-Message-State: AOAM532BuNkgLbXJCiG4XSKQpd0xsIsM6bBCu91JmIbzvver56djJYkj SPgBSWrBRxmRanz6THGFHWNuZU+aPM4= X-Google-Smtp-Source: ABdhPJx/T1BZxDGY6WgjIdkSkOJvolxaOqpcOb9QGyERnkWdeKLVFUyxgZTzl8c1bEmdXiqp/P5Z6Q== X-Received: by 2002:a63:4516:: with SMTP id s22mr6854983pga.170.1639551469678; Tue, 14 Dec 2021 22:57:49 -0800 (PST) Received: from localhost (218-173-164-169.dynamic-ip.hinet.net. [218.173.164.169]) by smtp.gmail.com with ESMTPSA id u22sm1182755pfk.148.2021.12.14.22.57.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 22:57:49 -0800 (PST) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 9/9][SRU][Jammy] drm/amd/display: Add callbacks for DMUB HPD IRQ notifications Date: Wed, 15 Dec 2021 14:57:30 +0800 Message-Id: <20211215065730.390346-10-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211215065730.390346-1-vicamo.yang@canonical.com> References: <20211215065730.390346-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.215.169; envelope-from=vicamo@gmail.com; helo=mail-pg1-f169.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Nicholas Kazlauskas BugLink: https://bugs.launchpad.net/bugs/1953008 [Why] We need HPD IRQ notifications (RX, short pulse) to properly handle DP MST for DPIA connections. [How] A null pointer exception currently occurs when these are received so add a check to validate that we have a handler installed for the notification. Extend the HPD handler to also handle HPD IRQ (RX) since the logic is the same. Fixes: e27c41d5b068 ("drm/amd/display: Support for DMUB HPD interrupt handling") Reviewed-by: Wayne Lin Reviewed-by: Jude Shih Acked-by: Anson Jacob Tested-by: Daniel Wheeler Signed-off-by: Nicholas Kazlauskas Signed-off-by: Alex Deucher (backported from commit c40a09e56fa3d17a3d06cec9a24b04364bb18c8f) Signed-off-by: You-Sheng Yang --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index d5a579d9fa9e..865a5b0d9a0c 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -217,6 +217,7 @@ static const struct drm_format_info * amd_get_format_info(const struct drm_mode_fb_cmd2 *cmd); static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector); +static void handle_hpd_rx_irq(void *param); static bool is_timing_unchanged_for_freesync(struct drm_crtc_state *old_crtc_state, @@ -683,8 +684,12 @@ void dmub_hpd_callback(struct amdgpu_device *adev, struct dmub_notification *not } drm_connector_list_iter_end(&iter); - if (hpd_aconnector) - handle_hpd_irq_helper(hpd_aconnector); + if (hpd_aconnector) { + if (notify->type == DMUB_NOTIFICATION_HPD) + handle_hpd_irq_helper(hpd_aconnector); + else if (notify->type == DMUB_NOTIFICATION_HPD_IRQ) + handle_hpd_rx_irq(hpd_aconnector); + } } /** @@ -760,6 +765,10 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params) DRM_ERROR("DM: notify type %d invalid!", notify.type); continue; } + if (!dm->dmub_callback[notify.type]) { + DRM_DEBUG_DRIVER("DMUB notification skipped, no handler: type=%d\n", notify.type); + continue; + } if (dm->dmub_thread_offload[notify.type] == true) { dmub_hpd_wrk = kzalloc(sizeof(*dmub_hpd_wrk), GFP_ATOMIC); if (!dmub_hpd_wrk) { @@ -1433,6 +1442,10 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) DRM_ERROR("amdgpu: fail to register dmub hpd callback"); goto error; } + if (!register_dmub_notify_callback(adev, DMUB_NOTIFICATION_HPD_IRQ, dmub_hpd_callback, true)) { + DRM_ERROR("amdgpu: fail to register dmub hpd callback"); + goto error; + } #endif }