This is effectively a revert of commit 6ea4c0fe4570 ("soc/fsl/qbman:
Update device tree with reserved memory").

What that commit intended to do: Fix up the device tree that is passed
to a subsequent kexec-loaded kernel, so that the reserved-memory nodes
have the same base addresses as the currently running kernel.

What that commit actually does: Fix up the running device tree, which
has no effect whatsoever upon the device tree passed to the next kernel.

I would have refrained from making this kind of non-bugfix change in
stable kernels, but qbman_init_private_mem() grossly misrepresents
what this function does, and for an actual upcoming bug fix, it needs to
be refactored. There is no place for the bogus code afterwards, so it
needs to go as part of that, sadly.

Cc: <sta...@vger.kernel.org>
Signed-off-by: Vladimir Oltean <vladimir.olt...@nxp.com>
---
 drivers/soc/fsl/qbman/dpaa_sys.c | 31 -------------------------------
 1 file changed, 31 deletions(-)

diff --git a/drivers/soc/fsl/qbman/dpaa_sys.c b/drivers/soc/fsl/qbman/dpaa_sys.c
index e1d7b79cc450..b1cee145cbd7 100644
--- a/drivers/soc/fsl/qbman/dpaa_sys.c
+++ b/drivers/soc/fsl/qbman/dpaa_sys.c
@@ -39,8 +39,6 @@ int qbman_init_private_mem(struct device *dev, int idx, const 
char *compat,
 {
        struct device_node *mem_node;
        struct reserved_mem *rmem;
-       int err;
-       __be32 *res_array;
 
        mem_node = of_parse_phandle(dev->of_node, "memory-region", idx);
        if (!mem_node) {
@@ -60,34 +58,5 @@ int qbman_init_private_mem(struct device *dev, int idx, 
const char *compat,
        *addr = rmem->base;
        *size = rmem->size;
 
-       /*
-        * Check if the reg property exists - if not insert the node
-        * so upon kexec() the same memory region address will be preserved.
-        * This is needed because QBMan HW does not allow the base address/
-        * size to be modified once set.
-        */
-       if (!of_property_present(mem_node, "reg")) {
-               struct property *prop;
-
-               prop = devm_kzalloc(dev, sizeof(*prop), GFP_KERNEL);
-               if (!prop)
-                       return -ENOMEM;
-               prop->value = res_array = devm_kzalloc(dev, sizeof(__be32) * 4,
-                                                      GFP_KERNEL);
-               if (!prop->value)
-                       return -ENOMEM;
-               res_array[0] = cpu_to_be32(upper_32_bits(*addr));
-               res_array[1] = cpu_to_be32(lower_32_bits(*addr));
-               res_array[2] = cpu_to_be32(upper_32_bits(*size));
-               res_array[3] = cpu_to_be32(lower_32_bits(*size));
-               prop->length = sizeof(__be32) * 4;
-               prop->name = devm_kstrdup(dev, "reg", GFP_KERNEL);
-               if (!prop->name)
-                       return -ENOMEM;
-               err = of_add_property(mem_node, prop);
-               if (err)
-                       return err;
-       }
-
        return 0;
 }
-- 
2.34.1

Reply via email to