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: 12713236 X-Patchwork-Delegate: bhelgaas@google.com 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ED46C433FE for ; Fri, 14 Jan 2022 00:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238399AbiANA2N (ORCPT ); Thu, 13 Jan 2022 19:28:13 -0500 Received: from mga04.intel.com ([192.55.52.120]:24454 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230165AbiANA2N (ORCPT ); Thu, 13 Jan 2022 19:28:13 -0500 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:mime-version: content-transfer-encoding; bh=RRSc0fCF2gQ58MCLYJ6EBu3GpIJNYU365XBPjiNmmwU=; b=aH2hmOTwwfKK+7xqAT3xwiRYnJPanp28ULfpIXa3JM2OtWPTBLRoceFs EFYyGpJ5d6Mzc7XZ0yZW3h3RtCSdFsXlKFE6OcHnoHFlniUbU8dHct2z2 AKNVo+Hoih3KkW+Ub0sQ8kG+LtLGSiHERbH/pWmvojpRYPasSHOIxKuwC 5pXglXux9y+c80/thexk8jwphMFvCaEN3+lJMdUPP6vuJdsFm+aCubBmq MjLJ5y9GiPyp4NbL27W9wrML9nmVSmKkJlTPk5+cn6Qh76DtNrD5FWeSf BE7tby8VpvLxrfkx+FGiJg3+b4vFXwZH0pkdcj6Q6bQ9gER0YjkUxhxkj Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10226"; a="242964235" X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="242964235" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.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 Cc: Dave Hansen , Ingo Molnar , Thomas Gleixner , Bjorn Helgaas , linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org, =?utf-8?b?Vmls?= =?utf-8?b?bGUgU3lyasOkbMOk?= , Matt Roper , Rodrigo Vivi , stable@vger.kernel.org Subject: [PATCH v5 1/5] x86/quirks: Fix stolen detection with integrated + discrete GPU 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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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: 12713239 X-Patchwork-Delegate: bhelgaas@google.com 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 988C9C43217 for ; Fri, 14 Jan 2022 00:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235600AbiANA2O (ORCPT ); Thu, 13 Jan 2022 19:28:14 -0500 Received: from mga04.intel.com ([192.55.52.120]:24454 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238409AbiANA2N (ORCPT ); Thu, 13 Jan 2022 19:28:13 -0500 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=gChLAsxaUfo34M70y3IYu5wvatIKFodsmuRuEKDfuLg=; b=FsFnL49Lhl0zy/uwRcluJuiLQPP1JEyNYrUUuWj18mhhBQ0YUohMUaOf G3W5c9LvM6EV1bYdxEHb0r/rc00tJh6Bs2r1p+oWaMLfq+6j/Q59fDyJa 9AATWPe/19SgOPTeFN8orGelnKdLDd7/wUZVTF3Y83xFCeeZA+EEFJpHu 6D9ibBJbPAcLU808OrwWgalrh1muudRmO4Gyn15KR/C8xVR/4StEYq2R6 ue2M7oUJR7YLh47gBpywFfucgG1qIyoq/ooizxxI7U7gso1lTvOHjix67 nim16AcB7yR0lLYtKlGv2makvBgzvo9C6xJ4fh2VmimmgpGDhYhrVIKzG A==; X-IronPort-AV: E=McAfee;i="6200,9189,10226"; a="242964237" X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="242964237" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.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 Cc: Dave Hansen , Ingo Molnar , Thomas Gleixner , Bjorn Helgaas , linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org, =?utf-8?b?Vmls?= =?utf-8?b?bGUgU3lyasOkbMOk?= , Matt Roper , Rodrigo Vivi Subject: [PATCH v5 2/5] x86/quirks: Stop using QFLAG_APPLY_ONCE in via_bugs() 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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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: 12713237 X-Patchwork-Delegate: bhelgaas@google.com 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82EC3C433EF for ; Fri, 14 Jan 2022 00:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230165AbiANA2N (ORCPT ); Thu, 13 Jan 2022 19:28:13 -0500 Received: from mga04.intel.com ([192.55.52.120]:24454 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbiANA2N (ORCPT ); Thu, 13 Jan 2022 19:28:13 -0500 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="242964240" X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="242964240" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:13 -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 Cc: Dave Hansen , Ingo Molnar , Thomas Gleixner , Bjorn Helgaas , linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org, =?utf-8?b?Vmls?= =?utf-8?b?bGUgU3lyasOkbMOk?= , Matt Roper , Rodrigo Vivi Subject: [PATCH v5 3/5] x86/quirks: Stop using QFLAG_APPLY_ONCE in nvidia_bugs() 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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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: 12713240 X-Patchwork-Delegate: bhelgaas@google.com 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEFD8C4321E for ; Fri, 14 Jan 2022 00:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238409AbiANA2P (ORCPT ); Thu, 13 Jan 2022 19:28:15 -0500 Received: from mga04.intel.com ([192.55.52.120]:24454 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbiANA2N (ORCPT ); Thu, 13 Jan 2022 19:28:13 -0500 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="242964243" X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="242964243" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:13 -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 Cc: Dave Hansen , Ingo Molnar , Thomas Gleixner , Bjorn Helgaas , linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org, =?utf-8?b?Vmls?= =?utf-8?b?bGUgU3lyasOkbMOk?= , Matt Roper , Rodrigo Vivi Subject: [PATCH v5 4/5] x86/quirks: Remove unused logic for flags 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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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: 12713238 X-Patchwork-Delegate: bhelgaas@google.com 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 306E7C43219 for ; Fri, 14 Jan 2022 00:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238411AbiANA2O (ORCPT ); Thu, 13 Jan 2022 19:28:14 -0500 Received: from mga09.intel.com ([134.134.136.24]:31865 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235600AbiANA2N (ORCPT ); Thu, 13 Jan 2022 19:28:13 -0500 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="243945288" X-IronPort-AV: E=Sophos;i="5.88,287,1635231600"; d="scan'208";a="243945288" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jan 2022 16:28:13 -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 Cc: Dave Hansen , Ingo Molnar , Thomas Gleixner , Bjorn Helgaas , linux-pci@vger.kernel.org, intel-gfx@lists.freedesktop.org, =?utf-8?b?Vmls?= =?utf-8?b?bGUgU3lyasOkbMOk?= , Matt Roper , Rodrigo Vivi Subject: [PATCH v5 5/5] x86/quirks: Improve line wrap on quirk conditions 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 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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,