From: Nadav Amit <namit@vmware.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: <kvm@vger.kernel.org>, Nadav Amit <namit@vmware.com>
Subject: [kvm-unit-tests PATCH] x86: realmode: fix serial_init()
Date: Wed, 1 Jul 2020 12:30:45 -0700 [thread overview]
Message-ID: <20200701193045.31247-1-namit@vmware.com> (raw)
In some setups serial output from the real-mode tests is corrupted.
I do not know the serial port initialization code well, but the
protected mode initialization code is different than the real-mode code.
Using the protected mode serial port initialization fixes the problem.
Keeping the tradition of code duplication between real-mode and
protected mode, this patch copies the missing initialization into
real-mode serial port initialization.
Signed-off-by: Nadav Amit <namit@vmware.com>
---
x86/realmode.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/x86/realmode.c b/x86/realmode.c
index 90ecd13..7c2d776 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -77,6 +77,15 @@ static void serial_init(void)
lcr = inb(serial_iobase + 0x03);
lcr &= ~0x80;
outb(lcr, serial_iobase + 0x03);
+
+ /* IER: disable interrupts */
+ outb(0x00, serial_iobase + 0x01);
+ /* LCR: 8 bits, no parity, one stop bit */
+ outb(0x03, serial_iobase + 0x03);
+ /* FCR: disable FIFO queues */
+ outb(0x00, serial_iobase + 0x02);
+ /* MCR: RTS, DTR on */
+ outb(0x03, serial_iobase + 0x04);
}
#endif
--
2.17.1
reply other threads:[~2020-07-01 19:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200701193045.31247-1-namit@vmware.com \
--to=namit@vmware.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/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