Commit 97e7dc52 authored by Nishanth Aravamudan's avatar Nishanth Aravamudan Committed by Benjamin Herrenschmidt

Revert "pseries/iommu: Remove DDW on kexec"

After reverting 25ebc45b
("powerpc/pseries/iommu: remove default window before attempting DDW
manipulation"), we no longer remove the base window in enable_ddw.
Therefore, we no longer need to reset the DMA window state in
find_existing_ddw_windows(). We can instead go back to what was done
before, which simply reuses the previous configuration, if any. Further,
this removes the final caller of the reset-pe-dma-windows call, so
remove those functions.

This fixes an EEH on kdump with the ipr driver. The EEH occurs, because
the initcall removes the DDW configuration (64-bit DMA window), but
doesn't ensure the ops are via the IOMMU -- a DMA operation occurs
during probe (still investigating this) and we EEH.

This reverts commit 14b6f00f.
Signed-off-by: default avatarNishanth Aravamudan <nacc@linux.vnet.ibm.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent ae69e1ed
...@@ -787,68 +787,33 @@ static u64 find_existing_ddw(struct device_node *pdn) ...@@ -787,68 +787,33 @@ static u64 find_existing_ddw(struct device_node *pdn)
return dma_addr; return dma_addr;
} }
static void __restore_default_window(struct eeh_dev *edev,
u32 ddw_restore_token)
{
u32 cfg_addr;
u64 buid;
int ret;
/*
* Get the config address and phb buid of the PE window.
* Rely on eeh to retrieve this for us.
* Retrieve them from the pci device, not the node with the
* dma-window property
*/
cfg_addr = edev->config_addr;
if (edev->pe_config_addr)
cfg_addr = edev->pe_config_addr;
buid = edev->phb->buid;
do {
ret = rtas_call(ddw_restore_token, 3, 1, NULL, cfg_addr,
BUID_HI(buid), BUID_LO(buid));
} while (rtas_busy_delay(ret));
pr_info("ibm,reset-pe-dma-windows(%x) %x %x %x returned %d\n",
ddw_restore_token, cfg_addr, BUID_HI(buid), BUID_LO(buid), ret);
}
static int find_existing_ddw_windows(void) static int find_existing_ddw_windows(void)
{ {
int len;
struct device_node *pdn; struct device_node *pdn;
struct direct_window *window;
const struct dynamic_dma_window_prop *direct64; const struct dynamic_dma_window_prop *direct64;
const u32 *ddw_extensions;
if (!firmware_has_feature(FW_FEATURE_LPAR)) if (!firmware_has_feature(FW_FEATURE_LPAR))
return 0; return 0;
for_each_node_with_property(pdn, DIRECT64_PROPNAME) { for_each_node_with_property(pdn, DIRECT64_PROPNAME) {
direct64 = of_get_property(pdn, DIRECT64_PROPNAME, NULL); direct64 = of_get_property(pdn, DIRECT64_PROPNAME, &len);
if (!direct64) if (!direct64)
continue; continue;
/* window = kzalloc(sizeof(*window), GFP_KERNEL);
* We need to ensure the IOMMU table is active when we if (!window || len < sizeof(struct dynamic_dma_window_prop)) {
* return from the IOMMU setup so that the common code kfree(window);
* can clear the table or find the holes. To that end, remove_ddw(pdn);
* first, remove any existing DDW configuration. continue;
*/ }
remove_ddw(pdn);
/* window->device = pdn;
* Second, if we are running on a new enough level of window->prop = direct64;
* firmware where the restore API is present, use it to spin_lock(&direct_window_list_lock);
* restore the 32-bit window, which was removed in list_add(&window->list, &direct_window_list);
* create_ddw. spin_unlock(&direct_window_list_lock);
* If the API is not present, then create_ddw couldn't
* have removed the 32-bit window in the first place, so
* removing the DDW configuration should be sufficient.
*/
ddw_extensions = of_get_property(pdn, "ibm,ddw-extensions",
NULL);
if (ddw_extensions && ddw_extensions[0] > 0)
__restore_default_window(of_node_to_eeh_dev(pdn),
ddw_extensions[1]);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment