From patchwork Fri Jan 14 00:28:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 12713242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 576D9C433F5 for ; Fri, 14 Jan 2022 00:28:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8ACD110E86E; Fri, 14 Jan 2022 00:28:14 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC65210E86E for ; Fri, 14 Jan 2022 00:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642120092; x=1673656092; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=RRSc0fCF2gQ58MCLYJ6EBu3GpIJNYU365XBPjiNmmwU=; b=Is5UVV4j5ALLxSvgsaGN1ThpGSaZ7vbmEkcEe2/n2gaXUfItQikjoWFo 0/0JTxA4AkPRYbVycIapwTBFePKTcqjKAtkUImClpe/gMWNmESM+0+5cN 6RHyqbrmHgoTbAmB8yz9ZYJFQVlI6Xr8AhEL4v+x7JaDfcGdsAhfc/8hA oi2/SGSrSiuBebmDjSqF+scmnIvSWTRhZDEOVJnGIiZ/T2OTw0BDuVXz7 5vdyjOL441ZCBDuDugQctSdaINSNGOasp20LHaiTt7waz4+KzSn0ZsK+h 7i/GW9T6Fr3XgCJ7SGL3sXoty9jdh4vAZwtTcgXKMUA/mV/i8y1+/yEoc w==; X-IronPort-AV: E=McAfee;i="6200,9189,10226"; a="244103839" X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="244103839" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:12 -0800 X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="491317600" Received: from lucas-s2600cw.jf.intel.com ([10.165.21.202]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:12 -0800 From: Lucas De Marchi To: x86@kernel.org Date: Thu, 13 Jan 2022 16:28:39 -0800 Message-Id: <20220114002843.2083382-1-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v5 1/5] x86/quirks: Fix stolen detection with integrated + discrete GPU X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org, Dave Hansen , stable@vger.kernel.org, Ingo Molnar , Bjorn Helgaas , Thomas Gleixner Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" early_pci_scan_bus() does a depth-first traversal, possibly calling the quirk functions for each device based on vendor, device and class from early_qrk table. intel_graphics_quirks() however uses PCI_ANY_ID and does additional filtering in the quirk. If there is an Intel integrated + discrete GPU the quirk may be called first for the discrete GPU based on the PCI topology. Then we will fail to reserve the system stolen memory for the integrated GPU, because we will already have marked the quirk as "applied". This was reproduced in a setup with Alderlake-P (integrated) + DG2 (discrete), with the following PCI topology: - 00:01.0 Bridge `- 03:00.0 DG2 - 00:02.0 Integrated GPU So, stop using the QFLAG_APPLY_ONCE flag, replacing it with a static local variable. We can set this variable in the right place, inside intel_graphics_quirks(), only when the quirk was actually applied, i.e. when we find the integrated GPU based on the intel_early_ids table. Cc: stable@vger.kernel.org Signed-off-by: Lucas De Marchi --- v5: apply fix before the refactor arch/x86/kernel/early-quirks.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 1ca3a56fdc2d..de9a76eb544e 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -589,10 +589,14 @@ intel_graphics_stolen(int num, int slot, int func, static void __init intel_graphics_quirks(int num, int slot, int func) { + static bool quirk_applied __initdata; const struct intel_early_ops *early_ops; u16 device; int i; + if (quirk_applied) + return; + device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID); for (i = 0; i < ARRAY_SIZE(intel_early_ids); i++) { @@ -605,6 +609,8 @@ static void __init intel_graphics_quirks(int num, int slot, int func) intel_graphics_stolen(num, slot, func, early_ops); + quirk_applied = true; + return; } } @@ -705,7 +711,7 @@ static struct chipset early_qrk[] __initdata = { { 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_VGA, PCI_ANY_ID, - QFLAG_APPLY_ONCE, intel_graphics_quirks }, + 0, intel_graphics_quirks }, /* * HPET on the current version of the Baytrail platform has accuracy * problems: it will halt in deep idle state - so we disable it. From patchwork Fri Jan 14 00:28:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 12713241 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28F34C4332F for ; Fri, 14 Jan 2022 00:28:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4645010E867; Fri, 14 Jan 2022 00:28:14 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id B3A4910E867 for ; Fri, 14 Jan 2022 00:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642120092; x=1673656092; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gChLAsxaUfo34M70y3IYu5wvatIKFodsmuRuEKDfuLg=; b=jkzg+7GHkJHHeo+ECX5ml3At5/m0StFTGuHFfg7zxp7so9M4KMsAFaY4 z33PmP9HKs1dr/Pe+ipiwaOcaSV8La9BmLhhwnOe8YQAm6x3h3Ban1Zwv jwCMKa6mLjlIn4ssbul6KJ/6MmxI4PMDBT7vPQX47Ae3cY5/DqAa47F/N g6oLJfOllyzRLAFh0bEJ+DiHIOVvrIgYOiUKOixOGWKsDDpU5UbBFF7Q7 7Z+ew9aMdOKP7VR7QLAMatV9CUOI5HVJ6InCeFnsMqj1G6vArd2JnXd4K coBvazI+sHCn3+VQ6OAm73uE7Zlw6Am5FNcD/9InZZkWB3i6YjfBlu07F Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10226"; a="244103840" X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="244103840" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:12 -0800 X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="491317602" Received: from lucas-s2600cw.jf.intel.com ([10.165.21.202]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:12 -0800 From: Lucas De Marchi To: x86@kernel.org Date: Thu, 13 Jan 2022 16:28:40 -0800 Message-Id: <20220114002843.2083382-2-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114002843.2083382-1-lucas.demarchi@intel.com> References: <20220114002843.2083382-1-lucas.demarchi@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v5 2/5] x86/quirks: Stop using QFLAG_APPLY_ONCE in via_bugs() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org, Dave Hansen , Ingo Molnar , Bjorn Helgaas , Thomas Gleixner Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Adopt the same approach as in intel_graphics_quirks(), with a static local variable, to control when the quirk has already been applied. However, contrary to intel_graphics_quirks() here we always set it as applied as soon as it's called to avoid changing the current behavior that is not failing. After converting other users, it will allow us to remove all the logic handling the flags. Signed-off-by: Lucas De Marchi --- arch/x86/kernel/early-quirks.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index de9a76eb544e..59cc67aace93 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -57,6 +57,13 @@ static void __init fix_hypertransport_config(int num, int slot, int func) static void __init via_bugs(int num, int slot, int func) { #ifdef CONFIG_GART_IOMMU + static bool quirk_applied __initdata; + + if (quirk_applied) + return; + + quirk_applied = true; + if ((max_pfn > MAX_DMA32_PFN || force_iommu) && !gart_iommu_aperture_allowed) { printk(KERN_INFO @@ -697,7 +704,7 @@ static struct chipset early_qrk[] __initdata = { { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs }, { PCI_VENDOR_ID_VIA, PCI_ANY_ID, - PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, via_bugs }, + PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, 0, via_bugs }, { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB, PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config }, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS, From patchwork Fri Jan 14 00:28:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 12713243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B721CC433EF for ; Fri, 14 Jan 2022 00:28:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A3CF10E870; Fri, 14 Jan 2022 00:28:17 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1151510E867 for ; Fri, 14 Jan 2022 00:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642120093; x=1673656093; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T53454V8nQ4gSGGOXNzK4CkJUyzEgeyk3LttBFKGHco=; b=MxvfG6B6KFAmmEhdFefFUERBOnvXOY3MGRL1t5uIYwgRJnBKebshuNNN m45y2K1pPDVtA7+vFAe/CbV7uTDmd4kUTQSvYEEQyRTJysK7Q96mrEuNw DCZXwUv/DlXthm2RkKB2k5OfJzIXjTJy25iqEr7SE7O8CiayZpsw1kal1 s4ohVmsRNuA3XlWtKiF9YqUEtVYZtvvqNRvkfcN30XHAKH3j9F+Ze4NAL dcekFHNVYiMcBHugdbsiZlcKJtwBTA5CJNdcIlp1Qf6gS7c1aPNGyOuSO 2RbzFVVaN00+iTI3EY15ee3D4XcftnC8akj31770seoHTsY3xll8VIbly g==; X-IronPort-AV: E=McAfee;i="6200,9189,10226"; a="244103841" X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="244103841" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:12 -0800 X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="491317605" Received: from lucas-s2600cw.jf.intel.com ([10.165.21.202]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:12 -0800 From: Lucas De Marchi To: x86@kernel.org Date: Thu, 13 Jan 2022 16:28:41 -0800 Message-Id: <20220114002843.2083382-3-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114002843.2083382-1-lucas.demarchi@intel.com> References: <20220114002843.2083382-1-lucas.demarchi@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v5 3/5] x86/quirks: Stop using QFLAG_APPLY_ONCE in nvidia_bugs() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org, Dave Hansen , Ingo Molnar , Bjorn Helgaas , Thomas Gleixner Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Adopt the same approach as in intel_graphics_quirks(), with a static local variable, to control when the quirk has already been applied. However, contrary to intel_graphics_quirks(), here we always set it as applied as soon as it's called to avoid changing the current behavior that is not failing. This is the last user of the flags, so we can cleanup the early-quirks, removing all the flags logic later. Signed-off-by: Lucas De Marchi --- arch/x86/kernel/early-quirks.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 59cc67aace93..7c70977737de 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -88,6 +88,13 @@ static void __init nvidia_bugs(int num, int slot, int func) { #ifdef CONFIG_ACPI #ifdef CONFIG_X86_IO_APIC + static bool quirk_applied __initdata; + + if (quirk_applied) + return; + + quirk_applied = true; + /* * Only applies to Nvidia root ports (bus 0) and not to * Nvidia graphics cards with PCI ports on secondary buses. @@ -702,7 +709,7 @@ struct chipset { static struct chipset early_qrk[] __initdata = { { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, - PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs }, + PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, 0, nvidia_bugs }, { PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, 0, via_bugs }, { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB, From patchwork Fri Jan 14 00:28:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 12713244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 760D8C433F5 for ; Fri, 14 Jan 2022 00:28:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D26E10E874; Fri, 14 Jan 2022 00:28:17 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A60710E86E for ; Fri, 14 Jan 2022 00:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642120093; x=1673656093; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IQ2QQ/cS+ncHjNfC6BsTxJSLJNhPyLYfEjqhOLdZvlw=; b=H8PagfavtSHIQ90UqgOdV9aHCEIfLJt6Ijk6GhsnnivFo24F7ih2Oqlx fjZIneSCjOz3lcnqyNBlvkHpEQUeUm7HhC4D5A8GZKlQfTGcyuSBu+srj drp6dvzi02+iETZVaVXnf7xBnQ2vlt5U2Z5riglPNMrabzbKNig6Gh91M VOs2hBLjqbIyzEWTF6CSUlHNtBaHbJzSEOCLYCVAYmtJLsBWTbxUpKYX8 c+yjmBM8IgNpEzOdtEhR0GhlsHn23IGbMVOPDTouMRXbZKzUUCk7aYKU2 kKZt8FOx23HAjwSQjoCJYOrV682T6yApfUbE5PMAAog4RchW1qheZJtnb A==; X-IronPort-AV: E=McAfee;i="6200,9189,10226"; a="244103842" X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="244103842" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:12 -0800 X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="491317608" Received: from lucas-s2600cw.jf.intel.com ([10.165.21.202]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:12 -0800 From: Lucas De Marchi To: x86@kernel.org Date: Thu, 13 Jan 2022 16:28:42 -0800 Message-Id: <20220114002843.2083382-4-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114002843.2083382-1-lucas.demarchi@intel.com> References: <20220114002843.2083382-1-lucas.demarchi@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v5 4/5] x86/quirks: Remove unused logic for flags X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org, Dave Hansen , Ingo Molnar , Bjorn Helgaas , Thomas Gleixner Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The flags were only used to mark the quirk as applied when it was requested to be called only once. Now all the users were converted to use a static local variable, so this logic can be removed. Signed-off-by: Lucas De Marchi --- arch/x86/kernel/early-quirks.c | 35 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 7c70977737de..1db4d92f8a85 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -695,37 +695,33 @@ static void __init apple_airport_reset(int bus, int slot, int func) early_iounmap(mmio, BCM4331_MMIO_SIZE); } -#define QFLAG_APPLY_ONCE 0x1 -#define QFLAG_APPLIED 0x2 -#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) struct chipset { u32 vendor; u32 device; u32 class; u32 class_mask; - u32 flags; void (*f)(int num, int slot, int func); }; static struct chipset early_qrk[] __initdata = { { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, - PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, 0, nvidia_bugs }, + PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, nvidia_bugs }, { PCI_VENDOR_ID_VIA, PCI_ANY_ID, - PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, 0, via_bugs }, + PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, via_bugs }, { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB, - PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config }, + PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, fix_hypertransport_config }, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS, - PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs }, + PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, ati_bugs }, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, - PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, + PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, ati_bugs_contd }, { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST, - PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, + PCI_BASE_CLASS_BRIDGE, intel_remapping_check }, { PCI_VENDOR_ID_INTEL, 0x3405, PCI_CLASS_BRIDGE_HOST, - PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, + PCI_BASE_CLASS_BRIDGE, intel_remapping_check }, { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, - PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, + PCI_BASE_CLASS_BRIDGE, intel_remapping_check }, { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA, PCI_ANY_ID, - 0, intel_graphics_quirks }, + intel_graphics_quirks }, /* * HPET on the current version of the Baytrail platform has accuracy * problems: it will halt in deep idle state - so we disable it. @@ -735,9 +731,9 @@ static struct chipset early_qrk[] __initdata = { * http://www.intel.com/content/dam/www/public/us/en/documents/datasheets/atom-z8000-datasheet-vol-1.pdf */ { PCI_VENDOR_ID_INTEL, 0x0f00, - PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, + PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, force_disable_hpet}, { PCI_VENDOR_ID_BROADCOM, 0x4331, - PCI_CLASS_NETWORK_OTHER, PCI_ANY_ID, 0, apple_airport_reset}, + PCI_CLASS_NETWORK_OTHER, PCI_ANY_ID, apple_airport_reset}, {} }; @@ -778,12 +774,9 @@ static int __init check_dev_quirk(int num, int slot, int func) ((early_qrk[i].device == PCI_ANY_ID) || (early_qrk[i].device == device)) && (!((early_qrk[i].class ^ class) & - early_qrk[i].class_mask))) { - if ((early_qrk[i].flags & - QFLAG_DONE) != QFLAG_DONE) - early_qrk[i].f(num, slot, func); - early_qrk[i].flags |= QFLAG_APPLIED; - } + early_qrk[i].class_mask))) + early_qrk[i].f(num, slot, func); + } type = read_pci_config_byte(num, slot, func, From patchwork Fri Jan 14 00:28:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas De Marchi X-Patchwork-Id: 12713245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13231C433EF for ; Fri, 14 Jan 2022 00:28:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7304210E875; Fri, 14 Jan 2022 00:28:17 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 62D6210E867 for ; Fri, 14 Jan 2022 00:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642120093; x=1673656093; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9MmdtQRSP84iEIfaXDUKrSAI73pBddgm1gbmWx06UMk=; b=oBOLX2s5orz0XD3VMoZuPtVb1soV5NVPxJ+6tYUjFPnt7IWOYJfdOjTI HsGbJZcei7SvtcyqzULlbfaoc5hROkGVxdHHdJkkJDblYf/x3WYGczsi5 CdlcOS62is+FRMKQu1+7rRY+gYTei6zwGPdcViYF8ADC+zURLnouIjHJf xnuEfqLxH8+4FNkACeKUiJSapXjybguDKNFXh7zEYNBO8FS98bt3nnN9a 1mf7WThVOUvg2z/O0uMqvpX+wS0M6sBtqMsparv35tNdpwN8OGpzbY/zO RVQOk1ZytlNV0P5xm+PyjmvDW+Yg4HBujKhX4ALGD86T+kV2m64T6t2AV Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10226"; a="244103843" X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="244103843" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:12 -0800 X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="491317611" Received: from lucas-s2600cw.jf.intel.com ([10.165.21.202]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:12 -0800 From: Lucas De Marchi To: x86@kernel.org Date: Thu, 13 Jan 2022 16:28:43 -0800 Message-Id: <20220114002843.2083382-5-lucas.demarchi@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114002843.2083382-1-lucas.demarchi@intel.com> References: <20220114002843.2083382-1-lucas.demarchi@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v5 5/5] x86/quirks: Improve line wrap on quirk conditions X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org, Dave Hansen , Ingo Molnar , Bjorn Helgaas , Thomas Gleixner Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Remove extra parenthesis and wrap lines so it's easier to read what are the conditions being checked. The call to the hook also had an extra indentation: remove here to conform to coding style. Signed-off-by: Lucas De Marchi Reviewed-by: Rodrigo Vivi --- arch/x86/kernel/early-quirks.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 1db4d92f8a85..996e3cbc1c5f 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -769,14 +769,12 @@ static int __init check_dev_quirk(int num, int slot, int func) device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID); for (i = 0; early_qrk[i].f != NULL; i++) { - if (((early_qrk[i].vendor == PCI_ANY_ID) || - (early_qrk[i].vendor == vendor)) && - ((early_qrk[i].device == PCI_ANY_ID) || - (early_qrk[i].device == device)) && - (!((early_qrk[i].class ^ class) & - early_qrk[i].class_mask))) - early_qrk[i].f(num, slot, func); - + if ((early_qrk[i].vendor == PCI_ANY_ID || + early_qrk[i].vendor == vendor) && + (early_qrk[i].device == PCI_ANY_ID || + early_qrk[i].device == device) && + !((early_qrk[i].class ^ class) & early_qrk[i].class_mask)) + early_qrk[i].f(num, slot, func); } type = read_pci_config_byte(num, slot, func,