arch/powerpc/kernel/eeh.c

Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/eeh.c

File Facts

System
Linux kernel
Corpus path
arch/powerpc/kernel/eeh.c
Extension
.c
Size
51092 bytes
Lines
1929
Domain
Architecture Layer
Bucket
arch/powerpc
Inferred role
Architecture Layer: operation-table or driver-model contract
Status
pattern 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.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct file_operations eeh_force_recover_fops = {
	.open	= simple_open,
	.write	= eeh_force_recover_write,
};

static ssize_t eeh_debugfs_dev_usage(struct file *filp,
				char __user *user_buf,
				size_t count, loff_t *ppos)
{
	static const char usage[] = "input format: <domain>:<bus>:<dev>.<fn>\n";

	return simple_read_from_buffer(user_buf, count, ppos,
				       usage, sizeof(usage) - 1);
}

static ssize_t eeh_dev_check_write(struct file *filp,
				const char __user *user_buf,
				size_t count, loff_t *ppos)
{
	struct pci_dev *pdev;
	struct eeh_dev *edev;
	int ret;

	pdev = eeh_debug_lookup_pdev(filp, user_buf, count, ppos);
	if (IS_ERR(pdev))
		return PTR_ERR(pdev);

	edev = pci_dev_to_eeh_dev(pdev);
	if (!edev) {
		pci_err(pdev, "No eeh_dev for this device!\n");
		pci_dev_put(pdev);
		return -ENODEV;
	}

	ret = eeh_dev_check_failure(edev);
	pci_info(pdev, "eeh_dev_check_failure(%s) = %d\n",
			pci_name(pdev), ret);

	pci_dev_put(pdev);

	return count;
}

static const struct file_operations eeh_dev_check_fops = {
	.open	= simple_open,
	.write	= eeh_dev_check_write,
	.read   = eeh_debugfs_dev_usage,
};

static ssize_t eeh_dev_break_write(struct file *filp,
				const char __user *user_buf,
				size_t count, loff_t *ppos)
{
	struct pci_dev *pdev;
	int ret;

	pdev = eeh_debug_lookup_pdev(filp, user_buf, count, ppos);
	if (IS_ERR(pdev))
		return PTR_ERR(pdev);

	ret = eeh_break_device(pdev);
	pci_dev_put(pdev);

	if (ret < 0)
		return ret;

	return count;
}

static const struct file_operations eeh_dev_break_fops = {
	.open	= simple_open,
	.write	= eeh_dev_break_write,
	.read   = eeh_debugfs_dev_usage,
};

static ssize_t eeh_dev_can_recover(struct file *filp,
				   const char __user *user_buf,
				   size_t count, loff_t *ppos)
{
	struct pci_driver *drv;
	struct pci_dev *pdev;
	size_t ret;

	pdev = eeh_debug_lookup_pdev(filp, user_buf, count, ppos);
	if (IS_ERR(pdev))
		return PTR_ERR(pdev);

	/*
	 * In order for error recovery to work the driver needs to implement
	 * .error_detected(), so it can quiesce IO to the device, and

Annotation

Implementation Notes