From patchwork Fri Jul 14 12:26:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gabriele Paoloni X-Patchwork-Id: 9840901 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 75E1660393 for ; Fri, 14 Jul 2017 12:33:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6815E28778 for ; Fri, 14 Jul 2017 12:33:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CDEE2877F; Fri, 14 Jul 2017 12:33:21 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 11F8628779 for ; Fri, 14 Jul 2017 12:33:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xVg+7T1/YgkMJMSJcU5E+zE8aWN9nA7EbDAUOReMsMA=; b=ncvlw4ZT2dHsC/ w2XZWtnMn8APrKdUGf7EvIxVZA5kuw1d2dvrNA+B8iHUDpVbxt4Tnj/tv9+EkeotmiNKFy4zFoh9m NNukXTeyD6PJUzmoL4LJJIsxNnjYBMYn2KJPg8Ww7zlgaLxeNHsXp1CEYBqfh9+RJ7Mqu8mtBesnN gG07coBB/lOF0bDcE1h2MflQ+hOZg1Sf0+hxeqoCX99YeO+Zej+jIiBD15lHU8uyqiUe/NQo1JePp jmPECMwKtR5b2qIzI6/NgZGjEhkotJD1GChCcwrh/OEBlHDgb+a90iDCcMpEJtmk0/vQKam/Z+0ND H5JVw//cw2V1uG0NOeQQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dVzmY-0005O9-Mh; Fri, 14 Jul 2017 12:33:18 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dVzmT-0005M5-OK for linux-arm-kernel@lists.infradead.org; Fri, 14 Jul 2017 12:33:16 +0000 Received: from 172.30.72.55 (EHLO nkgeml414-hub.china.huawei.com) ([172.30.72.55]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ASC11037; Fri, 14 Jul 2017 20:26:20 +0800 (CST) Received: from FRAEML703-CAH.china.huawei.com (10.206.14.34) by nkgeml414-hub.china.huawei.com (10.98.56.75) with Microsoft SMTP Server (TLS) id 14.3.235.1; Fri, 14 Jul 2017 20:26:17 +0800 Received: from FRAEML521-MBX.china.huawei.com ([169.254.1.122]) by fraeml703-cah.china.huawei.com ([10.206.14.34]) with mapi id 14.03.0301.000; Fri, 14 Jul 2017 14:26:05 +0200 From: Gabriele Paoloni To: Benjamin Herrenschmidt , Alex Williamson , Bjorn Helgaas Subject: RE: [PATCH v4] PCI: Support hibmc VGA cards behind a misbehaving HiSilicon bridge Thread-Topic: [PATCH v4] PCI: Support hibmc VGA cards behind a misbehaving HiSilicon bridge Thread-Index: AQHS+s1b+EtR4rKf6ku/WSkA/VN5laJQfQIAgAEKviD///e9AIAAoqUAgAACrwCAARsB8A== Date: Fri, 14 Jul 2017 12:26:05 +0000 Message-ID: References: <20170712050811.3620-1-dja@axtens.net> <20170712200430.GI14614@bhelgaas-glaptop.roam.corp.google.com> <20170713112938.GI4486@bhelgaas-glaptop.roam.corp.google.com> <20170713151146.53e9644c@w520.home> <1499980882.2865.65.camel@kernel.crashing.org> In-Reply-To: <1499980882.2865.65.camel@kernel.crashing.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.220.134.92] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.5968B86E.00B3, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=169.254.1.122, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 86d06e2286f83f3fd02ac0f4b22bc8e7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170714_053314_860667_F0C6D91A X-CRM114-Status: GOOD ( 19.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , "linux-pci@vger.kernel.org" , Will Deacon , "Liuxinliang \(Matthew Liu\)" , Catalin Marinas , Rongrong Zou , Daniel Vetter , "linux-arm-kernel@lists.infradead.org" , Daniel Axtens Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Ben, Alex > -----Original Message----- > From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org] > Sent: 13 July 2017 22:21 > To: Alex Williamson; Bjorn Helgaas > Cc: Gabriele Paoloni; Daniel Axtens; linux-pci@vger.kernel.org; > Liuxinliang (Matthew Liu); Rongrong Zou; Catalin Marinas; Will Deacon; > linux-arm-kernel@lists.infradead.org; David Airlie; Daniel Vetter > Subject: Re: [PATCH v4] PCI: Support hibmc VGA cards behind a > misbehaving HiSilicon bridge > > On Thu, 2017-07-13 at 15:11 -0600, Alex Williamson wrote: > > > >       */ > > > > -   if (vga_default == NULL && > > > > -       ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == > VGA_RSRC_LEGACY_MASK)) { > > > > +   if (vga_default == NULL) { > > > >              vgaarb_info(&pdev->dev, "setting as boot VGA > device\n"); > > > >              vga_set_default_device(pdev); > > > >      } > > > > > > "Legacy" is the breadcrumb we use to try to pick the same device for > > default VGA as the system firmware used as the boot VGA.  There can > be > > multiple VGA devices in the system, the change above would simply > make > > the first discovered device be the default VGA.  That would break > many, > > many systems.  If legacy VGA ranges mean nothing on ARM64, then > follow > > the powerpc lead and make an arch quirk that simply selects the first > > enabled VGA device as the default.  VGA routing is part of the PCI > spec > > though, so the default of selecting the device with routing enabled > > makes sense.  Thanks, > > "Legacy" there iirc also means that it has decoding enabled at boot. If > you pick the first one you may pick a device that doesn't and hasn't > been initialized by any driver (good old BIOS-initialized text mode). Right so effectively if there is a legacy dev we should pick that up; however what about the following code: Above after we have filled the list of VGA devices by iterating over all PCI devices we check if no legacy one has been set as default VGA device yet: therefore we set the first VGA device in the list as default one... Do you think it would work? Thanks Gab > > Cheers, > Ben. diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index 92f1452..ab3ad9a 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c @@ -1424,6 +1424,14 @@ static int __init vga_arb_device_init(void) list_for_each_entry(vgadev, &vga_list, list) { struct device *dev = &vgadev->pdev->dev; + + /* if no legacy device has been set as default VGA + * device, just pick up the first one in the list */ + if (vga_default == NULL) { + vgaarb_info(dev, "setting as boot VGA device\n"); + vga_set_default_device(vgadev->pdev); + } + #if defined(CONFIG_X86) || defined(CONFIG_IA64) /* * Override vga_arbiter_add_pci_device()'s I/O based detection