LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
From: Geoff Levand <geoff@infradead.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Markus Elfring <elfring@users.sourceforge.net>,
	Emmanuel Nicolet <emmanuel.nicolet@gmail.com>
Subject: [PATCH v2 9/9] hvc_console: Allow backends to set I/O buffer size
Date: Sat, 09 May 2020 18:58:32 +0000
Message-ID: <6f6294df663a53f47bb28abcbb1ef756c6a59922.1589049250.git.geoff@infradead.org> (raw)
In-Reply-To: <cover.1589049250.git.geoff@infradead.org>

To allow HVC backends to set the I/O buffer sizes to values
that are most efficient for the backend, change the macro
definitions where the buffer sizes are set to be conditional
on whether or not the macros are already defined.  Also,
rename the macros from N_OUTBUF to HVC_N_OUBUF and from
N_INBUF to HVC_N_INBUF.

Typical usage in the backend source file would be:

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 drivers/tty/hvc/hvc_console.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index 436cc51c92c3..2928bad057fc 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -42,12 +42,15 @@
 #define HVC_CLOSE_WAIT (HZ/100) /* 1/10 of a second */
 
 /*
- * These sizes are most efficient for vio, because they are the
- * native transfer size. We could make them selectable in the
- * future to better deal with backends that want other buffer sizes.
+ * These default sizes are most efficient for vio, because they are
+ * the native transfer size.
  */
-#define N_OUTBUF	16
-#define N_INBUF		16
+#if !defined(HVC_N_OUTBUF)
+# define HVC_N_OUTBUF	16
+#endif
+#if !defined(HVC_N_INBUF)
+# define HVC_N_INBUF	16
+#endif
 
 #define __ALIGNED__ __attribute__((__aligned__(sizeof(long))))
 
@@ -151,7 +154,7 @@ static uint32_t vtermnos[MAX_NR_HVC_CONSOLES] =
 static void hvc_console_print(struct console *co, const char *b,
 			      unsigned count)
 {
-	char c[N_OUTBUF] __ALIGNED__;
+	char c[HVC_N_OUTBUF] __ALIGNED__;
 	unsigned i = 0, n = 0;
 	int r, donecr = 0, index = co->index;
 
@@ -640,7 +643,7 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep)
 {
 	struct tty_struct *tty;
 	int i, n, count, poll_mask = 0;
-	char buf[N_INBUF] __ALIGNED__;
+	char buf[HVC_N_INBUF] __ALIGNED__;
 	unsigned long flags;
 	int read_total = 0;
 	int written_total = 0;
@@ -681,7 +684,7 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep)
 
  read_again:
 	/* Read data if any */
-	count = tty_buffer_request_room(&hp->port, N_INBUF);
+	count = tty_buffer_request_room(&hp->port, HVC_N_INBUF);
 
 	/* If flip is full, just reschedule a later read */
 	if (count == 0) {
-- 
2.20.1


  parent reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09 18:58 [PATCH v2 0/9] powerpc + ps3 patches Geoff Levand
2020-05-09 18:58 ` [PATCH v2 3/9] powerpc/head_check: Avoid broken pipe Geoff Levand
2020-05-09 18:58 ` [PATCH v2 4/9] drivers/ps3: Remove duplicate error messages Geoff Levand
2020-05-10 18:15   ` Markus Elfring
2020-05-09 18:58 ` [PATCH v2 1/9] powerpc/head_check: Automatic verbosity Geoff Levand
2020-05-09 18:58 ` [PATCH v2 2/9] powerpc/wrapper: Output linker map file Geoff Levand
2020-05-09 18:58 ` Geoff Levand [this message]
2020-05-10 19:05   ` [PATCH v2 9/9] hvc_console: Allow backends to set I/O buffer size Markus Elfring
2020-05-10 22:50   ` [PATCH v3 " Geoff Levand
2020-05-09 18:58 ` [PATCH v2 7/9] powerpc/ps3: Add check for otheros image size Geoff Levand
2020-05-15  2:02   ` Michael Ellerman
2020-05-16 16:03     ` Geoff Levand
2020-05-18  6:31       ` Michael Ellerman
2020-05-16 16:20   ` [PATCH v3 " Geoff Levand
2020-06-09  5:56     ` Michael Ellerman
2020-05-09 18:58 ` [PATCH v2 8/9] powerpc/ps3: Fix kexec shutdown hang Geoff Levand
2020-05-09 18:58 ` [PATCH v2 6/9] ps3disk: use the default segment boundary Geoff Levand
2020-05-09 18:58 ` [PATCH v2 5/9] net/ps3_gelic_net: Remove duplicate error message Geoff Levand
2020-05-10 18:25   ` Markus Elfring
2020-05-20 10:59 ` [PATCH v2 0/9] powerpc + ps3 patches Michael Ellerman

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=6f6294df663a53f47bb28abcbb1ef756c6a59922.1589049250.git.geoff@infradead.org \
    --to=geoff@infradead.org \
    --cc=elfring@users.sourceforge.net \
    --cc=emmanuel.nicolet@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git