platform: xuantie: Add custom PMU device for cycle/instret OF#8
Merged
Merged
Conversation
This reverts commit bbd2d8a. Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
Sscofpmf does not define overflow interrupts for the fixed cycle and instret counters. XuanTie cores expose this via vendor mhpmevent0 (0x7E0) and mhpmevent2 (0x7E1), with the OF/INH bits split into mhpmevent0H (0x7E2) / mhpmevent2H (0x7E3) on RV32 -- mirroring the standard mhpmevent3/3H layout. mxstatus[8] (OFINT) is the per-hart master gate that lets the vendor OF bit raise lcofip. Instead of patching the generic sbi_pmu code path, register a sbi_pmu_device (mirroring the thead c9xx pattern) and layer the vendor OF handling on top of Sscofpmf via hw_counter_enable_irq / hw_counter_disable_irq. The hooks only act on ctr_idx 0 and 2; the programmable counters (ctr_idx >= 3) continue to use the standard Sscofpmf code path unchanged. On RV32 the OF bit is reached via mhpmevent0H/mhpmevent2H, matching what pmu_ctr_enable_irq_hw() does for mhpmevent3H+. Set mxstatus[8] (OFINT) in xuantie_early_init() outside the cold_boot guard so it is enabled per hart on every boot path. Wire it up via QUIRK_XUANTIE_PMU. The xuantie,dummy match enables it alongside the existing quirks, and a new xuantie,pmu compatible is provided for boards that need just this driver. Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.