arch/x86/kernel/jailhouse.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/jailhouse.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/jailhouse.c- Extension
.c- Size
- 7512 bytes
- Lines
- 298
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi_pmtmr.hlinux/kernel.hlinux/reboot.hlinux/serial_8250.hlinux/acpi.hasm/apic.hasm/io_apic.hasm/acpi.hasm/cpu.hasm/cpuid/api.hasm/hypervisor.hasm/i8259.hasm/irqdomain.hasm/pci_x86.hasm/reboot.hasm/setup.hasm/jailhouse_para.h
Detected Declarations
function jailhouse_setup_irqfunction jailhouse_cpuid_basefunction jailhouse_detectfunction jailhouse_get_wallclockfunction jailhouse_timer_initfunction jailhouse_get_tscfunction jailhouse_x2apic_initfunction jailhouse_parse_smp_configfunction jailhouse_no_restartfunction jailhouse_pci_arch_initfunction jailhouse_uart_enabledfunction jailhouse_serial_fixupfunction jailhouse_serial_workaroundfunction jailhouse_serial_workaroundfunction jailhouse_paravirtfunction jailhouse_x2apic_available
Annotated Snippet
if (jailhouse_uart_enabled(n)) {
pr_info("Enabling UART%u (port 0x%lx)\n", n,
up->iobase);
jailhouse_setup_irq(up->irq);
} else {
/* Deactivate UART if access isn't allowed */
up->iobase = 0;
}
break;
}
}
static void __init jailhouse_serial_workaround(void)
{
/*
* There are flags inside setup_data that indicate availability of
* platform UARTs since setup data version 2.
*
* In case of version 1, we don't know which UARTs belong Linux. In
* this case, unconditionally register 1:1 mapping for legacy UART IRQs
* 3 and 4.
*/
if (setup_data.hdr.version > 1)
serial8250_set_isa_configurator(jailhouse_serial_fixup);
}
#else /* !CONFIG_SERIAL_8250 */
static inline void jailhouse_serial_workaround(void)
{
}
#endif /* CONFIG_SERIAL_8250 */
static void __init jailhouse_init_platform(void)
{
u64 pa_data = boot_params.hdr.setup_data;
unsigned long setup_data_len;
struct setup_data header;
void *mapping;
x86_init.irqs.pre_vector_init = x86_init_noop;
x86_init.timers.timer_init = jailhouse_timer_init;
x86_init.mpparse.find_mptable = x86_init_noop;
x86_init.mpparse.early_parse_smp_cfg = x86_init_noop;
x86_init.mpparse.parse_smp_cfg = jailhouse_parse_smp_config;
x86_init.pci.arch_init = jailhouse_pci_arch_init;
x86_platform.calibrate_cpu = jailhouse_get_tsc;
x86_platform.calibrate_tsc = jailhouse_get_tsc;
x86_platform.get_wallclock = jailhouse_get_wallclock;
x86_platform.legacy.rtc = 0;
x86_platform.legacy.warm_reset = 0;
x86_platform.legacy.i8042 = X86_LEGACY_I8042_PLATFORM_ABSENT;
legacy_pic = &null_legacy_pic;
machine_ops.emergency_restart = jailhouse_no_restart;
while (pa_data) {
mapping = early_memremap(pa_data, sizeof(header));
memcpy(&header, mapping, sizeof(header));
early_memunmap(mapping, sizeof(header));
if (header.type == SETUP_JAILHOUSE)
break;
pa_data = header.next;
}
if (!pa_data)
panic("Jailhouse: No valid setup data found");
/* setup data must at least contain the header */
if (header.len < sizeof(setup_data.hdr))
goto unsupported;
pa_data += offsetof(struct setup_data, data);
setup_data_len = min_t(unsigned long, sizeof(setup_data),
(unsigned long)header.len);
mapping = early_memremap(pa_data, setup_data_len);
memcpy(&setup_data, mapping, setup_data_len);
early_memunmap(mapping, setup_data_len);
if (setup_data.hdr.version == 0 ||
setup_data.hdr.compatible_version !=
JAILHOUSE_SETUP_REQUIRED_VERSION ||
(setup_data.hdr.version == 1 && header.len < SETUP_DATA_V1_LEN) ||
(setup_data.hdr.version >= 2 && header.len < SETUP_DATA_V2_LEN))
goto unsupported;
pmtmr_ioport = setup_data.v1.pm_timer_address;
pr_debug("Jailhouse: PM-Timer IO Port: %#x\n", pmtmr_ioport);
Annotation
- Immediate include surface: `linux/acpi_pmtmr.h`, `linux/kernel.h`, `linux/reboot.h`, `linux/serial_8250.h`, `linux/acpi.h`, `asm/apic.h`, `asm/io_apic.h`, `asm/acpi.h`.
- Detected declarations: `function jailhouse_setup_irq`, `function jailhouse_cpuid_base`, `function jailhouse_detect`, `function jailhouse_get_wallclock`, `function jailhouse_timer_init`, `function jailhouse_get_tsc`, `function jailhouse_x2apic_init`, `function jailhouse_parse_smp_config`, `function jailhouse_no_restart`, `function jailhouse_pci_arch_init`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source 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.