From patchwork Mon Nov 12 21:47:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10679313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B499B109C for ; Mon, 12 Nov 2018 21:47:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A66B329D3C for ; Mon, 12 Nov 2018 21:47:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AD9C2A4E8; Mon, 12 Nov 2018 21:47:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5873029D3C for ; Mon, 12 Nov 2018 21:47:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0FF616E253; Mon, 12 Nov 2018 21:47:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3DAEE6E255 for ; Mon, 12 Nov 2018 21:47:26 +0000 (UTC) Received: by mail-yb1-xb43.google.com with SMTP id i78-v6so4556907ybg.0 for ; Mon, 12 Nov 2018 13:47:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l0WeObaG0c2vDU98hIMTkh88M0te6B290BU1S+UiY00=; b=LkxNXZoI2qup6Vry9dcxWEssOPAADBn7K8ZdSeEACRco8e66vnao0aLF/SNHGQphFv RcpKyEIkTnfvub5sPyhiXQMYlTftQk4HOqYgaNHlgvOG2W0k+QNDTx4g9tbRnQub51TH rZj4On9uk/IZPhyVSIz791Y8y6K36GhYeUs+eZQizyzMZ8QCiCZdviVnnTafG8dqajxr eEcTftcj6bnny4z0oOIKIIMxQmicTMWvSexGHY6ye7QvP0wqXFJ9oSjikPP0ows2HR7e s0Liqva2aS7l+CNoLc8nK8jfMRn7hgiX8eCdJndE15F8i0N7rMFQMyycf4IUDNH/14TP Azyg== X-Gm-Message-State: AGRZ1gJV2+gtgm9Zd+LEaAs8o8ibpH16m8wuNP7icwNIKiFxqF4RiRi3 btzVpBP7iXhntQaGOqB9FatNmwnGFkIwPg== X-Google-Smtp-Source: AJdET5cXXCQqUzkzwmmSmBe1XVKp/VPLDA/zjyGf0Gy5iuLYIj+bpr+1AriGtXpef1a+xnPA48Mctg== X-Received: by 2002:a25:ac1f:: with SMTP id w31-v6mr2671838ybi.362.1542059245100; Mon, 12 Nov 2018 13:47:25 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id e195-v6sm2384452ywe.35.2018.11.12.13.47.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 13:47:24 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 3/3] drm/msm: dpu: Add modeset lock checks where applicable Date: Mon, 12 Nov 2018 16:47:05 -0500 Message-Id: <20181112214713.69826-3-sean@poorly.run> X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog In-Reply-To: <20181112214713.69826-1-sean@poorly.run> References: <20181112214713.69826-1-sean@poorly.run> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Add modeset lock checks to functions that could be called outside the core atomic stack. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index bf541a942da8..8c34fb3b9286 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -287,6 +287,8 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct drm_crtc *crtc) return INTF_MODE_NONE; } + WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); + /* TODO: Returns the first INTF_MODE, could there be multiple values? */ drm_for_each_encoder_mask(encoder, crtc->dev, crtc->state->encoder_mask) return dpu_encoder_get_intf_mode(encoder); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 78709699fe1e..aa32c353607b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -358,6 +358,7 @@ void dpu_kms_encoder_enable(struct drm_encoder *encoder) if (funcs && funcs->commit) funcs->commit(encoder); + WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); drm_for_each_crtc(crtc, dev) { if (!(crtc->state->encoder_mask & drm_encoder_mask(encoder))) continue;