Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7441b062 authored by Jan Glauber's avatar Jan Glauber Committed by Martin Schwidefsky
Browse files

s390/pci: PCI hotplug support via SCLP



Add SCLP PCI configure/deconfigure and implement a PCI hotplug
controller (s390_pci_hpc). The hotplug controller creates a slot
for every PCI function in stand-by or configured state. The PCI
functions are named after the PCI function ID (fid). By writing to
the power attribute in /sys/bus/pci/slots/<fid>/power the PCI function
is moved to stand-by or configured state. If moved to the configured
state the device is automatically scanned by the s390 PCI layer.

Signed-off-by: default avatarJan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent cbc0dd1f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -95,6 +95,11 @@ struct zpci_dev {
	enum pci_bus_speed max_bus_speed;
};

struct pci_hp_callback_ops {
	int (*create_slot)	(struct zpci_dev *zdev);
	void (*remove_slot)	(struct zpci_dev *zdev);
};

static inline bool zdev_enabled(struct zpci_dev *zdev)
{
	return (zdev->fh & (1UL << 31)) ? true : false;
@@ -140,4 +145,10 @@ bool zpci_fid_present(u32);
int zpci_dma_init(void);
void zpci_dma_exit(void);

/* Hotplug */
extern struct mutex zpci_list_lock;
extern struct list_head zpci_list;
extern struct pci_hp_callback_ops hotplug_ops;
extern unsigned int pci_probe;

#endif
+2 −0
Original line number Diff line number Diff line
@@ -55,5 +55,7 @@ int sclp_chp_read_info(struct sclp_chp_info *info);
void sclp_get_ipl_info(struct sclp_ipl_info *info);
bool sclp_has_linemode(void);
bool sclp_has_vt220(void);
int sclp_pci_configure(u32 fid);
int sclp_pci_deconfigure(u32 fid);

#endif /* _ASM_S390_SCLP_H */
+9 −0
Original line number Diff line number Diff line
@@ -47,7 +47,12 @@

/* list of all detected zpci devices */
LIST_HEAD(zpci_list);
EXPORT_SYMBOL_GPL(zpci_list);
DEFINE_MUTEX(zpci_list_lock);
EXPORT_SYMBOL_GPL(zpci_list_lock);

struct pci_hp_callback_ops hotplug_ops;
EXPORT_SYMBOL_GPL(hotplug_ops);

static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES);
static DEFINE_SPINLOCK(zpci_domain_lock);
@@ -935,6 +940,8 @@ int zpci_create_device(struct zpci_dev *zdev)

	mutex_lock(&zpci_list_lock);
	list_add_tail(&zdev->entry, &zpci_list);
	if (hotplug_ops.create_slot)
		hotplug_ops.create_slot(zdev);
	mutex_unlock(&zpci_list_lock);

	if (zdev->state == ZPCI_FN_STATE_STANDBY)
@@ -948,6 +955,8 @@ int zpci_create_device(struct zpci_dev *zdev)
out_start:
	mutex_lock(&zpci_list_lock);
	list_del(&zdev->entry);
	if (hotplug_ops.remove_slot)
		hotplug_ops.remove_slot(zdev);
	mutex_unlock(&zpci_list_lock);
out_bus:
	zpci_free_domain(zdev);
+11 −0
Original line number Diff line number Diff line
@@ -151,4 +151,15 @@ config HOTPLUG_PCI_SGI

	  When in doubt, say N.

config HOTPLUG_PCI_S390
	tristate "System z PCI Hotplug Support"
	depends on S390 && 64BIT
	help
	  Say Y here if you want to use the System z PCI Hotplug
	  driver for PCI devices. Without this driver it is not
	  possible to access stand-by PCI functions nor to deconfigure
	  PCI functions.

	  When in doubt, say Y.

endif # HOTPLUG_PCI
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ obj-$(CONFIG_HOTPLUG_PCI_RPA) += rpaphp.o
obj-$(CONFIG_HOTPLUG_PCI_RPA_DLPAR)	+= rpadlpar_io.o
obj-$(CONFIG_HOTPLUG_PCI_SGI)		+= sgi_hotplug.o
obj-$(CONFIG_HOTPLUG_PCI_ACPI)		+= acpiphp.o
obj-$(CONFIG_HOTPLUG_PCI_S390)		+= s390_pci_hpc.o

# acpiphp_ibm extends acpiphp, so should be linked afterwards.

Loading