From: Bjorn Helgaas <helgaas@kernel.org>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: x86@kernel.org, linux-pci@vger.kernel.org,
intel-gfx@lists.freedesktop.org,
Dave Hansen <dave.hansen@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [Intel-gfx] [PATCH v4] x86/quirks: Replace QFLAG_APPLY_ONCE with static locals
Date: Wed, 12 Jan 2022 18:08:05 -0600 [thread overview]
Message-ID: <20220113000805.GA295089@bhelgaas> (raw)
In-Reply-To: <20220112233043.1865454-1-lucas.demarchi@intel.com>
On Wed, Jan 12, 2022 at 03:30:43PM -0800, Lucas De Marchi wrote:
> The flags are only used to mark a quirk to be called once and nothing
> else. Also, that logic may not be appropriate if the quirk wants to
> do additional filtering and set quirk as applied by itself.
>
> So replace the uses of QFLAG_APPLY_ONCE with static local variables in
> the few quirks that use this logic and remove all the flags logic.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Only occurred to me now, but another, less intrusive approach would be
to just remove QFLAG_APPLY_ONCE from intel_graphics_quirks() and do
its bookkeeping internally, e.g.,
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 391a4e2b8604..7b655004e5fd 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -587,10 +587,14 @@ intel_graphics_stolen(int num, int slot, int func,
static void __init intel_graphics_quirks(int num, int slot, int func)
{
+ static bool stolen __initdata = false;
const struct intel_early_ops *early_ops;
u16 device;
int i;
+ if (stolen)
+ return;
+
device = read_pci_config_16(num, slot, func, PCI_DEVICE_ID);
for (i = 0; i < ARRAY_SIZE(intel_early_ids); i++) {
@@ -602,6 +606,7 @@ static void __init intel_graphics_quirks(int num, int slot, int func)
early_ops = (typeof(early_ops))driver_data;
intel_graphics_stolen(num, slot, func, early_ops);
+ stolen = true;
return;
}
@@ -703,7 +708,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.
next prev parent reply other threads:[~2022-01-13 0:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 21:05 [PATCH v3 1/3] x86/quirks: Replace QFLAG_APPLY_ONCE with static locals Lucas De Marchi
2022-01-07 21:05 ` [PATCH v3 2/3] x86/quirks: Improve line wrap on quirk conditions Lucas De Marchi
2022-01-10 17:11 ` [Intel-gfx] " Rodrigo Vivi
2022-01-07 21:05 ` [PATCH v3 3/3] x86/quirks: Fix stolen detection with integrated + discrete GPU Lucas De Marchi
2022-01-08 2:57 ` Bjorn Helgaas
2022-01-10 17:11 ` [Intel-gfx] " Rodrigo Vivi
2022-01-10 17:32 ` Bjorn Helgaas
2022-01-10 17:37 ` Rodrigo Vivi
2022-01-08 2:53 ` [PATCH v3 1/3] x86/quirks: Replace QFLAG_APPLY_ONCE with static locals Bjorn Helgaas
2022-01-12 23:30 ` [PATCH v4] " Lucas De Marchi
2022-01-13 0:08 ` Bjorn Helgaas [this message]
2022-01-13 0:21 ` [Intel-gfx] " Lucas De Marchi
2022-01-13 1:06 ` Bjorn Helgaas
2022-01-13 1:28 ` Lucas De Marchi
2022-01-13 20:28 ` Rodrigo Vivi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220113000805.GA295089@bhelgaas \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=dave.hansen@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-pci@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).