Skip to contentSkip to conversation

a tiny bit late SMM fixups

PATCH Applied Laszlo Ersek 3 participants 8 messages Jul 24, 2015 – Jul 27, 2015

lore
Share & tools
lore
#0 lore raw

cover a tiny bit late SMM fixups

So, I just happened to resume my SMM-for-OVMF work today, with v2.4.0-rc2-2-g12e21eb, and I suddenly realized that these patches never made upstream. The first two are trivial and I kinda "insist" on them :), the last one (from Paolo) doesn't seem that trivial (to me at least), and I don't strictly need it for my work just yet. I'll let you guys decide.

Cc Paolo Bonzini <[email protected]>
Cc Andreas Faerber <[email protected]>
Cc Eduardo Habkost <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>

Thanks
Laszlo

Laszlo Ersek (2):
hw/acpi/ich9: clear smi_en on reset
hw/acpi/ich9: clean up stale comment about KVM not supporting SMM

Paolo Bonzini (1):
target-i386: wake up processors that receive an SMI

 hw/acpi/ich9.c    | 4 ++--
 target-i386/cpu.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/3 hw/acpi/ich9: clear smi_en on reset

Otherwise on reboot firmware might think (due to APMC_EN remaining set from the previous boot) that SMI support is absent.

Cc "Michael S. Tsirkin" <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 hw/acpi/ich9.c | 1 +
 1 file changed, 1 insertion(+)
hw/acpi/ich9.c +1 -0
index f04f6dc..8da5a2d 100644
@@ -221,6 +221,7 @@ static void pm_reset(void *opaque)
     acpi_pm_tmr_reset(&pm->acpi_regs);
     acpi_gpe_reset(&pm->acpi_regs);
 
+    pm->smi_en = 0;
     if (!pm->smm_enabled) {
         /* Mark SMM as already inited to prevent SMM from running. KVM does not
          * support SMM mode. */
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/3
#2 lore raw

Re: [Qemu-devel] [PATCH for-2.4-rc3 1/3] hw/acpi/ich9: clear smi_en on reset

Quoted 2 lines · On Fri, 24 Jul 2015 20:16:00 +0200 Laszlo Ersek <[email protected]> wrote:

Otherwise on reboot firmware might think (due to APMC_EN remaining set from the previous boot) that SMI support is absent.

Quoted 23 lines
Cc "Michael S. Tsirkin" <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 hw/acpi/ich9.c | 1 +
 1 file changed, 1 insertion(+)
hw/acpi/ich9.c +1 -0
index f04f6dc..8da5a2d 100644
@@ -221,6 +221,7 @@ static void pm_reset(void *opaque)
     acpi_pm_tmr_reset(&pm->acpi_regs);
     acpi_gpe_reset(&pm->acpi_regs);
 
+    pm->smi_en = 0;
     if (!pm->smm_enabled) {
         /* Mark SMM as already inited to prevent SMM from running. KVM does not
          * support SMM mode. */
#3 lore raw

PATCH 2/3 hw/acpi/ich9: clean up stale comment about KVM not supporting SMM

In reply to Laszlo Ersek

Commit fba72476c6 ("ich9: add smm_enabled field and arguments") detached SMM availability from kvm_enabled(). However, the comment in pm_reset() was not updated; let's do it now.

Cc "Michael S. Tsirkin" <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Paolo Bonzini <[email protected]>
---
 hw/acpi/ich9.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/acpi/ich9.c +1 -2
index 8da5a2d..1c7fcfa 100644
@@ -223,8 +223,7 @@ static void pm_reset(void *opaque)
 
     pm->smi_en = 0;
     if (!pm->smm_enabled) {
-        /* Mark SMM as already inited to prevent SMM from running. KVM does not
-         * support SMM mode. */
+        /* Mark SMM as already inited to prevent SMM from running. */
         pm->smi_en |= ICH9_PMIO_SMI_EN_APMC_EN;
     }
     pm->smi_en_wmask = ~0;
Signature · 1 line
1.8.3.1
Reviewed-by on v1 2/3
#4 lore raw

Re: [Qemu-devel] [PATCH for-2.4-rc3 2/3] hw/acpi/ich9: clean up stale comment about KVM not supporting SMM

Quoted 10 lines · On Fri, 24 Jul 2015 20:16:01 +0200 Laszlo Ersek <[email protected]> wrote:

Commit fba72476c6 ("ich9: add smm_enabled field and arguments") detached SMM availability from kvm_enabled(). However, the comment in pm_reset() was not updated; let's do it now.

Cc "Michael S. Tsirkin" <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Paolo Bonzini <[email protected]>
Quoted 18 lines
---
 hw/acpi/ich9.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/acpi/ich9.c +1 -2
index 8da5a2d..1c7fcfa 100644
@@ -223,8 +223,7 @@ static void pm_reset(void *opaque)
 
     pm->smi_en = 0;
     if (!pm->smm_enabled) {
-        /* Mark SMM as already inited to prevent SMM from running. KVM does not
-         * support SMM mode. */
+        /* Mark SMM as already inited to prevent SMM from running. */
         pm->smi_en |= ICH9_PMIO_SMI_EN_APMC_EN;
     }
     pm->smi_en_wmask = ~0;
#5 lore raw

PATCH 3/3 target-i386: wake up processors that receive an SMI

In reply to Laszlo Ersek

From: Paolo Bonzini <[email protected]>

An SMI should definitely wake up a processor in halted state! This lets OVMF boot with SMM on multiprocessor systems, although it halts very soon after that with a "CpuIndex != BspIndex" assertion failure.

Cc Andreas Faerber <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>
---
 target-i386/cpu.c | 1 +
 1 file changed, 1 insertion(+)
target-i386/cpu.c +1 -0
index 7a779b1..ee7b4ac 100644
@@ -3134,6 +3134,7 @@ static bool x86_cpu_has_work(CPUState *cs)
     return ((cs->interrupt_request & CPU_INTERRUPT_HARD) &&
             (env->eflags & IF_MASK)) ||
            (cs->interrupt_request & (CPU_INTERRUPT_NMI |
+                                     CPU_INTERRUPT_SMI |
                                      CPU_INTERRUPT_INIT |
                                      CPU_INTERRUPT_SIPI |
                                      CPU_INTERRUPT_MCE)) ||
Signature · 1 line
1.8.3.1
#6 lore raw

Re: [Qemu-devel] [PATCH for-2.4-rc3 3/3] target-i386: wake up processors that receive an SMI

Quoted 23 lines · Laszlo Ersek

From: Paolo Bonzini <[email protected]>

An SMI should definitely wake up a processor in halted state! This lets OVMF boot with SMM on multiprocessor systems, although it halts very soon after that with a "CpuIndex != BspIndex" assertion failure.

Cc Andreas Faerber <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>
---
 target-i386/cpu.c | 1 +
 1 file changed, 1 insertion(+)
target-i386/cpu.c +0 -0
index 7a779b1..ee7b4ac 100644

target-i386/cpu.c static bool x86_cpu_has_work(CPUState *cs) · line 3140

Quoted 7 lines
target-i386/cpu.c +1 -0
@@ -3134,6 +3134,7 @@ static bool x86_cpu_has_work(CPUState *cs)
     return ((cs->interrupt_request & CPU_INTERRUPT_HARD) &&
             (env->eflags & IF_MASK)) ||
            (cs->interrupt_request & (CPU_INTERRUPT_NMI |
+                                     CPU_INTERRUPT_SMI |
                                      CPU_INTERRUPT_INIT |
                                      CPU_INTERRUPT_SIPI |
                                      CPU_INTERRUPT_MCE)) ||

My bad, please disregard this one patch in the series -- an improved version has already been committed as a9bad65d2c1f61af74ce2ff43238d4b20bf81c3a.

Sorry about the noise (but please do pick up the first two patches).

Thanks!
Laszlo

#7 lore raw
In reply to Laszlo Ersek
Quoted 6 lines · Laszlo Ersek

So, I just happened to resume my SMM-for-OVMF work today, with v2.4.0-rc2-2-g12e21eb, and I suddenly realized that these patches never made upstream. The first two are trivial and I kinda "insist" on them :), the last one (from Paolo) doesn't seem that trivial (to me at least), and I don't strictly need it for my work just yet. I'll let you guys decide.

Applied to -trivial, thanks!

/mjt