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
This commit is contained in:
@@ -29,6 +29,12 @@
|
|||||||
/* TISCI DEV ID for A53 Clock */
|
/* TISCI DEV ID for A53 Clock */
|
||||||
#define AM62X_DEV_A53SS0_CORE_0_DEV_ID 135
|
#define AM62X_DEV_A53SS0_CORE_0_DEV_ID 135
|
||||||
|
|
||||||
|
struct fwl_data rom_fwls[] = {
|
||||||
|
{ "SOC_DEVGRP_MAIN", 641, 1 },
|
||||||
|
{ "SOC_DEVGRP_MAIN", 642, 1 },
|
||||||
|
{ "SOC_DEVGRP_MAIN", 642, 2 },
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This uninitialized global variable would normal end up in the .bss section,
|
* This uninitialized global variable would normal end up in the .bss section,
|
||||||
* but the .bss is cleared between writing and reading this variable, so move
|
* but the .bss is cleared between writing and reading this variable, so move
|
||||||
@@ -177,6 +183,7 @@ void board_init_f(ulong dummy)
|
|||||||
{
|
{
|
||||||
struct udevice *dev;
|
struct udevice *dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_CPU_V7R)) {
|
if (IS_ENABLED(CONFIG_CPU_V7R)) {
|
||||||
setup_k3_mpu_regions();
|
setup_k3_mpu_regions();
|
||||||
@@ -261,6 +268,11 @@ void board_init_f(ulong dummy)
|
|||||||
/* Output System Firmware version info */
|
/* Output System Firmware version info */
|
||||||
k3_sysfw_print_ver();
|
k3_sysfw_print_ver();
|
||||||
|
|
||||||
|
/* Disable firewalls ROM has configured. */
|
||||||
|
if (IS_ENABLED(CONFIG_CPU_V7R))
|
||||||
|
for (i = 0; i < ARRAY_SIZE(rom_fwls); i++)
|
||||||
|
remove_fwl_region(&rom_fwls[i]);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_ESM_K3)) {
|
if (IS_ENABLED(CONFIG_ESM_K3)) {
|
||||||
/* Probe/configure ESM0 */
|
/* Probe/configure ESM0 */
|
||||||
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@420000", &dev);
|
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@420000", &dev);
|
||||||
|
@@ -35,6 +35,7 @@ enum k3_device_type {
|
|||||||
void setup_k3_mpu_regions(void);
|
void setup_k3_mpu_regions(void);
|
||||||
int early_console_init(void);
|
int early_console_init(void);
|
||||||
void disable_linefill_optimization(void);
|
void disable_linefill_optimization(void);
|
||||||
|
int remove_fwl_region(struct fwl_data *fwl);
|
||||||
void remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);
|
void remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size);
|
||||||
int load_firmware(char *name_fw, char *name_loadaddr, u32 *loadaddr);
|
int load_firmware(char *name_fw, char *name_loadaddr, u32 *loadaddr);
|
||||||
void k3_sysfw_print_ver(void);
|
void k3_sysfw_print_ver(void);
|
||||||
|
@@ -253,6 +253,31 @@ void disable_linefill_optimization(void)
|
|||||||
asm("mcr p15, 0, %0, c1, c0, 1" : : "r" (actlr));
|
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, ®ion);
|
||||||
|
|
||||||
|
/* 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, ®ion);
|
||||||
|
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,
|
static void remove_fwl_regions(struct fwl_data fwl_data, size_t num_regions,
|
||||||
enum k3_firewall_region_type fwl_type)
|
enum k3_firewall_region_type fwl_type)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user