Message ID | 20170719021516.24718-2-dja@axtens.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> 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 2B9E9602A7 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 19 Jul 2017 02:16:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13D0C28585 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 19 Jul 2017 02:16:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06F782859E; Wed, 19 Jul 2017 02:16:41 +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 9A3CA28585 for <patchwork-linux-arm@patchwork.kernel.org>; Wed, 19 Jul 2017 02:16:40 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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=tO7fH+8PkjLsSvaI+m0dXx6/qSlv+ZFwPjJTgZQujok=; b=o7ZlAqP21n/Q7E/5lUs0EXAyIk vdix5Xu7QpEd6lHML9nIRqz000Dov0/FW4cvB2ovCowUdU0qBdE9EVI3be9qw4EcRX1Yk4cSsfI1i YQxFIK7qa8YMjIlt2/GbM1KEKrSCTi5HpaY6XtOF9tcU7A4FRUQ9Dq3RI2rgxXzUb4XwLee0GwK/a 1h3mmKbi81g0h8E4eFTwkGQR15kkdXTzU/7MtT8pbrunjqsl/QLkEHEUMhQsro/50V/aSZ6vd0Q4Z qwxvUSRRMDV8TYb4kC3FA7xrtPoBL1Bc8COE4e9f3xnuLNVv3wVHxsKODfD5cSLrHkrPvpf7wpoZG BQckEJjA==; 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 1dXeXV-0006AP-9R; Wed, 19 Jul 2017 02:16:37 +0000 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXeXN-0005tE-Cm for linux-arm-kernel@lists.infradead.org; Wed, 19 Jul 2017 02:16:35 +0000 Received: by mail-pf0-x242.google.com with SMTP id o88so4673319pfk.1 for <linux-arm-kernel@lists.infradead.org>; Tue, 18 Jul 2017 19:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rSS2eipgv9pIXzYYfw3XVFzRsORq4uNuyG7CP1C5huE=; b=ViZpTqxFMG96m0vljkVYxRt5IkKSsLZ+wn8O8kaWEPM7eYkWmaYIOfodL18vHTJDKC lOUoiloMQDnSdObtaP6qxpBJiarjAhT1wnsgc2+IDpWz3UPXGCNDQZtTvLRaiKxFWHaf HbwJqrsSZcPt1r1Q/f7s9ti8Yz5aNRT8PtO/s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rSS2eipgv9pIXzYYfw3XVFzRsORq4uNuyG7CP1C5huE=; b=pcALa8Y9JePa1roKNJy25/HNtlgxDnn2AdqrPM/HH+J4k1M/umdpNkKlTwmbgvz447 eyybRceZU/ylMIg7eEO8RxCdO2LzFgCIPU7tJo3jsF3DbBF0a6xVqqULF4dEzxu/oO2p +JG8O8pFYw/892sghd0vSKLP1RkmcGVXUB1CAioJw1AKgnyGH6yF61eEpDvGws82z39o PJVSN5bGR1z1599B8sssSndJR/sBMJsgRur3u5LDSNsDN4QV/G6EQKNUyt2gjy1bYoWp jo7NirIBMLACMyXnyhWlh4O3PBN4FQgYUfv78Up+mJIq9zVdaf8udO95Uj3HizhEKTJY G8xQ== X-Gm-Message-State: AIVw1110+ts8XOLn1ola6UzULUdFX9xZWaMSXsaV3+g4TpkE15S5jclr m5o59Nfhk+y21H1u X-Received: by 10.99.132.195 with SMTP id k186mr600413pgd.127.1500430568360; Tue, 18 Jul 2017 19:16:08 -0700 (PDT) Received: from localhost.localdomain (203-59-51-51.dyn.iinet.net.au. [203.59.51.51]) by smtp.gmail.com with ESMTPSA id d70sm8732241pfg.132.2017.07.18.19.16.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jul 2017 19:16:07 -0700 (PDT) From: Daniel Axtens <dja@axtens.net> To: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/4] powerpc: simplify and fix VGA default device behaviour Date: Wed, 19 Jul 2017 12:15:13 +1000 Message-Id: <20170719021516.24718-2-dja@axtens.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170719021516.24718-1-dja@axtens.net> References: <20170719021516.24718-1-dja@axtens.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170718_191631_038882_91327DD9 X-CRM114-Status: GOOD ( 16.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: gabriele.paoloni@huawei.com, airlied@linux.ie, benh@kernel.crashing.org, Brian King <brking@linux.vnet.ibm.com>, will.deacon@arm.com, z.liuxinliang@hisilicon.com, bhelgaas@google.com, alex.williamson@redhat.com, catalin.marinas@arm.com, zourongrong@gmail.com, daniel.vetter@intel.com, Daniel Axtens <dja@axtens.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 341a7469cab8..c95fdda3a2dc 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -1746,8 +1746,11 @@ static void fixup_vga(struct pci_dev *pdev) { u16 cmd; + if (vga_default_device()) + return; + pci_read_config_word(pdev, PCI_COMMAND, &cmd); - if ((cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) || !vga_default_device()) + if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) vga_set_default_device(pdev); }
Some powerpc devices provide a PCI display that isn't picked up by the VGA arbiter, presumably because it doesn't support the PCI legacy VGA ranges. Commit c2e1d84523ad ("powerpc: Set default VGA device") introduced an arch quirk to mark these devices as default to fix X autoconfig. The commit message stated that the patch: Ensures a default VGA is always set if a graphics adapter is present, even if firmware did not initialize it. If more than one graphics adapter is present, ensure the one initialized by firmware is set as the default VGA device. The patch used the following test to decide whether or not to mark a device as default: pci_read_config_word(pdev, PCI_COMMAND, &cmd); if ((cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) || !vga_default_device()) vga_set_default_device(pdev); This doesn't seem like it works quite as intended. Because of the logical OR, the default device will be set in 2 cases: 1) if there is no default device OR 2) if this device has normal memory/IO decoding turned on This will work as intended if there is only one device, but if there are multiple devices, we may override the device the VGA arbiter picked. Instead, set a device as default if there is no default device AND this device decodes. This will not change behaviour on single-headed systems. Cc: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: Daniel Axtens <dja@axtens.net> --- Tested in TCG (the card provided by qemu doesn't automatically register with vgaarb, so the relevant code path has been tested) but I would appreciate any tests on real hardware. --- arch/powerpc/kernel/pci-common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)