From patchwork Tue Sep 13 05:53:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 9328395 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 1B79160231 for ; Tue, 13 Sep 2016 05:58:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDF1C29123 for ; Tue, 13 Sep 2016 05:58:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1C2C29126; Tue, 13 Sep 2016 05:58:05 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6962329123 for ; Tue, 13 Sep 2016 05:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750927AbcIMF6E (ORCPT ); Tue, 13 Sep 2016 01:58:04 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:44508 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750747AbcIMF6E (ORCPT ); Tue, 13 Sep 2016 01:58:04 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8D5w36a044588 for ; Tue, 13 Sep 2016 01:58:03 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0a-001b2d01.pphosted.com with ESMTP id 25e3v0fjty-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 13 Sep 2016 01:58:03 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 12 Sep 2016 23:57:48 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 12 Sep 2016 23:57:46 -0600 X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: xyjxie@linux.vnet.ibm.com Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 214DD1FF002E; Mon, 12 Sep 2016 23:57:27 -0600 (MDT) Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u8D5vjJ015466966; Tue, 13 Sep 2016 05:57:45 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 134B7AC03A; Tue, 13 Sep 2016 01:57:45 -0400 (EDT) Received: from localhost (unknown [9.186.9.18]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id BC2BDAC03F; Tue, 13 Sep 2016 01:57:44 -0400 (EDT) From: Yongji Xie To: linux-fbdev@vger.kernel.org Cc: plagnioj@jcrosoft.com, tomi.valkeinen@ti.com, bhelgaas@google.com, xyjxie@linux.vnet.ibm.com Subject: [PATCH] video: fbdev: offb: Call pci_enable_device() before using the PCI VGA device Date: Tue, 13 Sep 2016 13:53:46 +0800 X-Mailer: git-send-email 1.7.1 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16091305-0016-0000-0000-000004A5F6F9 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005752; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000185; SDB=6.00757113; UDB=6.00358958; IPR=6.00530461; BA=6.00004711; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012657; XFM=3.00000011; UTC=2016-09-13 05:57:47 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16091305-0017-0000-0000-000032DDFF9D Message-Id: <1473746026-11695-1-git-send-email-xyjxie@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-13_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609130090 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently the offb module will use the PCI VGA device as frame buffer device without calling something like pci_enable_device(). However, this would cause some problem if we disable memory decoding of the upstream bridge before. When the console driver issued memory access to the VGA device, the access cannot be supported by the bridge which will cause EEH error on Power machine. Signed-off-by: Yongji Xie --- drivers/video/fbdev/offb.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/video/fbdev/offb.c b/drivers/video/fbdev/offb.c index fb60a8f..906c6e7 100644 --- a/drivers/video/fbdev/offb.c +++ b/drivers/video/fbdev/offb.c @@ -625,6 +625,21 @@ static void __init offb_init_nodriver(struct device_node *dp, int no_real_node) if (address == OF_BAD_ADDR && addr_prop) address = (u64)addr_prop; if (address != OF_BAD_ADDR) { +#ifdef CONFIG_PCI + const __be32 *vidp, *didp; + u32 vid, did; + struct pci_dev *pdev; + + vidp = of_get_property(dp, "vendor-id", NULL); + didp = of_get_property(dp, "device-id", NULL); + if (vidp && didp) { + vid = be32_to_cpup(vidp); + did = be32_to_cpup(didp); + pdev = pci_get_device(vid, did, NULL); + if (!pdev || pci_enable_device(pdev)) + return; + } +#endif /* kludge for valkyrie */ if (strcmp(dp->name, "valkyrie") == 0) address += 0x1000;