arch/x86/kernel/quirks.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/quirks.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/quirks.c- Extension
.c- Size
- 18195 bytes
- Lines
- 672
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dmi.hlinux/pci.hlinux/irq.hasm/hpet.hasm/setup.hasm/mce.hlinux/platform_data/x86/apple.h
Detected Declarations
function quirk_intel_irqbalancefunction ich_force_hpet_resumefunction ich_force_enable_hpetfunction hpet_print_force_infofunction old_ich_force_hpet_resumefunction old_ich_force_enable_hpetfunction old_ich_force_enable_hpet_userfunction vt8237_force_hpet_resumefunction vt8237_force_enable_hpetfunction ati_force_hpet_resumefunction ati_ixp4x0_revfunction ati_force_enable_hpetfunction nvidia_force_hpet_resumefunction nvidia_force_enable_hpetfunction force_hpet_resumefunction e6xx_force_enable_hpetfunction boardsfunction quirk_amd_nb_nodefunction amd_disable_seq_and_redirect_scrubfunction quirk_intel_brickland_xeon_ras_capfunction quirk_intel_purley_xeon_ras_capfunction early_platform_quirksexport x86_apple_machine
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* This file contains work-arounds for x86 and x86_64 platform bugs.
*/
#include <linux/dmi.h>
#include <linux/pci.h>
#include <linux/irq.h>
#include <asm/hpet.h>
#include <asm/setup.h>
#include <asm/mce.h>
#include <linux/platform_data/x86/apple.h>
#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI)
static void quirk_intel_irqbalance(struct pci_dev *dev)
{
u8 config;
u16 word;
/* BIOS may enable hardware IRQ balancing for
* E7520/E7320/E7525(revision ID 0x9 and below)
* based platforms.
* Disable SW irqbalance/affinity on those platforms.
*/
if (dev->revision > 0x9)
return;
/* enable access to config space*/
pci_read_config_byte(dev, 0xf4, &config);
pci_write_config_byte(dev, 0xf4, config|0x2);
/*
* read xTPR register. We may not have a pci_dev for device 8
* because it might be hidden until the above write.
*/
pci_bus_read_config_word(dev->bus, PCI_DEVFN(8, 0), 0x4c, &word);
if (!(word & (1 << 13))) {
dev_info(&dev->dev, "Intel E7520/7320/7525 detected; "
"disabling irq balancing and affinity\n");
noirqdebug_setup("");
#ifdef CONFIG_PROC_FS
no_irq_affinity = 1;
#endif
}
/* put back the original value for config space*/
if (!(config & 0x2))
pci_write_config_byte(dev, 0xf4, config);
}
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH,
quirk_intel_irqbalance);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH,
quirk_intel_irqbalance);
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH,
quirk_intel_irqbalance);
#endif
#if defined(CONFIG_HPET_TIMER)
unsigned long force_hpet_address;
static enum {
NONE_FORCE_HPET_RESUME,
OLD_ICH_FORCE_HPET_RESUME,
ICH_FORCE_HPET_RESUME,
VT8237_FORCE_HPET_RESUME,
NVIDIA_FORCE_HPET_RESUME,
ATI_FORCE_HPET_RESUME,
} force_hpet_resume_type;
static void __iomem *rcba_base;
static void ich_force_hpet_resume(void)
{
u32 val;
if (!force_hpet_address)
return;
BUG_ON(rcba_base == NULL);
/* read the Function Disable register, dword mode only */
val = readl(rcba_base + 0x3404);
if (!(val & 0x80)) {
/* HPET disabled in HPTC. Trying to enable */
writel(val | 0x80, rcba_base + 0x3404);
}
Annotation
- Immediate include surface: `linux/dmi.h`, `linux/pci.h`, `linux/irq.h`, `asm/hpet.h`, `asm/setup.h`, `asm/mce.h`, `linux/platform_data/x86/apple.h`.
- Detected declarations: `function quirk_intel_irqbalance`, `function ich_force_hpet_resume`, `function ich_force_enable_hpet`, `function hpet_print_force_info`, `function old_ich_force_hpet_resume`, `function old_ich_force_enable_hpet`, `function old_ich_force_enable_hpet_user`, `function vt8237_force_hpet_resume`, `function vt8237_force_enable_hpet`, `function ati_force_hpet_resume`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: integration implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.