xref: /openbmc/qemu/hw/ppc/e500plat.c (revision cb3778a0)
14d5c29caSScott Wood /*
24d5c29caSScott Wood  * Generic device-tree-driven paravirt PPC e500 platform
34d5c29caSScott Wood  *
44d5c29caSScott Wood  * Copyright 2012 Freescale Semiconductor, Inc.
54d5c29caSScott Wood  *
64d5c29caSScott Wood  * This is free software; you can redistribute it and/or modify
74d5c29caSScott Wood  * it under the terms of  the GNU General  Public License as published by
84d5c29caSScott Wood  * the Free Software Foundation;  either version 2 of the  License, or
94d5c29caSScott Wood  * (at your option) any later version.
104d5c29caSScott Wood  */
114d5c29caSScott Wood 
124d5c29caSScott Wood #include "config.h"
134d5c29caSScott Wood #include "qemu-common.h"
144d5c29caSScott Wood #include "e500.h"
157948b4b0SPaolo Bonzini #include "hw/boards.h"
169c17d615SPaolo Bonzini #include "sysemu/device_tree.h"
179c17d615SPaolo Bonzini #include "hw/pci/pci.h"
180d09e41aSPaolo Bonzini #include "hw/ppc/openpic.h"
193b961124SStuart Yoder #include "kvm_ppc.h"
204d5c29caSScott Wood 
214d5c29caSScott Wood static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt)
224d5c29caSScott Wood {
234d5c29caSScott Wood     const char model[] = "QEMU ppce500";
244d5c29caSScott Wood     const char compatible[] = "fsl,qemu-e500";
254d5c29caSScott Wood 
265a4348d1SPeter Crosthwaite     qemu_fdt_setprop(fdt, "/", "model", model, sizeof(model));
275a4348d1SPeter Crosthwaite     qemu_fdt_setprop(fdt, "/", "compatible", compatible,
284d5c29caSScott Wood                      sizeof(compatible));
294d5c29caSScott Wood }
304d5c29caSScott Wood 
313ef96221SMarcel Apfelbaum static void e500plat_init(MachineState *machine)
324d5c29caSScott Wood {
334d5c29caSScott Wood     PPCE500Params params = {
343bb7e02aSAlexander Graf         .pci_first_slot = 0x1,
353bb7e02aSAlexander Graf         .pci_nr_slots = PCI_SLOT_MAX - 1,
364d5c29caSScott Wood         .fixup_devtree = e500plat_fixup_devtree,
37f5fba9d2SScott Wood         .mpic_version = OPENPIC_MODEL_FSL_MPIC_42,
38b88e77f4SAlexander Graf         .has_mpc8xxx_gpio = true,
39f7087343SAlexander Graf         .has_platform_bus = true,
40f7087343SAlexander Graf         .platform_bus_base = 0xf00000000ULL,
41f7087343SAlexander Graf         .platform_bus_size = (128ULL * 1024 * 1024),
42f7087343SAlexander Graf         .platform_bus_first_irq = 5,
43f7087343SAlexander Graf         .platform_bus_num_irqs = 10,
44e6b4e5f4SAlexander Graf         .ccsrbar_base = 0xFE0000000ULL,
45e6b4e5f4SAlexander Graf         .pci_pio_base = 0xFE1000000ULL,
46*cb3778a0SAlexander Graf         .pci_mmio_base = 0xC00000000ULL,
47*cb3778a0SAlexander Graf         .pci_mmio_bus_base = 0xE0000000ULL,
48e6b4e5f4SAlexander Graf         .spin_base = 0xFEF000000ULL,
494d5c29caSScott Wood     };
504d5c29caSScott Wood 
513b961124SStuart Yoder     /* Older KVM versions don't support EPR which breaks guests when we announce
523b961124SStuart Yoder        MPIC variants that support EPR. Revert to an older one for those */
533b961124SStuart Yoder     if (kvm_enabled() && !kvmppc_has_cap_epr()) {
543b961124SStuart Yoder         params.mpic_version = OPENPIC_MODEL_FSL_MPIC_20;
553b961124SStuart Yoder     }
563b961124SStuart Yoder 
573ef96221SMarcel Apfelbaum     ppce500_init(machine, &params);
584d5c29caSScott Wood }
594d5c29caSScott Wood 
604d5c29caSScott Wood static QEMUMachine e500plat_machine = {
614d5c29caSScott Wood     .name = "ppce500",
624d5c29caSScott Wood     .desc = "generic paravirt e500 platform",
634d5c29caSScott Wood     .init = e500plat_init,
64f5fba9d2SScott Wood     .max_cpus = 32,
65f7087343SAlexander Graf     .has_dynamic_sysbus = true,
664d5c29caSScott Wood };
674d5c29caSScott Wood 
684d5c29caSScott Wood static void e500plat_machine_init(void)
694d5c29caSScott Wood {
704d5c29caSScott Wood     qemu_register_machine(&e500plat_machine);
714d5c29caSScott Wood }
724d5c29caSScott Wood 
734d5c29caSScott Wood machine_init(e500plat_machine_init);
74