arch/s390/pci/pci_bus.c
Source file repositories/reference/linux-study-clean/arch/s390/pci/pci_bus.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/pci/pci_bus.c- Extension
.c- Size
- 11587 bytes
- Lines
- 484
- Domain
- Architecture Layer
- Bucket
- arch/s390
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/slab.hlinux/err.hlinux/delay.hlinux/seq_file.hlinux/irqdomain.hlinux/jump_label.hlinux/pci.hlinux/printk.hlinux/dma-direct.hasm/pci_clp.hasm/pci_dma.hpci_bus.hpci_iov.h
Detected Declarations
function zpci_bus_prepare_devicefunction zpci_bus_scan_devicefunction zpci_bus_remove_devicefunction zpci_bus_scan_busfunction zpci_bus_is_multifunction_rootfunction zpci_bus_create_pci_busfunction zpci_bus_releasefunction __zpci_bus_getfunction zpci_bus_putfunction iteratesfunction pci_dma_range_setupfunction pcibios_bus_add_devicefunction zpci_bus_add_devicefunction zpci_bus_is_isolated_vffunction zpci_bus_device_registerfunction zpci_bus_device_unregister
Annotated Snippet
if (rc) {
pr_err("Enabling PCI function %08x failed\n", zdev->fid);
return rc;
}
}
if (!zdev->has_resources) {
zpci_setup_bus_resources(zdev);
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
if (zdev->bars[i].res)
pci_bus_add_resource(zdev->zbus->bus, zdev->bars[i].res);
}
}
return 0;
}
/* zpci_bus_scan_device - Scan a single device adding it to the PCI core
* @zdev: the zdev to be scanned
*
* Scans the PCI function making it available to the common PCI code.
*
* Return: 0 on success, an error value otherwise
*/
int zpci_bus_scan_device(struct zpci_dev *zdev)
{
struct pci_dev *pdev;
int rc;
rc = zpci_bus_prepare_device(zdev);
if (rc)
return rc;
pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn);
if (!pdev)
return -ENODEV;
pci_lock_rescan_remove();
pci_bus_add_device(pdev);
pci_unlock_rescan_remove();
return 0;
}
/* zpci_bus_remove_device - Removes the given zdev from the PCI core
* @zdev: the zdev to be removed from the PCI core
* @set_error: if true the device's error state is set to permanent failure
*
* Sets a zPCI device to a configured but offline state; the zPCI
* device is still accessible through its hotplug slot and the zPCI
* API but is removed from the common code PCI bus, making it
* no longer available to drivers.
*/
void zpci_bus_remove_device(struct zpci_dev *zdev, bool set_error)
{
struct zpci_bus *zbus = zdev->zbus;
struct pci_dev *pdev;
if (!zdev->zbus->bus)
return;
pdev = pci_get_slot(zbus->bus, zdev->devfn);
if (pdev) {
if (set_error)
pdev->error_state = pci_channel_io_perm_failure;
if (pdev->is_virtfn) {
zpci_iov_remove_virtfn(pdev, zdev->vfn);
/* balance pci_get_slot */
pci_dev_put(pdev);
return;
}
pci_stop_and_remove_bus_device_locked(pdev);
/* balance pci_get_slot */
pci_dev_put(pdev);
}
}
/* zpci_bus_scan_bus - Scan all configured zPCI functions on the bus
* @zbus: the zbus to be scanned
*
* Enables and scans all PCI functions on the bus making them available to the
* common PCI code. If a PCI function fails to be initialized an error will be
* returned but attempts will still be made for all other functions on the bus.
*
* Return: 0 on success, an error value otherwise
*/
int zpci_bus_scan_bus(struct zpci_bus *zbus)
{
struct zpci_dev *zdev;
int devfn, rc, ret = 0;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/err.h`, `linux/delay.h`, `linux/seq_file.h`, `linux/irqdomain.h`, `linux/jump_label.h`, `linux/pci.h`.
- Detected declarations: `function zpci_bus_prepare_device`, `function zpci_bus_scan_device`, `function zpci_bus_remove_device`, `function zpci_bus_scan_bus`, `function zpci_bus_is_multifunction_root`, `function zpci_bus_create_pci_bus`, `function zpci_bus_release`, `function __zpci_bus_get`, `function zpci_bus_put`, `function iterates`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.