Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
26a9a47
Documentation
LICENSES
arch
block
certs
crypto
drivers
accel
accessibility
acpi
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus
cache
cdrom
cdx
char
clk
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto
cxl
dax
dca
devfreq
dio
dma-buf
dma
dpll
edac
eisa
extcon
firewire
firmware
fpga
fsi
fwctl
gnss
gpio
gpu
greybus
hid
hsi
hte
hv
hwmon
hwspinlock
hwtracing
i2c
i3c
idle
iio
infiniband
input
interconnect
iommu
ipack
irqchip
isdn
leds
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc
mmc
most
mtd
mux
net
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
opp
parisc
parport
pci
controller
endpoint
hotplug
Kconfig
Makefile
TODO
acpi_pcihp.c
acpiphp.h
acpiphp_ampere_altra.c
acpiphp_core.c
acpiphp_glue.c
acpiphp_ibm.c
cpci_hotplug.h
cpci_hotplug_core.c
cpci_hotplug_pci.c
cpcihp_generic.c
cpcihp_zt5550.c
cpcihp_zt5550.h
cpqphp.h
cpqphp_core.c
cpqphp_ctrl.c
cpqphp_nvram.c
cpqphp_nvram.h
cpqphp_pci.c
cpqphp_sysfs.c
ibmphp.h
ibmphp_core.c
ibmphp_ebda.c
ibmphp_hpc.c
ibmphp_pci.c
ibmphp_res.c
octep_hp.c
pci_hotplug_core.c
pciehp.h
pciehp_core.c
pciehp_ctrl.c
pciehp_hpc.c
pciehp_pci.c
pnv_php.c
rpadlpar.h
rpadlpar_core.c
rpadlpar_sysfs.c
rpaphp.h
rpaphp_core.c
rpaphp_pci.c
rpaphp_slot.c
s390_pci_hpc.c
shpchp.h
shpchp_core.c
shpchp_ctrl.c
shpchp_hpc.c
shpchp_pci.c
shpchp_sysfs.c
msi
pcie
pwrctrl
switch
Kconfig
Makefile
access.c
ats.c
bus.c
devres.c
doe.c
ecam.c
host-bridge.c
iomap.c
iov.c
irq.c
mmap.c
npem.c
of.c
of_property.c
p2pdma.c
pci-acpi.c
pci-bridge-emul.c
pci-bridge-emul.h
pci-driver.c
pci-label.c
pci-mid.c
pci-pf-stub.c
pci-stub.c
pci-sysfs.c
pci.c
pci.h
probe.c
proc.c
quirks.c
remove.c
rom.c
search.c
setup-bus.c
setup-res.c
slot.c
syscall.c
tph.c
vc.c
vgaarb.c
vpd.c
xen-pcifront.c
pcmcia
peci
perf
phy
pinctrl
platform
pmdomain
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging
target
tc
tee
thermal
thunderbolt
tty
ufs
uio
usb
vdpa
vfio
vhost
video
virt
virtio
w1
watchdog
xen
zorro
Kconfig
Makefile
fs
include
init
io_uring
ipc
kernel
lib
mm
net
rust
samples
scripts
security
sound
tools
usr
virt
.clang-format
.clippy.toml
.cocciconfig
.editorconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
drivers
/
pci
/
hotplug
/
s390_pci_hpc.c
Copy path
Blame
Blame
Latest commit
History
History
142 lines (118 loc) · 3.13 KB
Breadcrumbs
linux
/
drivers
/
pci
/
hotplug
/
s390_pci_hpc.c
Top
File metadata and controls
Code
Blame
142 lines (118 loc) · 3.13 KB
Raw
// SPDX-License-Identifier: GPL-2.0+ /* * PCI Hot Plug Controller Driver for System z * * Copyright 2012 IBM Corp. * * Author(s): * Jan Glauber <jang@linux.vnet.ibm.com> */ #define KMSG_COMPONENT "zpci" #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt #include <linux/kernel.h> #include <linux/slab.h> #include <linux/pci.h> #include <linux/pci_hotplug.h> #include <asm/pci_debug.h> #include <asm/sclp.h> #define SLOT_NAME_SIZE 10 static int enable_slot(struct hotplug_slot *hotplug_slot) { struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev, hotplug_slot); int rc; mutex_lock(&zdev->state_lock); if (zdev->state != ZPCI_FN_STATE_STANDBY) { rc = -EIO; goto out; } rc = sclp_pci_configure(zdev->fid); zpci_dbg(3, "conf fid:%x, rc:%d\n", zdev->fid, rc); if (rc) goto out; zdev->state = ZPCI_FN_STATE_CONFIGURED; rc = zpci_scan_configured_device(zdev, zdev->fh); out: mutex_unlock(&zdev->state_lock); return rc; } static int disable_slot(struct hotplug_slot *hotplug_slot) { struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev, hotplug_slot); struct pci_dev *pdev = NULL; int rc; mutex_lock(&zdev->state_lock); if (zdev->state != ZPCI_FN_STATE_CONFIGURED) { rc = -EIO; goto out; } pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); if (pdev && pci_num_vf(pdev)) { rc = -EBUSY; goto out; } rc = zpci_deconfigure_device(zdev); out: mutex_unlock(&zdev->state_lock); if (pdev) pci_dev_put(pdev); return rc; } static int reset_slot(struct hotplug_slot *hotplug_slot, bool probe) { struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev, hotplug_slot); int rc = -EIO; /* * If we can't get the zdev->state_lock the device state is * currently undergoing a transition and we bail out - just * the same as if the device's state is not configured at all. */ if (!mutex_trylock(&zdev->state_lock)) return rc; /* We can reset only if the function is configured */ if (zdev->state != ZPCI_FN_STATE_CONFIGURED) goto out; if (probe) { rc = 0; goto out; } rc = zpci_hot_reset_device(zdev); out: mutex_unlock(&zdev->state_lock); return rc; } static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) { struct zpci_dev *zdev = container_of(hotplug_slot, struct zpci_dev, hotplug_slot); *value = zpci_is_device_configured(zdev) ? 1 : 0; return 0; } static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) { /* if the slot exists it always contains a function */ *value = 1; return 0; } static const struct hotplug_slot_ops s390_hotplug_slot_ops = { .enable_slot = enable_slot, .disable_slot = disable_slot, .reset_slot = reset_slot, .get_power_status = get_power_status, .get_adapter_status = get_adapter_status, }; int zpci_init_slot(struct zpci_dev *zdev) { char name[SLOT_NAME_SIZE]; struct zpci_bus *zbus = zdev->zbus; zdev->hotplug_slot.ops = &s390_hotplug_slot_ops; snprintf(name, SLOT_NAME_SIZE, "%08x", zdev->fid); return pci_hp_register(&zdev->hotplug_slot, zbus->bus, zdev->devfn, name); } void zpci_exit_slot(struct zpci_dev *zdev) { pci_hp_deregister(&zdev->hotplug_slot); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
You can’t perform that action at this time.