summaryrefslogtreecommitdiff
path: root/arch/arm/mach-k3/r5/common.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-04-24 10:45:41 -0600
committerTom Rini <trini@konsulko.com>2025-04-24 10:45:41 -0600
commit629f089387adf7b0c39b77ac8d337cff7989f81d (patch)
tree4b53a852e9273c0324215377c6cdb536d1c88228 /arch/arm/mach-k3/r5/common.c
parentb0a300ad14323532ee88196c4dfb5658b644df82 (diff)
parent33b191997fc215e32cd51ffd979c5f6d1189c46e (diff)
Merge patch series "arm: mach-k3: remove some firewalls left over by ROM"
Bryan Brattlof <bb@ti.com> says: This small series is here to remove some firewalls setup by ROM during their boot and clean things up for Linux later on. Ideally this would be a simple call to remove_fwl_configs() however the location of the firewall is problematic (could potentially crash the core) when we're currently executing from the memory region protected by the firewall. So we need to introduce a function which allows us to disable specific firewall regions and skip others to ensure boot stability. Link: https://lore.kernel.org/r/20250414-firewalls-v1-0-89090085c08b@ti.com
Diffstat (limited to 'arch/arm/mach-k3/r5/common.c')
-rw-r--r--arch/arm/mach-k3/r5/common.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/arm/mach-k3/r5/common.c b/arch/arm/mach-k3/r5/common.c
index fd188e7c90e..0b6604039f3 100644
--- a/arch/arm/mach-k3/r5/common.c
+++ b/arch/arm/mach-k3/r5/common.c
@@ -253,6 +253,31 @@ void disable_linefill_optimization(void)
asm("mcr p15, 0, %0, c1, c0, 1" : : "r" (actlr));
}
+int remove_fwl_region(struct fwl_data *fwl)
+{
+ struct ti_sci_handle *sci = get_ti_sci_handle();
+ struct ti_sci_fwl_ops *ops = &sci->ops.fwl_ops;
+ struct ti_sci_msg_fwl_region region;
+ int ret;
+
+ region.fwl_id = fwl->fwl_id;
+ region.region = fwl->regions;
+ region.n_permission_regs = 3;
+
+ ops->get_fwl_region(sci, &region);
+
+ /* zero out the enable field of the firewall */
+ region.control = region.control & ~0xF;
+
+ pr_debug("Disabling firewall id: %d region: %d\n",
+ region.fwl_id, region.region);
+
+ ret = ops->set_fwl_region(sci, &region);
+ if (ret)
+ pr_err("Could not disable firewall\n");
+ return ret;
+}
+
static void remove_fwl_regions(struct fwl_data fwl_data, size_t num_regions,
enum k3_firewall_region_type fwl_type)
{