qemu-patch-raspberry4/hw
Volker Rümelin ff6e1624b3 pckbd: don't update OBF flags if KBD_STAT_OBF is set
Don't update the OBF flags in the status register and the cor-
responding IRQ lines if KBD_STAT_OBF is set. Otherwise this
may change the PS/2 event type. If the guest ISR was already
scheduled, the changed event type will be rather surprising for
the guest.

This fixes a mouse event stream corruption. To reproduce the
problem start a FreeDOS 1.2 guest with -machine pc,accel=kvm
and -display gtk. The KVM in-kernel irqchip has to be enabled.
Now open a text file with edit.exe in the guest and hold down
the cursor right key and at the same time move the mouse around.
You will quickly notice erratic mouse movements and unexpected
mouse clicks.

A trace file shows the mouse event stream corruption. Guest
rip 0xce93 (f000:ce93) is the in al,0x60 instruction in the
seabios mouse ISR, guest rip 0xceca (f000:ceca) is the
in al,0x60 instruction in the seabios keyboard ISR.

qemu-system-x86-5659  [007] ....   280.971116:
 tracing_mark_write: pckbd_kbd_update_irq kbd=0 aux=1
 # gtk queues a mouse event

qemu-system-x86-5665  [000] ....   280.971121:
 kvm_exit: reason EXTERNAL_INTERRUPT rip 0x22da info 0 800000fd
qemu-system-x86-5665  [000] d..1   280.971122:
 kvm_entry: vcpu 0, rip 0x22da
qemu-system-x86-5665  [000] ....   280.971123:
 kvm_exit: reason EXTERNAL_INTERRUPT rip 0x22da info 0 800000fd
qemu-system-x86-5665  [000] d..1   280.971124:
 kvm_entry: vcpu 0, rip 0x22da
qemu-system-x86-5665  [000] ....   280.971126:
 kvm_exit: reason IO_INSTRUCTION rip 0x110c8c info 640008 0
qemu-system-x86-5665  [000] ....   280.971176:
 tracing_mark_write: pckbd_kbd_read_status 0x3d
 # KBD_STAT_OBF and KBD_STAT_MOUSE_OBF set, the mouse ISR will
 # read data from the PS/2 controller.

qemu-system-x86-5665  [000] d..1   280.971180:
 kvm_entry: vcpu 0, rip 0x110c8d
qemu-system-x86-5665  [000] ....   280.971191:
 kvm_exit: reason EXTERNAL_INTERRUPT rip 0x110c8d info 0 800000f6
qemu-system-x86-5665  [000] d..1   280.971191:
 kvm_entry: vcpu 0, rip 0x110c8d
qemu-system-x86-5665  [000] ....   280.971193:
 kvm_exit: reason IO_INSTRUCTION rip 0xce93 info 600048 0
 # the mouse ISR wants to read data from the PS/2 controller

qemu-system-x86-5659  [007] ....   280.971231:
 tracing_mark_write: pckbd_kbd_update_irq kbd=1 aux=0
qemu-system-x86-5659  [007] ....   280.971238:
 tracing_mark_write: pckbd_kbd_update_irq kbd=1 aux=0
 # gtk queues a keyboard event 0xe0 0x4d (key right)

qemu-system-x86-5665  [000] ....   280.971257:
 tracing_mark_write: pckbd_kbd_update_irq kbd=0 aux=1
qemu-system-x86-5665  [000] ....   280.971262:
 tracing_mark_write: pckbd_kbd_update_irq kbd=1 aux=0
 # ps2_read_data() deasserts and reasserts the keyboard IRQ

qemu-system-x86-5665  [000] ....   280.971266:
 tracing_mark_write: pckbd_kbd_read_data 0xe0 kbd
 # -> the mouse ISR receives keyboard data

qemu-system-x86-5665  [000] d..1   280.971268:
 kvm_entry: vcpu 0, rip 0xce95
qemu-system-x86-5665  [000] ....   280.971269:
 kvm_exit: reason IO_INSTRUCTION rip 0xe828 info a00040 0
qemu-system-x86-5665  [000] ....   280.971270:
 kvm_ack_irq: irqchip PIC slave pin 12
qemu-system-x86-5665  [000] d..1   280.971270:
 kvm_entry: vcpu 0, rip 0xe82a
qemu-system-x86-5665  [000] ....   280.971271:
 kvm_exit: reason IO_INSTRUCTION rip 0xe82a info 200040 0
qemu-system-x86-5665  [000] ....   280.971271:
 kvm_ack_irq: irqchip PIC master pin 2
qemu-system-x86-5665  [000] d..1   280.971271:
 kvm_entry: vcpu 0, rip 0xe82c
qemu-system-x86-5665  [000] ....   280.971272:
 kvm_exit: reason PENDING_INTERRUPT rip 0x22da info 0 0
qemu-system-x86-5665  [000] d..1   280.971273:
 kvm_entry: vcpu 0, rip 0x22da
qemu-system-x86-5665  [000] ....   280.971274:
 kvm_exit: reason IO_INSTRUCTION rip 0x110c8c info 640008 0
qemu-system-x86-5665  [000] ....   280.971275:
 tracing_mark_write: pckbd_kbd_read_status 0x1d
qemu-system-x86-5665  [000] d..1   280.971276:
 kvm_entry: vcpu 0, rip 0x110c8d
qemu-system-x86-5665  [000] ....   280.971277:
 kvm_exit: reason IO_INSTRUCTION rip 0xceca info 600048 0
 # the keyboard ISR wants to read data from the PS/2 controller

qemu-system-x86-5665  [000] ....   280.971279:
 tracing_mark_write: pckbd_kbd_update_irq kbd=0 aux=1
qemu-system-x86-5665  [000] ....   280.971282:
 tracing_mark_write: pckbd_kbd_read_data 0x4d kbd
 # the keyboard ISR receives the second byte of the keyboard event

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-Id: <20210525181441.27768-5-vr_qemu@t-online.de>

[ kraxel: add missing include ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2021-05-26 11:29:56 +02:00
..
9pfs hw/9pfs/9p-synth: Replaced qemu_mutex_lock with QEMU_LOCK_GUARD 2021-03-16 11:41:49 +01:00
acpi pc,pci,virtio: bugfixes, improvements 2021-05-16 17:22:46 +01:00
adc clock: Add ClockEvent parameter to callbacks 2021-03-08 17:20:01 +00:00
alpha Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
arm hw/arm: Model TCMs in the SSE-300, not the AN547 2021-05-25 16:01:43 +01:00
audio Drop the deprecated lm32 target 2021-05-12 18:20:25 +02:00
avr hw/avr/atmega.c: use the avr51 cpu for atmega1280 2021-05-13 19:11:42 +02:00
block Block layer patches 2021-05-19 16:10:35 +01:00
char Miscellaneous patches for 2021-05-12 2021-05-13 20:13:24 +01:00
core pckbd: don't update OBF flags if KBD_STAT_OBF is set 2021-05-26 11:29:56 +02:00
cpu cpu/core: Fix "help" of CPU core device types 2021-04-09 16:05:16 -04:00
cris Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
display Drop the deprecated lm32 target 2021-05-12 18:20:25 +02:00
dma Drop the deprecated unicore32 target 2021-05-12 18:20:52 +02:00
gpio Pull request trivial-branch 20210515 2021-05-17 16:44:47 +01:00
hppa Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
hyperv qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
i2c Add a bus multiplexer device 2021-05-14 14:26:23 +01:00
i386 pc,pci,virtio: bugfixes, improvements 2021-05-16 17:22:46 +01:00
ide hw: Do not include hw/sysbus.h if it is not necessary 2021-05-02 17:24:50 +02:00
input pckbd: don't update OBF flags if KBD_STAT_OBF is set 2021-05-26 11:29:56 +02:00
intc hw/intc/arm_gicv3_cpuif: Fix EOIR write access check logic 2021-05-25 16:01:43 +01:00
ipack Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
ipmi hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
isa ppc patch queue 2021-05-04 2021-05-05 20:29:14 +01:00
m68k Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
mem Pull request trivial-branch 20210515 2021-05-17 16:44:47 +01:00
microblaze Do not include sysemu/sysemu.h if it's not really necessary 2021-05-02 17:24:50 +02:00
mips Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
misc Drop the deprecated unicore32 target 2021-05-12 18:20:52 +02:00
net pc,pci,virtio: bugfixes, improvements 2021-05-16 17:22:46 +01:00
nios2 Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
nubus hw: Do not include hw/sysbus.h if it is not necessary 2021-05-02 17:24:50 +02:00
nvme hw/nvme: move nvme emulation out of hw/block 2021-05-17 09:19:00 +02:00
nvram Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
openrisc Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
pci Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
pci-bridge Kconfig: Compile PXB for ARM_VIRT 2021-01-17 06:42:54 -05:00
pci-host hw/pci-host: Do not build gpex-acpi.c if GPEX is not selected 2021-05-13 18:12:40 +02:00
pcmcia hw/pcmcia: Do not register PCMCIA type if not required 2021-05-02 17:24:50 +02:00
ppc hw/ppc: moved has_spr to cpu.h 2021-05-19 10:30:28 +10:00
rdma pvrdma: wean code off pvrdma_ring.h kernel header 2021-03-15 16:41:22 +08:00
remote multi-process: Initialize variables declared with g_auto* 2021-05-21 15:43:57 +01:00
riscv hw/riscv: Fix OT IBEX reset vector 2021-05-11 20:02:07 +10:00
rtc hw/rtc/mc146818rtc: Convert to 3-phase reset (Resettable interface) 2021-05-13 18:05:22 +02:00
rx hw/rx/rx-gdbsim: Do not accept invalid memory size 2021-05-03 10:07:41 +02:00
s390x hw/s390x/ccw: Register qbus type in abstract TYPE_CCW_DEVICE parent 2021-05-20 14:19:30 +02:00
scsi pc,pci,virtio: bugfixes, improvements 2021-05-16 17:22:46 +01:00
sd Drop the deprecated lm32 target 2021-05-12 18:20:25 +02:00
sh4 Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
smbios hw/smbios: support for type 41 (onboard devices extended information) 2021-05-14 10:26:18 -04:00
sparc qemu-sparc queue 2021-05-10 12:34:05 +01:00
sparc64 qemu-sparc queue 2021-05-10 12:34:05 +01:00
ssi Trivial patches pull request 20210503 2021-05-05 13:52:00 +01:00
timer Pull request trivial-branch 20210515 2021-05-17 16:44:47 +01:00
tpm Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
tricore hw/tricore: Add testdevice for tests in tests/tcg/ 2021-05-18 09:36:21 +01:00
usb Drop the deprecated lm32 target 2021-05-12 18:20:25 +02:00
vfio vfio-ccw: Attempt to clean up all IRQs on error 2021-05-20 14:19:30 +02:00
virtio vhost-user-blk: Check that num-queues is supported by backend 2021-05-18 12:57:39 +02:00
watchdog clock: Add ClockEvent parameter to callbacks 2021-03-08 17:20:01 +00:00
xen Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
xenpv meson: convert hw/arch* 2020-08-21 06:30:33 -04:00
xtensa Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
Kconfig hw/nvme: move nvme emulation out of hw/block 2021-05-17 09:19:00 +02:00
meson.build hw/nvme: move nvme emulation out of hw/block 2021-05-17 09:19:00 +02:00