qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Glauber Costa <gcosta@redhat.com>
To: kvm-devel@lists.sourceforge.net
Cc: marcelo@kvack.org, glommer@gmail.com, qemu-devel@nongnu.org,
	Glauber Costa <gcosta@redhat.com>,
	chrisw@sous-sol.org
Subject: [Qemu-devel] [PATCH 11/15] manipulate the gpe bits and send sci up the os.
Date: Tue, 26 Feb 2008 16:56:41 -0300	[thread overview]
Message-ID: <1204055805-32349-12-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <1204055805-32349-11-git-send-email-gcosta@redhat.com>

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 7340f15..5a6d1a8 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -534,10 +534,13 @@ void qemu_system_powerdown(void)
 }
 #endif
 #define GPE_BASE 0xafe0
+#define PROC_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 PROC_BASE:
+            val = g->up;
+            break;
+        case PROC_BASE + 1:
+            val = g->down;
+            break;
+
         case GPE_BASE:
             val = g->sts & 0xFF;
             break;
@@ -573,6 +583,13 @@ static void gpe_writeb(void *opaque, uin
 {
     struct gpe_regs *g = opaque;
     switch (addr) {
+        case PROC_BASE:
+            g->up = val;
+            break;
+        case PROC_BASE + 1:
+            g->down = val;
+            break;
+
         case GPE_BASE:
             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(PROC_BASE, 4, 1, gpe_writeb, &gpe);
+    register_ioport_read(PROC_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

  reply	other threads:[~2008-02-26 20:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-26 19:56 [Qemu-devel] [PATCH 0/15] acpi processor hotplug Glauber Costa
2008-02-26 19:56 ` [Qemu-devel] [PATCH 1/15] Make a GPE register block be acessible Glauber Costa
2008-02-26 19:56   ` [Qemu-devel] [PATCH 2/15] mark extra cpus as present Glauber Costa
2008-02-26 19:56     ` [Qemu-devel] [PATCH 3/15] introduce cpu_set to qemu monitor Glauber Costa
2008-02-26 19:56       ` [Qemu-devel] [PATCH 4/15] mark processors as presents Glauber Costa
2008-02-26 19:56         ` [Qemu-devel] [PATCH 5/15] provide gpe _L0x methods Glauber Costa
2008-02-26 19:56           ` [Qemu-devel] [PATCH 6/15] provide operation region for pio to the gpes Glauber Costa
2008-02-26 19:56             ` [Qemu-devel] [PATCH 7/15] implement method _L00 for GPE0 Glauber Costa
2008-02-26 19:56               ` [Qemu-devel] [PATCH 8/15] isolate cpu initialization function in hw/pc.c Glauber Costa
2008-02-26 19:56                 ` [Qemu-devel] [PATCH 9/15] initialize hot add system Glauber Costa
2008-02-26 19:56                   ` [Qemu-devel] [PATCH 10/15] handle gpe data for pio Glauber Costa
2008-02-26 19:56                     ` Glauber Costa [this message]
2008-02-26 19:56                       ` [Qemu-devel] [PATCH 12/15] isolate cpu thread creation in qemu-kvm.c Glauber Costa
2008-02-26 19:56                         ` [Qemu-devel] [PATCH 13/15] provide _MAT to acpi processor Glauber Costa
2008-02-26 19:56                           ` [Qemu-devel] [PATCH 14/15] start a new cpu thread Glauber Costa
2008-02-26 19:56                             ` [Qemu-devel] [PATCH 15/15] remove acpi_build_processor_ssdt Glauber Costa
2008-02-26 23:05         ` [Qemu-devel] Re: [kvm-devel] [PATCH 4/15] mark processors as presents Alexander Graf
2008-02-26 23:07           ` Alexander Graf
2008-02-27 10:55 ` [Qemu-devel] Re: [kvm-devel] [PATCH 0/15] acpi processor hotplug Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1204055805-32349-12-git-send-email-gcosta@redhat.com \
    --to=gcosta@redhat.com \
    --cc=chrisw@sous-sol.org \
    --cc=glommer@gmail.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=marcelo@kvack.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).