From mboxrd@z Thu Jan 1 00:00:00 1970 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?q?Ville=20Syrj=C3=A4l=C3=A4?= , 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 Content-Transfer-Encoding: 8bit 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, -- 2.34.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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 Content-Transfer-Encoding: 8bit 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, -- 2.34.1