DF-5483 / estforce.c
/* * DF-5483 rig helper -- substitutes ONLY the missing CPUID advertisement. * * This QEMU build masks CPUID.01H.ECX.EST under both KVM and TCG (KVM lacks * the host bit; TCG masks est as unimplemented), so the Intel P-state md * probe (acpi_pst_intel_probe, acpi_pstate_machdep.c:418-428) would bail * and the driver would never engage -- exactly the DF-5155/DF-5160 * "VMM lies about CPUID" premise, constructed here deliberately. * * The module sets cpu_feature2 |= CPUID2_EST from the boot loader * (estforce_load="YES"), i.e. BEFORE acpi0/cpu_pst probe. Everything * afterwards is the genuine stock driver: parse _PSS/_PCT, allocate the * firmware-named IO ports, and write the _PSS control value at the first * P-state transition. */ #include <sys/param.h> #include <sys/module.h> #include <sys/kernel.h> #include <sys/systm.h> #include <machine/cputypes.h> #include <machine/specialreg.h> static int estforce_modevent(module_t mod, int type, void *data) { switch (type) { case MOD_LOAD: if (cpu_vendor_id == CPU_VENDOR_INTEL && (cpu_feature2 & CPUID2_EST) == 0) { cpu_feature2 |= CPUID2_EST; kprintf("estforce: cpu_feature2 |= CPUID2_EST " "(now %#x)\n", cpu_feature2); } else { kprintf("estforce: nothing to do " "(vendor %d, f2 %#x)\n", cpu_vendor_id, cpu_feature2); } return 0; case MOD_UNLOAD: return 0; } return EOPNOTSUPP; } static moduledata_t estforce_mod = { "estforce", estforce_modevent, NULL }; DECLARE_MODULE(estforce, estforce_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(estforce, 1); |