Files
kernel_common_drivers/drivers/debug/debug_mte.c
T
Yan Wang 76cd63506b MTE: debug: update flag according mte status. [1/1]
PD#SWPL-175090

Problem:
check mte enable/disable,
if mte disable, update flag to notify AO CPU.

Solution:
if mte disable, update flag to notify AO CPU.

Verify:
BL201

Change-Id: Ic1416ae5262b548f681a02ccbe15e4d98f0dc532
Signed-off-by: Yan Wang <yan.wang@amlogic.com>
2024-07-13 19:17:21 +08:00

61 lines
1.2 KiB
C

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Copyright (c) 2019 Amlogic, Inc. All rights reserved.
*/
#if IS_ENABLED(CONFIG_ARM64_MTE)
#include <linux/irqflags.h>
#include <linux/moduleparam.h>
#include <linux/module.h>
#include <linux/cpuset.h>
#include <linux/sched/isolation.h>
#include <linux/amlogic/gki_module.h>
#include <linux/sched.h>
#include <asm/cpufeature.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/errno.h>
#include <linux/of_address.h>
static void __iomem *debug_mte_reg;
/* SYSCTRL_DEBUG_REG4[0]=0b1: stop writing MTE clock */
#define MTE_CLK_STOP BIT(0)
int aml_debug_mte_init(void)
{
struct device_node *node;
unsigned int val;
if (!system_supports_mte()) {
node = of_find_node_by_path("/mte_debug");
if (!node) {
pr_info("no mte_debug node\n");
return -EINVAL;
}
debug_mte_reg = of_iomap(node, 0);
if (!debug_mte_reg) {
pr_info("mte_debug map fail\n");
return -ENOMEM;
}
val = readl_relaxed(debug_mte_reg);
val |= MTE_CLK_STOP;
writel_relaxed(val, debug_mte_reg);
pr_info("mte disabled\n");
} else {
pr_info("mte enabled\n");
}
return 0;
}
void aml_debug_mte_exit(void)
{
if (debug_mte_reg)
iounmap(debug_mte_reg);
}
#endif