From 2826880e535d05c4a50bf81167126ae74141c843 Mon Sep 17 00:00:00 2001 From: Murali Nalajala Date: Wed, 23 Sep 2020 00:32:14 -0700 Subject: [PATCH] hh_rm_core: delay sending characters to RM No flow control mechanism exist in RM console. That means when there is huge messages sent from SVM to PVM there is a possibility that messages being dropped by RM and hence loss of messages on console. Add a delay of 800us for every console write and flush calls. Change-Id: I65fb7a347b093d079c1380765c63b38bf90e0b66 Signed-off-by: Murali Nalajala --- drivers/tty/hvc/hvc_haven.c | 4 +++- drivers/virt/haven/hh_rm_core.c | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/tty/hvc/hvc_haven.c b/drivers/tty/hvc/hvc_haven.c index 31488e578430..ab7238dc4ce5 100644 --- a/drivers/tty/hvc/hvc_haven.c +++ b/drivers/tty/hvc/hvc_haven.c @@ -85,7 +85,9 @@ static int hh_hvc_notify_console_chars(struct notifier_block *this, pr_warn_ratelimited("dropped %d bytes from VM%d - full fifo\n", msg->num_bytes - ret, vm_name); - hvc_kick(); + if (hvc_poll(hh_hvc_data[vm_name].hvc)) + hvc_kick(); + return NOTIFY_OK; } diff --git a/drivers/virt/haven/hh_rm_core.c b/drivers/virt/haven/hh_rm_core.c index 152f9d78dbb8..6e56c9d1d384 100644 --- a/drivers/virt/haven/hh_rm_core.c +++ b/drivers/virt/haven/hh_rm_core.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -530,6 +531,11 @@ static int hh_rm_send_request(u32 message_id, */ tx_flags = (i == num_fragments) ? HH_MSGQ_TX_PUSH : 0; + /* delay sending console characters to RM */ + if (message_id == HH_RM_RPC_MSG_ID_CALL_VM_CONSOLE_WRITE || + message_id == HH_RM_RPC_MSG_ID_CALL_VM_CONSOLE_FLUSH) + udelay(800); + ret = hh_msgq_send(hh_rm_msgq_desc, send_buff, sizeof(*hdr) + payload_size, tx_flags);