Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/hw/arm/virt.c b/hw/arm/virt.c
- index 2972bb3..6a360d0 100644
- --- a/hw/arm/virt.c
- +++ b/hw/arm/virt.c
- @@ -72,6 +72,8 @@ enum {
- VIRT_RTC,
- VIRT_FW_CFG,
- VIRT_PCIE,
- + VIRT_TIMER01,
- + VIRT_TIMER23,
- VIRT_GIC_V2M,
- };
- @@ -134,6 +136,8 @@ static const MemMapEntry a15memmap[] = {
- [VIRT_UART] = { 0x09000000, 0x00001000 },
- [VIRT_RTC] = { 0x09010000, 0x00001000 },
- [VIRT_FW_CFG] = { 0x09020000, 0x0000000a },
- + [VIRT_TIMER01] = { 0x09030000, 0x00001000 },
- + [VIRT_TIMER23] = { 0x09040000, 0x00001000 },
- [VIRT_MMIO] = { 0x0a000000, 0x00000200 },
- /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */
- /*
- @@ -151,6 +155,8 @@ static const int a15irqmap[] = {
- [VIRT_UART] = 1,
- [VIRT_RTC] = 2,
- [VIRT_PCIE] = 3, /* ... to 6 */
- + [VIRT_TIMER01] = 7,
- + [VIRT_TIMER23] = 8,
- [VIRT_MMIO] = 16, /* ...to 16 + NUM_VIRTIO_TRANSPORTS - 1 */
- [VIRT_GIC_V2M] = 48, /* ...to 48 + NUM_GICV2M_SPIS - 1 */
- };
- @@ -277,6 +283,7 @@ static void fdt_add_timer_nodes(const VirtBoardInfo *vbi)
- * but for the GIC implementation provided by both QEMU and KVM
- * they are edge-triggered.
- */
- +#if 0
- ARMCPU *armcpu;
- uint32_t irqflags = GIC_FDT_IRQ_FLAGS_EDGE_LO_HI;
- @@ -299,6 +306,7 @@ static void fdt_add_timer_nodes(const VirtBoardInfo *vbi)
- GIC_FDT_IRQ_TYPE_PPI, 14, irqflags,
- GIC_FDT_IRQ_TYPE_PPI, 11, irqflags,
- GIC_FDT_IRQ_TYPE_PPI, 10, irqflags);
- +#endif
- }
- static void fdt_add_cpu_nodes(const VirtBoardInfo *vbi)
- @@ -490,6 +498,29 @@ static void create_rtc(const VirtBoardInfo *vbi, qemu_irq *pic)
- g_free(nodename);
- }
- +static void create_timer(const VirtBoardInfo *vbi, qemu_irq *pic)
- +{
- + char *nodename;
- + hwaddr base = vbi->memmap[VIRT_TIMER01].base;
- + hwaddr size = vbi->memmap[VIRT_TIMER01].size;
- + int irq = vbi->irqmap[VIRT_TIMER01];
- + const char compat[] = "arm,sp804\0arm,primecell";
- +
- + sysbus_create_simple("sp804", base, pic[irq]);
- +
- + nodename = g_strdup_printf("/timer@%" PRIx64, base);
- + qemu_fdt_add_subnode(vbi->fdt, nodename);
- + qemu_fdt_setprop(vbi->fdt, nodename, "compatible", compat, sizeof(compat));
- + qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "reg",
- + 2, base, 2, size); /* TODO: should be 1? */
- + qemu_fdt_setprop_cells(vbi->fdt, nodename, "interrupts",
- + GIC_FDT_IRQ_TYPE_SPI, irq,
- + GIC_FDT_IRQ_FLAGS_LEVEL_HI);
- + qemu_fdt_setprop_cell(vbi->fdt, nodename, "clocks", vbi->clock_phandle);
- + qemu_fdt_setprop_string(vbi->fdt, nodename, "clock-names", "apb_pclk");
- + g_free(nodename);
- +}
- +
- static void create_virtio_devices(const VirtBoardInfo *vbi, qemu_irq *pic)
- {
- int i;
- @@ -860,6 +891,8 @@ static void machvirt_init(MachineState *machine)
- create_rtc(vbi, pic);
- + create_timer(vbi, pic);
- +
- create_pcie(vbi, pic);
- /* Create mmio transports, so the user can create virtio backends
- diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
- index 1452910..6cb45f2 100644
- --- a/hw/timer/arm_timer.c
- +++ b/hw/timer/arm_timer.c
- @@ -382,8 +382,8 @@ static const TypeInfo icp_pit_info = {
- };
- static Property sp804_properties[] = {
- - DEFINE_PROP_UINT32("freq0", SP804State, freq0, 1000000),
- - DEFINE_PROP_UINT32("freq1", SP804State, freq1, 1000000),
- + DEFINE_PROP_UINT32("freq0", SP804State, freq0, 24000000),
- + DEFINE_PROP_UINT32("freq1", SP804State, freq1, 24000000),
- DEFINE_PROP_END_OF_LIST(),
- };
- diff --git a/kvm-all.c b/kvm-all.c
- index b2b1bc3..6434eba 100644
- --- a/kvm-all.c
- +++ b/kvm-all.c
- @@ -1388,9 +1388,11 @@ static int kvm_irqchip_create(MachineState *machine, KVMState *s)
- if (!machine_kernel_irqchip_allowed(machine) ||
- (!kvm_check_extension(s, KVM_CAP_IRQCHIP) &&
- (kvm_vm_enable_cap(s, KVM_CAP_S390_IRQCHIP, 0) < 0))) {
- + printf("[%s] gic is emulated\n", __func__);
- return 0;
- }
- + printf("[%s] gic is NOT emulated\n", __func__);
- /* First probe and see if there's a arch-specific hook to create the
- * in-kernel irqchip for us */
- ret = kvm_arch_irqchip_create(s);
Add Comment
Please, Sign In to add comment