On Wed, 31 Aug 2016 18:34:09 +0200 Cédric Le Goater <c...@kaod.org> wrote:
> From: Benjamin Herrenschmidt <b...@kernel.crashing.org> > > The goal is to emulate a PowerNV system at the level of the skiboot > firmware, which loads the OS and provides some runtime services. Power > Systems have a lower firmware (HostBoot) that does low level system > initialization, like DRAM training. This is beyond the scope of what > qemu will address in a PowerNV guest. > > No devices yet, not even an interrupt controller. Just to get started, > some RAM to load the skiboot firmware, the kernel and initrd. The > device tree is fully created in the machine reset op. > > Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> > [clg: - updated for qemu-2.7 > - replaced fprintf by error_report > - used a common definition of _FDT macro > - removed VMStateDescription as migration is not yet supported > - added IBM Copyright statements > - reworked kernel_filename handling > - merged PnvSystem and sPowerNVMachineState > - removed PHANDLE_XICP > - added ppc_create_page_sizes_prop helper > - removed nmi support > - removed kvm support > - updated powernv machine to version 2.8 > - removed chips and cpus, They will be provided in another patches > - added a machine reset routine to initialize the device tree (also) > - french has a squelette and english a skeleton. > - improved commit log. > - reworked prototypes parameters > - added a check on the ram size (thanks to Michael Ellerman) > - fixed chip-id cell > - changed MAX_CPUS to 2048 > - simplified memory node creation to one node only > - removed machine version > - rewrote the device tree creation with the fdt "rw" routines > - s/sPowerNVMachineState/PnvMachineState/ > - etc. > ] > Signed-off-by: Cédric Le Goater <c...@kaod.org> > --- > > Changes since v1: > > - changed MAX_CPUS to 2048 > - simplified memory node creation to one node only > - removed machine version > - rewrote the device tree creation with the fdt "rw" routines > - s/sPowerNVMachineState/PnvMachineState/ > - block_default_type is back to IF_IDE because of the AHCI device > > default-configs/ppc64-softmmu.mak | 1 + > hw/ppc/Makefile.objs | 2 + > hw/ppc/pnv.c | 244 > ++++++++++++++++++++++++++++++++++++++ > include/hw/ppc/pnv.h | 37 ++++++ > 4 files changed, 284 insertions(+) > create mode 100644 hw/ppc/pnv.c > create mode 100644 include/hw/ppc/pnv.h > > diff --git a/default-configs/ppc64-softmmu.mak > b/default-configs/ppc64-softmmu.mak > index c4be59f638ed..516a6e25aba3 100644 > --- a/default-configs/ppc64-softmmu.mak > +++ b/default-configs/ppc64-softmmu.mak > @@ -40,6 +40,7 @@ CONFIG_I8259=y > CONFIG_XILINX=y > CONFIG_XILINX_ETHLITE=y > CONFIG_PSERIES=y > +CONFIG_POWERNV=y > CONFIG_PREP=y > CONFIG_MAC=y > CONFIG_E500=y > diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs > index 99a0d4e581bf..8105db7d5600 100644 > --- a/hw/ppc/Makefile.objs > +++ b/hw/ppc/Makefile.objs > @@ -5,6 +5,8 @@ obj-$(CONFIG_PSERIES) += spapr.o spapr_vio.o spapr_events.o > obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o > obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o spapr_rng.o > obj-$(CONFIG_PSERIES) += spapr_cpu_core.o > +# IBM PowerNV > +obj-$(CONFIG_POWERNV) += pnv.o > ifeq ($(CONFIG_PCI)$(CONFIG_PSERIES)$(CONFIG_LINUX), yyy) > obj-y += spapr_pci_vfio.o > endif > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c > new file mode 100644 > index 000000000000..70413e3c5740 > --- /dev/null > +++ b/hw/ppc/pnv.c > @@ -0,0 +1,244 @@ > +/* > + * QEMU PowerPC PowerNV model > + * > + * Copyright (c) 2004-2007 Fabrice Bellard > + * Copyright (c) 2007 Jocelyn Mayer > + * Copyright (c) 2010 David Gibson, IBM Corporation. > + * Copyright (c) 2014-2016 BenH, IBM Corporation. > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > copy > + * of this software and associated documentation files (the "Software"), to > deal > + * in the Software without restriction, including without limitation the > rights > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > + * copies of the Software, and to permit persons to whom the Software is > + * furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > FROM, > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > + * THE SOFTWARE. > + * > + */ This file is a new contribution to QEMU. According to the LICENSE file, it should be released under GPL version 2 or later. If Ben agrees, probably better to have the same text as in include/hw/ppc/pnv.h below. > [...] > --- /dev/null > +++ b/include/hw/ppc/pnv.h > @@ -0,0 +1,37 @@ > +/* > + * QEMU PowerNV various definitions > + * > + * Copyright (c) 2014-2016 BenH, IBM Corporation. > + * > + * This library is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2 of the License, or (at your option) any later version. > + * > + * This library is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with this library; if not, see > <http://www.gnu.org/licenses/>. > + */