xref: /qemu/include/hw/ppc/spapr_xive.h (revision 38afd772f802ff787ea16af73b0c0d24a8c46b6c)
13aa597f6SCédric Le Goater /*
23aa597f6SCédric Le Goater  * QEMU PowerPC sPAPR XIVE interrupt controller model
33aa597f6SCédric Le Goater  *
43aa597f6SCédric Le Goater  * Copyright (c) 2017-2018, IBM Corporation.
53aa597f6SCédric Le Goater  *
63aa597f6SCédric Le Goater  * This code is licensed under the GPL version 2 or later. See the
73aa597f6SCédric Le Goater  * COPYING file in the top-level directory.
83aa597f6SCédric Le Goater  */
93aa597f6SCédric Le Goater 
103aa597f6SCédric Le Goater #ifndef PPC_SPAPR_XIVE_H
113aa597f6SCédric Le Goater #define PPC_SPAPR_XIVE_H
123aa597f6SCédric Le Goater 
133aa597f6SCédric Le Goater #include "hw/ppc/xive.h"
143aa597f6SCédric Le Goater 
153aa597f6SCédric Le Goater #define TYPE_SPAPR_XIVE "spapr-xive"
16ce2918cbSDavid Gibson #define SPAPR_XIVE(obj) OBJECT_CHECK(SpaprXive, (obj), TYPE_SPAPR_XIVE)
173aa597f6SCédric Le Goater 
18ce2918cbSDavid Gibson typedef struct SpaprXive {
193aa597f6SCédric Le Goater     XiveRouter    parent;
203aa597f6SCédric Le Goater 
213aa597f6SCédric Le Goater     /* Internal interrupt source for IPIs and virtual devices */
223aa597f6SCédric Le Goater     XiveSource    source;
233aa597f6SCédric Le Goater     hwaddr        vc_base;
243aa597f6SCédric Le Goater 
253aa597f6SCédric Le Goater     /* END ESB MMIOs */
263aa597f6SCédric Le Goater     XiveENDSource end_source;
273aa597f6SCédric Le Goater     hwaddr        end_base;
283aa597f6SCédric Le Goater 
29743ed566SGreg Kurz     /* DT */
30743ed566SGreg Kurz     gchar *nodename;
31743ed566SGreg Kurz 
323aa597f6SCédric Le Goater     /* Routing table */
333aa597f6SCédric Le Goater     XiveEAS       *eat;
343aa597f6SCédric Le Goater     uint32_t      nr_irqs;
353aa597f6SCédric Le Goater     XiveEND       *endt;
363aa597f6SCédric Le Goater     uint32_t      nr_ends;
373aa597f6SCédric Le Goater 
383aa597f6SCédric Le Goater     /* TIMA mapping address */
393aa597f6SCédric Le Goater     hwaddr        tm_base;
403aa597f6SCédric Le Goater     MemoryRegion  tm_mmio;
41*38afd772SCédric Le Goater 
42*38afd772SCédric Le Goater     /* KVM support */
43*38afd772SCédric Le Goater     int           fd;
44*38afd772SCédric Le Goater     void          *tm_mmap;
45ce2918cbSDavid Gibson } SpaprXive;
463aa597f6SCédric Le Goater 
47ce2918cbSDavid Gibson bool spapr_xive_irq_claim(SpaprXive *xive, uint32_t lisn, bool lsi);
48ce2918cbSDavid Gibson bool spapr_xive_irq_free(SpaprXive *xive, uint32_t lisn);
49ce2918cbSDavid Gibson void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon);
503aa597f6SCédric Le Goater 
51ce2918cbSDavid Gibson void spapr_xive_hcall_init(SpaprMachineState *spapr);
52ce2918cbSDavid Gibson void spapr_dt_xive(SpaprMachineState *spapr, uint32_t nr_servers, void *fdt,
536e21de4aSCédric Le Goater                    uint32_t phandle);
54b2e22477SCédric Le Goater void spapr_xive_set_tctx_os_cam(XiveTCTX *tctx);
55ce2918cbSDavid Gibson void spapr_xive_mmio_set_enabled(SpaprXive *xive, bool enable);
56*38afd772SCédric Le Goater void spapr_xive_map_mmio(SpaprXive *xive);
57*38afd772SCédric Le Goater 
58*38afd772SCédric Le Goater /*
59*38afd772SCédric Le Goater  * KVM XIVE device helpers
60*38afd772SCédric Le Goater  */
61*38afd772SCédric Le Goater void kvmppc_xive_connect(SpaprXive *xive, Error **errp);
6223bcd5ebSCédric Le Goater 
633aa597f6SCédric Le Goater #endif /* PPC_SPAPR_XIVE_H */
64