diff options
Diffstat (limited to 'patches/jailhouse/jailhouse_0005.patch')
-rw-r--r-- | patches/jailhouse/jailhouse_0005.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/patches/jailhouse/jailhouse_0005.patch b/patches/jailhouse/jailhouse_0005.patch new file mode 100644 index 0000000..cafff2b --- /dev/null +++ b/patches/jailhouse/jailhouse_0005.patch | |||
@@ -0,0 +1,64 @@ | |||
1 | From d921eb56b4b0516a0bd46e9337c3deb773146faf Mon Sep 17 00:00:00 2001 | ||
2 | From: Jan Kiszka <jan.kiszka@siemens.com> | ||
3 | Date: Tue, 21 Jun 2016 19:58:08 +0200 | ||
4 | Subject: [PATCH] pci: Add support for unbinding the generic PCI host | ||
5 | controller | ||
6 | |||
7 | Particularly useful when working in virtual environments where the | ||
8 | controller may come and go, but possibly not only there. | ||
9 | |||
10 | NOTE: leaks memory, see lkml thread! | ||
11 | --- | ||
12 | drivers/pci/host/pci-host-common.c | 13 +++++++++++++ | ||
13 | drivers/pci/host/pci-host-generic.c | 1 + | ||
14 | include/linux/pci-ecam.h | 1 + | ||
15 | 3 files changed, 15 insertions(+) | ||
16 | |||
17 | diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c | ||
18 | index 44a47d4..e0da836 100644 | ||
19 | --- a/drivers/pci/host/pci-host-common.c | ||
20 | +++ b/drivers/pci/host/pci-host-common.c | ||
21 | @@ -176,5 +176,18 @@ int pci_host_common_probe(struct platform_device *pdev, | ||
22 | } | ||
23 | |||
24 | pci_bus_add_devices(bus); | ||
25 | + platform_set_drvdata(pdev, bus); | ||
26 | + return 0; | ||
27 | +} | ||
28 | + | ||
29 | +int pci_host_common_remove(struct platform_device *pdev) | ||
30 | +{ | ||
31 | + struct pci_bus *bus = platform_get_drvdata(pdev); | ||
32 | + | ||
33 | + pci_lock_rescan_remove(); | ||
34 | + pci_stop_root_bus(bus); | ||
35 | + pci_remove_root_bus(bus); | ||
36 | + pci_unlock_rescan_remove(); | ||
37 | + | ||
38 | return 0; | ||
39 | } | ||
40 | diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c | ||
41 | index 7d709a7..b35057e 100644 | ||
42 | --- a/drivers/pci/host/pci-host-generic.c | ||
43 | +++ b/drivers/pci/host/pci-host-generic.c | ||
44 | @@ -63,5 +63,6 @@ static struct platform_driver gen_pci_driver = { | ||
45 | .suppress_bind_attrs = true, | ||
46 | }, | ||
47 | .probe = gen_pci_probe, | ||
48 | + .remove = pci_host_common_remove, | ||
49 | }; | ||
50 | builtin_platform_driver(gen_pci_driver); | ||
51 | diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h | ||
52 | index 809c2f1..36c9ddb 100644 | ||
53 | --- a/include/linux/pci-ecam.h | ||
54 | +++ b/include/linux/pci-ecam.h | ||
55 | @@ -73,5 +73,6 @@ extern struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x */ | ||
56 | /* for DT-based PCI controllers that support ECAM */ | ||
57 | int pci_host_common_probe(struct platform_device *pdev, | ||
58 | struct pci_ecam_ops *ops); | ||
59 | +int pci_host_common_remove(struct platform_device *pdev); | ||
60 | #endif | ||
61 | #endif | ||
62 | -- | ||
63 | 2.1.4 | ||
64 | |||