Skip to contentSkip to conversation

PC: improve emulation correctness

PATCH In review Hervé Poussineau 4 participants 10 messages Feb 11, 2014 – Mar 5, 2014

lore
Share & tools
lore
#0 lore raw

cover PC: improve emulation correctness

With those two patches, I'm able to run a real BIOS in QEMU (Iwill P55XB2) However, QEMU crashes when rebooting the computer after leaving BIOS settings.

Hervé Poussineau (2):
pam: partly fix write-only mode
pckbd: return 'keyboard enabled' on read input port command

 hw/input/pckbd.c  |    2 +-
 hw/pci-host/pam.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/2 pam: partly fix write-only mode

In write-only mode, writes are forwarded to RAM, while reads should not be handled (ie should return 0xff).
Assume that in this mode, no read access is ever done, as they shouldn't give any sensible result.

So, in write-only mode, alias PAM region to RAM, instead of PCI memory (which can even be mapped to some device!)

This fixes Award BIOS, which use this mode to shadow system BIOS and video BIOS.

---
 hw/pci-host/pam.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci-host/pam.c +1 -1
index ec6be46..e1e95aa 100644
@@ -68,7 +68,7 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory,
     /* XXX: should distinguish read/write cases */
     memory_region_init_alias(&mem->alias[0], OBJECT(dev), "pam-pci", pci_address_space,
                              start, size);
-    memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", pci_address_space,
+    memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", ram_memory,
                              start, size);
 
     for (i = 0; i < 4; ++i) {
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/2 pckbd: return 'keyboard enabled' on read input port command

In reply to Hervé Poussineau

Bit 7 of Input Port is the keyboard inhibit switch. 0 means keyboard inhibited, while 1 means keyboard enabled.

Incidentaly, this also fixes an error encountered while booting an Award BIOS: "Keyboard is locked out - Unlock the key".

---
 hw/input/pckbd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/input/pckbd.c +1 -1
index 655b8c5..29af3d7 100644
@@ -281,7 +281,7 @@ static void kbd_write_command(void *opaque, hwaddr addr,
         kbd_update_irq(s);
         break;
     case KBD_CCMD_READ_INPORT:
-        kbd_queue(s, 0x00, 0);
+        kbd_queue(s, 0x80, 0);
         break;
     case KBD_CCMD_READ_OUTPORT:
         kbd_queue(s, s->outport, 0);
Signature · 1 line
1.7.10.4
#3 lore raw
In reply to Hervé Poussineau

Ping.

QEMU crash at reboot is due to not resetting PAM registers at i440fx reset, but a patch has already been rejected on ML: http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02928.html

Hervé

Quoted 11 lines · Hervé Poussineau

With those two patches, I'm able to run a real BIOS in QEMU (Iwill P55XB2) However, QEMU crashes when rebooting the computer after leaving BIOS settings.

Hervé Poussineau (2):
pam: partly fix write-only mode
pckbd: return 'keyboard enabled' on read input port command

 hw/input/pckbd.c  |    2 +-
 hw/pci-host/pam.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
#4 lore raw
Quoted 7 lines · Hervé Poussineau

Ping.

QEMU crash at reboot is due to not resetting PAM registers at i440fx reset, but a patch has already been rejected on ML:
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02928.html

Hervé

I thought an alternative fix is being worked on?
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02967.html

Quoted 12 lines
Quoted 11 lines · Hervé Poussineau

With those two patches, I'm able to run a real BIOS in QEMU (Iwill P55XB2) However, QEMU crashes when rebooting the computer after leaving BIOS settings.

Hervé Poussineau (2):
pam: partly fix write-only mode
pckbd: return 'keyboard enabled' on read input port command

hw/input/pckbd.c  |    2 +-
hw/pci-host/pam.c |    2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
#5 lore raw

Il 05/03/2014 00:49, Michael S. Tsirkin ha scritto:

Quoted 11 lines · Hervé Poussineau
Quoted 7 lines

Ping.

QEMU crash at reboot is due to not resetting PAM registers at i440fx reset, but a patch has already been rejected on ML:
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02928.html

Hervé

I thought an alternative fix is being worked on?
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02967.html

Hervé, how does the BIOS do the reset?

Paolo

#9 lore raw
In reply to Hervé Poussineau
Quoted 6 lines · Hervé Poussineau

With those two patches, I'm able to run a real BIOS in QEMU (Iwill P55XB2) However, QEMU crashes when rebooting the computer after leaving BIOS settings.

Hervé Poussineau (2):
pam: partly fix write-only mode
pckbd: return 'keyboard enabled' on read input port command

Thanks, I've applied this.

Quoted 6 lines
 hw/input/pckbd.c  |    2 +-
 hw/pci-host/pam.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.10.4
#7 lore raw
In reply to Michael S. Tsirkin

Am 05.03.2014 00:49, schrieb Michael S. Tsirkin:

Quoted 11 lines · Hervé Poussineau
Quoted 7 lines

Ping.

QEMU crash at reboot is due to not resetting PAM registers at i440fx reset, but a patch has already been rejected on ML:
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02928.html

Hervé

I thought an alternative fix is being worked on?
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02967.html

And I was told an alternative fix had been applied - was I misinformed?

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#8 lore raw
Quoted 8 lines · Andreas Färber

Am 05.03.2014 00:49, schrieb Michael S. Tsirkin:

Quoted 7 lines · Hervé Poussineau
Quoted 6 lines

Ping.

QEMU crash at reboot is due to not resetting PAM registers at i440fx reset, but a patch has already been rejected on ML:
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02928.html

Quoted 9 lines
Quoted 4 lines
Quoted 1 line

Hervé

I thought an alternative fix is being worked on?
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02967.html

And I was told an alternative fix had been applied - was I misinformed?

Andreas

In current master, I don't see any reset of PAM registers in hw/pci-host/piix.c . However, piix3 has a reset function.

Hervé

#6 lore raw
In reply to Paolo Bonzini
Quoted 8 lines · Paolo Bonzini

Il 05/03/2014 00:49, Michael S. Tsirkin ha scritto:

Quoted 7 lines · Hervé Poussineau
Quoted 6 lines

Ping.

QEMU crash at reboot is due to not resetting PAM registers at i440fx reset, but a patch has already been rejected on ML:
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02928.html

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Hervé

I thought an alternative fix is being worked on?
http://lists.gnu.org/archive/html/qemu-devel/2013-02/msg02967.html

Hervé, how does the BIOS do the reset?

Paolo

At cold boot, BIOS is shadowed to RAM, and then hot-patched, so a warm boot won't do the same thing.
At BIOS exit, BIOS jumps to the new warm boot path.
This warm path doesn't work and crashes QEMU with "qemu: fatal: Trying to execute code outside RAM or ROM at 0x000a1249" ; I've no idea why exactly. Resetting PAM registers prevents the shadowed copy to be visible, and BIOS does again a cold boot, which works.

Hervé