diff options
| author | Adrian Mangeac <Adrian.Mangeac@enea.com> | 2019-04-17 17:41:51 +0200 |
|---|---|---|
| committer | Adrian Mangeac <Adrian.Mangeac@enea.com> | 2019-04-17 17:52:58 +0200 |
| commit | bbd51f4b06ed088704e883b3153644af9b336e69 (patch) | |
| tree | 04cc4442aa25e51d7761824aeebb92aeee1ba712 | |
| parent | ef8404b9e5215e5fdfdc2fdb8600cd35c58802e1 (diff) | |
| download | enea-kernel-cache-bbd51f4b06ed088704e883b3153644af9b336e69.tar.gz | |
Add jailhouse related patches
Change-Id: I7f7f4a17dddc512dd8c3d50e0606f2618ee7e23e
Signed-off-by: Adrian Mangeac <Adrian.Mangeac@enea.com>
| -rw-r--r-- | patches/jailhouse/0001-export__hyp_stub_vectors.patch | 57 | ||||
| -rw-r--r-- | patches/jailhouse/0002-disable_uart1.patch | 13 | ||||
| -rw-r--r-- | patches/jailhouse/jailhouse.scc | 5 | ||||
| -rw-r--r-- | patches/jailhouse/jailhouse_0004.patch | 155 | ||||
| -rw-r--r-- | patches/jailhouse/jailhouse_0005.patch | 64 | ||||
| -rw-r--r-- | patches/jailhouse/jailhouse_0006.patch | 9 |
6 files changed, 303 insertions, 0 deletions
diff --git a/patches/jailhouse/0001-export__hyp_stub_vectors.patch b/patches/jailhouse/0001-export__hyp_stub_vectors.patch new file mode 100644 index 0000000..b58b522 --- /dev/null +++ b/patches/jailhouse/0001-export__hyp_stub_vectors.patch | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | From 90165e12a59df7e26bfb4cedd76a1def45cee5a9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de> | ||
| 3 | Date: Wed, 7 Jun 2017 15:48:43 +0200 | ||
| 4 | Subject: [PATCH] arm, arm64: export __hyp_stub_vectors | ||
| 5 | |||
| 6 | HVC_GET_VECTORS got removed. External hypervisors, like Jailhouse, need | ||
| 7 | this address when they are deactivated, in order to restore original | ||
| 8 | state. | ||
| 9 | |||
| 10 | Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de> | ||
| 11 | Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> | ||
| 12 | --- | ||
| 13 | arch/arm/kernel/hyp-stub.S | 2 ++ | ||
| 14 | arch/arm64/kernel/hyp-stub.S | 2 ++ | ||
| 15 | 2 files changed, 4 insertions(+) | ||
| 16 | |||
| 17 | diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S | ||
| 18 | index 60146e3..d34efc5 100644 | ||
| 19 | --- a/arch/arm/kernel/hyp-stub.S | ||
| 20 | +++ b/arch/arm/kernel/hyp-stub.S | ||
| 21 | @@ -19,6 +19,7 @@ | ||
| 22 | #include <linux/init.h> | ||
| 23 | #include <linux/irqchip/arm-gic-v3.h> | ||
| 24 | #include <linux/linkage.h> | ||
| 25 | +#include <asm-generic/export.h> | ||
| 26 | #include <asm/assembler.h> | ||
| 27 | #include <asm/virt.h> | ||
| 28 | |||
| 29 | @@ -282,4 +283,5 @@ __hyp_stub_trap: W(b) __hyp_stub_do_trap | ||
| 30 | __hyp_stub_irq: W(b) . | ||
| 31 | __hyp_stub_fiq: W(b) . | ||
| 32 | ENDPROC(__hyp_stub_vectors) | ||
| 33 | +EXPORT_SYMBOL_GPL(__hyp_stub_vectors) | ||
| 34 | |||
| 35 | diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S | ||
| 36 | index e1261fb..061b32e 100644 | ||
| 37 | --- a/arch/arm64/kernel/hyp-stub.S | ||
| 38 | +++ b/arch/arm64/kernel/hyp-stub.S | ||
| 39 | @@ -21,6 +21,7 @@ | ||
| 40 | #include <linux/linkage.h> | ||
| 41 | #include <linux/irqchip/arm-gic-v3.h> | ||
| 42 | |||
| 43 | +#include <asm-generic/export.h> | ||
| 44 | #include <asm/assembler.h> | ||
| 45 | #include <asm/kvm_arm.h> | ||
| 46 | #include <asm/kvm_asm.h> | ||
| 47 | @@ -51,6 +52,7 @@ ENTRY(__hyp_stub_vectors) | ||
| 48 | ventry el1_fiq_invalid // FIQ 32-bit EL1 | ||
| 49 | ventry el1_error_invalid // Error 32-bit EL1 | ||
| 50 | ENDPROC(__hyp_stub_vectors) | ||
| 51 | +EXPORT_SYMBOL_GPL(__hyp_stub_vectors) | ||
| 52 | |||
| 53 | .align 11 | ||
| 54 | |||
| 55 | -- | ||
| 56 | 2.1.4 | ||
| 57 | |||
diff --git a/patches/jailhouse/0002-disable_uart1.patch b/patches/jailhouse/0002-disable_uart1.patch new file mode 100644 index 0000000..64eb5b9 --- /dev/null +++ b/patches/jailhouse/0002-disable_uart1.patch | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | diff --git a/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts b/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts | ||
| 2 | index 46ab349..e1d6739 100644 | ||
| 3 | --- a/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts | ||
| 4 | +++ b/arch/arm64/boot/dts/xilinx/zynqmp-zcu102-revA.dts | ||
| 5 | @@ -913,7 +913,7 @@ drivers/hwmon/pmbus/Makefile:11:obj-$(CONFIG_SENSORS_MAX20751) += max20751.o | ||
| 6 | }; | ||
| 7 | |||
| 8 | &uart1 { | ||
| 9 | - status = "okay"; | ||
| 10 | + status = "disabled"; /* Disable so that jailhouse inmate can use it. */ | ||
| 11 | pinctrl-names = "default"; | ||
| 12 | pinctrl-0 = <&pinctrl_uart1_default>; | ||
| 13 | }; | ||
diff --git a/patches/jailhouse/jailhouse.scc b/patches/jailhouse/jailhouse.scc new file mode 100644 index 0000000..11db4ae --- /dev/null +++ b/patches/jailhouse/jailhouse.scc | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | patch 0001-export__hyp_stub_vectors.patch | ||
| 2 | patch 0002-disable_uart1.patch | ||
| 3 | patch jailhouse_0004.patch | ||
| 4 | patch jailhouse_0005.patch | ||
| 5 | patch jailhouse_0006.patch | ||
diff --git a/patches/jailhouse/jailhouse_0004.patch b/patches/jailhouse/jailhouse_0004.patch new file mode 100644 index 0000000..be612ff --- /dev/null +++ b/patches/jailhouse/jailhouse_0004.patch | |||
| @@ -0,0 +1,155 @@ | |||
| 1 | From 8ba0c10a0b7fd44efe2e17462bb39732498b6d9b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jan Kiszka <jan.kiszka@siemens.com> | ||
| 3 | Date: Sun, 11 Sep 2016 23:30:04 +0200 | ||
| 4 | Subject: [PATCH] jailhouse: Add simple debug console via the hypervisor | ||
| 5 | |||
| 6 | Jailhouse allows explicitly configured cells to write character-wise | ||
| 7 | messages to the hypervisor debug console. Make use of this for a | ||
| 8 | platform-agnostic boot diagnosis channel, specifically for non-root | ||
| 9 | cells. It also comes with earlycon support. | ||
| 10 | |||
| 11 | Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> | ||
| 12 | --- | ||
| 13 | drivers/virt/Kconfig | 11 +++++ | ||
| 14 | drivers/virt/Makefile | 1 + | ||
| 15 | drivers/virt/jailhouse_dbgcon.c | 99 +++++++++++++++++++++++++++++++++++++++++ | ||
| 16 | 3 files changed, 111 insertions(+) | ||
| 17 | create mode 100644 drivers/virt/jailhouse_dbgcon.c | ||
| 18 | |||
| 19 | diff --git a/drivers/virt/Kconfig b/drivers/virt/Kconfig | ||
| 20 | index 99ebdde..baf04bb 100644 | ||
| 21 | --- a/drivers/virt/Kconfig | ||
| 22 | +++ b/drivers/virt/Kconfig | ||
| 23 | @@ -30,4 +30,15 @@ config FSL_HV_MANAGER | ||
| 24 | 4) A kernel interface for receiving callbacks when a managed | ||
| 25 | partition shuts down. | ||
| 26 | |||
| 27 | +config JAILHOUSE_DBGCON | ||
| 28 | + tristate "Jailhouse console driver" | ||
| 29 | + depends on X86 || ARM || ARM64 | ||
| 30 | + help | ||
| 31 | + The Jailhouse hypervisor provides a simple write-only console for | ||
| 32 | + debugging the bootstrap process of its cells. This driver registers | ||
| 33 | + a console with the kernel to make use of it. | ||
| 34 | + | ||
| 35 | + Note that Jailhouse has to be configured to permit a cell the usage | ||
| 36 | + of the console interface. | ||
| 37 | + | ||
| 38 | endif | ||
| 39 | diff --git a/drivers/virt/Makefile b/drivers/virt/Makefile | ||
| 40 | index c47f04d..abd4baa 100644 | ||
| 41 | --- a/drivers/virt/Makefile | ||
| 42 | +++ b/drivers/virt/Makefile | ||
| 43 | @@ -3,3 +3,4 @@ | ||
| 44 | # | ||
| 45 | |||
| 46 | obj-$(CONFIG_FSL_HV_MANAGER) += fsl_hypervisor.o | ||
| 47 | +obj-$(CONFIG_JAILHOUSE_DBGCON) += jailhouse_dbgcon.o | ||
| 48 | diff --git a/drivers/virt/jailhouse_dbgcon.c b/drivers/virt/jailhouse_dbgcon.c | ||
| 49 | new file mode 100644 | ||
| 50 | index 0000000..5a8a8fb | ||
| 51 | --- /dev/null | ||
| 52 | +++ b/drivers/virt/jailhouse_dbgcon.c | ||
| 53 | @@ -0,0 +1,99 @@ | ||
| 54 | +/* | ||
| 55 | + * Console driver for running over the Jailhouse partitioning hypervisor | ||
| 56 | + * | ||
| 57 | + * Copyright (c) Siemens AG, 2016 | ||
| 58 | + * | ||
| 59 | + * Authors: | ||
| 60 | + * Jan Kiszka <jan.kiszka@siemens.com> | ||
| 61 | + * | ||
| 62 | + * This work is licensed under the terms of the GNU GPL, version 2. See | ||
| 63 | + * the COPYING file in the top-level directory. | ||
| 64 | + */ | ||
| 65 | + | ||
| 66 | +#include <linux/module.h> | ||
| 67 | +#include <linux/console.h> | ||
| 68 | +#include <linux/serial_core.h> | ||
| 69 | +#ifdef CONFIG_X86 | ||
| 70 | +#include <asm/alternative.h> | ||
| 71 | +#endif | ||
| 72 | +#ifdef CONFIG_ARM | ||
| 73 | +#include <asm/opcodes-virt.h> | ||
| 74 | +#endif | ||
| 75 | + | ||
| 76 | +#define JAILHOUSE_HC_DEBUG_CONSOLE_PUTC 8 | ||
| 77 | + | ||
| 78 | +static void hypervisor_putc(char c) | ||
| 79 | +{ | ||
| 80 | +#if defined(CONFIG_X86) | ||
| 81 | + int result; | ||
| 82 | + | ||
| 83 | + asm volatile( | ||
| 84 | + ALTERNATIVE(".byte 0x0f,0x01,0xc1", ".byte 0x0f,0x01,0xd9", | ||
| 85 | + X86_FEATURE_VMMCALL) | ||
| 86 | + : "=a" (result) | ||
| 87 | + : "a" (JAILHOUSE_HC_DEBUG_CONSOLE_PUTC), "D" (c) | ||
| 88 | + : "memory"); | ||
| 89 | +#elif defined(CONFIG_ARM) | ||
| 90 | + register u32 num_res asm("r0") = JAILHOUSE_HC_DEBUG_CONSOLE_PUTC; | ||
| 91 | + register u32 arg1 asm("r1") = c; | ||
| 92 | + | ||
| 93 | + asm volatile( | ||
| 94 | + __HVC(0x4a48) | ||
| 95 | + : "=r" (num_res) | ||
| 96 | + : "r" (num_res), "r" (arg1) | ||
| 97 | + : "memory"); | ||
| 98 | +#elif defined(CONFIG_ARM64) | ||
| 99 | + register u64 num_res asm("x0") = JAILHOUSE_HC_DEBUG_CONSOLE_PUTC; | ||
| 100 | + register u64 arg1 asm("x1") = c; | ||
| 101 | + | ||
| 102 | + asm volatile( | ||
| 103 | + "hvc #0x4a48\n\t" | ||
| 104 | + : "=r" (num_res) | ||
| 105 | + : "r" (num_res), "r" (arg1) | ||
| 106 | + : "memory"); | ||
| 107 | +#endif | ||
| 108 | +} | ||
| 109 | + | ||
| 110 | +static void jailhouse_dbgcon_write(struct console *con, const char *s, | ||
| 111 | + unsigned count) | ||
| 112 | +{ | ||
| 113 | + while (count > 0) { | ||
| 114 | + hypervisor_putc(*s); | ||
| 115 | + count--; | ||
| 116 | + s++; | ||
| 117 | + } | ||
| 118 | +} | ||
| 119 | + | ||
| 120 | +static int __init early_jailhouse_dbgcon_setup(struct earlycon_device *device, | ||
| 121 | + const char *options) | ||
| 122 | +{ | ||
| 123 | + device->con->write = jailhouse_dbgcon_write; | ||
| 124 | + return 0; | ||
| 125 | +} | ||
| 126 | + | ||
| 127 | +EARLYCON_DECLARE(jailhouse, early_jailhouse_dbgcon_setup); | ||
| 128 | + | ||
| 129 | +static struct console jailhouse_dbgcon = { | ||
| 130 | + .name = "jailhouse", | ||
| 131 | + .write = jailhouse_dbgcon_write, | ||
| 132 | + .flags = CON_PRINTBUFFER | CON_ANYTIME, | ||
| 133 | + .index = -1, | ||
| 134 | +}; | ||
| 135 | + | ||
| 136 | +static int __init jailhouse_dbgcon_init(void) | ||
| 137 | +{ | ||
| 138 | + register_console(&jailhouse_dbgcon); | ||
| 139 | + return 0; | ||
| 140 | +} | ||
| 141 | + | ||
| 142 | +static void __exit jailhouse_dbgcon_exit(void) | ||
| 143 | +{ | ||
| 144 | + unregister_console(&jailhouse_dbgcon); | ||
| 145 | +} | ||
| 146 | + | ||
| 147 | +module_init(jailhouse_dbgcon_init); | ||
| 148 | +module_exit(jailhouse_dbgcon_exit); | ||
| 149 | + | ||
| 150 | +MODULE_LICENSE("GPL v2"); | ||
| 151 | +MODULE_DESCRIPTION("Jailhouse debug console driver"); | ||
| 152 | +MODULE_AUTHOR("Jan Kiszka <jan.kiszka@siemens.com>"); | ||
| 153 | -- | ||
| 154 | 2.1.4 | ||
| 155 | |||
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 | |||
diff --git a/patches/jailhouse/jailhouse_0006.patch b/patches/jailhouse/jailhouse_0006.patch new file mode 100644 index 0000000..8f0bbaf --- /dev/null +++ b/patches/jailhouse/jailhouse_0006.patch | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | diff --git a/lib/ioremap.c b/lib/ioremap.c | ||
| 2 | index b808a39..e486ef9 100644 | ||
| 3 | --- a/lib/ioremap.c | ||
| 4 | +++ b/lib/ioremap.c | ||
| 5 | @@ -179,3 +179,4 @@ int ioremap_page_range(unsigned long addr, | ||
| 6 | |||
| 7 | return err; | ||
| 8 | } | ||
| 9 | +EXPORT_SYMBOL_GPL(ioremap_page_range); | ||
