Skip to contentSkip to conversation

hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work.

PATCH In review Konrad Rzeszutek Wilk 5 participants 11 messages Nov 11, 2013 – Nov 25, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work.

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Device (S20)

{
    Name (_ADR, 0x00040000)
    Name (_SUN, 0x04)
    Method (_EJ0, 1, NotSerialized)
    {
	Store (0x20, \_GPE.DPT1)
	Store (0x88, \_GPE.DPT2)
	Store (One, \_GPE.PH20)
    }

    Method (_STA, 0, NotSerialized)
    {
	Store (0x20, \_GPE.DPT1)
	Store (0x89, \_GPE.DPT2)
    }
}

and DPT1 (and DPT2) is defined as:

OperationRegion ( DG1, SystemIO, 0xb044, 0x04 )

Field ( DG1, ByteAcc, NoLock, Preserve ) {
    DPT1, 8, DPT2, 8
}

But unfortunately when we do the writes they are done as byte writes, not as 4-byte writes (long). Hence any debug values are never show in QEMU.

This fixes it so that we can see them in the log file.

---
 hw/piix4acpi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/piix4acpi.c +2 -2
index bf916d9..ddbe8e0 100644
@@ -284,7 +284,7 @@ static inline void clear_bit(uint8_t *map, int bit)
     map[bit / 8] &= ~(1 << (bit % 8));
 }
 
-static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
+static void acpi_dbg_writeb(void *opaque, uint32_t addr, uint32_t val)
 {
     PIIX4ACPI_LOG(PIIX4ACPI_LOG_DEBUG, "ACPI: DBG: 0x%08x\n", val);
     PIIX4ACPI_LOG(PIIX4ACPI_LOG_INFO, "ACPI:debug: write addr=0x%x, val=0x%x.\n", addr, val);
@@ -776,7 +776,7 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
 #ifdef CONFIG_PASSTHROUGH
     php_devfn_init();
 #endif
-    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, d);
+    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 1, acpi_dbg_writeb, d);
 
     register_savevm("piix4acpi", 0, 2, piix4acpi_save, piix4acpi_load, d);
 
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 22 lines · Konrad Rzeszutek Wilk

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Device (S20)

{
     Name (_ADR, 0x00040000)
     Name (_SUN, 0x04)
     Method (_EJ0, 1, NotSerialized)
     {
	Store (0x20, \_GPE.DPT1)
	Store (0x88, \_GPE.DPT2)
	Store (One, \_GPE.PH20)
     }

     Method (_STA, 0, NotSerialized)
     {
	Store (0x20, \_GPE.DPT1)
	Store (0x89, \_GPE.DPT2)
     }
}
Quoted 6 lines

and DPT1 (and DPT2) is defined as:

OperationRegion ( DG1, SystemIO, 0xb044, 0x04 )

Field ( DG1, ByteAcc, NoLock, Preserve ) {
     DPT1, 8, DPT2, 8
}

Just as a note for the sake of correctness, that Field only defines 2 bytes but the OpRegion is defined as 4 bytes (and doesn't need to be).

Quoted 36 lines

But unfortunately when we do the writes they are done as byte writes, not as 4-byte writes (long). Hence any debug values are never show in QEMU.

This fixes it so that we can see them in the log file.

---
  hw/piix4acpi.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
hw/piix4acpi.c +2 -2
index bf916d9..ddbe8e0 100644
@@ -284,7 +284,7 @@ static inline void clear_bit(uint8_t *map, int bit)
      map[bit / 8] &= ~(1 << (bit % 8));
  }
 
-static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
+static void acpi_dbg_writeb(void *opaque, uint32_t addr, uint32_t val)
  {
      PIIX4ACPI_LOG(PIIX4ACPI_LOG_DEBUG, "ACPI: DBG: 0x%08x\n", val);
      PIIX4ACPI_LOG(PIIX4ACPI_LOG_INFO, "ACPI:debug: write addr=0x%x, val=0x%x.\n", addr, val);
@@ -776,7 +776,7 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
  #ifdef CONFIG_PASSTHROUGH
      php_devfn_init();
  #endif
-    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, d);
+    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 1, acpi_dbg_writeb, d);
 
      register_savevm("piix4acpi", 0, 2, piix4acpi_save, piix4acpi_load, d);
 
#2 lore raw
Quoted 25 lines · Ross Philipson
Quoted 24 lines · Konrad Rzeszutek Wilk

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Device (S20)

{
    Name (_ADR, 0x00040000)
    Name (_SUN, 0x04)
    Method (_EJ0, 1, NotSerialized)
    {
	Store (0x20, \_GPE.DPT1)
	Store (0x88, \_GPE.DPT2)
	Store (One, \_GPE.PH20)
    }

    Method (_STA, 0, NotSerialized)
    {
	Store (0x20, \_GPE.DPT1)
	Store (0x89, \_GPE.DPT2)
    }
}

and DPT1 (and DPT2) is defined as:

Quoted 8 lines
Quoted 4 lines

OperationRegion ( DG1, SystemIO, 0xb044, 0x04 )

Field ( DG1, ByteAcc, NoLock, Preserve ) {
    DPT1, 8, DPT2, 8
}

Just as a note for the sake of correctness, that Field only defines 2 bytes but the OpRegion is defined as 4 bytes (and doesn't need to be).

Yup, I saw that too and was wondering why it was defined that way.

It probably can use some more fixes :-)

Quoted 43 lines
Quoted 29 lines

But unfortunately when we do the writes they are done as byte writes, not as 4-byte writes (long). Hence any debug values are never show in QEMU.

This fixes it so that we can see them in the log file.

---
 hw/piix4acpi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/piix4acpi.c +1 -1
index bf916d9..ddbe8e0 100644
@@ -284,7 +284,7 @@ static inline void clear_bit(uint8_t *map, int bit)
     map[bit / 8] &= ~(1 << (bit % 8));
 }
 
-static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
+static void acpi_dbg_writeb(void *opaque, uint32_t addr, uint32_t val)
 {
     PIIX4ACPI_LOG(PIIX4ACPI_LOG_DEBUG, "ACPI: DBG: 0x%08x\n", val);
     PIIX4ACPI_LOG(PIIX4ACPI_LOG_INFO, "ACPI:debug: write addr=0x%x, val=0x%x.\n", addr, val);

hw/piix4acpi.c i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, · line 782

Quoted 8 lines
hw/piix4acpi.c +1 -1
@@ -776,7 +776,7 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
 #ifdef CONFIG_PASSTHROUGH
     php_devfn_init();
 #endif
-    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, d);
+    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 1, acpi_dbg_writeb, d);
 
     register_savevm("piix4acpi", 0, 2, piix4acpi_save, piix4acpi_load, d);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#3 lore raw
In reply to Konrad Rzeszutek Wilk

Konrad Rzeszutek Wilk writes ("[PATCH] hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work."):

Quoted 3 lines

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Thanks.

to qemu-xen-traditional master.

I think this ought to be backported in due course so I have put it on my list.

Ian.

#4 lore raw
Quoted 9 lines · Ian Jackson

Konrad Rzeszutek Wilk writes ("[PATCH] hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work."):

Quoted 3 lines

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Thanks.

Yeey!

Quoted 2 lines

to qemu-xen-traditional master.

It also applies to the qemu-xen but I forgot to CC Stefano. Doing it here.

Quoted 3 lines

I think this ought to be backported in due course so I have put it on my list.

Much appreciated.

Quoted 2 lines

Ian.

#5 lore raw
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Ian Jackson

Konrad Rzeszutek Wilk writes ("[PATCH] hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work."):

Quoted 3 lines

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Thanks.

Quoted 6 lines

Yeey!

Quoted 2 lines

to qemu-xen-traditional master.

It also applies to the qemu-xen but I forgot to CC Stefano. Doing it here.

Unfortunately the code in upstream qemu is very different in this area, and it looks like ACPI_DBG_IO_ADDR is actually unused.

#6 lore raw
Quoted 14 lines · Stefano Stabellini
Quoted 13 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Ian Jackson

Konrad Rzeszutek Wilk writes ("[PATCH] hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work."):

Quoted 3 lines

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Thanks.

Yeey!

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

to qemu-xen-traditional master.

It also applies to the qemu-xen but I forgot to CC Stefano. Doing it here.

Unfortunately the code in upstream qemu is very different in this area, and it looks like ACPI_DBG_IO_ADDR is actually unused.

Correct. Not for upstream qemu but for qemu-xen. You are the maintainer of that tree too right?

#7 lore raw
Quoted 17 lines · Konrad Rzeszutek Wilk
Quoted 16 lines · Stefano Stabellini
Quoted 15 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Ian Jackson

Konrad Rzeszutek Wilk writes ("[PATCH] hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work."):

Quoted 3 lines

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Thanks.

Yeey!

Quoted 2 lines

to qemu-xen-traditional master.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

It also applies to the qemu-xen but I forgot to CC Stefano. Doing it here.

Unfortunately the code in upstream qemu is very different in this area, and it looks like ACPI_DBG_IO_ADDR is actually unused.

Correct. Not for upstream qemu but for qemu-xen. You are the maintainer of that tree too right?

Right, the situation is the same in qemu-xen as in upstream QEMU.

#8 lore raw
Quoted 21 lines · Stefano Stabellini
Quoted 20 lines · Konrad Rzeszutek Wilk
Quoted 19 lines · Stefano Stabellini
Quoted 17 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Ian Jackson

Konrad Rzeszutek Wilk writes ("[PATCH] hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work."):

Quoted 3 lines

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Thanks.

Yeey!

Quoted 2 lines

to qemu-xen-traditional master.

It also applies to the qemu-xen but I forgot to CC Stefano. Doing it here.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Unfortunately the code in upstream qemu is very different in this area, and it looks like ACPI_DBG_IO_ADDR is actually unused.

Correct. Not for upstream qemu but for qemu-xen. You are the maintainer of that tree too right?

Right, the situation is the same in qemu-xen as in upstream QEMU.

I see that the qemu-xen has changed the name of the file, so its acpi_piix4.c instead of piix4_acpi.c.

This seems to apply to my local xen-unstable tree:

hw/acpi_piix4.c +2 -2
index 059b64f..4ad9043 100644
@@ -197,7 +197,7 @@ static void apm_ctrl_changed(uint32_t val, void *arg)
     }
 }
 
-static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
+static void acpi_dbg_writeb(void *opaque, uint32_t addr, uint32_t val)
 {
     PIIX4_DPRINTF("ACPI: DBG: 0x%08x\n", val);
 }
@@ -453,7 +453,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
     /* APM */
     apm_init(&s->apm, apm_ctrl_changed, s);
 
-    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, s);
+    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 1, acpi_dbg_writeb, s);
 
     if (s->kvm_enabled) {
         /* Mark SMM as already inited to prevent SMM from running.  KVM does not

Would you like me to repost it with the right file and the same commit description?

Thank you.

#9 lore raw
Quoted 59 lines · Konrad Rzeszutek Wilk
Quoted 21 lines · Stefano Stabellini
Quoted 20 lines · Konrad Rzeszutek Wilk
Quoted 19 lines · Stefano Stabellini
Quoted 17 lines · Konrad Rzeszutek Wilk
Quoted 9 lines · Ian Jackson

Konrad Rzeszutek Wilk writes ("[PATCH] hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work."):

Quoted 3 lines

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Thanks.

Yeey!

Quoted 2 lines

to qemu-xen-traditional master.

It also applies to the qemu-xen but I forgot to CC Stefano. Doing it here.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Unfortunately the code in upstream qemu is very different in this area, and it looks like ACPI_DBG_IO_ADDR is actually unused.

Correct. Not for upstream qemu but for qemu-xen. You are the maintainer of that tree too right?

Right, the situation is the same in qemu-xen as in upstream QEMU.

I see that the qemu-xen has changed the name of the file, so its acpi_piix4.c instead of piix4_acpi.c.

This seems to apply to my local xen-unstable tree:

hw/acpi_piix4.c +2 -2
index 059b64f..4ad9043 100644
@@ -197,7 +197,7 @@ static void apm_ctrl_changed(uint32_t val, void *arg)
     }
 }
 
-static void acpi_dbg_writel(void *opaque, uint32_t addr, uint32_t val)
+static void acpi_dbg_writeb(void *opaque, uint32_t addr, uint32_t val)
 {
     PIIX4_DPRINTF("ACPI: DBG: 0x%08x\n", val);
 }
@@ -453,7 +453,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
     /* APM */
     apm_init(&s->apm, apm_ctrl_changed, s);
 
-    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, s);
+    register_ioport_write(ACPI_DBG_IO_ADDR, 4, 1, acpi_dbg_writeb, s);
 
     if (s->kvm_enabled) {
         /* Mark SMM as already inited to prevent SMM from running.  KVM does not
Quoted 2 lines

Would you like me to repost it with the right file and the same commit description?

I think we are not looking at the same repository: qemu-xen has been blocked on failing OSSTests since the rebase. Anthony is trying to fix the issue that has something to do with dirty bit tracking on EPT.

Meanwhile please use the staging repository:

git://xenbits.xensource.com/staging/qemu-upstream-unstable.git

#10 lore raw
In reply to Ian Jackson

Ian Jackson writes ("Re: [PATCH] hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work."):

Quoted 7 lines

Konrad Rzeszutek Wilk writes ("[PATCH] hw/piix4acpi: Make writes to ACPI_DBG_IO_ADDR actually work."):

Quoted 3 lines

The ACPI AML code has little snippets where it uses two memory locations to stash debug information when doing PCI hotplug, such as:

Thanks.

Quoted 7 lines

to qemu-xen-traditional master.

I think this ought to be backported in due course so I have put it on my list.

Now applied to qemu-xen-traditional for Xen 4.3, 4.2, 4.1.

(I know 4.1 is EOL but it was 10 seconds' work to git-cherry-pick and run my push script.)

Ian.