Lines Matching full:window
109 /* Default DMA window table is at index 0, while DDW at 1. SR-IOV in iommu_pseries_free_group()
417 /* Dynamic DMA Window support */
432 /* prevents races between memory on/offline and window creation */
434 /* protects initializing window twice for same device */
658 /* Calculate amount of DMA window per slot. Each window must be in pci_dma_bus_setup_pSeries()
665 /* No ISA/IDE - just set window size and return */ in pci_dma_bus_setup_pSeries()
670 pr_debug("No ISA/IDE, window size is 0x%llx\n", in pci_dma_bus_setup_pSeries()
698 pr_debug("ISA/IDE, window size is 0x%llx\n", pci->phb->dma_window_size); in pci_dma_bus_setup_pSeries()
747 * When the DMA window properties might have been removed,
768 * Find nearest ibm,dma-window (default DMA window) or direct DMA window or
769 * dynamic 64bit DMA window, walking up the device tree.
780 default_prop = of_get_property(dn, "ibm,dma-window", NULL); in pci_dma_find()
798 /* At least found default window, which is the case for normal boot */ in pci_dma_find()
803 /* For PCI devices there will always be a DMA window, either on the device in pci_dma_find()
808 /* caller doesn't want to get DMA window property */ in pci_dma_find()
812 /* parse DMA window property. During normal system boot, only default in pci_dma_find()
813 * DMA window is passed in OF. But, for kdump, a dedicated adapter might in pci_dma_find()
815 * over default window. in pci_dma_find()
853 /* In PPC architecture, there will always be DMA window on bus or one of the in pci_dma_bus_setup_pSeriesLP()
854 * parent bus. During reboot, there will be ibm,dma-window property to in pci_dma_bus_setup_pSeriesLP()
855 * define DMA window. For kdump, there will at least be default window or DDW in pci_dma_bus_setup_pSeriesLP()
858 * state, firmware may not provide ibm,dma-window property at the time in pci_dma_bus_setup_pSeriesLP()
863 pr_debug(" no ibm,dma-window property !\n"); in pci_dma_bus_setup_pSeriesLP()
904 * the window sizes already. in pci_dma_dev_setup_pSeries()
955 pr_warn("%pOF failed to clear tces in window.\n", in clean_dma_window()
958 pr_debug("%pOF successfully cleared tces in window.\n", in clean_dma_window()
963 * Call only if DMA window is clean.
971 pr_warn("%pOF: failed to remove DMA window: rtas returned " in __remove_dma_window()
972 "%d to ibm,remove-pe-dma-window(%x) %llx\n", in __remove_dma_window()
975 pr_debug("%pOF: successfully removed DMA window: rtas returned " in __remove_dma_window()
976 "%d to ibm,remove-pe-dma-window(%x) %llx\n", in __remove_dma_window()
1013 pr_err("Unable to add DMA window property for %pOF", pdn); in copy_property()
1047 /* Default window property if removed is lost as reset-pe doesn't restore it. in remove_dma_window_named()
1051 if ((strcmp(win_name, "ibm,dma-window") == 0) && in remove_dma_window_named()
1052 !of_find_property(np, "ibm,dma-window-saved", NULL)) in remove_dma_window_named()
1053 copy_property(np, win_name, "ibm,dma-window-saved"); in remove_dma_window_named()
1057 pr_warn("%pOF: failed to remove DMA window property: %d\n", in remove_dma_window_named()
1065 struct dma_win *window; in find_existing_ddw() local
1070 /* check if we already created a window and dupe that config if so */ in find_existing_ddw()
1071 list_for_each_entry(window, &dma_win_list, list) { in find_existing_ddw()
1072 if (window->device == pdn) { in find_existing_ddw()
1073 dma64 = window->prop; in find_existing_ddw()
1076 *direct_mapping = window->direct; in find_existing_ddw()
1089 struct dma_win *window; in ddw_list_new_entry() local
1091 window = kzalloc(sizeof(*window), GFP_KERNEL); in ddw_list_new_entry()
1092 if (!window) in ddw_list_new_entry()
1095 window->device = pdn; in ddw_list_new_entry()
1096 window->prop = dma64; in ddw_list_new_entry()
1097 window->direct = false; in ddw_list_new_entry()
1099 return window; in ddw_list_new_entry()
1106 struct dma_win *window; in find_existing_ddw_windows_named() local
1120 * set window->direct = false. in find_existing_ddw_windows_named()
1122 window = ddw_list_new_entry(pdn, dma64); in find_existing_ddw_windows_named()
1123 if (!window) { in find_existing_ddw_windows_named()
1129 list_add(&window->list, &dma_win_list); in find_existing_ddw_windows_named()
1204 * Get the config address and phb buid of the PE window. in query_ddw()
1207 * dma-window property in query_ddw()
1252 * Get the config address and phb buid of the PE window. in create_ddw()
1255 * dma-window property in create_ddw()
1269 "ibm,create-pe-dma-window(%x) %x %x %x %x %x returned %d " in create_ddw()
1306 * That rtas-call can be used to restore the default DMA window for the device.
1334 /* Return largest page shift based on "IO Page Sizes" output of ibm,query-pe-dma-window. */
1348 * On LoPAR, ibm,query-pe-dma-window outputs "IO Page Sizes" using a bit field: in iommu_get_page_shift()
1397 * Future: also check if we can remap the base window for our base page size
1412 struct dma_win *window; in enable_ddw() local
1433 * DMA window again, as it will race with in-flight operations in enable_ddw()
1444 * ibm,query-pe-dma-window in enable_ddw()
1445 * ibm,create-pe-dma-window in enable_ddw()
1446 * ibm,remove-pe-dma-window in enable_ddw()
1456 * Query if there is a second window of size to map the in enable_ddw()
1467 * If there is no window available, remove the default DMA window, in enable_ddw()
1469 * new DDW window. in enable_ddw()
1476 /* DDW + IOMMU on single window may fail if there is any allocation */ in enable_ddw()
1482 default_win = of_find_property(pdn, "ibm,dma-window", NULL); in enable_ddw()
1493 /* Query again, to check if the window is available */ in enable_ddw()
1590 dev_err(&dev->dev, "unable to add DMA window property for %pOF: %d", in enable_ddw()
1595 window = ddw_list_new_entry(pdn, win64->value); in enable_ddw()
1596 if (!window) in enable_ddw()
1599 window->direct = direct_mapping; in enable_ddw()
1606 dev_info(&dev->dev, "failed to map DMA window for %pOF: %d\n", in enable_ddw()
1637 /* New table for using DDW instead of the default DMA window */ in enable_ddw()
1662 if (!of_find_property(pdn, "ibm,dma-window-saved", NULL)) in enable_ddw()
1663 copy_property(pdn, "ibm,dma-window", "ibm,dma-window-saved"); in enable_ddw()
1665 dev_info(&dev->dev, "Removed default DMA window for %pOF\n", pdn); in enable_ddw()
1669 list_add(&window->list, &dma_win_list); in enable_ddw()
1676 kfree(window); in enable_ddw()
1703 /* If we have persistent memory and the window size is not big enough in enable_ddw()
1740 /* Only for normal boot with default window. Doesn't matter during in spapr_tce_init_table_group()
1752 if (!of_find_property(pdn, "ibm,dma-window", NULL)) in spapr_tce_init_table_group()
1753 dev_err(&pdev->dev, "default dma window missing!\n"); in spapr_tce_init_table_group()
1788 * contain the dma-window properties per-device and not necessarily in pci_dma_dev_setup_pSeriesLP()
1790 * either hit a dma-window property, OR find a parent with a table in pci_dma_dev_setup_pSeriesLP()
1799 "no DMA window found for pci dev=%s dn=%pOF\n", in pci_dma_dev_setup_pSeriesLP()
1822 pr_debug(" found DMA window, table: %p\n", pci->table_group); in pci_dma_dev_setup_pSeriesLP()
1835 /* only attempt to use a new window if 64-bit DMA is requested */ in iommu_bypass_supported_pSeriesLP()
1842 * the device tree might contain the dma-window properties in iommu_bypass_supported_pSeriesLP()
1844 * search upwards in the tree until we either hit a dma-window in iommu_bypass_supported_pSeriesLP()
1890 copy_property(pdn, "ibm,dma-window-saved", "ibm,dma-window"); in restore_default_dma_window()
1896 struct dma_win *window; in remove_dynamic_dma_windows() local
1910 /* Default window was removed and only the DDW exists */ in remove_dynamic_dma_windows()
1916 list_for_each_entry(window, &dma_win_list, list) { in remove_dynamic_dma_windows()
1917 if (window->device == pdn) { in remove_dynamic_dma_windows()
1918 list_del(&window->list); in remove_dynamic_dma_windows()
1919 kfree(window); in remove_dynamic_dma_windows()
1946 /* The default window is restored if not present already on removal of DDW. in pseries_setup_default_iommu_config()
1950 * So, restore the default window with reset-pe-dma call explicitly. in pseries_setup_default_iommu_config()
1954 default_prop = of_get_property(pdn, "ibm,dma-window", NULL); in pseries_setup_default_iommu_config()
1998 struct dma_win *window; in spapr_tce_create_table() local
2037 /* The request is not for default window? Ensure there is no DDW window already */ in spapr_tce_create_table()
2041 dev_warn(&pdev->dev, "%pOF: 64-bit window already present.", pdn); in spapr_tce_create_table()
2046 /* Request is for Default window, ensure there is no DDW if there is a in spapr_tce_create_table()
2049 default_prop = of_get_property(pdn, "ibm,dma-window", NULL); in spapr_tce_create_table()
2053 …"%pOF: Attempt to create window#0 when 64-bit window is present. Preventing the attempt as that wo… in spapr_tce_create_table()
2061 default_prop = of_get_property(pdn, "ibm,dma-window", NULL); in spapr_tce_create_table()
2063 /* Limit the default window size to window_size */ in spapr_tce_create_table()
2095 dev_dbg(&pdev->dev, "can't map window 0x%llx with %llu %llu-sized pages\n", in spapr_tce_create_table()
2098 ret = -EINVAL; /* Retry with smaller window size */ in spapr_tce_create_table()
2114 dev_err(&pdev->dev, "unable to add DMA window property for %pOF: %ld", pdn, ret); in spapr_tce_create_table()
2119 window = ddw_list_new_entry(pdn, win64->value); in spapr_tce_create_table()
2120 if (!window) in spapr_tce_create_table()
2123 window->direct = false; in spapr_tce_create_table()
2136 /* New table for using DDW instead of the default DMA window */ in spapr_tce_create_table()
2146 list_add(&window->list, &dma_win_list); in spapr_tce_create_table()
2204 struct dma_win *window; in spapr_tce_unset_window() local
2211 win_name = "ibm,dma-window"; in spapr_tce_unset_window()
2229 list_for_each_entry(window, &dma_win_list, list) { in spapr_tce_unset_window()
2230 if (window->device == pdn) { in spapr_tce_unset_window()
2231 list_del(&window->list); in spapr_tce_unset_window()
2232 kfree(window); in spapr_tce_unset_window()
2284 * is fine for PEs with 2 DMA windows where the second window is created with create-pe in spapr_tce_take_ownership()
2285 * at which point the table is cleared. However, on VFs having only one DMA window, the in spapr_tce_take_ownership()
2286 * default window would end up seeing the entries left over from the direct map done in spapr_tce_take_ownership()
2287 * on the second window. So, remove the ddw explicitly so that clean_dma_window() in spapr_tce_take_ownership()
2296 /* The table_group->tables[0] is not null now, it must be the default window in spapr_tce_take_ownership()
2300 remove_dma_window_named(pdn, true, "ibm,dma-window", true); in spapr_tce_take_ownership()
2315 if (tbl) { /* Default window already restored */ in spapr_tce_release_ownership()
2321 /* Restore the default window */ in spapr_tce_release_ownership()
2342 struct dma_win *window; in iommu_mem_notifier() local
2349 list_for_each_entry(window, &dma_win_list, list) { in iommu_mem_notifier()
2350 if (window->direct) { in iommu_mem_notifier()
2352 arg->nr_pages, window->prop); in iommu_mem_notifier()
2361 list_for_each_entry(window, &dma_win_list, list) { in iommu_mem_notifier()
2362 if (window->direct) { in iommu_mem_notifier()
2364 arg->nr_pages, window->prop); in iommu_mem_notifier()
2389 struct dma_win *window; in iommu_reconfig_notifier() local
2408 list_for_each_entry(window, &dma_win_list, list) { in iommu_reconfig_notifier()
2409 if (window->device == np) { in iommu_reconfig_notifier()
2410 list_del(&window->list); in iommu_reconfig_notifier()
2411 kfree(window); in iommu_reconfig_notifier()