From patchwork Fri Aug 4 10:20:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Axtens X-Patchwork-Id: 9880939 X-Patchwork-Delegate: bhelgaas@google.com 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 6989B602B8 for ; Fri, 4 Aug 2017 10:22:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59C14289C5 for ; Fri, 4 Aug 2017 10:22:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BA07289CA; Fri, 4 Aug 2017 10:22:00 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 D56CF289C5 for ; Fri, 4 Aug 2017 10:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751291AbdHDKV7 (ORCPT ); Fri, 4 Aug 2017 06:21:59 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:33392 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278AbdHDKV6 (ORCPT ); Fri, 4 Aug 2017 06:21:58 -0400 Received: by mail-wr0-f193.google.com with SMTP id y43so2693485wrd.0 for ; Fri, 04 Aug 2017 03:21:58 -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=ljvN5OwVJMTS/oV/Vtbg3wiSdG+YhKDLm16g+jeE4Ec=; b=A1iOqtb2iiRbcJ6T5t+JalYsEJkocVCP/q6BUUeWzh64aZ2FvBqpKLyHyNlXYsZAn0 5QL4zK8cqclSaOtixP96XINgibdrYdC9lf0AuZk8yvCCCT12gkltnhCgT84ckb61evER x22m7cT8xOBfqb7bSeU1HSB1+YUClzmq7L7pk= 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=ljvN5OwVJMTS/oV/Vtbg3wiSdG+YhKDLm16g+jeE4Ec=; b=uOSSSlPmVx9Qa9pR4Mk8HJOBXq71Tc46YscX6vQYexFvWktRt50JeuU4QRPasL+Cdo XvQDeZwTYNJokhXL1NmDayiIzJVAfXwuXobnO5CX9ro9g6o0OcbwClJlDS5895lhyWq3 d11R2y4sVQpd3/rU9YqoU2IhjyF21/NDXr3mAu/fsYg/9vLSf6icv3dTdvspKpLWsfv+ KQrl/mb2c9WnjrIIXl3r/gRYvMCaqBYO0Ljlbp2Bo4ydk1n5/Tm7vgtg76+vfLf+Yy8Q kWPr5WVdxu+7KryTk0DscyiQ9hrTfmP69KIn0uPUfMPsJFQ5bTEWcMfDXH2dkO0qzqex VtEw== X-Gm-Message-State: AIVw110SnM/9BCXs/ivZhK4TSRRSKqP58s0Fyy6+e7bGbTS9lZZI/soq 44CquBhlnIQ8JlmTV87rew== X-Received: by 10.223.175.212 with SMTP id y20mr1246167wrd.267.1501842117191; Fri, 04 Aug 2017 03:21:57 -0700 (PDT) Received: from localhost.localdomain (uk.sesame.canonical.com. [91.189.88.154]) by smtp.gmail.com with ESMTPSA id g93sm4037467wrd.11.2017.08.04.03.21.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Aug 2017 03:21:56 -0700 (PDT) From: Daniel Axtens To: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Cc: benh@kernel.crashing.org, z.liuxinliang@hisilicon.com, zourongrong@gmail.com, catalin.marinas@arm.com, will.deacon@arm.com, gabriele.paoloni@huawei.com, bhelgaas@google.com, airlied@linux.ie, daniel.vetter@intel.com, alex.williamson@redhat.com, Daniel Axtens , Brian King Subject: [PATCH 3/3] powerpc: replace vga_fixup() with generic code Date: Fri, 4 Aug 2017 20:20:33 +1000 Message-Id: <20170804102033.27731-4-dja@axtens.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170804102033.27731-1-dja@axtens.net> References: <20170804102033.27731-1-dja@axtens.net> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, we do a PCI fixup to mark a default card so that Xorg autoconfiguration works. There is a new generic method to do this sort of vga fixup, and it occurs by default. Drop our old method. This method is different: - it will only mark a card as default if a driver is bound - the marking will happen at late_initcall time, or even later if a card is enabled later on (via an ENABLE hook). Currently things are enabled in a FINAL hook. This *does* change behaviour under some circumstances. For example, pseries_le_defconfig doesn't have DRM drivers for many of the qemu GPU models, including the 'standard' vga. So when a VM with that GPU boots, no driver binds the GPU, and it does *not* get marked as default. Previously, it would have been marked as default. As it turns out Xorg (at least Xorg v1.19.3) can still autoconfigure it, as Xorg is smart about OpenFirmware framebuffer devices. If the right GPU driver is available, and the OpenFirmware fb driver is removed, the device *is* marked as a boot GPU. (If the OpenFirmware driver is around, it enables the PCI device but doesn't bind to it, making it ineligible to be the default card. Then, when the right driver is loaded, the enable hook doesn't fire because the card has already been enabled. Fun!) So everything works as intended, I guess. Cc: Brian King Signed-off-by: Daniel Axtens --- This would benefit from some tests on real hardware. --- arch/powerpc/kernel/pci-common.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 6cfaec107374..65cd5bad5ad6 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -1741,18 +1740,3 @@ static void fixup_hide_host_resource_fsl(struct pci_dev *dev) } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MOTOROLA, PCI_ANY_ID, fixup_hide_host_resource_fsl); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, fixup_hide_host_resource_fsl); - -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_set_default_device(pdev); - -} -DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_DISPLAY_VGA, 8, fixup_vga);