Files
s390-tools/zpcictl/zpcictl.h
Niklas Schnelle 6324f62da7 zpcictl: Add option to trigger firmware reset
With "zpcictl --reset DDDD:BB:FF.F" now causing a fully Linux driven
reset where the Linux kernel does an explicit device driver unbind,
disable and re-enable, let's also expose a way to instead have firmware
perform a device reset by issuing an SCLP with SCLP_ERRNOTIFY_RESET.

When firmware is done resetting the device it will then issue an error
notification with PCI Error Code 0x3a indicating successful reset, which
will subsequently cause the new kernel based automatic recovery
mechanism to perform recovery in coordination with the device driver.
This allows resetting devices without unbinding them from their device
driver and thus without losing related block devices or network
interfaces. This may also be used to test the automatic recovery
mechanism.

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-04-12 17:18:26 +02:00

62 lines
1.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* zpcictl - Manage PCI devices on z Systems
*
* Copyright IBM Corp. 2018
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#ifndef ZPCICTL_H
#define ZPCICTL_H
#include <linux/types.h>
#include "lib/zt_common.h"
#define SCLP_ERRNOTIFY_AQ_RESET 0
#define SCLP_ERRNOTIFY_AQ_DECONF 1
#define SCLP_ERRNOTIFY_AQ_REPORT_ERR 2
#define PCI_CLASS_UNCLASSIFIED 0x000000U
#define PCI_CLASS_NVME 0x010802U
#define PCI_CLASS_NETWORK 0x020000U
struct options {
unsigned int reset;
unsigned int reset_fw;
unsigned int deconfigure;
unsigned int report;
};
struct zpci_device {
u16 fid;
u16 pchid;
u32 class;
char slot[13];
char *device;
};
struct zpci_report_error_header {
__u8 version; /* Interface version byte */
__u8 action; /* Action qualifier byte
* 0: Adapter Reset Request
* 1: Deconfigure and repair action requested
* 2: Informational Report
*/
__u16 length; /* Length of Subsequent Data (up to 4K SCLP header) */
__u8 data[0]; /* Subsequent Data passed verbatim to SCLP ET 24 */
};
struct zpci_report_error_data {
__u64 timestamp;
__u64 err_log_id;
char log_data[4054]; /* We cannot exceed a total of 4074 bytes (header + data) */
};
struct zpci_report_error {
struct zpci_report_error_header header;
struct zpci_report_error_data data;
} __packed;
#endif /* ZPCICTL_H */