Skip to content

Commit

Permalink
platform: generic: thead: separate T-Head PMU Errata
Browse files Browse the repository at this point in the history
As Guo Ren said from the kernel mailing list [1], future T-Head CPUs,
including the newer versions of T-Head C908, will feature standard
Sscofpmf extension. For these CPUs, T-Head's implementation of PMU
Overflow Interrupts may not needed anymore. In this case, we shouldn't
apply T-Head PMU for all T-Head CPUs. Thus, this patch separated T-Head PMU
errata.

[1] https://lore.kernel.org/linux-riscv/[email protected]/

Signed-off-by: Yangyu Chen <[email protected]>
Reviewed-by: Inochi Amaoto <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
  • Loading branch information
cyyself authored and cp0613 committed Dec 23, 2024
1 parent a9994da commit 9294bed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions platform/generic/include/thead/c9xx_errata.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* stale entrie avoid incorrect memory access.
*/
#define THEAD_QUIRK_ERRATA_TLB_FLUSH BIT(0)
#define THEAD_QUIRK_ERRATA_THEAD_PMU BIT(1)

void thead_register_tlb_flush_trap_handler(void);

Expand Down
8 changes: 6 additions & 2 deletions platform/generic/thead/thead-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@ static int thead_generic_early_init(bool cold_boot,
static int thead_generic_extensions_init(const struct fdt_match *match,
struct sbi_hart_features *hfeatures)
{
thead_c9xx_register_pmu_device();
struct thead_generic_quirks *quirks = (void *)match->data;

if (quirks->errata & THEAD_QUIRK_ERRATA_THEAD_PMU)
thead_c9xx_register_pmu_device();

return 0;
}

static struct thead_generic_quirks thead_th1520_quirks = {
.errata = THEAD_QUIRK_ERRATA_TLB_FLUSH,
.errata = THEAD_QUIRK_ERRATA_TLB_FLUSH | THEAD_QUIRK_ERRATA_THEAD_PMU,
};

static const struct fdt_match thead_generic_match[] = {
Expand Down

0 comments on commit 9294bed

Please sign in to comment.