Skip to contentSkip to conversation

platform: andes: Drop andes_pmu_setup()

PATCH New Yu Chien Peter Lin 2 participants 2 messages Feb 22, 2024 – Mar 4, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform: andes: Drop andes_pmu_setup()

andes_pmu_setup() [1] was intended to populate event mapping from hardcoded arrays, however, this increases firmware size and we should just use PMU DT node [2] instead.

---
 platform/generic/andes/andes_pmu.c         | 12 ------------
 platform/generic/include/andes/andes_hpm.h | 12 ------------
 2 files changed, 24 deletions(-)
 delete mode 100644 platform/generic/include/andes/andes_hpm.h
platform/generic/andes/andes_pmu.c +0 -12
index 4b2d45b..479fb9a 100644
@@ -6,7 +6,6 @@
  */
 
 #include <andes/andes45.h>
-#include <andes/andes_hpm.h>
 #include <andes/andes_pmu.h>
 #include <sbi/sbi_bitops.h>
 #include <sbi/sbi_error.h>
@@ -86,20 +85,9 @@ int andes_pmu_extensions_init(const struct fdt_match *match,
 int andes_pmu_init(const struct fdt_match *match)
 {
 	struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
-	void *fdt = fdt_get_address();
-	int pmu_offset;
 
 	if (sbi_hart_has_extension(scratch, SBI_HART_EXT_XANDESPMU))
 		sbi_pmu_set_device(&andes_pmu);
 
-	/*
-	 * Populate default mappings if device-tree doesn't
-	 * provide a valid pmu node.
-	 */
-	pmu_offset = fdt_node_offset_by_compatible(fdt, -1, "riscv,pmu");
-	if (pmu_offset < 0)
-		return (pmu_offset == -FDT_ERR_NOTFOUND) ? andes_pmu_setup()
-							 : SBI_EFAIL;
-
 	return 0;
 }
platform/generic/include/andes/andes_hpm.h deleted +0 -12
deleted file mode 100644
index b4d71b9..0000000
@@ -1,12 +0,0 @@
-/*
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright (c) 2023 Andes Technology Corporation
- */
-
-#ifndef _ANDES_HPM_H_
-#define _ANDES_HPM_H_
-
-static inline int andes_pmu_setup(void) { return 0; }
-
-#endif /* _ANDES_HPM_H_ */
Signature · 1 line
2.34.1
Applied
#1 lore raw

PATCH 1/1 platform: andes: Drop andes_pmu_setup()

Quoted 8 lines · On Thu, Feb 22, 2024 at 2:49?PM Yu Chien Peter Lin <[email protected]>…

andes_pmu_setup() [1] was intended to populate event mapping from hardcoded arrays, however, this increases firmware size and we should just use PMU DT node [2] instead.

LGTM.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 65 lines
---
 platform/generic/andes/andes_pmu.c         | 12 ------------
 platform/generic/include/andes/andes_hpm.h | 12 ------------
 2 files changed, 24 deletions(-)
 delete mode 100644 platform/generic/include/andes/andes_hpm.h
platform/generic/andes/andes_pmu.c +0 -12
index 4b2d45b..479fb9a 100644
@@ -6,7 +6,6 @@
  */
 
 #include <andes/andes45.h>
-#include <andes/andes_hpm.h>
 #include <andes/andes_pmu.h>
 #include <sbi/sbi_bitops.h>
 #include <sbi/sbi_error.h>
@@ -86,20 +85,9 @@ int andes_pmu_extensions_init(const struct fdt_match *match,
 int andes_pmu_init(const struct fdt_match *match)
 {
        struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
-       void *fdt = fdt_get_address();
-       int pmu_offset;
 
        if (sbi_hart_has_extension(scratch, SBI_HART_EXT_XANDESPMU))
                sbi_pmu_set_device(&andes_pmu);
 
-       /*
-        * Populate default mappings if device-tree doesn't
-        * provide a valid pmu node.
-        */
-       pmu_offset = fdt_node_offset_by_compatible(fdt, -1, "riscv,pmu");
-       if (pmu_offset < 0)
-               return (pmu_offset == -FDT_ERR_NOTFOUND) ? andes_pmu_setup()
-                                                        : SBI_EFAIL;
-
        return 0;
 }
platform/generic/include/andes/andes_hpm.h deleted +0 -13
deleted file mode 100644
index b4d71b9..0000000
@@ -1,12 +0,0 @@
-/*
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * Copyright (c) 2023 Andes Technology Corporation
- */
-
-#ifndef _ANDES_HPM_H_
-#define _ANDES_HPM_H_
-
-static inline int andes_pmu_setup(void) { return 0; }
-
-#endif /* _ANDES_HPM_H_ */
--

2.34.1

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi