Skip to contentSkip to conversation

Fix aml_name_string() to recognize block name modifiers.

PATCH In review Gleb Natapov 4 participants 25 messages May 20, 2012 – Jun 22, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Fix aml_name_string() to recognize block name modifiers.

---
 tools/acpi_extract.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
tools/acpi_extract.py +5 -1
index 5f613e4..8038269 100755
@@ -121,7 +121,11 @@ def aml_name_string(offset):
     if (aml[offset] != 0x08):
         die( "Name offset 0x%x: expected 0x08 actual 0x%x" %
              (offset, aml[offset]));
-    return offset + 1;
+    offset += 1
+    # Block Name Modifier. Skip it.
+    if (aml[offset] == 0x5c or aml[offset] == 0x5e):
+        offset += 1
+    return offset;
 
 # Given data offset, find dword const offset
 def aml_data_dword_const(offset):
Signature · 1 line
1.7.7.3
#1 lore raw

PATCH 2/3 Add ACPI_EXTRACT_PKG_START macro parsing

It allows to extract the beginning of a Package object content.

---
 tools/acpi_extract.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
tools/acpi_extract.py +12 -0
index 8038269..167a322 100755
@@ -29,6 +29,7 @@
 # ACPI_EXTRACT_PROCESSOR_START - start of Processor() block
 # ACPI_EXTRACT_PROCESSOR_STRING - extract a NameString from Processor()
 # ACPI_EXTRACT_PROCESSOR_END - offset at last byte of Processor() + 1
+# ACPI_EXTRACT_PKG_START - start of Package block
 #
 # ACPI_EXTRACT_ALL_CODE - create an array storing the generated AML bytecode
 # 
@@ -185,6 +186,15 @@ def aml_processor_end(offset):
     pkglen = aml_pkglen(offset)
     return offset + pkglen
 
+def aml_package_start(offset):
+    offset = aml_name_string(offset) + 4
+    # 0x12 PkgLength NumElements PackageElementList
+    if (aml[offset] != 0x12):
+        die( "Name offset 0x%x: expected 0x12 actual 0x%x" %
+             (offset, aml[offset]));
+    offset += 1
+    return offset + aml_pkglen_bytes(offset) + 1
+
 lineno = 0
 for line in fileinput.input():
     # Strip trailing newline
@@ -267,6 +277,8 @@ for i in range(len(asl)):
         offset = aml_processor_string(offset)
     elif (directive == "ACPI_EXTRACT_PROCESSOR_END"):
         offset = aml_processor_end(offset)
+    elif (directive == "ACPI_EXTRACT_PKG_START"):
+        offset = aml_package_start(offset)
     else:
         die("Unsupported directive %s" % directive)
 
Signature · 1 line
1.7.7.3
#2 lore raw

PATCH 3/3 Get system state configuration from QEMU and patch DSDT with it.

In reply to Gleb Natapov

QEMU may want to disable guest's S3/S4 support and it wants to distinguish between regular powerdown and S4 powerdown. To support that new fw_cfg option was added that passes supported system states and what value should guest use to enter each state. States are passed in 6 byte array. Each byte represents one system state. If byte at offset X has its MSB set it means that system state X is supported and to enter it guest should use the value from lowest 7 bits. Patch also detects old QEMU and uses values that work in backwards compatible way there.

---
 src/acpi-dsdt.dsl  |   32 ---------
 src/acpi-dsdt.hex  |   42 +-----------
 src/acpi.c         |   15 ++++
 src/ssdt-pcihp.dsl |   36 ++++++++++
 src/ssdt-pcihp.hex |  185 +++++++++++++++++++++++++++++++++-------------------
 5 files changed, 172 insertions(+), 138 deletions(-)
src/acpi-dsdt.dsl +0 -32
index 4bdc268..37899fc 100644
@@ -604,38 +604,6 @@ DefinitionBlock (
         }
     }
 
-
-/****************************************************************
- * Suspend
- ****************************************************************/
-
-    /*
-     * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
-     * must match piix4 emulation.
-     */
-    Name (\_S3, Package (0x04)
-    {
-        0x01,  /* PM1a_CNT.SLP_TYP */
-        0x01,  /* PM1b_CNT.SLP_TYP */
-        Zero,  /* reserved */
-        Zero   /* reserved */
-    })
-    Name (\_S4, Package (0x04)
-    {
-        Zero,  /* PM1a_CNT.SLP_TYP */
-        Zero,  /* PM1b_CNT.SLP_TYP */
-        Zero,  /* reserved */
-        Zero   /* reserved */
-    })
-    Name (\_S5, Package (0x04)
-    {
-        Zero,  /* PM1a_CNT.SLP_TYP */
-        Zero,  /* PM1b_CNT.SLP_TYP */
-        Zero,  /* reserved */
-        Zero   /* reserved */
-    })
-
-
 /****************************************************************
  * CPU hotplug
  ****************************************************************/
src/acpi-dsdt.hex +3 -39

57 lines not on this page · raw message

src/acpi.c +15 -0
index 30888b9..06ffe0a 100644
@@ -492,6 +492,8 @@ extern void link_time_assertion(void);
 
 static void* build_pcihp(void)
 {
+    char *sys_states;
+    int sys_state_size;
     u32 rmvc_pcrm;
     int i;
 
@@ -523,6 +525,19 @@ static void* build_pcihp(void)
         }
     }
 
+    sys_states = romfile_loadfile("etc/system-states", &sys_state_size);
+    if (!sys_states || sys_state_size != 6)
+        sys_states = (char[]){128, 0, 0, 129, 128, 128};
+
+    if (!(sys_states[3] & 128))
+        ssdt[acpi_s3_name[0]] = 'X';
+    if (!(sys_states[4] & 128))
+        ssdt[acpi_s4_name[0]] = 'X';
+    else
+        ssdt[acpi_s4_pkg[0] + 1] = ssdt[acpi_s4_pkg[0] + 3] = sys_states[4] & 127;
+    ((struct acpi_table_header*)ssdt)->checksum = 0;
+    ((struct acpi_table_header*)ssdt)->checksum -= checksum(ssdt, sizeof(ssdp_pcihp_aml));
+
     return ssdt;
 }
 
src/ssdt-pcihp.dsl +36 -0
index 4b435b8..12555e2 100644
@@ -95,4 +95,40 @@ DefinitionBlock ("ssdt-pcihp.aml", "SSDT", 0x01, "BXPC", "BXSSDTPCIHP", 0x1)
             gen_pci_hotplug(1f)
         }
     }
+
+    Scope(\) {
+/****************************************************************
+ * Suspend
+ ****************************************************************/
+
+    /*
+     * S3 (suspend-to-ram), S4 (suspend-to-disk) and S5 (power-off) type codes:
+     * must match piix4 emulation.
+     */
+
+        ACPI_EXTRACT_NAME_STRING acpi_s3_name
+        Name (_S3, Package (0x04)
+        {
+            One,  /* PM1a_CNT.SLP_TYP */
+            One,  /* PM1b_CNT.SLP_TYP */
+            Zero,  /* reserved */
+            Zero   /* reserved */
+        })
+        ACPI_EXTRACT_NAME_STRING acpi_s4_name
+        ACPI_EXTRACT_PKG_START acpi_s4_pkg
+        Name (_S4, Package (0x04)
+        {
+            0x2,  /* PM1a_CNT.SLP_TYP */
+            0x2,  /* PM1b_CNT.SLP_TYP */
+            Zero,  /* reserved */
+            Zero   /* reserved */
+        })
+        Name (_S5, Package (0x04)
+        {
+            Zero,  /* PM1a_CNT.SLP_TYP */
+            Zero,  /* PM1b_CNT.SLP_TYP */
+            Zero,  /* reserved */
+            Zero   /* reserved */
+        })
+    }
 }
src/ssdt-pcihp.hex +118 -67

203 lines not on this page · raw message

Signature · 1 line
1.7.7.3
#20 lore raw
In reply to Gleb Natapov
Quoted 11 lines · Gleb Natapov
---
 tools/acpi_extract.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
tools/acpi_extract.py +0 -0
index 5f613e4..8038269 100755

tools/acpi_extract.py def aml_name_string(offset): · line 126

Quoted 7 lines
tools/acpi_extract.py +3 -1
@@ -121,7 +121,11 @@ def aml_name_string(offset):
     if (aml[offset] != 0x08):
         die( "Name offset 0x%x: expected 0x08 actual 0x%x" %
              (offset, aml[offset]));
-    return offset + 1;
+    offset += 1
+    # Block Name Modifier. Skip it.
+    if (aml[offset] == 0x5c or aml[offset] == 0x5e):

You don't need parenthesis around the whole conditional.

Quoted 13 lines
tools/acpi_extract.py +2 -0
+        offset += 1
+    return offset;
 
 # Given data offset, find dword const offset
 def aml_data_dword_const(offset):
Signature · 7 lines
1.7.7.3


_______________________________________________
SeaBIOS mailing list
[email protected]
http://www.seabios.org/mailman/listinfo/seabios
#21 lore raw
Quoted 7 lines · Alon Levy
Quoted 6 lines · Gleb Natapov
---
 tools/acpi_extract.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
Quoted 14 lines

tools/acpi_extract.py def aml_name_string(offset): · line 126

Quoted 12 lines
tools/acpi_extract.py +3 -1
index 5f613e4..8038269 100755
@@ -121,7 +121,11 @@ def aml_name_string(offset):
     if (aml[offset] != 0x08):
         die( "Name offset 0x%x: expected 0x08 actual 0x%x" %
              (offset, aml[offset]));
-    return offset + 1;
+    offset += 1
+    # Block Name Modifier. Skip it.
+    if (aml[offset] == 0x5c or aml[offset] == 0x5e):

You don't need parenthesis around the whole conditional.

Rest of the code has it. Better to keep same style :)

Quoted 10 lines
Quoted 10 lines
tools/acpi_extract.py +2 -0
+        offset += 1
+    return offset;
 
 # Given data offset, find dword const offset
 def aml_data_dword_const(offset):
Signature · 1 line
1.7.7.3
Quoted 4 lines
Quoted 4 lines

_______________________________________________
SeaBIOS mailing list
[email protected]
http://www.seabios.org/mailman/listinfo/seabios

--
Gleb.

#3 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

In reply to Gleb Natapov
Quoted 9 lines · Gleb Natapov

QEMU may want to disable guest's S3/S4 support and it wants to distinguish between regular powerdown and S4 powerdown. To support that new fw_cfg option was added that passes supported system states and what value should guest use to enter each state. States are passed in 6 byte array. Each byte represents one system state. If byte at offset X has its MSB set it means that system state X is supported and to enter it guest should use the value from lowest 7 bits. Patch also detects old QEMU and uses values that work in backwards compatible way there.

Do we actually have to patch the DSDT? Or can _S3 etc be made into functions instead? (and talk to the bios, or even to fwcfg directly?)

Signature · 1 line
error compiling committee.c: too many arguments to function
#4 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 12 lines · Avi Kivity
Quoted 9 lines · Gleb Natapov

QEMU may want to disable guest's S3/S4 support and it wants to distinguish between regular powerdown and S4 powerdown. To support that new fw_cfg option was added that passes supported system states and what value should guest use to enter each state. States are passed in 6 byte array. Each byte represents one system state. If byte at offset X has its MSB set it means that system state X is supported and to enter it guest should use the value from lowest 7 bits. Patch also detects old QEMU and uses values that work in backwards compatible way there.

Quoted 3 lines

Do we actually have to patch the DSDT? Or can _S3 etc be made into functions instead? (and talk to the bios, or even to fwcfg directly?)

We better not talk to fwcfg after OSPM is started since this is firmware confing interface. Regardless, presence of _S3 name or method is all that needed for OS enabling S3 option. If _S3 is defined as a method it has to return Package() otherwise iasl refuses to compile it.

--
Gleb.

#5 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 13 lines · Gleb Natapov
Quoted 12 lines · Avi Kivity
Quoted 9 lines · Gleb Natapov

QEMU may want to disable guest's S3/S4 support and it wants to distinguish between regular powerdown and S4 powerdown. To support that new fw_cfg option was added that passes supported system states and what value should guest use to enter each state. States are passed in 6 byte array. Each byte represents one system state. If byte at offset X has its MSB set it means that system state X is supported and to enter it guest should use the value from lowest 7 bits. Patch also detects old QEMU and uses values that work in backwards compatible way there.

Quoted 5 lines
Quoted 3 lines

Do we actually have to patch the DSDT? Or can _S3 etc be made into functions instead? (and talk to the bios, or even to fwcfg directly?)

We better not talk to fwcfg after OSPM is started since this is firmware confing interface.

Why not? The OS isn't going to talk to it, so we can have a driver in ACPI.

Quoted 3 lines

Regardless, presence of _S3 name or method is all
that needed for OS enabling S3 option. If _S3 is defined as a method it has to return Package() otherwise iasl refuses to compile it.

Can't we Return (Package (...) { ... }) or equivalent?

Signature · 1 line
error compiling committee.c: too many arguments to function
#6 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 14 lines · Avi Kivity
Quoted 13 lines · Gleb Natapov
Quoted 12 lines · Avi Kivity
Quoted 9 lines · Gleb Natapov

QEMU may want to disable guest's S3/S4 support and it wants to distinguish between regular powerdown and S4 powerdown. To support that new fw_cfg option was added that passes supported system states and what value should guest use to enter each state. States are passed in 6 byte array. Each byte represents one system state. If byte at offset X has its MSB set it means that system state X is supported and to enter it guest should use the value from lowest 7 bits. Patch also detects old QEMU and uses values that work in backwards compatible way there.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Do we actually have to patch the DSDT? Or can _S3 etc be made into functions instead? (and talk to the bios, or even to fwcfg directly?)

We better not talk to fwcfg after OSPM is started since this is firmware confing interface.

Why not? The OS isn't going to talk to it, so we can have a driver in ACPI.

The OS is going to talk to it since the OS is the one who interprets AML. We may want to disable fwcfg after OS bootup at all in the feature. Who knows what kind of sensitive information we may want to pass by it in the feature? May be something TPM related? And I do not see any advantage of using fwcfg from AML.

Quoted 6 lines
Quoted 3 lines

Regardless, presence of _S3 name or method is all
that needed for OS enabling S3 option. If _S3 is defined as a method it has to return Package() otherwise iasl refuses to compile it.

Can't we Return (Package (...) { ... }) or equivalent?

We can, how does it help?

--
Gleb.

#7 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 18 lines · Gleb Natapov
Quoted 17 lines · Avi Kivity
Quoted 16 lines · Gleb Natapov
Quoted 15 lines · Avi Kivity
Quoted 9 lines · Gleb Natapov

QEMU may want to disable guest's S3/S4 support and it wants to distinguish between regular powerdown and S4 powerdown. To support that new fw_cfg option was added that passes supported system states and what value should guest use to enter each state. States are passed in 6 byte array. Each byte represents one system state. If byte at offset X has its MSB set it means that system state X is supported and to enter it guest should use the value from lowest 7 bits. Patch also detects old QEMU and uses values that work in backwards compatible way there.

Do we actually have to patch the DSDT? Or can _S3 etc be made into functions instead? (and talk to the bios, or even to fwcfg directly?)

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

We better not talk to fwcfg after OSPM is started since this is firmware confing interface.

Why not? The OS isn't going to talk to it, so we can have a driver in ACPI.

The OS is going to talk to it since the OS is the one who interprets AML.

I meant, not directly. So the driver in ACPI has exclusive access.

Quoted 3 lines

We may want to disable fwcfg after OS bootup at all in the feature. Who knows what kind of sensitive information we may want to pass by it in the feature? May be something TPM related?

fwcfg is for passing information to the guest. If you want to hide something from the guest, just don't put it in fwcfg.

Quoted 2 lines

And I do not see any advantage
of using fwcfg from AML.

It's an alternative to patching AML. Sure it takes some effort to write the driver, but afterwards we can modify the guest behaviour more easily. One possible client is -M old, so you can revert to previous behaviour depending on fwcfg data.

(we don't need a driver in AML to avoid patching, we can have AML talk to the bios and the bios drive fwcfg; but I think we'll find uses for a driver).

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

Regardless, presence of _S3 name or method is all
that needed for OS enabling S3 option. If _S3 is defined as a method it has to return Package() otherwise iasl refuses to compile it.

Can't we Return (Package (...) { ... }) or equivalent?

We can, how does it help?

The contents of the package can be determined at runtime.

Signature · 1 line
error compiling committee.c: too many arguments to function
#8 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 22 lines · Avi Kivity
Quoted 21 lines · Gleb Natapov
Quoted 20 lines · Avi Kivity
Quoted 18 lines · Gleb Natapov
Quoted 12 lines · Avi Kivity
Quoted 9 lines · Gleb Natapov

QEMU may want to disable guest's S3/S4 support and it wants to distinguish between regular powerdown and S4 powerdown. To support that new fw_cfg option was added that passes supported system states and what value should guest use to enter each state. States are passed in 6 byte array. Each byte represents one system state. If byte at offset X has its MSB set it means that system state X is supported and to enter it guest should use the value from lowest 7 bits. Patch also detects old QEMU and uses values that work in backwards compatible way there.

Quoted 3 lines

Do we actually have to patch the DSDT? Or can _S3 etc be made into functions instead? (and talk to the bios, or even to fwcfg directly?)

We better not talk to fwcfg after OSPM is started since this is firmware confing interface.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Why not? The OS isn't going to talk to it, so we can have a driver in ACPI.

The OS is going to talk to it since the OS is the one who interprets AML.

I meant, not directly. So the driver in ACPI has exclusive access.

What's the difference?

Quoted 7 lines
Quoted 3 lines

We may want to disable fwcfg after OS bootup at all in the feature. Who knows what kind of sensitive information we may want to pass by it in the feature? May be something TPM related?

fwcfg is for passing information to the guest. If you want to hide something from the guest, just don't put it in fwcfg.

Where to put it if we want to pass it to a firmware, but not an OS. That was the point of fwcfg. If you want to pass something to a guest OS use virtio-serial.

Quoted 7 lines
Quoted 2 lines

And I do not see any advantage
of using fwcfg from AML.

It's an alternative to patching AML. Sure it takes some effort to write the driver, but afterwards we can modify the guest behaviour more easily. One possible client is -M old, so you can revert to previous behaviour depending on fwcfg data.

-M old is easy to support with the current patch. You just set new properties to compatibility values. The code is written with this in mind. And this is not an alternative to patching AML as I am trying to explain to you below. You can eliminate patching of s4 value, but that's it, you still need to patch out _S3/_S4 names.

Quoted 4 lines

(we don't need a driver in AML to avoid patching, we can have AML talk to the bios and the bios drive fwcfg; but I think we'll find uses for a driver).

I am not sure what you mean. AML can't talk to the bios. It can read values that bios put somewhere. I do not see advantage of this method and it requires patching still.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Regardless, presence of _S3 name or method is all
that needed for OS enabling S3 option. If _S3 is defined as a method it has to return Package() otherwise iasl refuses to compile it.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Can't we Return (Package (...) { ... }) or equivalent?

We can, how does it help?

The contents of the package can be determined at runtime.

And? _S3 name should not exists at all in order to disable S3, not return something different.

--
Gleb.

#9 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 7 lines · Gleb Natapov
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

Do we actually have to patch the DSDT? Or can _S3 etc be made into functions instead? (and talk to the bios, or even to fwcfg directly?)

We better not talk to fwcfg after OSPM is started since this is firmware confing interface.

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Why not? The OS isn't going to talk to it, so we can have a driver in ACPI.

The OS is going to talk to it since the OS is the one who interprets AML.

I meant, not directly. So the driver in ACPI has exclusive access.

What's the difference?

ACPI is firmware, not OS.

Quoted 10 lines
Quoted 7 lines
Quoted 3 lines

We may want to disable fwcfg after OS bootup at all in the feature. Who knows what kind of sensitive information we may want to pass by it in the feature? May be something TPM related?

fwcfg is for passing information to the guest. If you want to hide something from the guest, just don't put it in fwcfg.

Where to put it if we want to pass it to a firmware, but not an OS. That was the point of fwcfg. If you want to pass something to a guest OS use virtio-serial.

See above.

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

And I do not see any advantage
of using fwcfg from AML.

It's an alternative to patching AML. Sure it takes some effort to write the driver, but afterwards we can modify the guest behaviour more easily. One possible client is -M old, so you can revert to previous behaviour depending on fwcfg data.

Quoted 5 lines

-M old is easy to support with the current patch. You just set new properties to compatibility values. The code is written with this in mind. And this is not an alternative to patching AML as I am trying to explain to you below. You can eliminate patching of s4 value, but that's it, you still need to patch out _S3/_S4 names.

What about

  If (Fcfg(...)) {
        Method()...
  }

?

(i.e.. define the method conditionally at runtime)

Quoted 7 lines
Quoted 5 lines

(we don't need a driver in AML to avoid patching, we can have AML talk to the bios and the bios drive fwcfg; but I think we'll find uses for a driver).

I am not sure what you mean. AML can't talk to the bios. It can read values that bios put somewhere.

That's what I meant - communicate through memory.

Quoted 2 lines

I do not see advantage of this method
and it requires patching still.

For the existence of the names? Yes, if we can't avoid it it's a problem. But if we can avoid patching, we should.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

Regardless, presence of _S3 name or method is all
that needed for OS enabling S3 option. If _S3 is defined as a method it has to return Package() otherwise iasl refuses to compile it.

Can't we Return (Package (...) { ... }) or equivalent?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

We can, how does it help?

The contents of the package can be determined at runtime.

And? _S3 name should not exists at all in order to disable S3, not return something different.

See above.

Signature · 1 line
error compiling committee.c: too many arguments to function
#10 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 10 lines · Avi Kivity
Quoted 9 lines · Gleb Natapov
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

Do we actually have to patch the DSDT? Or can _S3 etc be made into functions instead? (and talk to the bios, or even to fwcfg directly?)

We better not talk to fwcfg after OSPM is started since this is firmware confing interface.

Why not? The OS isn't going to talk to it, so we can have a driver in ACPI.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

The OS is going to talk to it since the OS is the one who interprets AML.

I meant, not directly. So the driver in ACPI has exclusive access.

What's the difference?

ACPI is firmware, not OS.

AML is a data provided by firmware. AML's runtime is different from firmware's.

Quoted 27 lines
Quoted 11 lines
Quoted 8 lines
Quoted 4 lines

We may want to disable fwcfg after OS bootup at all in the feature. Who knows what kind of sensitive information we may want to pass by it in the feature? May be something TPM related?

fwcfg is for passing information to the guest. If you want to hide something from the guest, just don't put it in fwcfg.

Where to put it if we want to pass it to a firmware, but not an OS. That was the point of fwcfg. If you want to pass something to a guest OS use virtio-serial.

See above.

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

And I do not see any advantage
of using fwcfg from AML.

It's an alternative to patching AML. Sure it takes some effort to write the driver, but afterwards we can modify the guest behaviour more easily. One possible client is -M old, so you can revert to previous behaviour depending on fwcfg data.

Quoted 5 lines

-M old is easy to support with the current patch. You just set new properties to compatibility values. The code is written with this in mind. And this is not an alternative to patching AML as I am trying to explain to you below. You can eliminate patching of s4 value, but that's it, you still need to patch out _S3/_S4 names.

Quoted 7 lines

What about

  If (Fcfg(...)) {
        Method()...
  }

?

syntax error, unexpected PARSEOP_IF

Quoted 5 lines

(i.e.. define the method conditionally at runtime)

Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

(we don't need a driver in AML to avoid patching, we can have AML talk to the bios and the bios drive fwcfg; but I think we'll find uses for a driver).

I am not sure what you mean. AML can't talk to the bios. It can read values that bios put somewhere.

That's what I meant - communicate through memory.

What's the benefit? The patching is still needed. You need to pass address of OperationRegion() to AML. You can do it either by patching or by creating OperationRegion() code dynamically.

Quoted 6 lines
Quoted 2 lines

I do not see advantage of this method
and it requires patching still.

For the existence of the names? Yes, if we can't avoid it it's a problem. But if we can avoid patching, we should.

If we can, we should, but we can't as far as I see. The patching was here long before this patch.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines

Regardless, presence of _S3 name or method is all
that needed for OS enabling S3 option. If _S3 is defined as a method it has to return Package() otherwise iasl refuses to compile it.

Can't we Return (Package (...) { ... }) or equivalent?

We can, how does it help?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The contents of the package can be determined at runtime.

And? _S3 name should not exists at all in order to disable S3, not return something different.

See above.

Does not work for me, can you send me a patch that works?

--
Gleb.

#11 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 14 lines · Gleb Natapov
Quoted 13 lines · Avi Kivity
Quoted 12 lines · Gleb Natapov
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

Do we actually have to patch the DSDT? Or can _S3 etc be made into functions instead? (and talk to the bios, or even to fwcfg directly?)

We better not talk to fwcfg after OSPM is started since this is firmware confing interface.

Why not? The OS isn't going to talk to it, so we can have a driver in ACPI.

The OS is going to talk to it since the OS is the one who interprets AML.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

I meant, not directly. So the driver in ACPI has exclusive access.

What's the difference?

ACPI is firmware, not OS.

AML is a data provided by firmware. AML's runtime is different from firmware's.

It's still firmware.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

It's an alternative to patching AML. Sure it takes some effort to write the driver, but afterwards we can modify the guest behaviour more easily. One possible client is -M old, so you can revert to previous behaviour depending on fwcfg data.

-M old is easy to support with the current patch. You just set new properties to compatibility values. The code is written with this in mind. And this is not an alternative to patching AML as I am trying to explain to you below. You can eliminate patching of s4 value, but that's it, you still need to patch out _S3/_S4 names.

Quoted 8 lines
Quoted 7 lines

What about

  If (Fcfg(...)) {
        Method()...
  }

?

syntax error, unexpected PARSEOP_IF

Unfortunately the ACPI spec forbids this construct, so either patching or double complication is necessary.

Quoted 8 lines
Quoted 8 lines

(i.e.. define the method conditionally at runtime)

Quoted 5 lines
Quoted 5 lines

(we don't need a driver in AML to avoid patching, we can have AML talk to the bios and the bios drive fwcfg; but I think we'll find uses for a driver).

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I am not sure what you mean. AML can't talk to the bios. It can read values that bios put somewhere.

That's what I meant - communicate through memory.

What's the benefit? The patching is still needed. You need to pass address of OperationRegion() to AML. You can do it either by patching or by creating OperationRegion() code dynamically.

Or it can be a fixed address in low memory, or a scratch register in hardware.

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

I do not see advantage of this method
and it requires patching still.

For the existence of the names? Yes, if we can't avoid it it's a problem. But if we can avoid patching, we should.

If we can, we should, but we can't as far as I see. The patching was here long before this patch.

I agree we probably can't.

Signature · 1 line
error compiling committee.c: too many arguments to function
#12 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 15 lines · Avi Kivity
Quoted 14 lines · Gleb Natapov
Quoted 13 lines · Avi Kivity
Quoted 12 lines · Gleb Natapov
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

Do we actually have to patch the DSDT? Or can _S3 etc be made into functions instead? (and talk to the bios, or even to fwcfg directly?)

We better not talk to fwcfg after OSPM is started since this is firmware confing interface.

Why not? The OS isn't going to talk to it, so we can have a driver in ACPI.

The OS is going to talk to it since the OS is the one who interprets AML.

Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

I meant, not directly. So the driver in ACPI has exclusive access.

What's the difference?

ACPI is firmware, not OS.

AML is a data provided by firmware. AML's runtime is different from firmware's.

It's still firmware.

We have to agree to disagree here :) It's just a data for OS to use as far as I am concern.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 10 lines
Quoted 5 lines

It's an alternative to patching AML. Sure it takes some effort to write the driver, but afterwards we can modify the guest behaviour more easily. One possible client is -M old, so you can revert to previous behaviour depending on fwcfg data.

-M old is easy to support with the current patch. You just set new properties to compatibility values. The code is written with this in mind. And this is not an alternative to patching AML as I am trying to explain to you below. You can eliminate patching of s4 value, but that's it, you still need to patch out _S3/_S4 names.

What about

  If (Fcfg(...)) {
        Method()...
  }
Quoted 6 lines
Quoted 2 lines
Quoted 1 line

?

syntax error, unexpected PARSEOP_IF

Unfortunately the ACPI spec forbids this construct, so either patching or double complication is necessary.

It's not double if we will take all possible combinations into account.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

(i.e.. define the method conditionally at runtime)

Quoted 7 lines
Quoted 5 lines

(we don't need a driver in AML to avoid patching, we can have AML talk to the bios and the bios drive fwcfg; but I think we'll find uses for a driver).

I am not sure what you mean. AML can't talk to the bios. It can read values that bios put somewhere.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

That's what I meant - communicate through memory.

What's the benefit? The patching is still needed. You need to pass address of OperationRegion() to AML. You can do it either by patching or by creating OperationRegion() code dynamically.

Or it can be a fixed address in low memory, or a scratch register in hardware.

Both will work (fixed addresses are better be avoided and who needs another PV device), but I do not see how either of them is better then patching. What is your concern?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

I do not see advantage of this method
and it requires patching still.

Quoted 10 lines
Quoted 5 lines
Quoted 3 lines

For the existence of the names? Yes, if we can't avoid it it's a problem. But if we can avoid patching, we should.

If we can, we should, but we can't as far as I see. The patching was here long before this patch.

I agree we probably can't.

Signature · 1 line
error compiling committee.c: too many arguments to function

--
Gleb.

#13 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 8 lines · Gleb Natapov
Quoted 4 lines

Or it can be a fixed address in low memory, or a scratch register in hardware.

Both will work (fixed addresses are better be avoided and who needs another PV device), but I do not see how either of them is better then patching. What is your concern?

Patching is harder to maintain. Unfortunately it's unavoidable.

Signature · 1 line
error compiling committee.c: too many arguments to function
#14 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 5 lines · Avi Kivity
Quoted 4 lines · Gleb Natapov
Quoted 4 lines

Or it can be a fixed address in low memory, or a scratch register in hardware.

Quoted 7 lines
Quoted 4 lines

Both will work (fixed addresses are better be avoided and who needs another PV device), but I do not see how either of them is better then patching. What is your concern?

Patching is harder to maintain. Unfortunately it's unavoidable.

Here we in agreement, and I was against patching till it was unavoidable, but than pci hotplug started using it, and afterwards processor definitions, so no point in avoiding it now by using inferior methods.

--
Gleb.

#19 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

In reply to Avi Kivity
Quoted 9 lines · Avi Kivity

What about

  If (Fcfg(...)) {
        Method()...
  }

?

(i.e.. define the method conditionally at runtime)

As Gleb points out, this wont work. AML defines a static device/method/variable tree heirarchy. Only the return values of methods is programmable. This completely confused me when I first started looking at AML.

ACPI is truly a bizarre spec.

-Kevin

#15 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

In reply to Gleb Natapov
Quoted 11 lines · Gleb Natapov
Quoted 10 lines · Avi Kivity
Quoted 8 lines · Gleb Natapov
Quoted 4 lines

Or it can be a fixed address in low memory, or a scratch register in hardware.

Both will work (fixed addresses are better be avoided and who needs another PV device), but I do not see how either of them is better then patching. What is your concern?

Quoted 5 lines
Quoted 2 lines

Patching is harder to maintain. Unfortunately it's unavoidable.

Here we in agreement, and I was against patching till it was unavoidable, but than pci hotplug started using it, and afterwards processor definitions, so no point in avoiding it now by using inferior methods.

I agree as well.

What's the background to needing to have dynamic S3/S4 definitions? (Why will some qemu instances be able to sleep and not others?)

-Kevin

#16 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 9 lines · Kevin O'Connor
Quoted 3 lines

Here we in agreement, and I was against patching till it was unavoidable, but than pci hotplug started using it, and afterwards processor definitions, so no point in avoiding it now by using inferior methods.

I agree as well.

What's the background to needing to have dynamic S3/S4 definitions? (Why will some qemu instances be able to sleep and not others?)

Backwards compatibility. qemu has a -M machine-type option that expose an old qemu's guest-visible attributes. If an old qemu didn't support S3, then -M old shouldn't either.

Signature · 1 line
error compiling committee.c: too many arguments to function
#17 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 7 lines · Avi Kivity
Quoted 6 lines · Kevin O'Connor
Quoted 3 lines

Here we in agreement, and I was against patching till it was unavoidable, but than pci hotplug started using it, and afterwards processor definitions, so no point in avoiding it now by using inferior methods.

I agree as well.

Quoted 7 lines
Quoted 3 lines

What's the background to needing to have dynamic S3/S4 definitions? (Why will some qemu instances be able to sleep and not others?)

Backwards compatibility. qemu has a -M machine-type option that expose an old qemu's guest-visible attributes. If an old qemu didn't support S3, then -M old shouldn't either.

The DSDT has claimed S3, S4, and S5 support since SeaBIOS has supported ACPI. What's the background to the requirement to stop claiming support for it?

-Kevin

#18 lore raw

Re: [Qemu-devel] [PATCH 3/3] Get system state configuration from QEMU and patch DSDT with it.

Quoted 12 lines · Kevin O'Connor
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Kevin O'Connor
Quoted 3 lines

Here we in agreement, and I was against patching till it was unavoidable, but than pci hotplug started using it, and afterwards processor definitions, so no point in avoiding it now by using inferior methods.

I agree as well.

What's the background to needing to have dynamic S3/S4 definitions? (Why will some qemu instances be able to sleep and not others?)

Quoted 8 lines
Quoted 3 lines

Backwards compatibility. qemu has a -M machine-type option that expose an old qemu's guest-visible attributes. If an old qemu didn't support S3, then -M old shouldn't either.

The DSDT has claimed S3, S4, and S5 support since SeaBIOS has supported ACPI. What's the background to the requirement to stop claiming support for it?

Not all guests have working S3/S4 implementation. We want management to be able to disable S3/S4 for such guests. S4 value changes since we want to distinguish between S4 and S5 in qemu.

--
Gleb.

#23 lore raw
Quoted 7 lines · Kevin O'Connor
Quoted 2 lines · Gleb Natapov

The patch series looks okay to me. Let me know when the corresponding qemu patches are committed.

It is committed now: 459ae5ea5ad682c2b3220beb244d4102c1a4e332

--
Gleb.

#24 lore raw
Quoted 9 lines · Gleb Natapov
Quoted 7 lines · Kevin O'Connor
Quoted 2 lines · Gleb Natapov

The patch series looks okay to me. Let me know when the corresponding qemu patches are committed.

It is committed now: 459ae5ea5ad682c2b3220beb244d4102c1a4e332

Thanks. I committed your seabios patches.

-Kevin