Skip to content

Commit 8599395

Browse files
LeoBrasmpe
authored andcommitted
powerpc/pseries/iommu: Find existing DDW with given property name
At the moment pseries stores information about created directly mapped DDW window in DIRECT64_PROPNAME. With the objective of implementing indirect DMA mapping with DDW, it's necessary to have another propriety name to make sure kexec'ing into older kernels does not break, as it would if we reuse DIRECT64_PROPNAME. In order to have this, find_existing_ddw_windows() needs to be able to look for different property names. Extract find_existing_ddw_windows() into find_existing_ddw_windows_named() and calls it with current property name. Signed-off-by: Leonardo Bras <[email protected]> Reviewed-by: Alexey Kardashevskiy <[email protected]> Reviewed-by: Frederic Barrat <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a5fd951 commit 8599395

File tree

1 file changed

+15
-10
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+15
-10
lines changed

arch/powerpc/platforms/pseries/iommu.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -910,31 +910,36 @@ static struct direct_window *ddw_list_new_entry(struct device_node *pdn,
910910
return window;
911911
}
912912

913-
static int find_existing_ddw_windows(void)
913+
static void find_existing_ddw_windows_named(const char *name)
914914
{
915915
int len;
916916
struct device_node *pdn;
917917
struct direct_window *window;
918-
const struct dynamic_dma_window_prop *direct64;
919-
920-
if (!firmware_has_feature(FW_FEATURE_LPAR))
921-
return 0;
918+
const struct dynamic_dma_window_prop *dma64;
922919

923-
for_each_node_with_property(pdn, DIRECT64_PROPNAME) {
924-
direct64 = of_get_property(pdn, DIRECT64_PROPNAME, &len);
925-
if (!direct64 || len < sizeof(*direct64)) {
926-
remove_ddw(pdn, true, DIRECT64_PROPNAME);
920+
for_each_node_with_property(pdn, name) {
921+
dma64 = of_get_property(pdn, name, &len);
922+
if (!dma64 || len < sizeof(*dma64)) {
923+
remove_ddw(pdn, true, name);
927924
continue;
928925
}
929926

930-
window = ddw_list_new_entry(pdn, direct64);
927+
window = ddw_list_new_entry(pdn, dma64);
931928
if (!window)
932929
break;
933930

934931
spin_lock(&direct_window_list_lock);
935932
list_add(&window->list, &direct_window_list);
936933
spin_unlock(&direct_window_list_lock);
937934
}
935+
}
936+
937+
static int find_existing_ddw_windows(void)
938+
{
939+
if (!firmware_has_feature(FW_FEATURE_LPAR))
940+
return 0;
941+
942+
find_existing_ddw_windows_named(DIRECT64_PROPNAME);
938943

939944
return 0;
940945
}

0 commit comments

Comments
 (0)