Skip to contentSkip to conversation

Add pvevent device driver

PATCH Superseded Hu Tao 4 participants 8 messages Mar 14, 2013

v1 of 15 Superseded Latest is v15 →

lore
Share & tools
lore

Hu Tao

author
#0 lore raw

PATCH 1/1 Add pvevent device driver

pvevent device is used to notify host(qemu) when guest panic happens.

ref: http://lists.nongnu.org/archive/html/qemu-devel/2013-03/msg02293.html

---
 src/acpi-dsdt-isa.dsl | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
src/acpi-dsdt-isa.dsl +30 -0
index 23761db..d083245 100644
@@ -99,4 +99,34 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 3 }
         })
     }
+
+    Device(PEVT) {
+        Name(_HID, "MSFT0001")
+        OperationRegion(PEOR, SystemIO, 0x0505, 0x01)
+        Field(PEOR, ByteAcc, NoLock, Preserve) {
+            PEPT,   8,
+        }
+
+        Method(_STA, 0, NotSerialized) {
+            Store(PEPT, Local0)
+            If (LEqual(Local0, Zero)) {
+                Return (0x00)
+            } Else {
+                Return (0x0F)
+            }
+        }
+
+        Method(RDPT, 0, NotSerialized) {
+            Store(PEPT, Local0)
+            Return (Local0)
+        }
+
+        Method(WRPT, 1, NotSerialized) {
+            Store(Arg0, PEPT)
+        }
+
+        Name(_CRS, ResourceTemplate() {
+            IO(Decode16, 0x0505, 0x0505, 0x01, 0x01)
+        })
+    }
 }
Signature · 1 line
1.8.1.4
#1 lore raw
Quoted 15 lines · Hu Tao

pvevent device is used to notify host(qemu) when guest panic happens.

ref: http://lists.nongnu.org/archive/html/qemu-devel/2013-03/msg02293.html

---
 src/acpi-dsdt-isa.dsl | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
src/acpi-dsdt-isa.dsl +0 -0
index 23761db..d083245 100644

src/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 104

Quoted 6 lines
src/acpi-dsdt-isa.dsl +3 -0
@@ -99,4 +99,34 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 3 }
         })
     }
+
+    Device(PEVT) {
+        Name(_HID, "MSFT0001")

We cannot use MSFT!

src/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 105

Quoted 1 line
src/acpi-dsdt-isa.dsl +1 -0
+        OperationRegion(PEOR, SystemIO, 0x0505, 0x01)

IO port should be received form QEMU by fw_cfg and patched here at run time.

src/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 117

Quoted 12 lines
src/acpi-dsdt-isa.dsl +12 -0
+        Field(PEOR, ByteAcc, NoLock, Preserve) {
+            PEPT,   8,
+        }
+
+        Method(_STA, 0, NotSerialized) {
+            Store(PEPT, Local0)
+            If (LEqual(Local0, Zero)) {
+                Return (0x00)
+            } Else {
+                Return (0x0F)
+            }
+        }

No probing. If QEMU does not provide IO port function should be patched to return zero.

Quoted 17 lines
src/acpi-dsdt-isa.dsl +14 -0
+
+        Method(RDPT, 0, NotSerialized) {
+            Store(PEPT, Local0)
+            Return (Local0)
+        }
+
+        Method(WRPT, 1, NotSerialized) {
+            Store(Arg0, PEPT)
+        }
+
+        Name(_CRS, ResourceTemplate() {
+            IO(Decode16, 0x0505, 0x0505, 0x01, 0x01)
+        })
+    }
 }
Signature · 1 line
1.8.1.4

--
Gleb.

author
#2 lore raw
Quoted 11 lines · Gleb Natapov
Quoted 10 lines · Hu Tao

pvevent device is used to notify host(qemu) when guest panic happens.

ref: http://lists.nongnu.org/archive/html/qemu-devel/2013-03/msg02293.html

---
 src/acpi-dsdt-isa.dsl | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
Quoted 12 lines

src/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 104

Quoted 11 lines
src/acpi-dsdt-isa.dsl +3 -0
index 23761db..d083245 100644
@@ -99,4 +99,34 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 3 }
         })
     }
+
+    Device(PEVT) {
+        Name(_HID, "MSFT0001")

We cannot use MSFT!

OK, I see now, we have to use QEMU0001 or like. More question: if I request ACPI ID: QEMU from [email protected], who should be CCed, Anthony, qemu-list or any others?

Quoted 3 lines

src/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 105

Quoted 2 lines
src/acpi-dsdt-isa.dsl +1 -0
+        OperationRegion(PEOR, SystemIO, 0x0505, 0x01)

IO port should be received form QEMU by fw_cfg and patched here at run time.

If I'm right, io port can be passed to seabios through fw_cfg file interface, but I'm still figuring out how to patch DSDT here and below at run time. Maybe build_ssdt() is close to this.

Quoted 36 lines

src/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 117

Quoted 13 lines
src/acpi-dsdt-isa.dsl +12 -0
+        Field(PEOR, ByteAcc, NoLock, Preserve) {
+            PEPT,   8,
+        }
+
+        Method(_STA, 0, NotSerialized) {
+            Store(PEPT, Local0)
+            If (LEqual(Local0, Zero)) {
+                Return (0x00)
+            } Else {
+                Return (0x0F)
+            }
+        }

No probing. If QEMU does not provide IO port function should be patched to return zero.

Quoted 17 lines
src/acpi-dsdt-isa.dsl +14 -0
+
+        Method(RDPT, 0, NotSerialized) {
+            Store(PEPT, Local0)
+            Return (Local0)
+        }
+
+        Method(WRPT, 1, NotSerialized) {
+            Store(Arg0, PEPT)
+        }
+
+        Name(_CRS, ResourceTemplate() {
+            IO(Decode16, 0x0505, 0x0505, 0x01, 0x01)
+        })
+    }
 }
Signature · 1 line
1.8.1.4

--
Gleb.

#3 lore raw
Quoted 25 lines · Hu Tao
Quoted 11 lines · Gleb Natapov
Quoted 10 lines · Hu Tao

pvevent device is used to notify host(qemu) when guest panic happens.

ref: http://lists.nongnu.org/archive/html/qemu-devel/2013-03/msg02293.html

---
 src/acpi-dsdt-isa.dsl | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
Quoted 12 lines

src/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 104

Quoted 11 lines
src/acpi-dsdt-isa.dsl +3 -0
index 23761db..d083245 100644
@@ -99,4 +99,34 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 3 }
         })
     }
+
+    Device(PEVT) {
+        Name(_HID, "MSFT0001")

We cannot use MSFT!

Quoted 4 lines

OK, I see now, we have to use QEMU0001 or like. More question: if I request ACPI ID: QEMU from [email protected], who should be CCed, Anthony, qemu-list or any others?

Cannot really answer that. I do not think mailing list should be included. My be Anthony should request the ID on behalf of QEMU project.

Quoted 9 lines
Quoted 4 lines

src/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 105

Quoted 3 lines
src/acpi-dsdt-isa.dsl +1 -0
+        OperationRegion(PEOR, SystemIO, 0x0505, 0x01)

IO port should be received form QEMU by fw_cfg and patched here at run time.

If I'm right, io port can be passed to seabios through fw_cfg file interface, but I'm still figuring out how to patch DSDT here and below at run time. Maybe build_ssdt() is close to this.

Yes, we already are doing similar things in build_ssdt().

--
Gleb.

#4 lore raw
In reply to Gleb Natapov
Quoted 4 lines · Gleb Natapov
Quoted 2 lines

+ OperationRegion(PEOR, SystemIO, 0x0505, 0x01)

IO port should be received form QEMU by fw_cfg and patched here at run time.

Pfft. ACPI table should be received from QEMU. :)

Signature · 1 line
dwmw2
#5 lore raw
Quoted 8 lines · David Woodhouse
Quoted 4 lines · Gleb Natapov
Quoted 2 lines

+ OperationRegion(PEOR, SystemIO, 0x0505, 0x01)

IO port should be received form QEMU by fw_cfg and patched here at run time.

Pfft. ACPI table should be received from QEMU. :)

That's the feature that, as far as I understand, everyone agreed upon, but since we want to apply these patches before that feature is here we will have to do it old fashioned way for now.

--
Gleb.

#6 lore raw
In reply to Hu Tao

Il 14/03/2013 09:48, Hu Tao ha scritto:

Quoted 40 lines

pvevent device is used to notify host(qemu) when guest panic happens.

ref: http://lists.nongnu.org/archive/html/qemu-devel/2013-03/msg02293.html

---
 src/acpi-dsdt-isa.dsl | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
src/acpi-dsdt-isa.dsl +21 -0
index 23761db..d083245 100644
@@ -99,4 +99,34 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 3 }
         })
     }
+
+    Device(PEVT) {
+        Name(_HID, "MSFT0001")
+        OperationRegion(PEOR, SystemIO, 0x0505, 0x01)
+        Field(PEOR, ByteAcc, NoLock, Preserve) {
+            PEPT,   8,
+        }
+
+        Method(_STA, 0, NotSerialized) {
+            Store(PEPT, Local0)
+            If (LEqual(Local0, Zero)) {
+                Return (0x00)
+            } Else {
+                Return (0x0F)
+            }
+        }
+
+        Method(RDPT, 0, NotSerialized) {
+            Store(PEPT, Local0)
+            Return (Local0)
+        }

src/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 132

Quoted 10 lines
src/acpi-dsdt-isa.dsl +9 -0
+
+        Method(WRPT, 1, NotSerialized) {
+            Store(Arg0, PEPT)
+        }
+
+        Name(_CRS, ResourceTemplate() {
+            IO(Decode16, 0x0505, 0x0505, 0x01, 0x01)
+        })
+    }
 }

I like the idea of using methods in the DSDT to isolate from the actual implementation of the device. I don't see a huge problem with the probing, but Gleb does so please go on with the fw_cfg part.

Paolo

#7 lore raw
Quoted 47 lines · Paolo Bonzini

Il 14/03/2013 09:48, Hu Tao ha scritto:

Quoted 46 lines

pvevent device is used to notify host(qemu) when guest panic happens.

ref: http://lists.nongnu.org/archive/html/qemu-devel/2013-03/msg02293.html

---
 src/acpi-dsdt-isa.dsl | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
src/acpi-dsdt-isa.dsl +28 -0
index 23761db..d083245 100644
@@ -99,4 +99,34 @@ Scope(\_SB.PCI0.ISA) {
             IRQNoFlags() { 3 }
         })
     }
+
+    Device(PEVT) {
+        Name(_HID, "MSFT0001")
+        OperationRegion(PEOR, SystemIO, 0x0505, 0x01)
+        Field(PEOR, ByteAcc, NoLock, Preserve) {
+            PEPT,   8,
+        }
+
+        Method(_STA, 0, NotSerialized) {
+            Store(PEPT, Local0)
+            If (LEqual(Local0, Zero)) {
+                Return (0x00)
+            } Else {
+                Return (0x0F)
+            }
+        }
+
+        Method(RDPT, 0, NotSerialized) {
+            Store(PEPT, Local0)
+            Return (Local0)
+        }
+
+        Method(WRPT, 1, NotSerialized) {
+            Store(Arg0, PEPT)
+        }
+
+        Name(_CRS, ResourceTemplate() {
+            IO(Decode16, 0x0505, 0x0505, 0x01, 0x01)
Quoted 9 lines

src/acpi-dsdt-isa.dsl Scope(\_SB.PCI0.ISA) { · line 132

Quoted 4 lines
src/acpi-dsdt-isa.dsl +2 -0
+        })
+    }
 }

I like the idea of using methods in the DSDT to isolate from the actual implementation of the device. I don't see a huge problem with the probing, but Gleb does so please go on with the fw_cfg part.

Using methods is very nice idea indeed.

--
Gleb.