arm: xlnx-zynqmp: Add boot-cpu property
Add a string property that specifies the primary boot cpu. All CPUs except the one selected will start-powered-off. This allows for elf boots on any CPU, which prepares support for booting R5 elfs directly on the R5 processors. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Message-id: 53331c00d80c7ce9c6a83712348773f1b38fae2b.1434501320.git.peter.crosthwaite@xilinx.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
		
							parent
							
								
									2e5577bc55
								
							
						
					
					
						commit
						6396a193d3
					
				@ -65,7 +65,7 @@ static void xlnx_ep108_init(MachineState *machine)
 | 
				
			|||||||
    xlnx_ep108_binfo.kernel_cmdline = machine->kernel_cmdline;
 | 
					    xlnx_ep108_binfo.kernel_cmdline = machine->kernel_cmdline;
 | 
				
			||||||
    xlnx_ep108_binfo.initrd_filename = machine->initrd_filename;
 | 
					    xlnx_ep108_binfo.initrd_filename = machine->initrd_filename;
 | 
				
			||||||
    xlnx_ep108_binfo.loader_start = 0;
 | 
					    xlnx_ep108_binfo.loader_start = 0;
 | 
				
			||||||
    arm_load_kernel(&s->soc.apu_cpu[0], &xlnx_ep108_binfo);
 | 
					    arm_load_kernel(s->soc.boot_cpu_ptr, &xlnx_ep108_binfo);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static QEMUMachine xlnx_ep108_machine = {
 | 
					static QEMUMachine xlnx_ep108_machine = {
 | 
				
			||||||
 | 
				
			|||||||
@ -90,6 +90,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
 | 
				
			|||||||
    XlnxZynqMPState *s = XLNX_ZYNQMP(dev);
 | 
					    XlnxZynqMPState *s = XLNX_ZYNQMP(dev);
 | 
				
			||||||
    MemoryRegion *system_memory = get_system_memory();
 | 
					    MemoryRegion *system_memory = get_system_memory();
 | 
				
			||||||
    uint8_t i;
 | 
					    uint8_t i;
 | 
				
			||||||
 | 
					    const char *boot_cpu = s->boot_cpu ? s->boot_cpu : "apu-cpu[0]";
 | 
				
			||||||
    qemu_irq gic_spi[GIC_NUM_SPI_INTR];
 | 
					    qemu_irq gic_spi[GIC_NUM_SPI_INTR];
 | 
				
			||||||
    Error *err = NULL;
 | 
					    Error *err = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -123,13 +124,18 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    for (i = 0; i < XLNX_ZYNQMP_NUM_APU_CPUS; i++) {
 | 
					    for (i = 0; i < XLNX_ZYNQMP_NUM_APU_CPUS; i++) {
 | 
				
			||||||
        qemu_irq irq;
 | 
					        qemu_irq irq;
 | 
				
			||||||
 | 
					        char *name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        object_property_set_int(OBJECT(&s->apu_cpu[i]), QEMU_PSCI_CONDUIT_SMC,
 | 
					        object_property_set_int(OBJECT(&s->apu_cpu[i]), QEMU_PSCI_CONDUIT_SMC,
 | 
				
			||||||
                                "psci-conduit", &error_abort);
 | 
					                                "psci-conduit", &error_abort);
 | 
				
			||||||
        if (i > 0) {
 | 
					
 | 
				
			||||||
 | 
					        name = object_get_canonical_path_component(OBJECT(&s->apu_cpu[i]));
 | 
				
			||||||
 | 
					        if (strcmp(name, boot_cpu)) {
 | 
				
			||||||
            /* Secondary CPUs start in PSCI powered-down state */
 | 
					            /* Secondary CPUs start in PSCI powered-down state */
 | 
				
			||||||
            object_property_set_bool(OBJECT(&s->apu_cpu[i]), true,
 | 
					            object_property_set_bool(OBJECT(&s->apu_cpu[i]), true,
 | 
				
			||||||
                                     "start-powered-off", &error_abort);
 | 
					                                     "start-powered-off", &error_abort);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            s->boot_cpu_ptr = &s->apu_cpu[i];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        object_property_set_int(OBJECT(&s->apu_cpu[i]), GIC_BASE_ADDR,
 | 
					        object_property_set_int(OBJECT(&s->apu_cpu[i]), GIC_BASE_ADDR,
 | 
				
			||||||
@ -157,6 +163,11 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
 | 
				
			|||||||
        qdev_connect_gpio_out(DEVICE(&s->apu_cpu[i]), 1, irq);
 | 
					        qdev_connect_gpio_out(DEVICE(&s->apu_cpu[i]), 1, irq);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!s->boot_cpu_ptr) {
 | 
				
			||||||
 | 
					        error_setg(errp, "ZynqMP Boot cpu %s not found\n", boot_cpu);
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0; i < GIC_NUM_SPI_INTR; i++) {
 | 
					    for (i = 0; i < GIC_NUM_SPI_INTR; i++) {
 | 
				
			||||||
        gic_spi[i] = qdev_get_gpio_in(DEVICE(&s->gic), i);
 | 
					        gic_spi[i] = qdev_get_gpio_in(DEVICE(&s->gic), i);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -190,10 +201,16 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static Property xlnx_zynqmp_props[] = {
 | 
				
			||||||
 | 
					    DEFINE_PROP_STRING("boot-cpu", XlnxZynqMPState, boot_cpu),
 | 
				
			||||||
 | 
					    DEFINE_PROP_END_OF_LIST()
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void xlnx_zynqmp_class_init(ObjectClass *oc, void *data)
 | 
					static void xlnx_zynqmp_class_init(ObjectClass *oc, void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DeviceClass *dc = DEVICE_CLASS(oc);
 | 
					    DeviceClass *dc = DEVICE_CLASS(oc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dc->props = xlnx_zynqmp_props;
 | 
				
			||||||
    dc->realize = xlnx_zynqmp_realize;
 | 
					    dc->realize = xlnx_zynqmp_realize;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -52,6 +52,9 @@ typedef struct XlnxZynqMPState {
 | 
				
			|||||||
    MemoryRegion gic_mr[XLNX_ZYNQMP_GIC_REGIONS][XLNX_ZYNQMP_GIC_ALIASES];
 | 
					    MemoryRegion gic_mr[XLNX_ZYNQMP_GIC_REGIONS][XLNX_ZYNQMP_GIC_ALIASES];
 | 
				
			||||||
    CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS];
 | 
					    CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS];
 | 
				
			||||||
    CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS];
 | 
					    CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    char *boot_cpu;
 | 
				
			||||||
 | 
					    ARMCPU *boot_cpu_ptr;
 | 
				
			||||||
}  XlnxZynqMPState;
 | 
					}  XlnxZynqMPState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define XLNX_ZYNQMP_H
 | 
					#define XLNX_ZYNQMP_H
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user