@@ -19,6 +19,10 @@
#define HVSI_TSDTR 0x01
#define HVSI_TSCD 0x20
+/* Never send more than 12 bytes at once, that is 16 bytes
+ * with header, which is the max pHyp can swallow in one
+ * hcall.
+ */
#define HVSI_MAX_OUTGOING_DATA 12
#define HVSI_VERSION 1
@@ -316,10 +316,10 @@ void hvsilib_establish(struct hvsi_priv *pv)
pr_devel("HVSI@%x: Establishing...\n", pv->termno);
- /* Try for up to 200ms, there can be a packet to
+ /* Try for up to 500ms, there can be a packet to
* start the process waiting for us...
*/
- for (timeout = 0; timeout < 20; timeout++) {
+ for (timeout = 0; timeout < 50; timeout++) {
if (pv->established)
goto established;
if (!hvsi_get_packet(pv))
@@ -341,8 +341,8 @@ void hvsilib_establish(struct hvsi_priv *pv)
pr_devel("HVSI@%x: ... waiting handshake\n", pv->termno);
- /* Try for up to 200s */
- for (timeout = 0; timeout < 20; timeout++) {
+ /* Try for up to 500ms */
+ for (timeout = 0; timeout < 50; timeout++) {
if (pv->established)
goto established;
if (!hvsi_get_packet(pv))
@@ -379,7 +379,9 @@ int hvsilib_open(struct hvsi_priv *pv, struct hvc_struct *hp)
/* Keep track of the tty data structure */
pv->tty = tty_kref_get(hp->tty);
- hvsilib_establish(pv);
+ WARN_ON(pv->opened && !pv->is_console);
+ if (!pv->opened)
+ hvsilib_establish(pv);
return 0;
}
Experience shows that our hvsi negotiation timeouts were too short under OPAL v2. This patch bumps them from 200ms to 500ms. To limit the impact when the console is repeatedly opened/closed, we also avoid re-negotiating an already opened & established connection which typically happens when running init scripts on the tty shared with the kernel console. Finally, while touching hvsi, I added a comment explaining why we limit our output packet size to 12 bytes. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- arch/powerpc/include/asm/hvsi.h | 4 ++++ drivers/tty/hvc/hvsi_lib.c | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-)