aboutsummaryrefslogtreecommitdiff
path: root/hw/char
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-11-23 13:15:02 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-11-23 13:15:02 +0000
commit1b89975d420c4c6c2967730ea20f0fd0ce211c1f (patch)
tree75aa511bfd83bc8c34529d7d49ef5c1107454f7a /hw/char
parent2fe47fce7860a1f1212f6b309fcc1c3163c532de (diff)
parent6dd836f5d32b989e18c6dda655a26f4d73a52f6a (diff)
downloadqemu-1b89975d420c4c6c2967730ea20f0fd0ce211c1f.zip
qemu-1b89975d420c4c6c2967730ea20f0fd0ce211c1f.tar.gz
qemu-1b89975d420c4c6c2967730ea20f0fd0ce211c1f.tar.bz2
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.11-20171122' into staging
ppc patch queue 2017-11-22 Several more fixes to merge for qemu-2.11. # gpg: Signature made Wed 22 Nov 2017 04:29:57 GMT # gpg: using RSA key 0x6C38CACA20D9B392 # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" # gpg: aka "David Gibson (Red Hat) <dgibson@redhat.com>" # gpg: aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" # gpg: aka "David Gibson (kernel.org) <dwg@kernel.org>" # Primary key fingerprint: 75F4 6586 AE61 A66C C44E 87DC 6C38 CACA 20D9 B392 * remotes/dgibson/tags/ppc-for-2.11-20171122: ppc: fix VTB migration spapr: Implement bug in spapr-vty device to be compatible with PowerVM hw/ppc/spapr: Fix virtio-scsi bootindex handling for LUNs >= 256 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/char')
-rw-r--r--hw/char/spapr_vty.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c
index 0fa416c..6748334 100644
--- a/hw/char/spapr_vty.c
+++ b/hw/char/spapr_vty.c
@@ -58,6 +58,24 @@ static int vty_getchars(VIOsPAPRDevice *sdev, uint8_t *buf, int max)
while ((n < max) && (dev->out != dev->in)) {
buf[n++] = dev->buf[dev->out++ % VTERM_BUFSIZE];
+
+ /* PowerVM's vty implementation has a bug where it inserts a
+ * \0 after every \r going to the guest. Existing guests have
+ * a workaround for this which removes every \0 immediately
+ * following a \r, so here we make ourselves bug-for-bug
+ * compatible, so that the guest won't drop a real \0-after-\r
+ * that happens to occur in a binary stream. */
+ if (buf[n - 1] == '\r') {
+ if (n < max) {
+ buf[n++] = '\0';
+ } else {
+ /* No room for the extra \0, roll back and try again
+ * next time */
+ dev->out--;
+ n--;
+ break;
+ }
+ }
}
qemu_chr_fe_accept_input(&dev->chardev);