[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/10] pckbd: correctly disable PS/2 communication
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 09/10] pckbd: correctly disable PS/2 communication |
Date: |
Thu, 6 May 2021 08:27:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
Hi Volker,
On 5/5/21 9:21 PM, Volker Rümelin wrote:
> Currently the PS/2 controller command KBD_CCMD_MOUSE_DISABLE
> doesn't disable the PS/2 mouse communication at all, and the
> PS/2 controller commands KBD_CCMD_KBD_DISABLE and
> KBD_CCMD_KBD_ENABLE disable and enable the keyboard interrupt,
> which is very different from what a real PS/2 controller does.
> A guest may notice the difference.
>
> Mask out pending data on disabled queues to correctly disable
> the PS/2 controller communication.
>
> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
> ---
> hw/input/pckbd.c | 48 +++++++++++++++++++++++++++++++++++-------------
> 1 file changed, 35 insertions(+), 13 deletions(-)
> +static uint8_t kbd_pending(KBDState *s)
> +{
> + return s->pending & (~s->mode | ~(KBD_PENDING_KBD | KBD_PENDING_AUX));
> +}
Please introduce kbd_pending() in a preliminary patch.
> /* update irq and KBD_STAT_[MOUSE_]OBF */
> static void kbd_update_irq(KBDState *s)
> {
> + uint8_t pending = kbd_pending(s);
> +
> s->status &= ~(KBD_STAT_OBF | KBD_STAT_MOUSE_OBF);
> s->outport &= ~(KBD_OUT_OBF | KBD_OUT_MOUSE_OBF);
> - if (s->pending) {
> + if (pending) {
> s->status |= KBD_STAT_OBF;
> s->outport |= KBD_OUT_OBF;
> - if (s->pending & KBD_PENDING_CTRL_KBD) {
> + if (pending & KBD_PENDING_CTRL_KBD) {
> s->obsrc = KBD_OBSRC_CTRL;
- [PATCH 02/10] ps2: don't raise an interrupt if queue is full, (continued)
- [PATCH 02/10] ps2: don't raise an interrupt if queue is full, Volker Rümelin, 2021/05/05
- [PATCH 05/10] pckbd: don't update OBF flags if KBD_STAT_OBF is set, Volker Rümelin, 2021/05/05
- [PATCH 10/10] pckbd: remove duplicated keyboard and mouse defines, Volker Rümelin, 2021/05/05
- [PATCH 06/10] pckbd: PS/2 keyboard throttle, Volker Rümelin, 2021/05/05
- [PATCH 08/10] pckbd: add controller response queue, Volker Rümelin, 2021/05/05
- [PATCH 04/10] pckbd: split out interrupt line changing code, Volker Rümelin, 2021/05/05
- [PATCH 01/10] ps2: fix mouse stream corruption, Volker Rümelin, 2021/05/05
- [PATCH 09/10] pckbd: correctly disable PS/2 communication, Volker Rümelin, 2021/05/05
- Re: [PATCH 09/10] pckbd: correctly disable PS/2 communication,
Philippe Mathieu-Daudé <=
- [PATCH 07/10] pckbd: add state variable for interrupt source, Volker Rümelin, 2021/05/05