public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/15] Review: acpi processor hotplug
@ 2008-02-22 21:34 Glauber Costa
  2008-02-22 21:34 ` [PATCH 1/15] Make a GPE register block be acessible Glauber Costa
  2008-02-24  9:44 ` [PATCH 0/15] Review: acpi processor hotplug Avi Kivity
  0 siblings, 2 replies; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: chrisw, marcelo, avi

Hi,

In this series, I'm sending the result-so-far of my work
with acpi for processor hotplug. I'm able to put a cpu up and down
(with the help of some udev scripts I wrote), but it still has some
known bugs and issues. For x86_64 linux machines (because the kernel
supports it), you can plug cpus that _were not_ listed initially in 
smp_cpus.

The usage is : cpu_set x (online/offline), in qemu monitor.
It will then send the proper signals to the cpu #x.

However, it is important to note that:

* there's no way to know if it suceeded. (ex, if the udev scripts are not
running, the cpu will not be put up, and you'll never know)
* there's no way to unconditionally send an add signal. (if you send BUS_CHECK again,
  and the cpu is already marked as present, it will offline it instead)

because of that, management gets a bit complicated. The ideal situation is to specify:
"I want Y cpus", and have it. Error reported in case it fails. Because of that, I _still_
advocate for an alternative virtio implementation. ACPI still plays its role in this scenario,
but not the full role.

In my TODO list, you'll find:
* fix some more issues in this code, and merge the gently comments I'm sure you'll make
* device acpi hotplug
* virtio cpu hotplug for linux (meaning refactoring the existing patch)
* occupy 24 territories.
* conquer 18 territories with at least 2 battalions on each. 

Besides a bunch of boring personal items I'm sure are not of interest to anybody here.

Thanks in advance 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/15] Make a GPE register block be acessible.
  2008-02-22 21:34 [PATCH 0/15] Review: acpi processor hotplug Glauber Costa
@ 2008-02-22 21:34 ` Glauber Costa
  2008-02-22 21:34   ` [PATCH 2/15] mark extra cpus as present Glauber Costa
  2008-02-24  9:44 ` [PATCH 0/15] Review: acpi processor hotplug Avi Kivity
  1 sibling, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

gpe is acessible when its address listed by BIOS is !0.
This patch makes gpe blk 0 available, and 4 bytes in length

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 bios/rombios32.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/bios/rombios32.c b/bios/rombios32.c
index 5365b5f..3ec85cb 100755
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -1441,6 +1441,8 @@ #endif
     fadt->pm_tmr_len = 4;
     fadt->plvl2_lat = cpu_to_le16(0x0fff); // C2 state not supported
     fadt->plvl3_lat = cpu_to_le16(0x0fff); // C3 state not supported
+    fadt->gpe0_blk = cpu_to_le32(0xafe0);
+    fadt->gpe0_blk_len = 4;
     /* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC */
     fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6));
     acpi_build_table_header((struct acpi_table_header *)fadt, "FACP",
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/15] mark extra cpus as present
  2008-02-22 21:34 ` [PATCH 1/15] Make a GPE register block be acessible Glauber Costa
@ 2008-02-22 21:34   ` Glauber Costa
  2008-02-22 21:34     ` [PATCH 3/15] introduce cpu_set to qemu monitor Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

Mark cpus over smp_cpus as present, but disable.
The OS can then recognize it and make room for future hotplug

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 bios/rombios.h   |    2 ++
 bios/rombios32.c |   21 +++++++++++++--------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/bios/rombios.h b/bios/rombios.h
index 412c5e9..2cf2bb3 100644
--- a/bios/rombios.h
+++ b/bios/rombios.h
@@ -58,6 +58,8 @@ #define PM_IO_BASE        0xb000
 #define SMB_IO_BASE       0xb100
 #define CPU_COUNT_ADDR    0xf000
 
+#define MAX_CPUS 16
+
   // Define the application NAME
 #if defined(BX_QEMU)
 #  define BX_APPNAME "QEMU"
diff --git a/bios/rombios32.c b/bios/rombios32.c
index 3ec85cb..f2db740 100755
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -948,20 +948,22 @@ #endif
     putstr(&q, "0.1         "); /* vendor id */
     putle32(&q, 0); /* OEM table ptr */
     putle16(&q, 0); /* OEM table size */
-    putle16(&q, smp_cpus + 18); /* entry count */
+    putle16(&q, MAX_CPUS + 18); /* entry count */
     putle32(&q, 0xfee00000); /* local APIC addr */
     putle16(&q, 0); /* ext table length */
     putb(&q, 0); /* ext table checksum */
     putb(&q, 0); /* reserved */
 
-    for(i = 0; i < smp_cpus; i++) {
+    for(i = 0; i < MAX_CPUS ; i++) {
         putb(&q, 0); /* entry type = processor */
         putb(&q, i); /* APIC id */
         putb(&q, 0x11); /* local APIC version number */
         if (i == 0)
             putb(&q, 3); /* cpu flags: enabled, bootstrap cpu */
-        else
+        else if ( i < smp_cpus)
             putb(&q, 1); /* cpu flags: enabled */
+        else
+            putb(&q, 0); /* cpu flags: disabled */
         putb(&q, 0); /* cpu signature */
         putb(&q, 6);
         putb(&q, 0);
@@ -981,7 +983,7 @@ #endif
     putstr(&q, "ISA   ");
 
     /* ioapic */
-    ioapic_id = smp_cpus;
+    ioapic_id = MAX_CPUS;
     putb(&q, 2); /* entry type = I/O APIC */
     putb(&q, ioapic_id); /* apic ID */
     putb(&q, 0x11); /* I/O APIC version number */
@@ -1393,7 +1395,7 @@ #endif
     addr = (addr + 7) & ~7;
     madt_addr = addr;
     madt_size = sizeof(*madt) +
-        sizeof(struct madt_processor_apic) * smp_cpus +
+        sizeof(struct madt_processor_apic) * MAX_CPUS +
         sizeof(struct madt_io_apic);
     madt = (void *)(addr);
     addr += madt_size;
@@ -1466,18 +1468,21 @@ #endif
         madt->local_apic_address = cpu_to_le32(0xfee00000);
         madt->flags = cpu_to_le32(1);
         apic = (void *)(madt + 1);
-        for(i=0;i<smp_cpus;i++) {
+        for(i=0;i<MAX_CPUS;i++) {
             apic->type = APIC_PROCESSOR;
             apic->length = sizeof(*apic);
             apic->processor_id = i;
             apic->local_apic_id = i;
-            apic->flags = cpu_to_le32(1);
+            if (i < smp_cpus)
+                apic->flags = cpu_to_le32(1);
+            else
+                apic->flags = 0;
             apic++;
         }
         io_apic = (void *)apic;
         io_apic->type = APIC_IO;
         io_apic->length = sizeof(*io_apic);
-        io_apic->io_apic_id = smp_cpus;
+        io_apic->io_apic_id = MAX_CPUS;
         io_apic->address = cpu_to_le32(0xfec00000);
         io_apic->interrupt = cpu_to_le32(0);
 
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 3/15] introduce cpu_set to qemu monitor
  2008-02-22 21:34   ` [PATCH 2/15] mark extra cpus as present Glauber Costa
@ 2008-02-22 21:34     ` Glauber Costa
  2008-02-22 21:34       ` [PATCH 4/15] mark processors as presents Glauber Costa
  2008-02-24  9:34       ` [PATCH 3/15] introduce cpu_set to qemu monitor Avi Kivity
  0 siblings, 2 replies; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

in this patch, cpu_set is introduced to qemu monitor

semantics is : cpu_set x online|offline.

it will then tell the acpi backend to signal cpu x.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 qemu/hw/acpi.c |    3 +++
 qemu/monitor.c |   16 ++++++++++++++++
 qemu/sysemu.h  |    3 +++
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index e21ded0..18561e0 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -533,3 +533,6 @@ void qemu_system_powerdown(void)
     }
 }
 #endif
+void qemu_system_cpu_hot_add(int cpu, int state)
+{
+}
diff --git a/qemu/monitor.c b/qemu/monitor.c
index e8022c8..09f84a9 100644
--- a/qemu/monitor.c
+++ b/qemu/monitor.c
@@ -345,6 +345,21 @@ static void do_cpu_set(int index)
         term_printf("Invalid CPU index\n");
 }
 
+static void do_cpu_set_nr(int value, const char *status)
+{
+    int state;
+
+    if (!strcmp(status, "online"))
+       state = 1;
+    else if (!strcmp(status, "offline"))
+       state = 0;
+    else {
+       term_printf("invalid status: %s\n", status);
+       return;
+    }
+    qemu_system_cpu_hot_add(value, state);
+}
+
 static void do_info_jit(void)
 {
     dump_exec_info(NULL, monitor_fprintf);
@@ -1338,6 +1353,7 @@ #endif
       "", "cancel the current VM migration" },
     { "migrate_set_speed", "s", do_migrate_set_speed,
       "value", "set maximum speed (in bytes) for migrations" },
+    { "cpu_set", "is", do_cpu_set_nr, "cpu [online|offline]", "change cpu state" },
     { NULL, NULL, },
 };
 
diff --git a/qemu/sysemu.h b/qemu/sysemu.h
index ffc468a..fe929b4 100644
--- a/qemu/sysemu.h
+++ b/qemu/sysemu.h
@@ -153,6 +153,9 @@ int extboot_drive;
 extern int drive_get_index(BlockInterfaceType type, int bus, int unit);
 extern int drive_get_max_bus(BlockInterfaceType type);
 
+/* acpi */
+void qemu_system_cpu_hot_add(int cpu, int state);
+
 /* vmchannel devices */
 
 #define MAX_VMCHANNEL_DEVICES 4
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 4/15] mark processors as presents
  2008-02-22 21:34     ` [PATCH 3/15] introduce cpu_set to qemu monitor Glauber Costa
@ 2008-02-22 21:34       ` Glauber Costa
  2008-02-22 21:34         ` [PATCH 5/15] provide gpe _L0x methods Glauber Costa
  2008-02-24  9:33         ` [PATCH 4/15] mark processors as presents Avi Kivity
  2008-02-24  9:34       ` [PATCH 3/15] introduce cpu_set to qemu monitor Avi Kivity
  1 sibling, 2 replies; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

mark processors as present through the _STA method

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 bios/acpi-dsdt.dsl |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
index e900795..cd42e23 100755
--- a/bios/acpi-dsdt.dsl
+++ b/bios/acpi-dsdt.dsl
@@ -25,9 +25,28 @@ DefinitionBlock (
     0x1                 // OEM Revision
     )
 {
+   Scope (\_PR)
+   {
+        Processor (CPU0, 0x00, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPU1, 0x01, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPU2, 0x02, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPU3, 0x03, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPU4, 0x04, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPU5, 0x05, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPU6, 0x06, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPU7, 0x07, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPU8, 0x08, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPU9, 0x09, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPUA, 0x0a, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPUB, 0x0b, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPUC, 0x0c, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPUD, 0x0d, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPUE, 0x0e, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+    }
 
     Scope (\)
     {
+
         /* CMOS memory access */
         OperationRegion (CMS, SystemIO, 0x70, 0x02)
         Field (CMS, ByteAcc, NoLock, Preserve)
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 5/15] provide gpe _L0x methods
  2008-02-22 21:34       ` [PATCH 4/15] mark processors as presents Glauber Costa
@ 2008-02-22 21:34         ` Glauber Costa
  2008-02-22 21:34           ` [PATCH 6/15] provide operation region for pio to the gpes Glauber Costa
  2008-02-24  9:33         ` [PATCH 4/15] mark processors as presents Avi Kivity
  1 sibling, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

provide methods for gpe blk 0, even though they do nothing atm

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 bios/acpi-dsdt.dsl |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
index cd42e23..7c954c3 100755
--- a/bios/acpi-dsdt.dsl
+++ b/bios/acpi-dsdt.dsl
@@ -579,4 +579,55 @@ DefinitionBlock (
         0x00, // reserved
         0x00, // reserved
     })
+    Scope (\_GPE)
+    {
+        Method(_L00) {
+            Return(0x01)
+        }
+        Method(_L01) {
+            Return(0x01)
+        }
+        Method(_L02) {
+            Return(0x01)
+        }
+        Method(_L03) {
+            Return(0x01)
+        }
+        Method(_L04) {
+            Return(0x01)
+        }
+        Method(_L05) {
+            Return(0x01)
+        }
+        Method(_L06) {
+            Return(0x01)
+        }
+        Method(_L07) {
+            Return(0x01)
+        }
+        Method(_L08) {
+            Return(0x01)
+        }
+        Method(_L09) {
+            Return(0x01)
+        }
+        Method(_L0A) {
+            Return(0x01)
+        }
+        Method(_L0B) {
+            Return(0x01)
+        }
+        Method(_L0C) {
+            Return(0x01)
+        }
+        Method(_L0D) {
+            Return(0x01)
+        }
+        Method(_L0E) {
+            Return(0x01)
+        }
+        Method(_L0F) {
+            Return(0x01)
+        }
+    }
 }
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 6/15] provide operation region for pio to the gpes
  2008-02-22 21:34         ` [PATCH 5/15] provide gpe _L0x methods Glauber Costa
@ 2008-02-22 21:34           ` Glauber Costa
  2008-02-22 21:34             ` [PATCH 7/15] implement method _L00 for GPE0 Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 bios/acpi-dsdt.dsl |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
index 7c954c3..d738b2f 100755
--- a/bios/acpi-dsdt.dsl
+++ b/bios/acpi-dsdt.dsl
@@ -27,6 +27,13 @@ DefinitionBlock (
 {
    Scope (\_PR)
    {
+ 	OperationRegion( PRST, SystemIO, 0xaf00, 0x02)
+ 	Field (PRST, ByteAcc, NoLock, WriteAsZeros)
+ 	{
+ 		PRU, 8,
+ 		PRD, 8,
+ 	}
+
         Processor (CPU0, 0x00, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
         Processor (CPU1, 0x01, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
         Processor (CPU2, 0x02, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 7/15] implement method _L00 for GPE0
  2008-02-22 21:34           ` [PATCH 6/15] provide operation region for pio to the gpes Glauber Costa
@ 2008-02-22 21:34             ` Glauber Costa
  2008-02-22 21:34               ` [PATCH 8/15] isolate cpu initialization function in hw/pc.c Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

This corresponds to the cpu hotplug functionality

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 bios/acpi-dsdt.dsl |  114 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 114 insertions(+), 0 deletions(-)

diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
index d738b2f..bdb591a 100755
--- a/bios/acpi-dsdt.dsl
+++ b/bios/acpi-dsdt.dsl
@@ -589,6 +589,120 @@ DefinitionBlock (
     Scope (\_GPE)
     {
         Method(_L00) {
+            /* Up status */
+            If (And(\_PR.PRU, 0x2)) {
+                Notify(\_PR.CPU1,1)
+            }
+
+            If (And(\_PR.PRU, 0x4)) {
+                Notify(\_PR.CPU2,1)
+            }
+
+            If (And(\_PR.PRU, 0x8)) {
+                Notify(\_PR.CPU3,1)
+            }
+
+            If (And(\_PR.PRU, 0x10)) {
+                Notify(\_PR.CPU4,1)
+            }
+
+            If (And(\_PR.PRU, 0x20)) {
+                Notify(\_PR.CPU5,1)
+            }
+
+            If (And(\_PR.PRU, 0x40)) {
+                Notify(\_PR.CPU6,1)
+            }
+
+            If (And(\_PR.PRU, 0x80)) {
+                Notify(\_PR.CPU7,1)
+            }
+
+            If (And(\_PR.PRU, 0x100)) {
+                Notify(\_PR.CPU8,1)
+            }
+
+            If (And(\_PR.PRU, 0x200)) {
+                Notify(\_PR.CPU9,1)
+            }
+
+            If (And(\_PR.PRU, 0x400)) {
+                Notify(\_PR.CPUA,1)
+            }
+
+            If (And(\_PR.PRU, 0x800)) {
+                Notify(\_PR.CPUB,1)
+            }
+
+            If (And(\_PR.PRU, 0x1000)) {
+                Notify(\_PR.CPUC,1)
+            }
+
+            If (And(\_PR.PRU, 0x2000)) {
+                Notify(\_PR.CPUD,1)
+            }
+
+            If (And(\_PR.PRU, 0x4000)) {
+                Notify(\_PR.CPUE,1)
+            }
+
+            /* down */
+            If (And(\_PR.PRD, 0x2)) {
+                Notify(\_PR.CPU1,3)
+            }
+
+            If (And(\_PR.PRD, 0x4)) {
+                Notify(\_PR.CPU2,3)
+            }
+
+            If (And(\_PR.PRD, 0x8)) {
+                Notify(\_PR.CPU3,3)
+            }
+
+            If (And(\_PR.PRD, 0x10)) {
+                Notify(\_PR.CPU4,3)
+            }
+
+            If (And(\_PR.PRD, 0x20)) {
+                Notify(\_PR.CPU5,3)
+            }
+
+            If (And(\_PR.PRD, 0x40)) {
+                Notify(\_PR.CPU6,3)
+            }
+
+            If (And(\_PR.PRD, 0x80)) {
+                Notify(\_PR.CPU7,3)
+            }
+
+            If (And(\_PR.PRD, 0x100)) {
+                Notify(\_PR.CPU8,3)
+            }
+
+            If (And(\_PR.PRD, 0x200)) {
+                Notify(\_PR.CPU9,3)
+            }
+
+            If (And(\_PR.PRD, 0x400)) {
+                Notify(\_PR.CPUA,3)
+            }
+
+            If (And(\_PR.PRD, 0x800)) {
+                Notify(\_PR.CPUB,3)
+            }
+
+            If (And(\_PR.PRD, 0x1000)) {
+                Notify(\_PR.CPUC,3)
+            }
+
+            If (And(\_PR.PRD, 0x2000)) {
+                Notify(\_PR.CPUD,3)
+            }
+
+            If (And(\_PR.PRD, 0x4000)) {
+                Notify(\_PR.CPUE,3)
+            }
+
             Return(0x01)
         }
         Method(_L01) {
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 8/15] isolate cpu initialization function in hw/pc.c
  2008-02-22 21:34             ` [PATCH 7/15] implement method _L00 for GPE0 Glauber Costa
@ 2008-02-22 21:34               ` Glauber Costa
  2008-02-22 21:34                 ` [PATCH 9/15] initialize hot add system Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

This patch wraps up the piece of code in hw/pc.c that
actually allocates and initializates a cpu. After that,
plan is to be able to start it later on.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 qemu/hw/pc.c |   40 +++++++++++++++++++++++-----------------
 qemu/hw/pc.h |    1 +
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index 77a7d53..982377d 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -740,6 +740,28 @@ static int load_option_rom(const char *f
     return size;
 }
 
+CPUState *pc_new_cpu(int cpu, const char *cpu_model, int pci_enabled)
+{
+        CPUState *env = cpu_init(cpu_model);
+        if (!env) {
+            fprintf(stderr, "Unable to find x86 CPU definition\n");
+            exit(1);
+        }
+        if (cpu != 0)
+            env->hflags |= HF_HALTED_MASK;
+        if (smp_cpus > 1) {
+            /* XXX: enable it in all cases */
+            env->cpuid_features |= CPUID_APIC;
+        }
+        register_savevm("cpu", cpu, 4, cpu_save, cpu_load, env);
+        qemu_register_reset(main_cpu_reset, env);
+        if (pci_enabled) {
+            apic_init(env);
+        }
+        vmport_init(env);
+	return env;
+}
+
 /* PC hardware initialisation */
 static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
                      const char *boot_device, DisplayState *ds,
@@ -779,23 +801,7 @@ #endif
     }
     
     for(i = 0; i < smp_cpus; i++) {
-        env = cpu_init(cpu_model);
-        if (!env) {
-            fprintf(stderr, "Unable to find x86 CPU definition\n");
-            exit(1);
-        }
-        if (i != 0)
-            env->hflags |= HF_HALTED_MASK;
-        if (smp_cpus > 1) {
-            /* XXX: enable it in all cases */
-            env->cpuid_features |= CPUID_APIC;
-        }
-        register_savevm("cpu", i, 4, cpu_save, cpu_load, env);
-        qemu_register_reset(main_cpu_reset, env);
-        if (pci_enabled) {
-            apic_init(env);
-        }
-        vmport_init(env);
+    	env = pc_new_cpu(i, cpu_model, pci_enabled);
     }
 
     /* allocate RAM */
diff --git a/qemu/hw/pc.h b/qemu/hw/pc.h
index f640395..f70ab55 100644
--- a/qemu/hw/pc.h
+++ b/qemu/hw/pc.h
@@ -85,6 +85,7 @@ extern int fd_bootchk;
 
 void ioport_set_a20(int enable);
 int ioport_get_a20(void);
+CPUState *pc_new_cpu(int cpu, const char *cpu_model, int pci_enabled);
 
 /* acpi.c */
 extern int acpi_enabled;
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 9/15] initialize hot add system.
  2008-02-22 21:34               ` [PATCH 8/15] isolate cpu initialization function in hw/pc.c Glauber Costa
@ 2008-02-22 21:34                 ` Glauber Costa
  2008-02-22 21:34                   ` [PATCH 10/15] handle gpe data for pio Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

Register the pios, and grab cpu_model for future usage.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 qemu/hw/acpi.c |   35 +++++++++++++++++++++++++++++++++++
 qemu/hw/pc.c   |    1 +
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index 18561e0..02f6bab 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -533,6 +533,41 @@ void qemu_system_powerdown(void)
     }
 }
 #endif
+unsigned long gpe_base = 0xafe0;
+
+struct gpe_regs {
+    uint16_t sts; /* status */
+    uint16_t en;  /* enabled */
+};
+
+static struct gpe_regs gpe;
+
+static uint32_t gpe_readb(void *opaque, uint32_t addr)
+{
+    uint32_t val = 0;
+#if defined(DEBUG)
+    printf("gpe read %lx == %lx\n", addr, val);
+#endif
+    return val;
+}
+
+static void gpe_writeb(void *opaque, uint32_t addr, uint32_t val)
+{
+#if defined(DEBUG)
+    printf("gpe write %lx <== %d\n", addr, val);
+#endif
+}
+
+static char *model;
+
+void qemu_system_hot_add_init(char *cpu_model)
+{
+    register_ioport_write(gpe_base, 4, 1, gpe_writeb, &gpe);
+    register_ioport_read(gpe_base, 4, 1,  gpe_readb, &gpe);
+
+    model = cpu_model;
+}
+
 void qemu_system_cpu_hot_add(int cpu, int state)
 {
 }
diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index 982377d..ab69e5c 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -1020,6 +1020,7 @@ #endif
         }
     }
 
+    qemu_system_hot_add_init(cpu_model);
 #define USE_HYPERCALL
 #ifdef USE_HYPERCALL
     pci_hypercall_init(pci_bus);
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/15] handle gpe data for pio
  2008-02-22 21:34                 ` [PATCH 9/15] initialize hot add system Glauber Costa
@ 2008-02-22 21:34                   ` Glauber Costa
  2008-02-22 21:34                     ` [PATCH 11/15] manipulate the gpe bits and send sci up the os Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

actually grab and return data, instead of just being two
bogus functions.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 qemu/hw/acpi.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index 02f6bab..60d3094 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -545,6 +545,24 @@ static struct gpe_regs gpe;
 static uint32_t gpe_readb(void *opaque, uint32_t addr)
 {
     uint32_t val = 0;
+    struct gpe_regs *g = opaque;
+    switch (addr) {
+        case 0xafe0:
+            val = g->sts & 0xFF;
+            break;
+        case 0xafe1:
+            val =  (g->sts >> 8) & 0xFF;
+            break;
+        case 0xafe2:
+            val =  g->en & 0xFF;
+            break;
+        case 0xafe3:
+            val =  (g->en >> 8) & 0xFF;
+            break;
+        default:
+            break;
+    }
+
 #if defined(DEBUG)
     printf("gpe read %lx == %lx\n", addr, val);
 #endif
@@ -553,6 +571,24 @@ #endif
 
 static void gpe_writeb(void *opaque, uint32_t addr, uint32_t val)
 {
+    struct gpe_regs *g = opaque;
+    switch (addr) {
+        case 0xafe0:
+            g->sts = (g->sts & ~0xFFFF) | (val & 0xFFFF);
+            break;
+        case 0xafe1:
+            g->sts = (g->sts & 0xFFFF) | (val << 8);
+            break;
+        case 0xafe2:
+            g->en = (g->en & ~0xFFFF) | (val & 0xFFFF);
+            break;
+        case 0xafe3:
+            g->en = (g->en & 0xFFFF) | (val << 8);
+            break;
+        default:
+            break;
+   }
+
 #if defined(DEBUG)
     printf("gpe write %lx <== %d\n", addr, val);
 #endif
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 11/15] manipulate the gpe bits and send sci up the os.
  2008-02-22 21:34                   ` [PATCH 10/15] handle gpe data for pio Glauber Costa
@ 2008-02-22 21:34                     ` Glauber Costa
  2008-02-22 21:34                       ` [PATCH 12/15] isolate cpu thread creation in qemu-kvm.c Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 qemu/hw/acpi.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index 60d3094..038e993 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -534,10 +534,13 @@ void qemu_system_powerdown(void)
 }
 #endif
 unsigned long gpe_base = 0xafe0;
+unsigned long status_base = 0xaf00;
 
 struct gpe_regs {
     uint16_t sts; /* status */
     uint16_t en;  /* enabled */
+    uint8_t up;
+    uint8_t down;
 };
 
 static struct gpe_regs gpe;
@@ -547,6 +550,13 @@ static uint32_t gpe_readb(void *opaque, 
     uint32_t val = 0;
     struct gpe_regs *g = opaque;
     switch (addr) {
+        case 0xaf00:
+            val = g->up;
+            break;
+        case 0xaf01:
+            val = g->down;
+            break;
+
         case 0xafe0:
             val = g->sts & 0xFF;
             break;
@@ -573,6 +583,13 @@ static void gpe_writeb(void *opaque, uin
 {
     struct gpe_regs *g = opaque;
     switch (addr) {
+        case 0xaf00:
+            g->up = val;
+            break;
+        case 0xaf01:
+            g->down = val;
+            break;
+
         case 0xafe0:
             g->sts = (g->sts & ~0xFFFF) | (val & 0xFFFF);
             break;
@@ -601,9 +618,34 @@ void qemu_system_hot_add_init(char *cpu_
     register_ioport_write(gpe_base, 4, 1, gpe_writeb, &gpe);
     register_ioport_read(gpe_base, 4, 1,  gpe_readb, &gpe);
 
+    register_ioport_write(status_base, 4, 1, gpe_writeb, &gpe);
+    register_ioport_read(status_base, 4, 1,  gpe_readb, &gpe);
+
     model = cpu_model;
 }
 
+static void enable_processor(struct gpe_regs *g, int cpu)
+{
+    g->sts |= 1;
+    g->en |= 1;
+    g->up |= (1 << cpu);
+}
+
+static void disable_processor(struct gpe_regs *g, int cpu)
+{
+    g->sts |= 1;
+    g->en |= 1;
+    g->down |= (1 << cpu);
+}
+
 void qemu_system_cpu_hot_add(int cpu, int state)
 {
+    qemu_set_irq(pm_state->irq, 1);
+    gpe.up = 0;
+    gpe.down = 0;
+    if (state)
+        enable_processor(&gpe, cpu);
+    else
+        disable_processor(&gpe, cpu);
+    qemu_set_irq(pm_state->irq, 0);
 }
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 12/15] isolate cpu thread creation in qemu-kvm.c
  2008-02-22 21:34                     ` [PATCH 11/15] manipulate the gpe bits and send sci up the os Glauber Costa
@ 2008-02-22 21:34                       ` Glauber Costa
  2008-02-22 21:34                         ` [PATCH 13/15] provide _MAT to acpi processor Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 qemu/qemu-kvm.c |    9 +++++++--
 qemu/qemu-kvm.h |    1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index ffc59d5..59fe9df 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -351,6 +351,11 @@ static void kvm_add_signal(struct qemu_k
     sigdelset(&sigtab->negsigset, signum);
 }
 
+void kvm_init_new_ap(int cpu, CPUState *env)
+{
+    pthread_create(&vcpu_info[cpu].thread, NULL, ap_main_loop, env);
+}
+
 int kvm_init_ap(void)
 {
     CPUState *env = first_cpu->next_cpu;
@@ -371,8 +376,8 @@ #endif
     vcpu->env = first_cpu;
     signal(SIG_IPI, sig_ipi_handler);
     for (i = 1; i < smp_cpus; ++i) {
-	pthread_create(&vcpu_info[i].thread, NULL, ap_main_loop, env);
-	env = env->next_cpu;
+        kvm_init_new_ap(i, env);
+        env = env->next_cpu;
     }
     return 0;
 }
diff --git a/qemu/qemu-kvm.h b/qemu/qemu-kvm.h
index a637d71..8e45f30 100644
--- a/qemu/qemu-kvm.h
+++ b/qemu/qemu-kvm.h
@@ -13,6 +13,7 @@ #include "cpu.h"
 int kvm_main_loop(void);
 int kvm_qemu_init(void);
 int kvm_qemu_create_context(void);
+void kvm_init_new_ap(int cpu, CPUState *env);
 int kvm_init_ap(void);
 void kvm_qemu_destroy(void);
 void kvm_load_registers(CPUState *env);
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 13/15] provide _MAT to acpi processor
  2008-02-22 21:34                       ` [PATCH 12/15] isolate cpu thread creation in qemu-kvm.c Glauber Costa
@ 2008-02-22 21:34                         ` Glauber Costa
  2008-02-22 21:34                           ` [PATCH 14/15] start a new cpu thread Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 bios/acpi-dsdt.dsl |  154 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 140 insertions(+), 14 deletions(-)

diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
index bdb591a..4ce7b6a 100755
--- a/bios/acpi-dsdt.dsl
+++ b/bios/acpi-dsdt.dsl
@@ -35,20 +35,146 @@ DefinitionBlock (
  	}
 
         Processor (CPU0, 0x00, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPU1, 0x01, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPU2, 0x02, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPU3, 0x03, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPU4, 0x04, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPU5, 0x05, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPU6, 0x06, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPU7, 0x07, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPU8, 0x08, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPU9, 0x09, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPUA, 0x0a, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPUB, 0x0b, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPUC, 0x0c, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPUD, 0x0d, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
-        Processor (CPUE, 0x0e, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
+        Processor (CPU1, 0x01, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x01, 0x01, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x2)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPU2, 0x02, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x02, 0x02, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x4)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPU3, 0x03, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x03, 0x03, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x8)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPU4, 0x04, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x04, 0x04, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x10)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPU5, 0x05, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x05, 0x05, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x20)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPU6, 0x06, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x06, 0x06, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x40)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPU7, 0x07, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x07, 0x07, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x80)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPU8, 0x08, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x08, 0x08, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x100)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPU9, 0x09, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x09, 0x09, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x200)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPUA, 0x0a, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x0A, 0x0A, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x400)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPUB, 0x0b, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x0B, 0x0B, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x800)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPUC, 0x0c, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x0C, 0x0C, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x1000)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPUD, 0x0d, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x0D, 0x0D, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x2000)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
+        Processor (CPUE, 0x0e, 0x0000b010, 0x06) {
+            Name (TMP, Buffer(0x8) {0x0, 0x8, 0x0E, 0x0E, 0x1, 0x0, 0x0, 0x0})
+            Method(_MAT, 0) {
+                If (And(\_PR.PRU, 0x4000)) { Return(TMP) }
+                Else { Return(0x0) }
+            }
+            Method (_STA) {
+                Return(0x1)
+            }
+        }
     }
 
     Scope (\)
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 14/15] start a new cpu thread
  2008-02-22 21:34                         ` [PATCH 13/15] provide _MAT to acpi processor Glauber Costa
@ 2008-02-22 21:34                           ` Glauber Costa
  2008-02-22 21:34                             ` [PATCH 15/15] provide _EJ0 method for processor removal Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

spin up a new cpu thread if not yet running.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 qemu/hw/acpi.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index 038e993..93cbc68 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -23,6 +23,9 @@ #include "qemu-timer.h"
 #include "sysemu.h"
 #include "i2c.h"
 #include "smbus.h"
+#ifdef USE_KVM
+#include "qemu-kvm.h"
+#endif
 
 //#define DEBUG
 
@@ -640,6 +643,19 @@ static void disable_processor(struct gpe
 
 void qemu_system_cpu_hot_add(int cpu, int state)
 {
+    CPUState *env;
+
+    if ((state) && (!qemu_kvm_cpu_env(cpu))) {
+        env = pc_new_cpu(cpu, model, 1);
+        if (!env) {
+            fprintf(stderr, "cpu %d creation failed\n", cpu);
+            return;
+        }
+#ifdef USE_KVM
+        kvm_init_new_ap(cpu, env);
+#endif
+    }
+
     qemu_set_irq(pm_state->irq, 1);
     gpe.up = 0;
     gpe.down = 0;
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 15/15] provide _EJ0 method for processor removal
  2008-02-22 21:34                           ` [PATCH 14/15] start a new cpu thread Glauber Costa
@ 2008-02-22 21:34                             ` Glauber Costa
  0 siblings, 0 replies; 25+ messages in thread
From: Glauber Costa @ 2008-02-22 21:34 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, avi, Glauber Costa, chrisw

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 bios/acpi-dsdt.dsl    |   14 ++++++++++++++
 qemu/pc-bios/bios.bin |  Bin
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
index 4ce7b6a..33adfce 100755
--- a/bios/acpi-dsdt.dsl
+++ b/bios/acpi-dsdt.dsl
@@ -44,6 +44,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0, 1) { Return (0x0) }
         }
         Processor (CPU2, 0x02, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x02, 0x02, 0x1, 0x0, 0x0, 0x0})
@@ -54,6 +55,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPU3, 0x03, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x03, 0x03, 0x1, 0x0, 0x0, 0x0})
@@ -64,6 +66,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPU4, 0x04, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x04, 0x04, 0x1, 0x0, 0x0, 0x0})
@@ -74,6 +77,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPU5, 0x05, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x05, 0x05, 0x1, 0x0, 0x0, 0x0})
@@ -84,6 +88,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPU6, 0x06, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x06, 0x06, 0x1, 0x0, 0x0, 0x0})
@@ -94,6 +99,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPU7, 0x07, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x07, 0x07, 0x1, 0x0, 0x0, 0x0})
@@ -104,6 +110,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPU8, 0x08, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x08, 0x08, 0x1, 0x0, 0x0, 0x0})
@@ -114,6 +121,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPU9, 0x09, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x09, 0x09, 0x1, 0x0, 0x0, 0x0})
@@ -124,6 +132,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPUA, 0x0a, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x0A, 0x0A, 0x1, 0x0, 0x0, 0x0})
@@ -134,6 +143,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPUB, 0x0b, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x0B, 0x0B, 0x1, 0x0, 0x0, 0x0})
@@ -144,6 +154,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPUC, 0x0c, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x0C, 0x0C, 0x1, 0x0, 0x0, 0x0})
@@ -154,6 +165,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPUD, 0x0d, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x0D, 0x0D, 0x1, 0x0, 0x0, 0x0})
@@ -164,6 +176,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
         Processor (CPUE, 0x0e, 0x0000b010, 0x06) {
             Name (TMP, Buffer(0x8) {0x0, 0x8, 0x0E, 0x0E, 0x1, 0x0, 0x0, 0x0})
@@ -174,6 +187,7 @@ DefinitionBlock (
             Method (_STA) {
                 Return(0x1)
             }
+            Method (_EJ0,1) { Return (0x0) }
         }
     }
 
diff --git a/qemu/pc-bios/bios.bin b/qemu/pc-bios/bios.bin
index 64b7abb..872f073 100644
Binary files a/qemu/pc-bios/bios.bin and b/qemu/pc-bios/bios.bin differ
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 4/15] mark processors as presents
  2008-02-22 21:34       ` [PATCH 4/15] mark processors as presents Glauber Costa
  2008-02-22 21:34         ` [PATCH 5/15] provide gpe _L0x methods Glauber Costa
@ 2008-02-24  9:33         ` Avi Kivity
  2008-02-25 14:38           ` Glauber Costa
  1 sibling, 1 reply; 25+ messages in thread
From: Avi Kivity @ 2008-02-24  9:33 UTC (permalink / raw)
  To: Glauber Costa; +Cc: kvm-devel, marcelo, chrisw

Glauber Costa wrote:
> mark processors as present through the _STA method
>
> Signed-off-by: Glauber Costa <gcosta@redhat.com>
> ---
>  bios/acpi-dsdt.dsl |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
> index e900795..cd42e23 100755
> --- a/bios/acpi-dsdt.dsl
> +++ b/bios/acpi-dsdt.dsl
> @@ -25,9 +25,28 @@ DefinitionBlock (
>      0x1                 // OEM Revision
>      )
>  {
> +   Scope (\_PR)
> +   {
> +        Processor (CPU0, 0x00, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPU1, 0x01, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPU2, 0x02, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPU3, 0x03, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPU4, 0x04, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPU5, 0x05, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPU6, 0x06, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPU7, 0x07, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPU8, 0x08, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPU9, 0x09, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPUA, 0x0a, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPUB, 0x0b, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPUC, 0x0c, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPUD, 0x0d, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +        Processor (CPUE, 0x0e, 0x0000b010, 0x06) {Method (_STA) { Return(0x1)}}
> +    }
>   

There is now code in rombios32.c to do this.  It needs to be removed.  
See acpi_build_processor_ssdt().

>  
>      Scope (\)
>      {
> +
>          /* CMOS memory access */
>          OperationRegion (CMS, SystemIO, 0x70, 0x02)
>          Field (CMS, ByteAcc, NoLock, Preserve)
>   

-

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 3/15] introduce cpu_set to qemu monitor
  2008-02-22 21:34     ` [PATCH 3/15] introduce cpu_set to qemu monitor Glauber Costa
  2008-02-22 21:34       ` [PATCH 4/15] mark processors as presents Glauber Costa
@ 2008-02-24  9:34       ` Avi Kivity
  1 sibling, 0 replies; 25+ messages in thread
From: Avi Kivity @ 2008-02-24  9:34 UTC (permalink / raw)
  To: Glauber Costa; +Cc: kvm-devel, marcelo, chrisw

Glauber Costa wrote:
> in this patch, cpu_set is introduced to qemu monitor
>
> semantics is : cpu_set x online|offline.
>
> it will then tell the acpi backend to signal cpu x.
>
>   

> index e21ded0..18561e0 100644
> --- a/qemu/hw/acpi.c
> +++ b/qemu/hw/acpi.c
> @@ -533,3 +533,6 @@ void qemu_system_powerdown(void)
>      }
>  }
>  #endif
> +void qemu_system_cpu_hot_add(int cpu, int state)
> +{
> +}
>   

Missing empty line.

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 0/15] Review: acpi processor hotplug
  2008-02-22 21:34 [PATCH 0/15] Review: acpi processor hotplug Glauber Costa
  2008-02-22 21:34 ` [PATCH 1/15] Make a GPE register block be acessible Glauber Costa
@ 2008-02-24  9:44 ` Avi Kivity
  1 sibling, 0 replies; 25+ messages in thread
From: Avi Kivity @ 2008-02-24  9:44 UTC (permalink / raw)
  To: Glauber Costa; +Cc: kvm-devel, chrisw, marcelo

Glauber Costa wrote:
> Hi,
>
> In this series, I'm sending the result-so-far of my work
> with acpi for processor hotplug. I'm able to put a cpu up and down
> (with the help of some udev scripts I wrote), but it still has some
> known bugs and issues. For x86_64 linux machines (because the kernel
> supports it), you can plug cpus that _were not_ listed initially in 
> smp_cpus.
>
> The usage is : cpu_set x (online/offline), in qemu monitor.
> It will then send the proper signals to the cpu #x.
>
> However, it is important to note that:
>
> * there's no way to know if it suceeded. (ex, if the udev scripts are not
> running, the cpu will not be put up, and you'll never know)
> * there's no way to unconditionally send an add signal. (if you send BUS_CHECK again,
>   and the cpu is already marked as present, it will offline it instead)
>
> because of that, management gets a bit complicated. The ideal situation is to specify:
> "I want Y cpus", and have it. Error reported in case it fails. Because of that, I _still_
> advocate for an alternative virtio implementation. ACPI still plays its role in this scenario,
> but not the full role.
>
>   

Perhaps this can be implemented in userspace; I don't see anything that 
needs to be in the kernel for this.

Since it needs to work independently of networking, maybe it's a good 
first use for an AF_VIRT protocol family (which can be implemented on 
top of virtio).

> In my TODO list, you'll find:
> * fix some more issues in this code, and merge the gently comments I'm sure you'll make
>   

It's difficult with such near-perfect patchsets.  You're reducing me to 
whitespace comments.  Please post to qemu-devel as well so they can 
ignore it as usual.

> * device acpi hotplug
> * virtio cpu hotplug for linux (meaning refactoring the existing patch)
>   

Slightly related to this would be a qemu monitor mechanism to set 
vcpu->cpu affinity.

> * occupy 24 territories.
> * conquer 18 territories with at least 2 battalions on each. 
>   

Sounds risky.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 4/15] mark processors as presents
  2008-02-24  9:33         ` [PATCH 4/15] mark processors as presents Avi Kivity
@ 2008-02-25 14:38           ` Glauber Costa
  2008-02-25 14:49             ` Avi Kivity
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-25 14:38 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel, marcelo, chrisw

Avi Kivity wrote:
> Glauber Costa wrote:
>> mark processors as present through the _STA method
>>
>> Signed-off-by: Glauber Costa <gcosta@redhat.com>
>> ---
>>  bios/acpi-dsdt.dsl |   19 +++++++++++++++++++
>>  1 files changed, 19 insertions(+), 0 deletions(-)
>>
>> diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
>> index e900795..cd42e23 100755
>> --- a/bios/acpi-dsdt.dsl
>> +++ b/bios/acpi-dsdt.dsl
>> @@ -25,9 +25,28 @@ DefinitionBlock (
>>      0x1                 // OEM Revision
>>      )
>>  {
>> +   Scope (\_PR)
>> +   {
>> +        Processor (CPU0, 0x00, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPU1, 0x01, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPU2, 0x02, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPU3, 0x03, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPU4, 0x04, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPU5, 0x05, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPU6, 0x06, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPU7, 0x07, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPU8, 0x08, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPU9, 0x09, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPUA, 0x0a, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPUB, 0x0b, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPUC, 0x0c, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPUD, 0x0d, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +        Processor (CPUE, 0x0e, 0x0000b010, 0x06) {Method (_STA) { 
>> Return(0x1)}}
>> +    }
>>   
> 
> There is now code in rombios32.c to do this.  It needs to be removed.  
> See acpi_build_processor_ssdt().

Building the table by hand is trivial in the case where the processors 
are just _listed_, and can be easily justified. This first patch just 
add the _STA method, but other follows, which turns the processor block 
into a quite complicated thing. Not to mention the operational region,
the notifications that have to refer to the processor objects, etc.

So I can't see any valid justification for using the code in 
rombios32.c, instead of a high level language such as the one provided 
by acpi.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 4/15] mark processors as presents
  2008-02-25 14:49             ` Avi Kivity
@ 2008-02-25 14:43               ` Glauber Costa
  0 siblings, 0 replies; 25+ messages in thread
From: Glauber Costa @ 2008-02-25 14:43 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel, marcelo, chrisw

Avi Kivity wrote:
> Glauber Costa wrote:
>>>
>>> There is now code in rombios32.c to do this.  It needs to be 
>>> removed.  See acpi_build_processor_ssdt().
>>
>> Building the table by hand is trivial in the case where the processors 
>> are just _listed_, and can be easily justified. This first patch just 
>> add the _STA method, but other follows, which turns the processor 
>> block into a quite complicated thing. Not to mention the operational 
>> region,
>> the notifications that have to refer to the processor objects, etc.
>>
>> So I can't see any valid justification for using the code in 
>> rombios32.c, instead of a high level language such as the one provided 
>> by acpi.
> 
> I meant, remove the code in rombios32.c.  Sorry about the confusion.
> 
Oh, so that's okay ;-)


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 4/15] mark processors as presents
  2008-02-25 14:38           ` Glauber Costa
@ 2008-02-25 14:49             ` Avi Kivity
  2008-02-25 14:43               ` Glauber Costa
  0 siblings, 1 reply; 25+ messages in thread
From: Avi Kivity @ 2008-02-25 14:49 UTC (permalink / raw)
  To: Glauber Costa; +Cc: kvm-devel, marcelo, chrisw

Glauber Costa wrote:
>>
>> There is now code in rombios32.c to do this.  It needs to be 
>> removed.  See acpi_build_processor_ssdt().
>
> Building the table by hand is trivial in the case where the processors 
> are just _listed_, and can be easily justified. This first patch just 
> add the _STA method, but other follows, which turns the processor 
> block into a quite complicated thing. Not to mention the operational 
> region,
> the notifications that have to refer to the processor objects, etc.
>
> So I can't see any valid justification for using the code in 
> rombios32.c, instead of a high level language such as the one provided 
> by acpi.

I meant, remove the code in rombios32.c.  Sorry about the confusion.

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 4/15] mark processors as presents
  2008-02-26 19:56     ` [PATCH 3/15] introduce cpu_set to qemu monitor Glauber Costa
@ 2008-02-26 19:56       ` Glauber Costa
  2008-02-26 23:05         ` Alexander Graf
  0 siblings, 1 reply; 25+ messages in thread
From: Glauber Costa @ 2008-02-26 19:56 UTC (permalink / raw)
  To: kvm-devel; +Cc: marcelo, qemu-devel, avi, Glauber Costa, chrisw

mark processors as present through the _STA method

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 bios/acpi-dsdt.dsl |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
index e900795..244e906 100755
--- a/bios/acpi-dsdt.dsl
+++ b/bios/acpi-dsdt.dsl
@@ -25,6 +25,24 @@ DefinitionBlock (
     0x1                 // OEM Revision
     )
 {
+   Scope (\_PR)
+   {
+        Processor (CPU0, 0x00, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPU1, 0x01, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPU2, 0x02, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPU3, 0x03, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPU4, 0x04, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPU5, 0x05, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPU6, 0x06, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPU7, 0x07, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPU8, 0x08, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPU9, 0x09, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPUA, 0x0a, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPUB, 0x0b, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPUC, 0x0c, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPUD, 0x0d, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+        Processor (CPUE, 0x0e, 0x0000b010, 0x06) {Method (_STA) { Return(0xF)}}
+    }
 
     Scope (\)
     {
-- 
1.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 4/15] mark processors as presents
  2008-02-26 19:56       ` [PATCH 4/15] mark processors as presents Glauber Costa
@ 2008-02-26 23:05         ` Alexander Graf
  2008-02-26 23:07           ` Alexander Graf
  0 siblings, 1 reply; 25+ messages in thread
From: Alexander Graf @ 2008-02-26 23:05 UTC (permalink / raw)
  To: Glauber Costa; +Cc: kvm-devel, marcelo, chrisw, qemu-devel, avi


On Feb 26, 2008, at 8:56 PM, Glauber Costa wrote:

> mark processors as present through the _STA method
>
> Signed-off-by: Glauber Costa <gcosta@redhat.com>
> ---
> bios/acpi-dsdt.dsl |   18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
> index e900795..244e906 100755
> --- a/bios/acpi-dsdt.dsl
> +++ b/bios/acpi-dsdt.dsl
> @@ -25,6 +25,24 @@ DefinitionBlock (
>     0x1                 // OEM Revision
>     )
> {
> +   Scope (\_PR)
> +   {
> +        Processor (CPU0, 0x00, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPU1, 0x01, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPU2, 0x02, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPU3, 0x03, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPU4, 0x04, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPU5, 0x05, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPU6, 0x06, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPU7, 0x07, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPU8, 0x08, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPU9, 0x09, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPUA, 0x0a, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPUB, 0x0b, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPUC, 0x0c, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPUD, 0x0d, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}
> +        Processor (CPUE, 0x0e, 0x0000b010, 0x06) {Method (_STA)  
> { Return(0xF)}}

So if I understand this correctly, you set all possible CPUs on active  
and available. What exactly happens if one of these is not usable?
I know that Darwin broke on the _PR description quite badly, as it  
just allocates possible execution engines using the ACPI Processor  
specification and I do not know what happens if the engine is not  
available.

I have to admit that I have not tested it as I do not have the time to  
do so though, so maybe it works.

>
> +    }
>
>     Scope (\)
>     {
> -- 
> 1.4.2
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 4/15] mark processors as presents
  2008-02-26 23:05         ` Alexander Graf
@ 2008-02-26 23:07           ` Alexander Graf
  0 siblings, 0 replies; 25+ messages in thread
From: Alexander Graf @ 2008-02-26 23:07 UTC (permalink / raw)
  To: Alexander Graf; +Cc: kvm-devel, qemu-devel, avi, Glauber Costa, chrisw, marcelo


On Feb 27, 2008, at 12:05 AM, Alexander Graf wrote:

>
> On Feb 26, 2008, at 8:56 PM, Glauber Costa wrote:
>
>> mark processors as present through the _STA method
>>
>> Signed-off-by: Glauber Costa <gcosta@redhat.com>
>> ---
>> bios/acpi-dsdt.dsl |   18 ++++++++++++++++++
>> 1 files changed, 18 insertions(+), 0 deletions(-)
>>
>> diff --git a/bios/acpi-dsdt.dsl b/bios/acpi-dsdt.dsl
>> index e900795..244e906 100755
>> --- a/bios/acpi-dsdt.dsl
>> +++ b/bios/acpi-dsdt.dsl
>> @@ -25,6 +25,24 @@ DefinitionBlock (
>>    0x1                 // OEM Revision
>>    )
>> {
>> +   Scope (\_PR)
>> +   {
>> +        Processor (CPU0, 0x00, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPU1, 0x01, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPU2, 0x02, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPU3, 0x03, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPU4, 0x04, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPU5, 0x05, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPU6, 0x06, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPU7, 0x07, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPU8, 0x08, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPU9, 0x09, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPUA, 0x0a, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPUB, 0x0b, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPUC, 0x0c, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPUD, 0x0d, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>> +        Processor (CPUE, 0x0e, 0x0000b010, 0x06) {Method (_STA)
>> { Return(0xF)}}
>
> So if I understand this correctly, you set all possible CPUs on active
> and available. What exactly happens if one of these is not usable?
> I know that Darwin broke on the _PR description quite badly, as it
> just allocates possible execution engines using the ACPI Processor
> specification and I do not know what happens if the engine is not
> available.
>
> I have to admit that I have not tested it as I do not have the time to
> do so though, so maybe it works.

I just read patch 13 ... nevermind

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2008-02-26 23:07 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-22 21:34 [PATCH 0/15] Review: acpi processor hotplug Glauber Costa
2008-02-22 21:34 ` [PATCH 1/15] Make a GPE register block be acessible Glauber Costa
2008-02-22 21:34   ` [PATCH 2/15] mark extra cpus as present Glauber Costa
2008-02-22 21:34     ` [PATCH 3/15] introduce cpu_set to qemu monitor Glauber Costa
2008-02-22 21:34       ` [PATCH 4/15] mark processors as presents Glauber Costa
2008-02-22 21:34         ` [PATCH 5/15] provide gpe _L0x methods Glauber Costa
2008-02-22 21:34           ` [PATCH 6/15] provide operation region for pio to the gpes Glauber Costa
2008-02-22 21:34             ` [PATCH 7/15] implement method _L00 for GPE0 Glauber Costa
2008-02-22 21:34               ` [PATCH 8/15] isolate cpu initialization function in hw/pc.c Glauber Costa
2008-02-22 21:34                 ` [PATCH 9/15] initialize hot add system Glauber Costa
2008-02-22 21:34                   ` [PATCH 10/15] handle gpe data for pio Glauber Costa
2008-02-22 21:34                     ` [PATCH 11/15] manipulate the gpe bits and send sci up the os Glauber Costa
2008-02-22 21:34                       ` [PATCH 12/15] isolate cpu thread creation in qemu-kvm.c Glauber Costa
2008-02-22 21:34                         ` [PATCH 13/15] provide _MAT to acpi processor Glauber Costa
2008-02-22 21:34                           ` [PATCH 14/15] start a new cpu thread Glauber Costa
2008-02-22 21:34                             ` [PATCH 15/15] provide _EJ0 method for processor removal Glauber Costa
2008-02-24  9:33         ` [PATCH 4/15] mark processors as presents Avi Kivity
2008-02-25 14:38           ` Glauber Costa
2008-02-25 14:49             ` Avi Kivity
2008-02-25 14:43               ` Glauber Costa
2008-02-24  9:34       ` [PATCH 3/15] introduce cpu_set to qemu monitor Avi Kivity
2008-02-24  9:44 ` [PATCH 0/15] Review: acpi processor hotplug Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2008-02-26 19:56 [PATCH 0/15] " Glauber Costa
2008-02-26 19:56 ` [PATCH 1/15] Make a GPE register block be acessible Glauber Costa
2008-02-26 19:56   ` [PATCH 2/15] mark extra cpus as present Glauber Costa
2008-02-26 19:56     ` [PATCH 3/15] introduce cpu_set to qemu monitor Glauber Costa
2008-02-26 19:56       ` [PATCH 4/15] mark processors as presents Glauber Costa
2008-02-26 23:05         ` Alexander Graf
2008-02-26 23:07           ` Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox