aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-11-23 21:13:45 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-11-23 21:13:45 +0000
commit7668a27f1d3bced1b6f4b9727cc80dc769a19d8e (patch)
treedcc25f40b49e1a5137afd9fe10dd1126a636d183
parente5d13e2f64904a3181c7656f9d0eb884bb994bb1 (diff)
openpic SMP support (Jocelyn Mayer)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1655 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--hw/openpic.c13
-rw-r--r--hw/ppc_chrp.c2
-rw-r--r--vl.h3
3 files changed, 10 insertions, 8 deletions
diff --git a/hw/openpic.c b/hw/openpic.c
index 8068e7e590..31773373ac 100644
--- a/hw/openpic.c
+++ b/hw/openpic.c
@@ -159,7 +159,7 @@ typedef struct IRQ_dst_t {
uint32_t pcsr; /* CPU sensitivity register */
IRQ_queue_t raised;
IRQ_queue_t servicing;
- CPUState *env; /* Needed if we did SMP */
+ CPUState *env;
} IRQ_dst_t;
struct openpic_t {
@@ -265,8 +265,7 @@ static void IRQ_local_pipe (openpic_t *opp, int n_CPU, int n_IRQ)
if (priority > dst->raised.priority) {
IRQ_get_next(opp, &dst->raised);
DPRINTF("Raise CPU IRQ\n");
- /* XXX: choose the correct cpu */
- cpu_interrupt(first_cpu, CPU_INTERRUPT_HARD);
+ cpu_interrupt(dst->env, CPU_INTERRUPT_HARD);
}
}
@@ -782,8 +781,7 @@ static void openpic_cpu_write (void *opaque, uint32_t addr, uint32_t val)
src = &opp->src[n_IRQ];
if (IPVP_PRIORITY(src->ipvp) > dst->servicing.priority) {
DPRINTF("Raise CPU IRQ\n");
- /* XXX: choose cpu */
- cpu_interrupt(first_cpu, CPU_INTERRUPT_HARD);
+ cpu_interrupt(dst->env, CPU_INTERRUPT_HARD);
}
}
break;
@@ -965,7 +963,8 @@ static void openpic_map(PCIDevice *pci_dev, int region_num,
#endif
}
-openpic_t *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus)
+openpic_t *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus,
+ CPUPPCState **envp)
{
openpic_t *opp;
uint8_t *pci_conf;
@@ -1019,6 +1018,8 @@ openpic_t *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus)
for (; i < MAX_IRQ; i++) {
opp->src[i].type = IRQ_INTERNAL;
}
+ for (i = 0; i < nb_cpus; i++)
+ opp->dst[i].env = envp[i];
openpic_reset(opp);
if (pmem_index)
*pmem_index = opp->mem_index;
diff --git a/hw/ppc_chrp.c b/hw/ppc_chrp.c
index 395dd7f73e..5187372c6b 100644
--- a/hw/ppc_chrp.c
+++ b/hw/ppc_chrp.c
@@ -474,7 +474,7 @@ static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device,
vga_initialize(pci_bus, ds, phys_ram_base + ram_size,
ram_size, vga_ram_size,
vga_bios_offset, vga_bios_size);
- pic = openpic_init(NULL, &openpic_mem_index, 1);
+ pic = openpic_init(NULL, &openpic_mem_index, 1, &env);
set_irq = openpic_set_irq;
pci_set_pic(pci_bus, set_irq, pic);
diff --git a/vl.h b/vl.h
index fda99a7efd..2326c4c184 100644
--- a/vl.h
+++ b/vl.h
@@ -613,7 +613,8 @@ PCIBus *pci_apb_init(target_ulong special_base, target_ulong mem_base);
/* openpic.c */
typedef struct openpic_t openpic_t;
void openpic_set_irq(void *opaque, int n_IRQ, int level);
-openpic_t *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus);
+openpic_t *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus,
+ CPUState **envp);
/* heathrow_pic.c */
typedef struct HeathrowPICS HeathrowPICS;