From patchwork Wed Oct 26 03:31:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9395889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7F1EF60234 for ; Wed, 26 Oct 2016 03:39:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F18D2953C for ; Wed, 26 Oct 2016 03:39:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 634022959E; Wed, 26 Oct 2016 03:39:34 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 F3ACD2953C for ; Wed, 26 Oct 2016 03:39:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5F2C6E37A; Wed, 26 Oct 2016 03:39:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x233.google.com (mail-pf0-x233.google.com [IPv6:2607:f8b0:400e:c00::233]) by gabe.freedesktop.org (Postfix) with ESMTPS id A242D6E37A for ; Wed, 26 Oct 2016 03:39:30 +0000 (UTC) Received: by mail-pf0-x233.google.com with SMTP id n85so14513656pfi.1 for ; Tue, 25 Oct 2016 20:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:subject; bh=0QAKhIRVmrtc7oK6aU95zI57R2aS+xefnWBBLJVng8o=; b=L4QMqKrRCfRCB8wtU8L4cwozFPoFSG1/7gx7/itO0kd207jFjm/gq5iFJ9gjv/SUrA ADF6bzn4XygVfQ+B2qSOsXuhVxrEcLmGIj9Ar0bJzeaLDzSY1DKkHPdP5fO/NpwFca7P jAMOhFYKCvdg0GvmHhMnUd2rinQPMp5dJN7XL3qFZN7M1XMdwBMJeyJE/08B4YYwPdV4 qa2NKFQ1M9A3J3IrQ3Lml8xx2BwFqSlW//pu+BARU+ChH09m9v3r//jGnxlmt0Lts9pZ 9nVtyL1qFLMxGqGGqlmYptDo8NDeg6RH0IQSod1YcEzhAbOzqK8wOYQxuRaHhYrHAg9O upgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:date:message-id:subject; bh=0QAKhIRVmrtc7oK6aU95zI57R2aS+xefnWBBLJVng8o=; b=b+WWuobURZ2Hq1l7drXtoinxNfL5UwstQDB6AfBuLXxSU2FrEnaC+1ODJK+VAmo74z v1ASB8TNRHiTdVtnggWCIqcCPqfsaTPqXQsBMGGyky08oM6Yq3dtjF4p4yVHYiT+dA3e A+R1ynfEgx5C11BrM0MCwrz+10Euk4/HqyFbxiNNxjM5PVSQT3Kq+3gPEUrNmZlQ6LjT vsAka3oO2n4/8dipoe5DHPBVri+idtjgAvtJcU8Hewe4GDYRU5RyvlC0SI3tO5KYupUC qCE1qs45GzsFCH/Q/9brIUdWVdX9pmX/jw0/fXJ/dntgDM+RGEj5jQM5sUni0tdr3E2/ fEcw== X-Gm-Message-State: ABUngvfDZfgp/dzw2w16CBTiD1hxdLRP7Pq4JVnicWWZrj9+b9ZyWr1qknj3tI/BCEWL0A== X-Received: by 10.98.67.133 with SMTP id l5mr101337pfi.170.1477453169930; Tue, 25 Oct 2016 20:39:29 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id bx5sm35952pad.6.2016.10.25.20.39.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Oct 2016 20:39:28 -0700 (PDT) From: Magnus Damm To: dri-devel@lists.freedesktop.org Date: Wed, 26 Oct 2016 12:31:43 +0900 Message-Id: <20161026033143.6617.5834.sendpatchset@little-apple> Subject: [PATCH] drm: rcar-du: Fix R-Car Gen3 crash when VSP is disabled Cc: linux-renesas-soc@vger.kernel.org, Magnus Damm , linux-kernel@vger.kernel.org, laurent.pinchart@ideasonboard.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 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-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm For the DU to operate on R-Car Gen3 hardware a combination of DU and VSP devices are required. Since the DU driver also supports earlier generations hardware the VSP portion is enabled via Kconfig. The arm64 defconfig is as of v4.9-rc1 having the DU driver enabled as a module, however this is not enough to support R-Car Gen3. In the current case of CONFIG_DRM_RCAR_VSP=n then the kernel crashes when loading the module. This patch is fixing that particular case. In more detail, the crash triggers in drm_atomic_get_plane_state() when __drm_atomic_helper_set_config() passes NULL as crtc->primary. This patch corrects this issue by failing to load the DU driver on R-Car Gen3 when VSP is not available. Signed-off-by: Magnus Damm --- drivers/gpu/drm/rcar-du/rcar_du_vsp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 0001/drivers/gpu/drm/rcar-du/rcar_du_vsp.h +++ work/drivers/gpu/drm/rcar-du/rcar_du_vsp.h 2016-10-26 00:01:12.920607110 +0900 @@ -70,7 +70,7 @@ void rcar_du_vsp_disable(struct rcar_du_ void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc); void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc); #else -static inline int rcar_du_vsp_init(struct rcar_du_vsp *vsp) { return 0; }; +static inline int rcar_du_vsp_init(struct rcar_du_vsp *vsp) { return -ENXIO; }; static inline void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) { }; static inline void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) { }; static inline void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) { };