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, 39*f7087343SAlexander Graf .has_platform_bus = true, 40*f7087343SAlexander Graf .platform_bus_base = 0xf00000000ULL, 41*f7087343SAlexander Graf .platform_bus_size = (128ULL * 1024 * 1024), 42*f7087343SAlexander Graf .platform_bus_first_irq = 5, 43*f7087343SAlexander Graf .platform_bus_num_irqs = 10, 444d5c29caSScott Wood }; 454d5c29caSScott Wood 463b961124SStuart Yoder /* Older KVM versions don't support EPR which breaks guests when we announce 473b961124SStuart Yoder MPIC variants that support EPR. Revert to an older one for those */ 483b961124SStuart Yoder if (kvm_enabled() && !kvmppc_has_cap_epr()) { 493b961124SStuart Yoder params.mpic_version = OPENPIC_MODEL_FSL_MPIC_20; 503b961124SStuart Yoder } 513b961124SStuart Yoder 523ef96221SMarcel Apfelbaum ppce500_init(machine, ¶ms); 534d5c29caSScott Wood } 544d5c29caSScott Wood 554d5c29caSScott Wood static QEMUMachine e500plat_machine = { 564d5c29caSScott Wood .name = "ppce500", 574d5c29caSScott Wood .desc = "generic paravirt e500 platform", 584d5c29caSScott Wood .init = e500plat_init, 59f5fba9d2SScott Wood .max_cpus = 32, 60*f7087343SAlexander Graf .has_dynamic_sysbus = true, 614d5c29caSScott Wood }; 624d5c29caSScott Wood 634d5c29caSScott Wood static void e500plat_machine_init(void) 644d5c29caSScott Wood { 654d5c29caSScott Wood qemu_register_machine(&e500plat_machine); 664d5c29caSScott Wood } 674d5c29caSScott Wood 684d5c29caSScott Wood machine_init(e500plat_machine_init); 69