arch/mips/kernel/cpu-probe.c
Source file repositories/reference/linux-study-clean/arch/mips/kernel/cpu-probe.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/kernel/cpu-probe.c- Extension
.c- Size
- 53635 bytes
- Lines
- 2090
- Domain
- Architecture Layer
- Bucket
- arch/mips
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/kernel.hlinux/mmu_context.hlinux/ptrace.hlinux/smp.hlinux/stddef.hlinux/export.hasm/bugs.hasm/cpu.hasm/cpu-features.hasm/cpu-type.hasm/fpu.hasm/mipsregs.hasm/mipsmtregs.hasm/msa.hasm/watch.hasm/elf.hasm/pgtable-bits.hasm/spram.hasm/traps.hlinux/uaccess.hfpu-probe.hasm/mach-loongson64/cpucfg-emul.hloongson_regs.h
Detected Declarations
enum ftlb_flagsfunction cpu_get_msa_idfunction dsp_disablefunction htw_disablefunction ftlb_disablefunction cpu_set_mt_per_tc_perffunction check_erratafunction check_bugs32function cpu_has_confregfunction set_elf_platformfunction set_elf_base_platformfunction cpu_probe_vmbitsfunction set_isafunction calculate_ftlb_probabilityfunction set_ftlb_enablefunction mm_configfunction decode_config0function decode_config1function decode_config2function decode_config3function decode_config4function decode_config5function decode_configsfunction decode_guest_config0function decode_guest_config1function decode_guest_config2function decode_guest_config3function decode_guest_config4function decode_guest_config5function decode_guest_configsfunction cpu_probe_guestctl0function cpu_probe_guestctl1function cpu_probe_gtoffsetfunction cpu_probe_vzfunction cpu_probe_legacyfunction reasonablyfunction cpu_probe_mipsfunction cpu_probe_alchemyfunction cpu_probe_sibytefunction cpu_probe_sandcraftfunction cpu_probe_nxpfunction cpu_probe_broadcomfunction cpu_probe_caviumfunction decode_cpucfgfunction cpu_probe_loongsonfunction cpu_probe_loongsonfunction cpu_probefunction cpu_report
Annotated Snippet
if (flags & FTLB_SET_PROB) {
config &= ~(3 << MTI_CONF6_FTLBP_SHIFT);
config |= calculate_ftlb_probability(c)
<< MTI_CONF6_FTLBP_SHIFT;
}
write_c0_config6(config);
back_to_back_c0_hazard();
break;
case CPU_I6400:
case CPU_I6500:
/* There's no way to disable the FTLB */
if (!(flags & FTLB_EN))
return 1;
return 0;
case CPU_LOONGSON64:
/* Flush ITLB, DTLB, VTLB and FTLB */
write_c0_diag(LOONGSON_DIAG_ITLB | LOONGSON_DIAG_DTLB |
LOONGSON_DIAG_VTLB | LOONGSON_DIAG_FTLB);
/* Loongson-3 cores use Config6 to enable the FTLB */
config = read_c0_config6();
if (flags & FTLB_EN)
/* Enable FTLB */
write_c0_config6(config & ~LOONGSON_CONF6_FTLBDIS);
else
/* Disable FTLB */
write_c0_config6(config | LOONGSON_CONF6_FTLBDIS);
break;
default:
return 1;
}
return 0;
}
static int mm_config(struct cpuinfo_mips *c)
{
unsigned int config0, update, mm;
config0 = read_c0_config();
mm = config0 & MIPS_CONF_MM;
/*
* It's implementation dependent what type of write-merge is supported
* and whether it can be enabled/disabled. If it is settable lets make
* the merging allowed by default. Some platforms might have
* write-through caching unsupported. In this case just ignore the
* CP0.Config.MM bit field value.
*/
switch (c->cputype) {
case CPU_24K:
case CPU_34K:
case CPU_74K:
case CPU_P5600:
case CPU_P6600:
c->options |= MIPS_CPU_MM_FULL;
update = MIPS_CONF_MM_FULL;
break;
case CPU_1004K:
case CPU_1074K:
case CPU_INTERAPTIV:
case CPU_PROAPTIV:
mm = 0;
fallthrough;
default:
update = 0;
break;
}
if (update) {
config0 = (config0 & ~MIPS_CONF_MM) | update;
write_c0_config(config0);
} else if (mm == MIPS_CONF_MM_SYSAD) {
c->options |= MIPS_CPU_MM_SYSAD;
} else if (mm == MIPS_CONF_MM_FULL) {
c->options |= MIPS_CPU_MM_FULL;
}
return 0;
}
static inline unsigned int decode_config0(struct cpuinfo_mips *c)
{
unsigned int config0;
int isa, mt;
config0 = read_c0_config();
/*
* Look for Standard TLB or Dual VTLB and FTLB
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/mmu_context.h`, `linux/ptrace.h`, `linux/smp.h`, `linux/stddef.h`, `linux/export.h`, `asm/bugs.h`.
- Detected declarations: `enum ftlb_flags`, `function cpu_get_msa_id`, `function dsp_disable`, `function htw_disable`, `function ftlb_disable`, `function cpu_set_mt_per_tc_perf`, `function check_errata`, `function check_bugs32`, `function cpu_has_confreg`, `function set_elf_platform`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: integration implementation candidate.
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.