Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808543/?format=api
{ "id": 808543, "url": "http://patchwork.ozlabs.org/api/patches/808543/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20170901072744.2409-3-dja@axtens.net/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170901072744.2409-3-dja@axtens.net>", "list_archive_url": null, "date": "2017-09-01T07:27:43", "name": "[v3,2/3] drm: add fallback default device detection", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "54e272ae5aeb5e00530abf7ad4d5af4003bd84a3", "submitter": { "id": 65792, "url": "http://patchwork.ozlabs.org/api/people/65792/?format=api", "name": "Daniel Axtens", "email": "dja@axtens.net" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20170901072744.2409-3-dja@axtens.net/mbox/", "series": [ { "id": 959, "url": "http://patchwork.ozlabs.org/api/series/959/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=959", "date": "2017-09-01T07:27:41", "name": "Split default display handling out from VGA arbiter", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/959/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808543/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808543/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-pci-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=axtens.net header.i=@axtens.net\n\theader.b=\"ByoVjlt3\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xk9pB6cCLz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 1 Sep 2017 17:28:34 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751398AbdIAH2e (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tFri, 1 Sep 2017 03:28:34 -0400", "from mail-pg0-f68.google.com ([74.125.83.68]:37601 \"EHLO\n\tmail-pg0-f68.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751354AbdIAH2d (ORCPT\n\t<rfc822;linux-pci@vger.kernel.org>); Fri, 1 Sep 2017 03:28:33 -0400", "by mail-pg0-f68.google.com with SMTP id t193so1236431pgc.4\n\tfor <linux-pci@vger.kernel.org>; Fri, 01 Sep 2017 00:28:33 -0700 (PDT)", "from localhost.localdomain (124-171-202-56.dyn.iinet.net.au.\n\t[124.171.202.56]) by smtp.gmail.com with ESMTPSA id\n\tl30sm2430300pgc.61.2017.09.01.00.28.26\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 01 Sep 2017 00:28:32 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=wnD4PPKKYv/V53yhQhN0UzLmztzhzz/GAnd2khbo4L8=;\n\tb=ByoVjlt3ySIGfavIGSU2wdm95L+g9XCtiJou+7cMIlFr/nV9K/7smV7uuI3wtZ1dRa\n\t9FXxW8OZ2mzowpEQRfEB/TlyV7Ps2Ta5IE9RWJ6J21O0gkb/Prbt7/mX+fUUKw/g1j7X\n\tHN/k2IDrr4pLPWzOtRiuODoxOzLi8ZzVY1oY4=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=wnD4PPKKYv/V53yhQhN0UzLmztzhzz/GAnd2khbo4L8=;\n\tb=sieXNIyQIG1a1WozXZZOzG9IeO8/q+bW1oqv3MH1pheduvhyYefk6lfuDm23zHruLd\n\tXMqR75h35y4JUekvUQOW51hcpjauq7bQdJ5FHskLsn0TeqAkYO+4owUTk4MEwQB5paRA\n\tAnZhsr/6Pze2HmcbwzsZ+EfT5HLdgpakfaXdgBFLXWCvMq2IN1e0ustSP/mXMLpyFNdy\n\tOa6vW+oPb2JxOdROT+g3Y3YB09HoGRyQN7pKasM2eq0LC+ML/R2UOxBubYGWbVvADle7\n\tcD4MkMsRoSFzVds9KpWaMEaPg2YKbRNVVroHC7Jtv0vkHjF27KWZoXpudDClym9k8KYK\n\tn43w==", "X-Gm-Message-State": "AHPjjUg+Q/YWILT91+sY3O6Hrnuhroc5+TM86SygCCy9EzkpzHbnE5fK\n\tBBQc9UHg8jyCizsiAfELDQ==", "X-Google-Smtp-Source": "ADKCNb5G47z8NOzuV/WeooAYxaoGWu6SXt4g8gRYioqvc5CB27cgtFx6+P+cIgy9IkCwU5+OzPvTsg==", "X-Received": "by 10.98.59.11 with SMTP id i11mr1242701pfa.237.1504250912740;\n\tFri, 01 Sep 2017 00:28:32 -0700 (PDT)", "From": "Daniel Axtens <dja@axtens.net>", "To": "linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,\n\tlinux-arm-kernel@lists.infradead.org", "Cc": "benh@kernel.crashing.org, z.liuxinliang@hisilicon.com,\n\tzourongrong@gmail.com, catalin.marinas@arm.com,\n\twill.deacon@arm.com, gabriele.paoloni@huawei.com,\n\thelgaas@kernel.org, airlied@linux.ie, daniel.vetter@intel.com,\n\talex.williamson@redhat.com, dri-devel@lists.freedesktop.org,\n\tlukas@wunner.de, ard.biesheuvel@linaro.org,\n\tlorenzo.pieralisi@arm.com, Daniel Axtens <dja@axtens.net>", "Subject": "[PATCH v3 2/3] drm: add fallback default device detection", "Date": "Fri, 1 Sep 2017 17:27:43 +1000", "Message-Id": "<20170901072744.2409-3-dja@axtens.net>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170901072744.2409-1-dja@axtens.net>", "References": "<20170901072744.2409-1-dja@axtens.net>", "Sender": "linux-pci-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-pci.vger.kernel.org>", "X-Mailing-List": "linux-pci@vger.kernel.org" }, "content": "The VGA arbiter selects a default VGA device that is enabled and\nreachable via the legacy VGA resources (mem 0xa0000-0xbffff, io\n0x3b0-0x3bb, io 0x3c0-0x3df, etc).\n\n(As a special case for x86 and IA64, this can be overridden by\nEFI.)\n\nIf there is no such device, e.g., because there's no enabled VGA\ndevice, the host bridge doesn't support access to those legacy\nresources, or a PCI-PCI bridge doesn't have VGA Enable set, a\nplatform may select an arbitrary device by calling\npci_set_default_display(). powerpc does this, for example.\n\nIf there is also no platform hook, there will be no default\ndevice nominated. This is not necessarily what we want.\n\nAdd handling for devices that aren't handled by the vga arbiter or\nplatform by adding a late initcall and a class enable hook. If there\nis no default from vgaarb or the platform then the first VGA card\nthat is enabled, has a driver bound, and can decode memory or I/O\nwill be marked as default.\n\nThis means single-card setups on systems without access to legacy\nareas and without arch hooks will work. Multi-card setups on these\nsystems will nominate an arbitrary device, rather than no devices.\n\nSigned-off-by: Daniel Axtens <dja@axtens.net>\n\n---\n\nv3:\n\nSplit out from re-organisation for simplicity.\nAdd better description and better documentaion.\n\nThanks to (in no particular order), Daniel Vetter, Lorenzo Pieralisi,\nArd Biesheuvel and Dave Airlie. Special thanks to Ben Herrenschmidt\nand Bjorn Helgass, whose prose I have borrowed.\n\nv1:\n\nTested on:\n - x86_64 laptop\n - arm64 D05 board with hibmc card\n - qemu powerpc with tcg and bochs std-vga\n\nI know this adds another config option and that's a bit sad, but\nwe can't include it unconditionally as it depends on PCI.\nSuggestions welcome.\n---\n drivers/gpu/vga/default_display.c | 77 +++++++++++++++++++++++++++++++++++++++\n 1 file changed, 77 insertions(+)", "diff": "diff --git a/drivers/gpu/vga/default_display.c b/drivers/gpu/vga/default_display.c\nindex 99e4723360da..b8e4a5af38e8 100644\n--- a/drivers/gpu/vga/default_display.c\n+++ b/drivers/gpu/vga/default_display.c\n@@ -42,6 +42,10 @@\n *\n * 2) Anything specified by an arch hook,\n * e.g. arch/powerpc/kernel/pci-common.c::fixup_vga()\n+ *\n+ * 3) If neither of those, then we still want to pick something. For\n+ * now, pick the first PCI VGA device with a driver bound and with\n+ * memory or I/O control on.\n */\n \n #include <linux/module.h>\n@@ -53,6 +57,12 @@\n \n static struct pci_dev *vga_default;\n \n+/*\n+ * only go active after the late initcall so as not to interfere with\n+ * the arbiter\n+ */\n+static bool vga_default_active = false;\n+\n /**\n * pci_default_display - return the default display device\n *\n@@ -84,3 +94,70 @@ void pci_set_default_display(struct pci_dev *pdev)\n \tpci_dev_put(vga_default);\n \tvga_default = pci_dev_get(pdev);\n }\n+\n+static bool vga_default_try_device(struct pci_dev *pdev)\n+{\n+\tu16 cmd;\n+\n+\t/* Only deal with VGA class devices */\n+\tif ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)\n+\t\treturn false;\n+\n+\t/* Only deal with devices with drivers bound */\n+\tif (!pdev->driver)\n+\t\treturn false;\n+\n+\t/* Require I/O or memory control */\n+\tpci_read_config_word(pdev, PCI_COMMAND, &cmd);\n+\tif (!(cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)))\n+\t\treturn false;\n+\n+\tdev_info(&pdev->dev, \"vga_default: setting as default device\\n\");\n+\tpci_set_default_display(pdev);\n+\treturn true;\n+}\n+\n+static int __init vga_default_init(void)\n+{\n+\tstruct pci_dev *pdev;\n+\n+\tvga_default_active = true;\n+\n+\tif (pci_default_display())\n+\t\treturn 0;\n+\n+\tpdev = NULL;\n+\twhile ((pdev =\n+\t\tpci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,\n+\t\t\t PCI_ANY_ID, pdev)) != NULL) {\n+\t\tif (vga_default_try_device(pdev))\n+\t\t\treturn 0;\n+\t}\n+\n+\treturn 0;\n+}\n+late_initcall(vga_default_init);\n+\n+/*\n+ * A driver could be loaded much later than late_initcall, for example\n+ * if it's in a module.\n+ *\n+ * We want to pick that up. However, we want to make sure this does\n+ * not interfere with the arbiter - it should only activate if the\n+ * arbiter has already had a chance to operate. To ensure this, we set\n+ * vga_default_active in the late_initcall: as the vga arbiter is a\n+ * subsys initcall, it is guaranteed to fire first.\n+ */\n+static void vga_default_enable_hook(struct pci_dev *pdev)\n+{\n+ if (!vga_default_active)\n+\t return;\n+\n+ if (pci_default_display())\n+ return;\n+\n+ vga_default_try_device(pdev);\n+}\n+DECLARE_PCI_FIXUP_CLASS_ENABLE(PCI_ANY_ID, PCI_ANY_ID,\n+\t\t\t PCI_CLASS_DISPLAY_VGA, 8,\n+\t\t\t vga_default_enable_hook)\n", "prefixes": [ "v3", "2/3" ] }