From patchwork Wed Jun 19 13:10:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "G.R." X-Patchwork-Id: 2749121 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ED994C0AB1 for ; Wed, 19 Jun 2013 13:11:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CEB952035C for ; Wed, 19 Jun 2013 13:11:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9745720358 for ; Wed, 19 Jun 2013 13:11:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 90AE6E6141 for ; Wed, 19 Jun 2013 06:11:21 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 79D36E5D53 for ; Wed, 19 Jun 2013 06:11:10 -0700 (PDT) Received: by mail-pa0-f46.google.com with SMTP id fa11so5118020pad.5 for ; Wed, 19 Jun 2013 06:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=ReF1oDQCW0Eec8eqctHpMmoPJF5WbFDIx/HaFLWeXlQ=; b=q+cK/xBaOU2iOUAAhG7dAzvtBD4ofCS0DRuzc4Bc+XmTxHTxH4KSzHFl2gNPFXXdqx VGPHXY0G9ahlQ8fI0ZGcyJmpWTy5ob03l7ZFRjqDZNFn5jqQD/sYoqap/2Uh6kajRcxN DM6N0YFk8G76Kwh1FePa9EFelQhwL6rkyNMBoEOmzdXk6s5GFvLpZXpfqyK5nL+ZbgJ/ b2o+BECqpABKmboBGrwTESRrFOKlZfm18s498c5iNoymHemMNrmoD/jddRWVUlN00xk3 plbpTqiFtPN9x1DR3aq2x06tlWMYc3oHUFx1gYXqLQaFSub7M1N4E5TECxvOV4mdHFo9 QO/w== X-Received: by 10.68.25.102 with SMTP id b6mr2795866pbg.105.1371647470233; Wed, 19 Jun 2013 06:11:10 -0700 (PDT) Received: from Hasim.ustc.edu.cn ([180.158.166.78]) by mx.google.com with ESMTPSA id dc3sm23127206pbc.9.2013.06.19.06.11.04 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Jun 2013 06:11:09 -0700 (PDT) From: Rui Guo To: Daniel Vetter Date: Wed, 19 Jun 2013 21:10:23 +0800 Message-Id: <1371647423-11272-1-git-send-email-firemeteor@users.sourceforge.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] Fix PCH detect with multiple ISA bridges in VM 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=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 In some virtualized environments (e.g. XEN), there is irrelevant ISA bridge in the system. To work reliably, we should scan trhough all the ISA bridge devices and check for the first match, instead of only checking the first one. Signed-off-by: Rui Guo --- drivers/gpu/drm/i915/i915_drv.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index a2e4953..10316dc 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -454,9 +454,15 @@ void intel_detect_pch(struct drm_device *dev) * make graphics device passthrough work easy for VMM, that only * need to expose ISA bridge to let driver know the real hardware * underneath. This is a requirement from virtualization team. + * + * In some virtualized environments (e.g. XEN), there is irrelevant + * ISA bridge in the system. To work reliably, we should scan trhough + * all the ISA bridge devices and check for the first match, instead + * of only checking the first one. */ 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; id = pch->device & INTEL_PCH_DEVICE_ID_MASK; @@ -490,11 +496,20 @@ void intel_detect_pch(struct drm_device *dev) DRM_DEBUG_KMS("Found LynxPoint LP PCH\n"); WARN_ON(!IS_HASWELL(dev)); WARN_ON(!IS_ULT(dev)); + } else { + goto check_next; } + BUG_ON(dev_priv->num_pch_pll > I915_NUM_PLLS); + pci_dev_put(pch); + break; } - pci_dev_put(pch); +check_next: + pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, curr); + pci_dev_put(curr); } + if (!pch) + DRM_DEBUG_KMS("No PCH found?\n"); } bool i915_semaphore_is_enabled(struct drm_device *dev)