From patchwork Mon Jul 3 07:15:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?H=C3=A5kon_Alstadheim?= X-Patchwork-Id: 9822057 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 5AEB060237 for ; Mon, 3 Jul 2017 07:18:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4735D28396 for ; Mon, 3 Jul 2017 07:18:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B5EB2853A; Mon, 3 Jul 2017 07:18:22 +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=-3.3 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 441FC28396 for ; Mon, 3 Jul 2017 07:18:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRva3-0005qF-LN; Mon, 03 Jul 2017 07:15:35 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRva2-0005q9-I4 for Xen-devel@lists.xen.org; Mon, 03 Jul 2017 07:15:34 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 82/CA-02962-51FE9595; Mon, 03 Jul 2017 07:15:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrEIsWRWlGSWpSXmKPExsWS+72EQ1f0fWS kwZbTfBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8al3ZuYCjYLVhzZdJG9gfEWXxcjF4eQQAuz RNuLLuYuRk4OCQFjiQ07djFDJC4wSrRvXs4G4rAI/GKS+PDwLitE5gyTRNebu2AtIgLSEke/n 2MCsdkEnCQ2vFzADmILCyhKHLrZBmbzCrhKbHr3igXEZhFQkdg+oRnMFhUIl7i47jQjRI2gxM mZT8DizALqEn/mXWKGsMUlbj2ZzwRhy0s0b50NdSq/xO23R1lADpIQ2M8ocbDxO+sERsFZSGb NQjJrFpJZs5DMWsDIsopRozi1qCy1SNfQQi+pKDM9oyQ3MTNH19DATC83tbg4MT01JzGpWC85 P3cTIzCsGYBgB+PNjQGHGCU5mJREeV1vRkYK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuCNegeUE yxKTU+tSMvMAUYYTFqCg0dJhPfAPaA0b3FBYm5xZjpE6hSjopQ4bwxInwBIIqM0D64NFtWXGG WlhHkZgQ4R4ilILcrNLEGVf8UozsGoJMzrBzKFJzOvBG76K6DFTECLG3oiQBaXJCKkpBoYa+J F3Wp68tq+uS5Yuv71uRnbFNZw3+SIeDs5Zu3C2RdkHhbreTNvulUsYSObaszPd/35+Qp+KRHm 0y8qpq+Ncj7493nwHImw0O0X+A9HRS11XRHj+ak+N2JK27631fk2p0NDo6Z2Tri7qtjUJsDcy OS1ePWBdX+7lxbP8FyWbbvsYtNT1UxWJZbijERDLeai4kQADXAKnuUCAAA= X-Env-Sender: hakon@alstadheim.priv.no X-Msg-Ref: server-4.tower-27.messagelabs.com!1499066132!104457435!1 X-Originating-IP: [109.247.116.8] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48667 invoked from network); 3 Jul 2017 07:15:33 -0000 Received: from asav21.altibox.net (HELO asav21.altibox.net) (109.247.116.8) by server-4.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 3 Jul 2017 07:15:33 -0000 Received: from postfix-relay.alstadheim.priv.no (148-252-117.52.3p.ntebredband.no [148.252.117.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: hakon.alstadheim@ntebb.no) by asav21.altibox.net (Postfix) with ESMTPSA id 9D408800ED for ; Mon, 3 Jul 2017 09:15:32 +0200 (CEST) X-Finnesikke-B-A-I-T: finnesikke@alstadheim.priv.no Received: from smtps.alstadheim.priv.no (localhost [127.0.0.1]) by postfix-relay.alstadheim.priv.no (Postfix) with ESMTP id A4920C002ED0 for ; Mon, 3 Jul 2017 09:15:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=alstadheim.priv.no; h=to :from:subject:message-id:date:mime-version:content-type :content-transfer-encoding; s=smtp; bh=8tM9oSDgT7atJSOlOPFQ/yzNc /o=; b=qUNzfzSPYHPii4xuRZt3G5B8GAUQpsmEw+bO21Oza706WlcFutL2LixzS OG1pC1O+z9+m1s3TyZFylwNPw56mwK5ILGv2KxSfAsrrzuU4OqLdPerAaakSMY3J qj1ySDSc0B+n4xdf1Kt6M05p9xG3hu12SC194wuOh7agZfFGRo= Received: from [192.168.2.201] (unknown [192.168.2.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: hakon) by smtps.alstadheim.priv.no (Postfix) with ESMTPSA id 9FD2A156FE1 for ; Mon, 3 Jul 2017 09:15:31 +0200 (CEST) To: Xen-devel@lists.xen.org From: =?UTF-8?Q?H=c3=a5kon_Alstadheim?= Message-ID: Date: Mon, 3 Jul 2017 09:15:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 Content-Language: en-US X-CMAE-Score: 0 X-CMAE-Analysis: v=2.2 cv=G9VeKJs5 c=1 sm=1 tr=0 a=VqhJaNiO3++x7tSG63gBkQ==:117 a=VqhJaNiO3++x7tSG63gBkQ==:17 a=IkcTkHD0fZMA:10 a=G3gG6ho9WtcA:10 a=YtCOWTnjplAV-vpGU2oA:9 a=QEXdDO2ut3YA:10 Subject: [Xen-devel] [BUG] Segv in radeon drm X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Not sure who this should go to, but running linux as domU under Xen triggers this bug. modprobe radeon on a linux domU wich has a "VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Curacao PRO [Radeon R7 370 / R9 270/370 OEM]" -card passed through to it, causes a NULL dereference in the kernel. Also graphics-card is non-functional causing X to hang, usually forcing me to "xl destroy ". I have succeded in loading the module in domU by giving radeon module various *pm=0 -options. Not tested further for exactly which option is needed. I have no idea what dev->pdev->bus->self is, or which invariants it should be subject to, so the correct fix is likely somewhere else. Below patch, which applies to all kernel-versions I have tried including 4.12, allows module to load: ----------------- ------------------------------------------------------------------ The module loads fine on bare metal _without_ the patch. In domU, output to console during load is (with patch): ------------------------------------------------------------------ [drm] radeon: 2048M of VRAM memory ready [drm] radeon: 2048M of GTT memory ready. [drm] Loading pitcairn Microcode [drm] Internal thermal controller with fan control [drm] invalid dev->pdev->bus->self [drm] radeon: dpm initialized [drm] Found VCE firmware/feedback version 50.0.1 / 17! ----------------------------------------------------------------- --- HÃ¥kon --- drivers/gpu/drm/drm_pci.c.orig 2017-04-22 21:56:04.634330554 +0200 +++ drivers/gpu/drm/drm_pci.c 2017-06-18 21:28:18.473439278 +0200 @@ -337,11 +337,28 @@ u32 lnkcap, lnkcap2; *mask = 0; - if (!dev->pdev) - return -EINVAL; - + if (!dev->pdev) { + DRM_INFO("invalid dev->pdev\n"); + return -EINVAL; + } + + if (!dev->pdev->bus) { + DRM_INFO("invalid dev->pdev->bus\n"); + return -EINVAL; + } + + if (!dev->pdev->bus->self) { + DRM_INFO("invalid dev->pdev->bus->self\n"); + return -EINVAL; + } + root = dev->pdev->bus->self; + if (!root->vendor) { + DRM_INFO("invalid root->vendor\n"); + return -EINVAL; + } + /* we've been informed via and serverworks don't make the cut */ if (root->vendor == PCI_VENDOR_ID_VIA || root->vendor == PCI_VENDOR_ID_SERVERWORKS)