From patchwork Tue Jul 23 21:15:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 2832216 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5350B9F4D4 for ; Tue, 23 Jul 2013 21:17:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46CB020383 for ; Tue, 23 Jul 2013 21:17:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 695B520379 for ; Tue, 23 Jul 2013 21:17:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 420B5E66C6 for ; Tue, 23 Jul 2013 14:17:42 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from oproxy6-pub.bluehost.com (oproxy6-pub.bluehost.com [67.222.54.6]) by gabe.freedesktop.org (Postfix) with SMTP id 557C2E5F2C for ; Tue, 23 Jul 2013 14:16:18 -0700 (PDT) Received: (qmail 29169 invoked by uid 0); 23 Jul 2013 21:16:03 -0000 Received: from unknown (HELO box514.bluehost.com) (74.220.219.114) by oproxy6.bluehost.com with SMTP; 23 Jul 2013 21:16:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuousgeek.org; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:To:From; bh=eTEEkr655TTZAnptx4oPRV8AK8qMF1brEL0HjdNpMgU=; b=iN+9TGnzAQRWodie2SMb9P4YuxiHCGYNBKjo2BfhL8Ua8GW2NCPtR3OX71YjY5yc4w9mClqzjCulbFGtVQhq/lA6MmE3jut96Lb0zXcW+hPEdD5Rqb5pVQcCgHQKJ2xw; Received: from [67.161.37.189] (port=59674 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1V1jwA-0001OB-EY for intel-gfx@lists.freedesktop.org; Tue, 23 Jul 2013 15:16:02 -0600 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Tue, 23 Jul 2013 14:15:57 -0700 Message-Id: <1374614157-8324-3-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374614157-8324-1-git-send-email-jbarnes@virtuousgeek.org> References: <1374614157-8324-1-git-send-email-jbarnes@virtuousgeek.org> X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.161.37.189 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH 2/2] x86 early quirk: detect & reserve graphics stolen memory for Intel devices X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need to do this early on before the E820 map is modified or conflicting resources assigned on top. --- arch/x86/kernel/early-quirks.c | 91 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 94ab6b9..6017e45 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -208,6 +208,95 @@ static void __init intel_remapping_check(int num, int slot, int func) } +static const struct pci_device_id gen3_method_ids[] = { + INTEL_I830_IDS(NULL), + INTEL_I845G_IDS(NULL), + INTEL_I85X_IDS(NULL), + INTEL_I865G_IDS(NULL), + INTEL_I915G_IDS(NULL), + INTEL_I915GM_IDS(NULL), + INTEL_I945G_IDS(NULL), + INTEL_I945GM_IDS(NULL), + INTEL_VLV_M_IDS(NULL), + INTEL_VLV_D_IDS(NULL), + INTEL_PINEVIEW_IDS(NULL), +}; +static const struct pci_device_id gen4_method_ids[] = { + INTEL_I965G_IDS(NULL), + INTEL_G33_IDS(NULL), + INTEL_I965GM_IDS(NULL), + INTEL_GM45_IDS(NULL), + INTEL_G45_IDS(NULL), + INTEL_IRONLAKE_D_IDS(NULL), + INTEL_IRONLAKE_M_IDS(NULL), +}; +static const struct pci_device_id gen6_method_ids[] = { + INTEL_SNB_D_IDS(NULL), + INTEL_SNB_M_IDS(NULL), + INTEL_IVB_M_IDS(NULL), + INTEL_IVB_D_IDS(NULL), + INTEL_IVB_Q_IDS(NULL), + INTEL_HSW_D_IDS(NULL), + INTEL_HSW_M_IDS(NULL), +}; + +static void __init intel_gen3_method(int num, int slot, int func, + u32 *start, size_t *size) +{ +} + +static void __init intel_gen4_method(int num, int slot, int func, + u32 *start, size_t *size) +{ +} + +static void __init intel_gen6_method(int num, int slot, int func, + u32 *start, size_t *size) +{ +} + +static void __init intel_graphics_stolen(int num, int slot, int func) +{ + size_t size; + int i; + u32 start; + u16 device, subvendor, subdevice; + + device = read_pci_config_word(num, slot, func, PCI_DEVICE_ID); + subvendor = read_pci_config_word(num, slot, func, PCI_SUBVENDOR_ID); + subdevice = read_pci_config_word(num, slot, func, PCI_SUBDEVICE_ID); + + for (i = 0; i < ARRAY_SIZE(gen3_method_ids); i++) { + if (gen3_method_ids[i].device == device) { + intel_gen3_method(num, slot, func, &start, &size); + goto found; + } + } + + for (i = 0; i < ARRAY_SIZE(gen4_method_ids); i++) { + if (gen4_method_ids[i].device == device) { + intel_gen4_method(num, slot, func, &start, &size); + goto found; + } + } + + for (i = 0; i < ARRAY_SIZE(gen6_method_ids); i++) { + if (gen6_method_ids[i].device == device && + (gen6_method_ids[i].subvendor == PCI_ANY_ID || + gen6_method_ids[i].subvendor == subvendor) && + (gen6_method_ids[i].subdevice == PCI_ANY_ID || + gen6_method_ids[i].subdevce == subdevice)) { + intel_gen6_method(num, slot, func, &start, &size); + goto found; + } + } + + /* No match, don't bother reserving */ + return; +found: + /* Mark this space as reserved */ +} + #define QFLAG_APPLY_ONCE 0x1 #define QFLAG_APPLIED 0x2 #define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) @@ -241,6 +330,8 @@ static struct chipset early_qrk[] __initdata = { PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, + { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY, PCI_ANY_ID, + QFLAG_APPLY_ONCE, intel_graphics_stolen } {} };