From patchwork Tue Dec 18 16:49:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "G.R." X-Patchwork-Id: 1892531 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id C5F89DF2F6 for ; Tue, 18 Dec 2012 16:49:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE9C4E62E4 for ; Tue, 18 Dec 2012 08:49:40 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ia0-f169.google.com (mail-ia0-f169.google.com [209.85.210.169]) by gabe.freedesktop.org (Postfix) with ESMTP id 531C3E6296 for ; Tue, 18 Dec 2012 08:49:29 -0800 (PST) Received: by mail-ia0-f169.google.com with SMTP id r4so733707iaj.14 for ; Tue, 18 Dec 2012 08:49:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=OKXYxmEYSwzkeNrpaboZ4KtV6AIN1s3A8RdVNmopCcw=; b=nvdhTeEL676v4edow6ZoXxn/YUYuUShSwhEtdoHLZsdSI4bXf/ppOiUnj1pugOmmcz WuCW9uIefYGZuPtbadgqwBQU9PD3c5k2OffTzp+UXdxxNaHKj6/maI1VuwKrC1CPCBot UtqHcd7QB8H9x4ZLNulHpmwgwLhCuKWg5S5JBvcXLjNHWPI9B75oohFbAqDAHyh+cJu0 syhl1YNzq21S6cgs3W/o5Dj5B7/gmppndftgEzDR+D77eDHjwhgQAQN4q7h8ylZhHSrr Gb6t35NeanzTRlPJWDU7TXKoRBonBV/bMj8AuDBZE6M/togtQPuv4mjNmCy6R6+IWP3r M7Sw== MIME-Version: 1.0 Received: by 10.50.33.174 with SMTP id s14mr3443904igi.11.1355849368788; Tue, 18 Dec 2012 08:49:28 -0800 (PST) Received: by 10.64.20.4 with HTTP; Tue, 18 Dec 2012 08:49:28 -0800 (PST) Date: Wed, 19 Dec 2012 00:49:28 +0800 X-Google-Sender-Auth: VS7fr-qgrnHT9CMNVVC4Gm2tDqk Message-ID: From: "G.R." To: intel-gfx@lists.freedesktop.org Cc: Stefano Stabellini , "Dong, Eddie" , "Xu, Dongxiao" , "Zhang, Xiantao" Subject: [Intel-gfx] [PATCH] Fix intel_detect_pch() to work in xen environment. 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: , 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 Hi guys, In XEN HVM guest, there is always an emulated PIIX3 ISA bridge on slot 01.0. This shadows the PCH ISA bridge on 1f.0 with the current intel_detect_pch() implementation. The issue can be easily solved by looping through all the ISA bridges until the first match is found, instead of just check against the first one. Here I attach the patch I used locally. It's created on Torvalds's git. Looking forward to your comments. Thanks, Timothy Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 530db83..3f7e5fb 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -408,9 +408,11 @@ void intel_detect_pch(struct drm_device *dev) * underneath. This is a requirement from virtualization team. */ pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); - if (pch) { + while (pch) { + struct pci_dev * curr = pch; if (pch->vendor == PCI_VENDOR_ID_INTEL) { unsigned short id; + unsigned found = 1; id = pch->device & INTEL_PCH_DEVICE_ID_MASK; dev_priv->pch_id = id; @@ -440,10 +442,20 @@ void intel_detect_pch(struct drm_device *dev) dev_priv->num_pch_pll = 0; DRM_DEBUG_KMS("Found LynxPoint LP PCH\n"); WARN_ON(!IS_HASWELL(dev)); + } else { + found = 0; + } + if (found) { + BUG_ON(dev_priv->num_pch_pll > I915_NUM_PLLS); + pci_dev_put(pch); + break; } - BUG_ON(dev_priv->num_pch_pll > I915_NUM_PLLS); } - pci_dev_put(pch); + pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, curr); + pci_dev_put(curr); + } + if (!pch) { + DRM_DEBUG_KMS("No PCH found?\n"); } } _______________________________________________