From patchwork Mon Oct 3 16:43:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 9360743 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 D73E96075E for ; Mon, 3 Oct 2016 16:43:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDEDC288A2 for ; Mon, 3 Oct 2016 16:43:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1D04288A4; Mon, 3 Oct 2016 16:43:47 +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 3148F288A2 for ; Mon, 3 Oct 2016 16:43:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BABDD6E57A; Mon, 3 Oct 2016 16:43:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 454716E57A for ; Mon, 3 Oct 2016 16:43:43 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id b184so15569144wma.3 for ; Mon, 03 Oct 2016 09:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=kk6vuVvLfqZ9c5AC49gx0WAvV7inC/zGyokSrE02U7c=; b=Fd1FYM8pgt3Oir+5rE4JQPk2NuuXkIamy9qx32f1tOPccEAdXZ2YENVE2zei5iXJze VThfsQPaYGk9JDnT1YdOmnMyuaM9p6T9GG6/2eBj9FSsuqJ9dX0QtXxBENZPUzdJnV+M TndwvTz+YhU53HuNR13FoMxd4T55rqnYqvTBG0BwEFvPFajRtJfF2Gn1vD7tAalVSSY1 tHjqPsw9H+F4hBXZAnhLME8K4UEvtrvAolr8xwYNBcxjYf9+mDtEAqEsbZsfWmi4yaVP vNZd6Lwq15CThRDeDoAl4NlJumuGb0bpkjTMUOMT5++gKxghKcbDoqslAnj4RUAkVteS Wmkg== 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:subject:date:message-id; bh=kk6vuVvLfqZ9c5AC49gx0WAvV7inC/zGyokSrE02U7c=; b=e580PasXC0tjxn1P/TnVSYGbxpAN+2RG5tmuUocDGIgar/urjdVN4qCFYmECiDlp8I cbOOTAPUbt2zVF63d3T/YQ2wiEiLTi9DEtubOEnIVboyxtz048tOlXWJZOEGXI6HtOkB 5wrtLWex0h7xuQTQVuIe2mu4Cc8QFgzXpMAsWYsrYqTysg5Kua73hmjakDno+Is+zIjW LXVlqcKspElJRwAW90+y3oTogEDGc781Gs7TT/JWwRsmpFpPKfWn7mqqkjf8YqTM3t72 sBR6VoCDAwnanl/pNUpRMhm3Zwq/v4ourxEkapVzO6R56u5l6d0vT2j0nGzyIf5wVzWf O+Ew== X-Gm-Message-State: AA6/9RmwwVbA8qsa3htZNUWMbv/B1Pm9p5jFQqwR+HhhZv3GIK1x5WSqFT0fkxuoodZRsg== X-Received: by 10.194.17.197 with SMTP id q5mr2253982wjd.115.1475513006288; Mon, 03 Oct 2016 09:43:26 -0700 (PDT) Received: from arch-x220.cbg.collabora.co.uk ([2a00:1098:5:0:120b:a9ff:fe8d:c914]) by smtp.gmail.com with ESMTPSA id 190sm19688117wmk.13.2016.10.03.09.43.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Oct 2016 09:43:25 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/virtio: populate .set_busid callback Date: Mon, 3 Oct 2016 17:43:17 +0100 Message-Id: <20161003164317.15546-1-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.9.3 Cc: Daniel Vetter , emil.l.velikov@gmail.com, stable@vger.kernel.org, Laszlo Ersek 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 Earlier commit was removing all the users of drm_platform_set_busid and removed the virtio hunk (which uses the PCI version of the function) by mistake. This in itself resulted in user space receiving an incorrect value for the busid, which in the case below lead to the failure to detect the (correct) device and ultimately the X server failing to start. Fixes: a325725633c ("drm: Lobotomize set_busid nonsense for !pci drivers") Cc: Daniel Vetter Cc: Laszlo Ersek Cc: stable@vger.kernel.org Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1366842 Reported-by: Laszlo Ersek Signed-off-by: Emil Velikov Reviewed-by: Emil Velikov Tested-by: Laszlo Ersek --- Since I'm not 100% sure if we can get into .set_busid() as pci_dev is NULL (for the virtio-vga 'vs' virgio-gpu-pci case) I've left the local wrapper. Note: patch is against mainline (refs/tags/v4.8) but should apply for drm-next/others. --- drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 10 ++++++++++ drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + 3 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c index 7f0e93f87..88a3916 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c +++ b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c @@ -27,6 +27,16 @@ #include "virtgpu_drv.h" +int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master) +{ + struct pci_dev *pdev = dev->pdev; + + if (pdev) { + return drm_pci_set_busid(dev, master); + } + return 0; +} + static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev) { struct apertures_struct *ap; diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c index c13f70c..5820b702 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.c +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c @@ -117,6 +117,7 @@ static const struct file_operations virtio_gpu_driver_fops = { static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER | DRIVER_ATOMIC, + .set_busid = drm_virtio_set_busid, .load = virtio_gpu_driver_load, .unload = virtio_gpu_driver_unload, .open = virtio_gpu_driver_open, diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index b18ef31..acf556a 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -49,6 +49,7 @@ #define DRIVER_PATCHLEVEL 1 /* virtgpu_drm_bus.c */ +int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master); int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev); struct virtio_gpu_object {