Received: from eggs.gnu.org ([2001:4830:134:3::10]:42636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGlOM-0005Zx-B9 for qemu-devel@nongnu.org; Thu, 29 Jan 2015 04:28:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGlO8-0004Kh-A7 for qemu-devel@nongnu.org; Thu, 29 Jan 2015 04:28:02 -0500 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:54439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGlO7-0004Hc-Es for qemu-devel@nongnu.org; Thu, 29 Jan 2015 04:27:48 -0500 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 29 Jan 2015 19:27:43 +1000 From: Alexey Kardashevskiy Date: Thu, 29 Jan 2015 20:27:25 +1100 Message-Id: <1422523650-2888-14-git-send-email-aik@ozlabs.ru> In-Reply-To: <1422523650-2888-1-git-send-email-aik@ozlabs.ru> References: <1422523650-2888-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH v4 13/18] spapr_pci: Advertise dynamic DMA windows to guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , Alex Williamson , qemu-ppc@nongnu.org, Alexander Graf , David Gibson Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr.c | 5 +++++ hw/ppc/spapr_pci.c | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b560459..f9882c1 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1760,6 +1760,11 @@ static void spapr_machine_2_1_class_init(ObjectClass *oc, void *data) MachineClass *mc = MACHINE_CLASS(oc); static GlobalProperty compat_props[] = { HW_COMPAT_2_1, + { + .driver = TYPE_SPAPR_PCI_HOST_BRIDGE, + .property = "ddw", + .value = stringify(off), + }, { /* end of list */ } }; diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 3ec03be..a94bba1 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -775,6 +775,7 @@ static Property spapr_phb_properties[] = { DEFINE_PROP_UINT64("io_win_addr", sPAPRPHBState, io_win_addr, -1), DEFINE_PROP_UINT64("io_win_size", sPAPRPHBState, io_win_size, SPAPR_PCI_IO_WIN_SIZE), + DEFINE_PROP_BOOL("ddw", sPAPRPHBState, ddw_enabled, true), DEFINE_PROP_END_OF_LIST(), }; @@ -993,6 +994,12 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t interrupt_map_mask[] = { cpu_to_be32(b_ddddd(-1)|b_fff(0)), 0x0, 0x0, cpu_to_be32(-1)}; uint32_t interrupt_map[PCI_SLOT_MAX * PCI_NUM_PINS][7]; + uint32_t ddw_applicable[] = { + cpu_to_be32(RTAS_IBM_QUERY_PE_DMA_WINDOW), + cpu_to_be32(RTAS_IBM_CREATE_PE_DMA_WINDOW), + cpu_to_be32(RTAS_IBM_REMOVE_PE_DMA_WINDOW) + }; + sPAPRPHBClass *spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(phb); /* Start populating the FDT */ sprintf(nodename, "pci@%" PRIx64, phb->buid); @@ -1022,6 +1029,24 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb, _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pci-config-space-type", 0x1)); _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi", XICS_IRQS)); + /* Dynamic DMA window */ + if (phb->ddw_enabled && + spc->ddw_query && spc->ddw_create && spc->ddw_remove) { + _FDT(fdt_setprop(fdt, bus_off, "ibm,ddw-applicable", &ddw_applicable, + sizeof(ddw_applicable))); + + if (spc->ddw_reset) { + uint32_t ddw_extensions[] = { + cpu_to_be32(1), + cpu_to_be32(RTAS_IBM_RESET_PE_DMA_WINDOW) + }; + + /* When enabled, the guest will remove the default 32bit window */ + _FDT(fdt_setprop(fdt, bus_off, "ibm,ddw-extensions", + &ddw_extensions, sizeof(ddw_extensions))); + } + } + /* Build the interrupt-map, this must matches what is done * in pci_spapr_map_irq */ -- 2.0.0