From 602b160a9591675f9fbd46cd87f07949cbfb10d9 Mon Sep 17 00:00:00 2001 From: Elliot Berman Date: Tue, 6 Oct 2020 17:38:05 -0700 Subject: [PATCH] ANDROID: tty: hvc_dcc: Add parameter to enable DCC On cuttlefish device, DCC registers are unavailable and cause kernel to crash if those registers are probed. Introduce a module parameter ("hvc_dcc.enable") to enable DCC at the kernel commandline. Bug: 169129589 Change-Id: I0218d9e64443c881d163e484712edf18e42975fd Signed-off-by: Elliot Berman --- Documentation/admin-guide/kernel-parameters.txt | 4 ++++ drivers/tty/hvc/hvc_dcc.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a1068742a6df..096deaa447a6 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1550,6 +1550,10 @@ If specified, z/VM IUCV HVC accepts connections from listed z/VM user IDs only. + hvc_dcc.enable= [ARM,ARM64] Enable DCC driver at runtime. For GKI, + disabled at runtime by default to prevent + crashes in devices which do not support DCC. + hv_nopvspin [X86,HYPER_V] Disables the paravirt spinlock optimizations which allow the hypervisor to 'idle' the guest on lock contention. diff --git a/drivers/tty/hvc/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c index e1ebcdd5fe8d..e9aff1f6b196 100644 --- a/drivers/tty/hvc/hvc_dcc.c +++ b/drivers/tty/hvc/hvc_dcc.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -13,6 +14,13 @@ #include "hvc_console.h" +/* + * Disable DCC driver at runtime. Want driver enabled for GKI, but some devices + * do not support the registers and crash when driver pokes the registers + */ +static bool enable; +module_param(enable, bool, 0444); + /* DCC Status Bits */ #define DCC_STATUS_RX (1 << 30) #define DCC_STATUS_TX (1 << 29) @@ -244,7 +252,7 @@ static int __init hvc_dcc_console_init(void) { int ret; - if (!hvc_dcc_check()) + if (!enable || !hvc_dcc_check()) return -ENODEV; /* Returns -1 if error */ @@ -258,7 +266,7 @@ static int __init hvc_dcc_init(void) { struct hvc_struct *p; - if (!hvc_dcc_check()) + if (!enable || !hvc_dcc_check()) return -ENODEV; p = hvc_alloc(0, 0, &hvc_dcc_get_put_ops, 128);