linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH 04/21] tty/hvc/hvsi_lib: Updates for running under OPAL v2
Date: Sat, 10 Sep 2011 11:19:51 -0300	[thread overview]
Message-ID: <1315664408-16797-4-git-send-email-benh@kernel.crashing.org> (raw)
In-Reply-To: <1315664408-16797-1-git-send-email-benh@kernel.crashing.org>

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(-)

diff --git a/arch/powerpc/include/asm/hvsi.h b/arch/powerpc/include/asm/hvsi.h
index d3f64f3..ca85d9d 100644
--- a/arch/powerpc/include/asm/hvsi.h
+++ b/arch/powerpc/include/asm/hvsi.h
@@ -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
 
diff --git a/drivers/tty/hvc/hvsi_lib.c b/drivers/tty/hvc/hvsi_lib.c
index bd9b098..08e3e90 100644
--- a/drivers/tty/hvc/hvsi_lib.c
+++ b/drivers/tty/hvc/hvsi_lib.c
@@ -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;
 }
-- 
1.7.4.1

  parent reply	other threads:[~2011-09-10 14:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-10 14:19 [PATCH 01/21] powerpc/udbg: Fix Kconfig entry for avoiding 44x early debug with KVM Benjamin Herrenschmidt
2011-09-10 14:19 ` [PATCH 02/21] powerpc/smp: More generic support for "soft hotplug" Benjamin Herrenschmidt
2011-09-10 14:19 ` [PATCH 03/21] powerpc/pci: Call pcie_bus_configure_settings() Benjamin Herrenschmidt
2011-09-10 14:19 ` Benjamin Herrenschmidt [this message]
2011-09-10 14:19 ` [PATCH 05/21] powerpc/powernv: Don't clobber r9 in relative_toc() Benjamin Herrenschmidt
2011-09-10 14:19 ` [PATCH 06/21] powerpc: Add skeleton PowerNV platform Benjamin Herrenschmidt
2011-09-12  1:17   ` Michael Neuling
2011-09-12  6:02     ` Geert Uytterhoeven
2011-09-10 14:19 ` [PATCH 07/21] of: Change logic to overwrite cmd_line with CONFIG_CMDLINE Benjamin Herrenschmidt
2011-09-10 14:19 ` [PATCH 08/21] powerpc/powernv: Add CPU hotplug support Benjamin Herrenschmidt
2011-09-10 14:19 ` [PATCH 09/21] powerpc/powernv: Add OPAL takeover from PowerVM Benjamin Herrenschmidt
2011-09-10 14:19 ` [PATCH 10/21] powerpc/powernv: Get kernel command line accross OPAL takeover Benjamin Herrenschmidt
2011-09-10 14:19 ` [PATCH 11/21] powerpc/powernv: Basic support for OPAL Benjamin Herrenschmidt
2011-09-10 14:19 ` [PATCH 12/21] powerpc/powernv: Add support for instanciating OPAL v2 from Open Firmware Benjamin Herrenschmidt
2011-09-10 14:20 ` [PATCH 13/21] powerpc/powernv: Support for OPAL console Benjamin Herrenschmidt
2011-09-10 14:20 ` [PATCH 14/21] powerpc/powernv: Hookup reboot and poweroff functions Benjamin Herrenschmidt
2011-09-10 14:20 ` [PATCH 15/21] powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks Benjamin Herrenschmidt
2011-09-10 14:20 ` [PATCH 16/21] powerpc/powernv: Add OPAL ICS backend Benjamin Herrenschmidt
2011-09-10 14:20 ` [PATCH 17/21] powerpc/powernv: Register and handle OPAL interrupts Benjamin Herrenschmidt
2011-09-10 14:20 ` [PATCH 18/21] powerpc/powernv: Machine check and other system interrupts Benjamin Herrenschmidt
2011-09-10 14:20 ` [PATCH 19/21] powerpc/powernv: Add support for p5ioc2 PCI-X and PCIe Benjamin Herrenschmidt
2011-09-10 14:20 ` [PATCH 20/21] powerpc/powernv: Implement MSI support for p5ioc2 PCIe Benjamin Herrenschmidt
2011-09-10 14:20 ` [PATCH 21/21] powerpc/powernv: Handle PCI-X/PCIe reset delay Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315664408-16797-4-git-send-email-benh@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).