From: David Gibson <david@gibson.dropbear.id.au>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 27/77] ppc/pnv: Add XSCOM infrastructure
Date: Tue, 24 Nov 2015 14:20:50 +1100 [thread overview]
Message-ID: <20151124032050.GG26118@voom.fritz.box> (raw)
In-Reply-To: <1447201710-10229-28-git-send-email-benh@kernel.crashing.org>
[-- Attachment #1: Type: text/plain, Size: 21451 bytes --]
On Wed, Nov 11, 2015 at 11:27:40AM +1100, Benjamin Herrenschmidt wrote:
> XSCOM is an interface to a sideband bus provided by the POWER8 chip
> pervasive unit, which gives access to a number of facilities in the
> chip that are needed by the OPAL firmware and to a lesser extent,
> Linux. This is among others how the PCI Host bridges get configured
> at boot or how the LPC bus is accessed.
>
> This provides a simple bus and device type for devices sitting on
> XSCOM along with some facilities to optionally generate corresponding
> device-tree nodes
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> hw/ppc/Makefile.objs | 2 +-
> hw/ppc/pnv.c | 11 ++
> hw/ppc/pnv_xscom.c | 415 +++++++++++++++++++++++++++++++++++++++++++++
> include/hw/ppc/pnv.h | 2 +
> include/hw/ppc/pnv_xscom.h | 73 ++++++++
> 5 files changed, 502 insertions(+), 1 deletion(-)
> create mode 100644 hw/ppc/pnv_xscom.c
> create mode 100644 include/hw/ppc/pnv_xscom.h
>
> diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs
> index cd74c96..2a7dd42 100644
> --- a/hw/ppc/Makefile.objs
> +++ b/hw/ppc/Makefile.objs
> @@ -5,7 +5,7 @@ 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
> # IBM PowerNV
> -obj-$(CONFIG_POWERNV) += pnv.o
> +obj-$(CONFIG_POWERNV) += pnv.o pnv_xscom.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
> index e68c9b1..2eac877 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -41,6 +41,7 @@
> #include "hw/ppc/ppc.h"
> #include "hw/ppc/pnv.h"
> #include "hw/loader.h"
> +#include "hw/ppc/pnv_xscom.h"
>
> #include "exec/address-spaces.h"
> #include "qemu/config-file.h"
> @@ -310,6 +311,7 @@ static void *powernv_create_fdt(PnvSystem *sys, uint32_t initrd_base, uint32_t i
> uint32_t end_prop = cpu_to_be32(initrd_base + initrd_size);
> char *buf;
> const char plat_compat[] = "qemu,powernv\0ibm,powernv";
> + unsigned int i;
>
> fdt = g_malloc0(FDT_MAX_SIZE);
> _FDT((fdt_create(fdt, FDT_MAX_SIZE)));
> @@ -367,6 +369,12 @@ static void *powernv_create_fdt(PnvSystem *sys, uint32_t initrd_base, uint32_t i
> /* Memory */
> _FDT((powernv_populate_memory(fdt)));
>
> + /* For each chip */
> + for (i = 0; i < sys->num_chips; i++) {
> + /* Populate XSCOM */
> + _FDT((xscom_populate_fdt(sys->chips[i].xscom, fdt)));
> + }
> +
> /* /hypervisor node */
> if (kvm_enabled()) {
> uint8_t hypercall[16];
> @@ -424,6 +432,9 @@ static void pnv_create_chip(PnvSystem *sys, unsigned int chip_no)
>
> /* XXX Improve chip numbering to better match HW */
> chip->chip_id = chip_no;
> +
> + /* Set up XSCOM bus */
> + xscom_create(chip);
Hmm.. I'm thinking it probably makes sense to unify the representation
of "chip" and "xscom" since there's a 1:1 correspondance. To be
QOMishly correct, I think the right way would be a SysBusDevice for
each chip, implementing the xscom MMIOs, then an array of link properties
under the Machine object to find the right scoms by chip id.
> }
>
> static void ppc_powernv_init(MachineState *machine)
> diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c
> new file mode 100644
> index 0000000..bb35422
> --- /dev/null
> +++ b/hw/ppc/pnv_xscom.c
> @@ -0,0 +1,415 @@
> +
> +/*
> + * QEMU PowerNV XSCOM bus definitions
> + *
> + * Copyright (c) 2010 David Gibson, IBM Corporation <dwg@au1.ibm.com>
> + * Based on the s390 virtio bus code:
> + * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
> + *
> + * 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/>.
> + */
> +
> +/* TODO: Add some infrastructure for "random stuff" and FIRs that
> + * various units might want to deal with without creating actual
> + * XSCOM devices.
> + *
> + * For example, HB LPC XSCOM in the PIBAM
> + */
> +#include "hw/hw.h"
> +#include "sysemu/sysemu.h"
> +#include "hw/boards.h"
> +#include "monitor/monitor.h"
> +#include "hw/loader.h"
> +#include "elf.h"
> +#include "hw/sysbus.h"
> +#include "sysemu/kvm.h"
> +#include "sysemu/device_tree.h"
> +#include "kvm_ppc.h"
> +
> +#include "hw/ppc/pnv_xscom.h"
> +
> +#include <libfdt.h>
> +
> +#define TYPE_XSCOM "xscom"
> +#define XSCOM(obj) OBJECT_CHECK(XScomState, (obj), TYPE_XSCOM)
> +
> +#define XSCOM_SIZE 0x800000000ull
> +#define XSCOM_BASE(chip) (0x3fc0000000000ull + ((uint64_t)(chip)) * XSCOM_SIZE)
> +
> +//#define TRACE_SCOMS
> +
> +typedef struct XScomState {
> + /*< private >*/
> + SysBusDevice parent_obj;
> + /*< public >*/
> +
> + MemoryRegion mem;
> + int32_t chip_id;
> + XScomBus *bus;
> +} XScomState;
> +
> +static uint32_t xscom_to_pcb_addr(uint64_t addr)
> +{
> + addr &= (XSCOM_SIZE - 1);
> + return ((addr >> 4) & ~0xfull) | ((addr >> 3) & 0xf);
Wow, that's a pretty weird address transform.
> +}
> +
> +static void xscom_complete(uint64_t hmer_bits)
> +{
> + CPUState *cs = current_cpu;
> + PowerPCCPU *cpu = POWERPC_CPU(cs);
> + CPUPPCState *env = &cpu->env;
> +
> + cpu_synchronize_state(cs);
> + env->spr[SPR_HMER] |= hmer_bits;
> +
> + /* XXX Need a CPU helper to set HMER, also handle gneeration
> + * of HMIs
Not sure what you're referring to here. Nothing more should be needed
to set the HMER - because you've called cpu_synchronize_state() it
will be marked dirty and flushed back to KVM before re-entry.
> + */
> +}
> +
> +static XScomDevice *xscom_find_target(XScomState *s, uint32_t pcb_addr, uint32_t *range)
> +{
> + BusChild *bc;
> +
> + QTAILQ_FOREACH(bc, &s->bus->bus.children, sibling) {
> + DeviceState *qd = bc->child;
> + XScomDevice *xd = XSCOM_DEVICE(qd);
> + unsigned int i;
> +
> + for (i = 0; i < MAX_XSCOM_RANGES; i++) {
> + if (xd->ranges[i].addr <= pcb_addr &&
> + (xd->ranges[i].addr + xd->ranges[i].size) > pcb_addr) {
> + *range = i;
> + return xd;
> + }
> + }
> + }
I'm wondering if it makes sense to construct a custom AddressSpace and
use the existing address space lookup logic from exec.c and memory.c
rather than implementing your own.
> + return NULL;
> +}
> +
> +static bool xscom_dispatch_read(XScomState *s, uint32_t pcb_addr, uint64_t *out_val)
> +{
> + uint32_t range, offset;
> + struct XScomDevice *xd = xscom_find_target(s, pcb_addr, &range);
> + XScomDeviceClass *xc;
> +
> + if (!xd) {
> + return false;
> + }
> + xc = XSCOM_DEVICE_GET_CLASS(xd);
> + if (!xc->read) {
> + return false;
> + }
> + offset = pcb_addr - xd->ranges[range].addr;
> + return xc->read(xd, range, offset, out_val);
> +}
> +
> +static bool xscom_dispatch_write(XScomState *s, uint32_t pcb_addr, uint64_t val)
> +{
> + uint32_t range, offset;
> + struct XScomDevice *xd = xscom_find_target(s, pcb_addr, &range);
> + XScomDeviceClass *xc;
> +
> + if (!xd) {
> + return false;
> + }
> + xc = XSCOM_DEVICE_GET_CLASS(xd);
> + if (!xc->write) {
> + return false;
> + }
> + offset = pcb_addr - xd->ranges[range].addr;
> + return xc->write(xd, range, offset, val);
> +}
> +
> +static uint64_t xscom_read(void *opaque, hwaddr addr, unsigned width)
> +{
> + XScomState *s = opaque;
> + uint32_t pcba = xscom_to_pcb_addr(addr);
> + uint64_t val;
> +
> + assert(width == 8);
> +
> +#ifdef TRACE_SCOMS
> + printf("XSCOM_READ(0x%x:0x%x)\n", s->chip_id, pcba);
> +#endif
You should be using the built in trace infrastructure here - it's
really not that much of a pain. Put
trace_xscom_read(s->chip_id, pcba)
here, put a suitable format in trace-events, and ./configure
--enable-trace-backends=stderr
> +
> + /* Handle some SCOMs here before dispatch */
> + switch(pcba) {
> + case 0xf000f:
> + val = 0x221EF04980000000;
> + break;
> + case 0x1010c00: /* PIBAM FIR */
> + case 0x1010c03: /* PIBAM FIR MASK */
> + case 0x2020007: /* ADU stuff */
> + case 0x2020009: /* ADU stuff */
> + case 0x202000f: /* ADU stuff */
> + val = 0;
> + break;
> + case 0x2013f00: /* PBA stuff */
> + case 0x2013f01: /* PBA stuff */
> + case 0x2013f02: /* PBA stuff */
> + case 0x2013f03: /* PBA stuff */
> + case 0x2013f04: /* PBA stuff */
> + case 0x2013f05: /* PBA stuff */
> + case 0x2013f06: /* PBA stuff */
> + case 0x2013f07: /* PBA stuff */
> + val = 0;
> + break;
> + default:
> + if (!xscom_dispatch_read(s, pcba, &val)) {
> + xscom_complete(HMER_XSCOM_FAIL | HMER_XSCOM_DONE);
> + return 0;
> + }
> + }
> +
> + xscom_complete(HMER_XSCOM_DONE);
> + return val;
> +}
> +
> +static void xscom_write(void *opaque, hwaddr addr, uint64_t val,
> + unsigned width)
> +{
> + XScomState *s = opaque;
> + uint32_t pcba = xscom_to_pcb_addr(addr);
> +
> + assert(width == 8);
> +
> +#ifdef TRACE_SCOMS
> + printf("XSCOM_WRITE(0x%x:0x%x, 0x%016llx)\n",
> + s->chip_id, pcba, (unsigned long long)val);
> +#endif
> + /* Handle some SCOMs here before dispatch */
> + switch(pcba) {
> + /* We ignore writes to these */
> + case 0xf000f: /* chip id is RO */
> + case 0x1010c00: /* PIBAM FIR */
> + case 0x1010c01: /* PIBAM FIR */
> + case 0x1010c02: /* PIBAM FIR */
> + case 0x1010c03: /* PIBAM FIR MASK */
> + case 0x1010c04: /* PIBAM FIR MASK */
> + case 0x1010c05: /* PIBAM FIR MASK */
> + case 0x2020007: /* ADU stuff */
> + case 0x2020009: /* ADU stuff */
> + case 0x202000f: /* ADU stuff */
> + break;
> + default:
> + if (!xscom_dispatch_write(s, pcba, val)) {
> + xscom_complete(HMER_XSCOM_FAIL | HMER_XSCOM_DONE);
> + return;
> + }
> + }
> +
> + xscom_complete(HMER_XSCOM_DONE);
> +}
> +
> +static const MemoryRegionOps xscom_ops = {
> + .read = xscom_read,
> + .write = xscom_write,
> + .valid.min_access_size = 8,
> + .valid.max_access_size = 8,
> + .impl.min_access_size = 8,
> + .impl.max_access_size = 8,
> + .endianness = DEVICE_BIG_ENDIAN,
> +};
> +
> +static int xscom_init(SysBusDevice *dev)
> +{
> + XScomState *s = XSCOM(dev);
> +
> + s->chip_id = -1;
> + return 0;
> +}
> +
> +static void xscom_realize(DeviceState *dev, Error **errp)
> +{
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> + XScomState *s = XSCOM(dev);
> + char *name;
> +
> + assert(s->chip_id >= 0);
So, this assert could be tripped if the user explicitly instantiated
an xscom device which they probably shouldn't do, but could. So, it
probably makes sense to use error_setg() here instead of assert().
> + name = g_strdup_printf("xscom-%x", s->chip_id);
> + memory_region_init_io(&s->mem, OBJECT(s), &xscom_ops, s, name, XSCOM_SIZE);
> + sysbus_init_mmio(sbd, &s->mem);
> + sysbus_mmio_map(sbd, 0, XSCOM_BASE(s->chip_id));
> +}
> +
> +static Property xscom_properties[] = {
> + DEFINE_PROP_INT32("chip_id", XScomState, chip_id, 0),
> + DEFINE_PROP_END_OF_LIST(),
> +};
> +
> +static void xscom_class_init(ObjectClass *klass, void *data)
> +{
> + SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
> + DeviceClass *dc = DEVICE_CLASS(klass);
> +
> + dc->props = xscom_properties;
> + dc->realize = xscom_realize;
> + k->init = xscom_init;
> +}
> +
> +static const TypeInfo xscom_info = {
> + .name = TYPE_XSCOM,
> + .parent = TYPE_SYS_BUS_DEVICE,
> + .instance_size = sizeof(XScomState),
> + .class_init = xscom_class_init,
> +};
> +
> +static void xscom_bus_class_init(ObjectClass *klass, void *data)
> +{
> +}
> +
> +static const TypeInfo xscom_bus_info = {
> + .name = TYPE_XSCOM_BUS,
> + .parent = TYPE_BUS,
> + .class_init = xscom_bus_class_init,
> + .instance_size = sizeof(XScomBus),
> +};
> +
> +void xscom_create(PnvChip *chip)
> +{
> + DeviceState *dev;
> + XScomState *xdev;
> + BusState *qbus;
> + XScomBus *xb;
> +
> + dev = qdev_create(NULL, TYPE_XSCOM);
> + qdev_prop_set_uint32(dev, "chip_id", chip->chip_id);
> + qdev_init_nofail(dev);
> +
> + /* Create bus on bridge device */
> + qbus = qbus_create(TYPE_XSCOM_BUS, dev, "xscom");
> + xb = DO_UPCAST(XScomBus, bus, qbus);
> + xb->chip_id = chip->chip_id;
> + xdev = XSCOM(dev);
> + xdev->bus = xb;
> + chip->xscom = xb;
I believe the qbus_create() is usually invoked by the bridge's init
function, rather than externally.
> +}
> +
> +#define _FDT(exp) \
> + do { \
> + int ret = (exp); \
> + if (ret < 0) { \
> + fprintf(stderr, "qemu: error creating device tree: %s: %s\n", \
> + #exp, fdt_strerror(ret)); \
> + exit(1); \
> + } \
> + } while (0)
> +
> +
> +int xscom_populate_fdt(XScomBus *xb, void *fdt)
> +{
> + BusChild *bc;
> + char *name;
> + const char compat[] = "ibm,power8-xscom\0ibm,xscom";
> + uint64_t reg[] = { cpu_to_be64(XSCOM_BASE(xb->chip_id)),
> + cpu_to_be64(XSCOM_SIZE) };
> +
> + name = g_strdup_printf("xscom@%llx", (unsigned long long)be64_to_cpu(reg[0]));
> + _FDT((fdt_begin_node(fdt, name)));
> + g_free(name);
> + _FDT((fdt_property_cell(fdt, "ibm,chip-id", xb->chip_id)));
> + _FDT((fdt_property_cell(fdt, "#address-cells", 1)));
> + _FDT((fdt_property_cell(fdt, "#size-cells", 1)));
> + _FDT((fdt_property(fdt, "reg", reg, sizeof(reg))));
> + _FDT((fdt_property(fdt, "compatible", compat, sizeof(compat))));
> + _FDT((fdt_property(fdt, "scom-controller", NULL, 0)));
> +
> + QTAILQ_FOREACH(bc, &xb->bus.children, sibling) {
> + DeviceState *qd = bc->child;
> + XScomDevice *xd = XSCOM_DEVICE(qd);
> + XScomDeviceClass *xc = XSCOM_DEVICE_GET_CLASS(xd);
> + uint32_t reg[MAX_XSCOM_RANGES * 2];
> + unsigned int i, sz = 0;
> + void *cp, *p;
> +
> + /* Some XSCOM slaves may not be represented in the DT */
> + if (!xc->dt_name) {
> + continue;
> + }
> + name = g_strdup_printf("%s@%x", xc->dt_name, xd->ranges[0].addr);
> + _FDT((fdt_begin_node(fdt, name)));
> + g_free(name);
> + for (i = 0; i < MAX_XSCOM_RANGES; i++) {
> + if (xd->ranges[i].size == 0) {
> + break;
> + }
> + reg[sz++] = cpu_to_be32(xd->ranges[i].addr);
> + reg[sz++] = cpu_to_be32(xd->ranges[i].size);
> + }
> + _FDT((fdt_property(fdt, "reg", reg, sz * 4)));
> + if (xc->devnode) {
> + _FDT((xc->devnode(xd, fdt)));
> + }
> +#define MAX_COMPATIBLE_PROP 1024
> + cp = p = g_malloc0(MAX_COMPATIBLE_PROP);
> + i = 0;
> + while((p - cp) < MAX_COMPATIBLE_PROP) {
> + int l;
> + if (xc->dt_compatible[i] == NULL) {
> + break;
> + }
> + l = strlen(xc->dt_compatible[i]);
> + if (l >= (MAX_COMPATIBLE_PROP - i)) {
> + break;
> + }
> + strcpy(p, xc->dt_compatible[i++]);
> + p += l + 1;
> + }
> + _FDT((fdt_property(fdt, "compatible", cp, p - cp)));
> + _FDT((fdt_end_node(fdt)));
> + }
> +
> + _FDT((fdt_end_node(fdt)));
> +
> + return 0;
> +}
> +
> +static int xscom_qdev_init(DeviceState *qdev)
> +{
> + XScomDevice *xdev = (XScomDevice *)qdev;
> + XScomDeviceClass *xc = XSCOM_DEVICE_GET_CLASS(xdev);
> +
> + if (xc->init) {
> + return xc->init(xdev);
> + }
> + return 0;
> +}
> +
> +static void xscom_device_class_init(ObjectClass *klass, void *data)
> +{
> + DeviceClass *k = DEVICE_CLASS(klass);
> + k->init = xscom_qdev_init;
> + k->bus_type = TYPE_XSCOM_BUS;
> +}
> +
> +static const TypeInfo xscom_dev_info = {
> + .name = TYPE_XSCOM_DEVICE,
> + .parent = TYPE_DEVICE,
> + .instance_size = sizeof(XScomDevice),
> + .abstract = true,
> + .class_size = sizeof(XScomDeviceClass),
> + .class_init = xscom_device_class_init,
> +};
> +
> +static void xscom_register_types(void)
> +{
> + type_register_static(&xscom_info);
> + type_register_static(&xscom_bus_info);
> + type_register_static(&xscom_dev_info);
> +}
> +
> +type_init(xscom_register_types)
> +
> diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h
> index 9a48c16..cb157eb 100644
> --- a/include/hw/ppc/pnv.h
> +++ b/include/hw/ppc/pnv.h
> @@ -20,10 +20,12 @@
> */
>
> #include "hw/hw.h"
> +typedef struct XScomBus XScomBus;
>
> /* Should we turn that into a QOjb of some sort ? */
> typedef struct PnvChip {
> uint32_t chip_id;
> + XScomBus *xscom;
> } PnvChip;
>
> typedef struct PnvSystem {
> diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h
> new file mode 100644
> index 0000000..99de078
> --- /dev/null
> +++ b/include/hw/ppc/pnv_xscom.h
> @@ -0,0 +1,73 @@
> +#ifndef _HW_XSCOM_H
> +#define _HW_XSCOM_H
> +/*
> + * QEMU PowerNV XSCOM bus definitions
> + *
> + * Copyright (c) 2010 David Gibson, IBM Corporation <david@gibson.dropbear.id.au>
> + * Based on the s390 virtio bus definitions:
> + * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
> + *
> + * 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/>.
> + */
> +
> +#include <hw/ppc/pnv.h>
> +
> +#define TYPE_XSCOM_DEVICE "xscom-device"
> +#define XSCOM_DEVICE(obj) \
> + OBJECT_CHECK(XScomDevice, (obj), TYPE_XSCOM_DEVICE)
> +#define XSCOM_DEVICE_CLASS(klass) \
> + OBJECT_CLASS_CHECK(XScomDeviceClass, (klass), TYPE_XSCOM_DEVICE)
> +#define XSCOM_DEVICE_GET_CLASS(obj) \
> + OBJECT_GET_CLASS(XScomDeviceClass, (obj), TYPE_XSCOM_DEVICE)
> +
> +#define TYPE_XSCOM_BUS "xscom-bus"
> +#define XSCOM_BUS(obj) OBJECT_CHECK(XScomBus, (obj), TYPE_XSCOM_BUS)
> +
> +typedef struct XScomDevice XScomDevice;
> +typedef struct XScomBus XScomBus;
> +
> +typedef struct XScomDeviceClass {
> + DeviceClass parent_class;
> +
> + const char *dt_name;
> + const char **dt_compatible;
> + int (*init)(XScomDevice *dev);
> + int (*devnode)(XScomDevice *dev, void *fdt);
> +
> + /* Actual XScom accesses */
> + bool (*read)(XScomDevice *dev, uint32_t range, uint32_t offset, uint64_t *out_val);
> + bool (*write)(XScomDevice *dev, uint32_t range, uint32_t offset, uint64_t val);
> +} XScomDeviceClass;
> +
> +typedef struct XScomRange {
> + uint32_t addr;
> + uint32_t size;
> +} XScomRange;
> +
> +struct XScomDevice {
> + DeviceState qdev;
> +#define MAX_XSCOM_RANGES 4
> + struct XScomRange ranges[MAX_XSCOM_RANGES];
> +};
> +
> +struct XScomBus {
> + BusState bus;
> + uint32_t chip_id;
> +};
> +
> +extern void xscom_create(PnvChip *chip);
> +extern int xscom_populate_fdt(XScomBus *xscom, void *fdt);
> +
> +
> +#endif /* _HW_XSCOM_H */
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-11-24 6:01 UTC|newest]
Thread overview: 198+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-11 0:27 [Qemu-devel] [PATCH 00/77] ppc: Add "native" POWER8 platform Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 01/77] ppc: Remove MMU_MODEn_SUFFIX definitions Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 02/77] ppc: Use split I/D mmu modes to avoid flushes on interrupts Benjamin Herrenschmidt
2015-11-16 4:49 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-16 10:10 ` Benjamin Herrenschmidt
2015-11-16 12:42 ` David Gibson
2015-11-27 10:29 ` Alexander Graf
2015-11-27 12:15 ` Paolo Bonzini
2015-11-11 0:27 ` [Qemu-devel] [PATCH 03/77] ppc: Do some batching of TCG tlb flushes Benjamin Herrenschmidt
2015-11-16 5:00 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-16 10:16 ` Benjamin Herrenschmidt
2015-11-19 6:09 ` David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 04/77] target-ppc: Use sensible POWER8/POWER8E versions Benjamin Herrenschmidt
2015-11-11 0:59 ` [Qemu-devel] [Qemu-ppc] " Stewart Smith
2015-11-16 5:01 ` David Gibson
2015-11-16 10:17 ` Benjamin Herrenschmidt
2015-11-17 0:11 ` Alexey Kardashevskiy
2015-11-17 0:40 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 05/77] ppc: Update SPR definitions Benjamin Herrenschmidt
2015-11-16 5:06 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 06/77] ppc: Add macros to register hypervisor mode SPRs Benjamin Herrenschmidt
2015-11-16 5:09 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 07/77] ppc: Add a bunch of hypervisor SPRs to Book3s Benjamin Herrenschmidt
2015-11-19 6:11 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-19 10:21 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 08/77] ppc: Add number of threads per core to the processor definition Benjamin Herrenschmidt
2015-11-16 5:16 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-20 0:29 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 09/77] ppc: Fix do_rfi() for rfi emulation Benjamin Herrenschmidt
2015-11-19 6:19 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-19 10:23 ` Benjamin Herrenschmidt
2015-11-20 0:26 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 10/77] ppc: Fix hreg_store_msr() so that non-HV mode cannot alter MSR:HV Benjamin Herrenschmidt
2015-11-19 6:20 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 11/77] ppc: Create cpu_ppc_set_papr() helper Benjamin Herrenschmidt
2015-11-16 5:30 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 12/77] ppc: Better figure out if processor has HV mode Benjamin Herrenschmidt
2015-11-19 6:22 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 13/77] ppc: tlbie, tlbia and tlbisync are HV only Benjamin Herrenschmidt
2015-11-16 5:34 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-16 10:21 ` Benjamin Herrenschmidt
2015-11-18 0:06 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 14/77] ppc: Change 'invalid' bit mask of tlbiel and tlbie Benjamin Herrenschmidt
2015-11-20 7:02 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 15/77] ppc: Fix sign extension issue in mtmsr(d) emulation Benjamin Herrenschmidt
2015-11-19 6:26 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-19 10:26 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 16/77] ppc: Get out of emulation on SMT "OR" ops Benjamin Herrenschmidt
2015-11-16 5:40 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 17/77] ppc: Add PPC_64H instruction flag to POWER7 and POWER8 Benjamin Herrenschmidt
2015-11-16 5:41 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 18/77] ppc: Rework POWER7 & POWER8 exception model Benjamin Herrenschmidt
2015-11-19 6:44 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-19 10:31 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 19/77] ppc: Fix POWER7 and POWER8 exception definitions Benjamin Herrenschmidt
2015-11-19 6:46 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 20/77] ppc: Fix generation if ISI/DSI vs. HV mode Benjamin Herrenschmidt
2015-11-19 6:50 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 21/77] ppc: Rework generation of priv and inval interrupts Benjamin Herrenschmidt
2015-11-20 7:45 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-24 0:44 ` Benjamin Herrenschmidt
2015-11-24 2:22 ` David Gibson
2015-11-24 0:51 ` Benjamin Herrenschmidt
2015-11-24 2:22 ` David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 22/77] ppc: Add real mode CI load/store instructions for P7 and P8 Benjamin Herrenschmidt
2015-11-20 7:48 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-24 0:58 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 23/77] ppc: Turn a bunch of booleans from int to bool Benjamin Herrenschmidt
2015-11-20 7:49 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 24/77] ppc: Move exception generation code out of line Benjamin Herrenschmidt
2015-11-20 7:53 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-24 0:59 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 25/77] ppc: Add P7/P8 Power Management instructions Benjamin Herrenschmidt
2015-11-20 8:06 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 26/77] ppc/pnv: Add skeletton PowerNV platform Benjamin Herrenschmidt
2015-11-19 8:58 ` [Qemu-devel] [Qemu-ppc] " Stewart Smith
2015-11-20 8:21 ` David Gibson
2015-11-24 1:45 ` Benjamin Herrenschmidt
2015-11-24 2:43 ` David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 27/77] ppc/pnv: Add XSCOM infrastructure Benjamin Herrenschmidt
2015-11-24 3:20 ` David Gibson [this message]
2015-11-24 8:49 ` [Qemu-devel] [Qemu-ppc] " Benjamin Herrenschmidt
2015-11-24 8:55 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 28/77] ppc/xics: Rename existing XICS classe to XICS_SPAPR Benjamin Herrenschmidt
2015-11-24 3:25 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 29/77] ppc/xics: Move SPAPR specific code to a separate file Benjamin Herrenschmidt
2015-11-24 3:32 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 30/77] ppc/xics: Implement H_IPOLL using an accessor Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 31/77] ppc/xics: Remove unused xics_set_irq_type() Benjamin Herrenschmidt
2015-11-24 3:34 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 32/77] ppc/xics: Replace "icp" with "xics" in most places Benjamin Herrenschmidt
2015-11-24 3:36 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 33/77] ppc/xics: Make the ICSState a list Benjamin Herrenschmidt
2015-12-01 4:30 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 34/77] ppc/xics: An ICS with offset 0 is assumed to be uninitialized Benjamin Herrenschmidt
2015-12-01 4:40 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 35/77] ppc/xics: Move xics_set_nr_irqs() to xics_spapr.c and xics_kvm.c Benjamin Herrenschmidt
2015-12-01 4:46 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 36/77] ppc/xics: Use a helper to add a new ICS Benjamin Herrenschmidt
2015-12-01 4:47 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 37/77] ppc/xics: Split ICS into base class and "simple" implementation Benjamin Herrenschmidt
2015-12-01 5:13 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 38/77] ppc/xics: Add "native" XICS subclass Benjamin Herrenschmidt
2015-12-01 6:28 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-12-01 6:39 ` David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 39/77] ppc/xics: Add xics to the monitor "info pic" command Benjamin Herrenschmidt
2015-12-01 6:32 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 40/77] ppc/pnv: Wire up XICS native with PowerNV platform Benjamin Herrenschmidt
2015-12-01 6:41 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-11-11 0:27 ` [Qemu-devel] [PATCH 41/77] ppc/pnv: Add LPC controller and hook it up with a UART and RTC Benjamin Herrenschmidt
2015-11-17 0:32 ` Alexey Kardashevskiy
2015-11-17 0:40 ` Benjamin Herrenschmidt
2015-12-01 6:43 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2015-12-02 2:24 ` Alexey Kardashevskiy
2015-12-02 5:29 ` Benjamin Herrenschmidt
2015-12-03 1:04 ` Alexey Kardashevskiy
2015-12-03 1:45 ` David Gibson
2015-12-03 22:58 ` Benjamin Herrenschmidt
2015-12-03 22:54 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 42/77] ppc/pnv: Add cut down PSI bridge model and hookup external interrupt Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 43/77] ppc/pnv: Add OCC model stub with interrupt support Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 44/77] pci-bridge: Set a supported devfn_min for bridge Benjamin Herrenschmidt
2015-11-18 12:31 ` Paolo Bonzini
2015-11-18 12:41 ` [Qemu-devel] [PATCH for-2.5 " Paolo Bonzini
2015-11-18 14:21 ` Michael S. Tsirkin
2015-11-18 14:25 ` Paolo Bonzini
2015-11-18 16:38 ` Michael S. Tsirkin
2015-11-11 0:27 ` [Qemu-devel] [PATCH 45/77] qdev: Add a hook for a bus to device if it can add devices Benjamin Herrenschmidt
2015-11-18 12:34 ` Paolo Bonzini
2015-11-18 20:06 ` Benjamin Herrenschmidt
2015-11-11 0:27 ` [Qemu-devel] [PATCH 46/77] pci: Use the new pci_can_add_device() to enforce devfn_min/max Benjamin Herrenschmidt
2015-11-18 12:35 ` Paolo Bonzini
2015-11-11 0:28 ` [Qemu-devel] [PATCH 47/77] pci: Don't call pci_irq_handler() for a negative intx Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 48/77] ppc/pnv: Add model for Power8 PHB3 PCIe Host bridge Benjamin Herrenschmidt
2017-03-17 8:24 ` [Qemu-devel] [Qemu-ppc] " Cédric Le Goater
2017-03-17 22:15 ` Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 49/77] ppc/pnv: Create a default PCI layout Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 50/77] ppc: Update LPCR definitions Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 51/77] ppc: Use a helper to filter writes to LPCR Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 52/77] ppc: Cosmetic, align some comments Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 53/77] ppc: Add proper real mode translation support Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 54/77] ppc: Fix 64K pages support in full emulation Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 55/77] ppc/pnv+spapr: Add "ibm, pa-features" property to the device-tree Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 56/77] ppc: Fix conditions for delivering external interrupts to a guest Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 57/77] ppc: Enforce setting MSR:EE, IR and DR when MSR:PR is set Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 58/77] ppc: Initial HDEC support Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 59/77] ppc: Add placeholder SPRs for DPDES and DHDES on P8 Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 60/77] ppc: LPCR is a HV resource Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 61/77] ppc: SPURR & PURR are HV writeable and privileged Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 62/77] ppc: Add dummy SPR_IC for POWER8 Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 63/77] ppc: Initialize AMOR in PAPR mode Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 64/77] ppc: Fix writing to AMR/UAMOR Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 65/77] ppc: Add POWER8 IAMR register Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 66/77] ppc: Add a few more P8 PMU SPRs Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 67/77] ppc: Add dummy write to VTB Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 68/77] ppc: Add dummy POWER8 MPPR register Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 69/77] ppc: Add dummy POWER8 PSPB SPR Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 70/77] ppc: Add dummy CIABR SPR Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 71/77] ppc: Add dummy ACOP SPR Benjamin Herrenschmidt
2016-03-02 20:22 ` Thomas Huth
2015-11-11 0:28 ` [Qemu-devel] [PATCH 72/77] ppc: A couple more dummy POWER8 Book4 regs Benjamin Herrenschmidt
2016-03-02 20:30 ` Thomas Huth
2016-03-04 0:59 ` Benjamin Herrenschmidt
2016-03-09 20:04 ` [Qemu-devel] [Qemu-ppc] " Cédric Le Goater
2016-03-09 21:17 ` Thomas Huth
2016-03-10 18:01 ` Thomas Huth
2016-03-10 22:27 ` Cédric Le Goater
2016-03-11 10:04 ` Thomas Huth
2016-03-11 14:22 ` Cédric Le Goater
2016-03-11 14:46 ` Thomas Huth
2016-03-14 14:53 ` Cédric Le Goater
2016-03-14 15:43 ` Thomas Huth
2016-03-14 15:50 ` Cédric Le Goater
2015-11-11 0:28 ` [Qemu-devel] [PATCH 73/77] ppc: Add KVM numbers to some P8 SPRs Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 74/77] ppc: Print HSRR0/HSRR1 in "info registers" Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 75/77] ppc: Add dummy logmpp instruction Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 76/77] ppc: Add slbfee. instruction Benjamin Herrenschmidt
2015-11-11 0:28 ` [Qemu-devel] [PATCH 77/77] ppc: Fix CFAR updates Benjamin Herrenschmidt
2015-11-11 0:42 ` [Qemu-devel] [Qemu-ppc] [PATCH 00/77] ppc: Add "native" POWER8 platform Benjamin Herrenschmidt
2015-11-11 0:50 ` [Qemu-devel] " Eric Blake
2015-11-11 0:56 ` Benjamin Herrenschmidt
2015-11-11 3:27 ` [Qemu-devel] [Qemu-ppc] " Alexey Kardashevskiy
2015-11-11 3:38 ` Benjamin Herrenschmidt
2015-11-11 4:07 ` Alexey Kardashevskiy
2015-11-11 4:16 ` Benjamin Herrenschmidt
2015-11-11 4:41 ` Alexey Kardashevskiy
2015-11-11 4:47 ` Benjamin Herrenschmidt
2015-11-27 10:21 ` Alexander Graf
2015-11-28 7:59 ` Benjamin Herrenschmidt
2015-11-28 10:53 ` Alexander Graf
2015-11-29 0:38 ` Benjamin Herrenschmidt
2015-11-30 18:15 ` Cédric Le Goater
2015-11-30 20:09 ` Benjamin Herrenschmidt
2015-11-30 21:24 ` Cédric Le Goater
2015-11-30 23:12 ` Benjamin Herrenschmidt
2015-12-07 1:25 ` Stewart Smith
2015-12-07 22:48 ` Cédric Le Goater
2015-11-11 0:57 ` Stewart Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151124032050.GG26118@voom.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=benh@kernel.crashing.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).