arch/x86/xen/platform-pci-unplug.c
Source file repositories/reference/linux-study-clean/arch/x86/xen/platform-pci-unplug.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/xen/platform-pci-unplug.c- Extension
.c- Size
- 5664 bytes
- Lines
- 211
- 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.
Dependency Surface
linux/init.hlinux/io.hlinux/export.hxen/xen.hxen/platform_pci.hxen-ops.h
Detected Declarations
function check_platform_magicfunction xen_has_pv_devicesfunction __xen_has_pv_devicefunction xen_has_pv_nic_devicesfunction xen_has_pv_disk_devicesfunction legacyfunction xen_unplug_emulated_devicesfunction kernelfunction parse_xen_emul_unplugexport xen_has_pv_devicesexport xen_has_pv_nic_devicesexport xen_has_pv_disk_devicesexport xen_has_pv_and_legacy_disk_devices
Annotated Snippet
if (inw(XEN_IOPORT_MAGIC) != XEN_IOPORT_MAGIC_VAL) {
pr_err("Xen Platform: blacklisted by host\n");
return XEN_PLATFORM_ERR_BLACKLIST;
}
break;
default:
pr_warn("Xen Platform PCI: unknown I/O protocol version\n");
return XEN_PLATFORM_ERR_PROTOCOL;
}
return 0;
}
bool xen_has_pv_devices(void)
{
if (!xen_domain())
return false;
/* PV and PVH domains always have them. */
if (xen_pv_domain() || xen_pvh_domain())
return true;
/* And user has xen_platform_pci=0 set in guest config as
* driver did not modify the value. */
if (xen_platform_pci_unplug == 0)
return false;
if (xen_platform_pci_unplug & XEN_UNPLUG_NEVER)
return false;
if (xen_platform_pci_unplug & XEN_UNPLUG_ALL)
return true;
/* This is an odd one - we are going to run legacy
* and PV drivers at the same time. */
if (xen_platform_pci_unplug & XEN_UNPLUG_UNNECESSARY)
return true;
/* And the caller has to follow with xen_pv_{disk,nic}_devices
* to be certain which driver can load. */
return false;
}
EXPORT_SYMBOL_GPL(xen_has_pv_devices);
static bool __xen_has_pv_device(int state)
{
/* HVM domains might or might not */
if (xen_hvm_domain() && (xen_platform_pci_unplug & state))
return true;
return xen_has_pv_devices();
}
bool xen_has_pv_nic_devices(void)
{
return __xen_has_pv_device(XEN_UNPLUG_ALL_NICS | XEN_UNPLUG_ALL);
}
EXPORT_SYMBOL_GPL(xen_has_pv_nic_devices);
bool xen_has_pv_disk_devices(void)
{
return __xen_has_pv_device(XEN_UNPLUG_ALL_IDE_DISKS |
XEN_UNPLUG_AUX_IDE_DISKS | XEN_UNPLUG_ALL);
}
EXPORT_SYMBOL_GPL(xen_has_pv_disk_devices);
/*
* This one is odd - it determines whether you want to run PV _and_
* legacy (IDE) drivers together. This combination is only possible
* under HVM.
*/
bool xen_has_pv_and_legacy_disk_devices(void)
{
if (!xen_domain())
return false;
/* N.B. This is only ever used in HVM mode */
if (xen_pv_domain())
return false;
if (xen_platform_pci_unplug & XEN_UNPLUG_UNNECESSARY)
return true;
return false;
}
EXPORT_SYMBOL_GPL(xen_has_pv_and_legacy_disk_devices);
void xen_unplug_emulated_devices(void)
{
int r;
Annotation
- Immediate include surface: `linux/init.h`, `linux/io.h`, `linux/export.h`, `xen/xen.h`, `xen/platform_pci.h`, `xen-ops.h`.
- Detected declarations: `function check_platform_magic`, `function xen_has_pv_devices`, `function __xen_has_pv_device`, `function xen_has_pv_nic_devices`, `function xen_has_pv_disk_devices`, `function legacy`, `function xen_unplug_emulated_devices`, `function kernel`, `function parse_xen_emul_unplug`, `export xen_has_pv_devices`.
- Atlas domain: Architecture Layer / arch/x86.
- 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.