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 <eberman@codeaurora.org>
This commit is contained in:
Elliot Berman
2020-10-06 17:38:05 -07:00
committed by Todd Kjos
parent 710cc7493c
commit 602b160a95
2 changed files with 14 additions and 2 deletions

View File

@@ -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.

View File

@@ -4,6 +4,7 @@
#include <linux/console.h>
#include <linux/init.h>
#include <linux/kfifo.h>
#include <linux/moduleparam.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/spinlock.h>
@@ -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);