... | ... | ||
---|---|---|---|
4 | 4 | ||
5 | [1] https://lore.kernel.org/qemu-devel/20241009-pmu_event_machine-v1-0-dcbd7a60e3ba@rivosinc.com/ | 5 | [1] https://lore.kernel.org/qemu-devel/20241009-pmu_event_machine-v1-0-dcbd7a60e3ba@rivosinc.com/ |
6 | 6 | ||
7 | Signed-off-by: Atish Patra <atishp@rivosinc.com> | 7 | Signed-off-by: Atish Patra <atishp@rivosinc.com> |
8 | --- | 8 | --- |
9 | Changes in v2: | ||
10 | - Replace GENMASK_ULL with MAKE_64BIT_MASK | ||
11 | - Applied RB/AB tags. | ||
12 | - Link to v1: https://lore.kernel.org/r/20250115-pmu_minor_fixes-v1-0-c32388defb02@rivosinc.com | ||
13 | |||
14 | --- | ||
9 | Atish Patra (2): | 15 | Atish Patra (2): |
10 | target/riscv: Fix the hpmevent mask | 16 | target/riscv: Fix the hpmevent mask |
11 | target/riscv: Mask out upper sscofpmf bits during validation | 17 | target/riscv: Mask out upper sscofpmf bits during validation |
12 | 18 | ||
13 | target/riscv/cpu_bits.h | 9 ++++++--- | 19 | target/riscv/cpu_bits.h | 5 ++--- |
14 | target/riscv/pmu.c | 2 +- | 20 | target/riscv/pmu.c | 2 +- |
15 | 2 files changed, 7 insertions(+), 4 deletions(-) | 21 | 2 files changed, 3 insertions(+), 4 deletions(-) |
16 | --- | 22 | --- |
17 | base-commit: b82a273fb2210edf7beb9e5ca1401927fbcbe164 | 23 | base-commit: 3f26a7a370c11c7dff68dabcccc19c4e0de901e4 |
18 | change-id: 20250115-pmu_minor_fixes-7a2b8e3658e4 | 24 | change-id: 20250115-pmu_minor_fixes-7a2b8e3658e4 |
19 | -- | 25 | -- |
20 | Regards, | 26 | Regards, |
21 | Atish patra | 27 | Atish patra | diff view generated by jsdifflib |
1 | As per the latest privilege specification v1.13[1], the sscofpmf | 1 | As per the latest privilege specification v1.13[1], the sscofpmf |
---|---|---|---|
2 | only reserves first 8 bits of hpmeventX. Update the corresponding | 2 | only reserves first 8 bits of hpmeventX. Update the corresponding |
3 | masks accordingly. | 3 | masks accordingly. |
4 | 4 | ||
5 | [1]https://github.com/riscv/riscv-isa-manual/issues/1578 | 5 | [1]https://github.com/riscv/riscv-isa-manual/issues/1578 |
6 | 6 | ||
7 | Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> | ||
7 | Signed-off-by: Atish Patra <atishp@rivosinc.com> | 8 | Signed-off-by: Atish Patra <atishp@rivosinc.com> |
8 | --- | 9 | --- |
9 | target/riscv/cpu_bits.h | 9 ++++++--- | 10 | target/riscv/cpu_bits.h | 5 ++--- |
10 | 1 file changed, 6 insertions(+), 3 deletions(-) | 11 | 1 file changed, 2 insertions(+), 3 deletions(-) |
11 | 12 | ||
12 | diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h | 13 | diff --git a/target/riscv/cpu_bits.h b/target/riscv/cpu_bits.h |
13 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/riscv/cpu_bits.h | 15 | --- a/target/riscv/cpu_bits.h |
15 | +++ b/target/riscv/cpu_bits.h | 16 | +++ b/target/riscv/cpu_bits.h |
16 | @@ -XXX,XX +XXX,XX @@ | ||
17 | (((uint64_t)(val) * ((mask) & ~((mask) << 1))) & \ | ||
18 | (uint64_t)(mask))) | ||
19 | |||
20 | +#ifndef GENMASK_ULL | ||
21 | +#define GENMASK_ULL(h, l) (((~0ULL) >> (63 - (h) + (l))) << (l)) | ||
22 | +#endif | ||
23 | + | ||
24 | /* Extension context status mask */ | ||
25 | #define EXT_STATUS_MASK 0x3ULL | ||
26 | |||
27 | @@ -XXX,XX +XXX,XX @@ typedef enum RISCVException { | 17 | @@ -XXX,XX +XXX,XX @@ typedef enum RISCVException { |
28 | MHPMEVENTH_BIT_VSINH | \ | 18 | MHPMEVENTH_BIT_VSINH | \ |
29 | MHPMEVENTH_BIT_VUINH) | 19 | MHPMEVENTH_BIT_VUINH) |
30 | 20 | ||
31 | -#define MHPMEVENT_SSCOF_MASK _ULL(0xFFFF000000000000) | 21 | -#define MHPMEVENT_SSCOF_MASK _ULL(0xFFFF000000000000) |
32 | -#define MHPMEVENT_IDX_MASK 0xFFFFF | 22 | -#define MHPMEVENT_IDX_MASK 0xFFFFF |
33 | -#define MHPMEVENT_SSCOF_RESVD 16 | 23 | -#define MHPMEVENT_SSCOF_RESVD 16 |
34 | +#define MHPMEVENT_SSCOF_MASK GENMASK_ULL(63, 56) | 24 | +#define MHPMEVENT_SSCOF_MASK MAKE_64BIT_MASK(63, 56) |
35 | +#define MHPMEVENT_IDX_MASK (~MHPMEVENT_SSCOF_MASK) | 25 | +#define MHPMEVENT_IDX_MASK (~MHPMEVENT_SSCOF_MASK) |
36 | 26 | ||
37 | /* RISC-V-specific interrupt pending bits. */ | 27 | /* RISC-V-specific interrupt pending bits. */ |
38 | #define CPU_INTERRUPT_RNMI CPU_INTERRUPT_TGT_EXT_0 | 28 | #define CPU_INTERRUPT_RNMI CPU_INTERRUPT_TGT_EXT_0 |
39 | 29 | ||
40 | -- | 30 | -- |
41 | 2.34.1 | 31 | 2.43.0 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
5 | Software may set the OF bit to indicate disable interrupt. | 5 | Software may set the OF bit to indicate disable interrupt. |
6 | 6 | ||
7 | Ensure that correct value is checked after masking while clearing the | 7 | Ensure that correct value is checked after masking while clearing the |
8 | event encodings. | 8 | event encodings. |
9 | 9 | ||
10 | Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> | ||
11 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | Signed-off-by: Atish Patra <atishp@rivosinc.com> | 12 | Signed-off-by: Atish Patra <atishp@rivosinc.com> |
11 | --- | 13 | --- |
12 | target/riscv/pmu.c | 2 +- | 14 | target/riscv/pmu.c | 2 +- |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 15 | 1 file changed, 1 insertion(+), 1 deletion(-) |
14 | 16 | ||
... | ... | ||
25 | g_hash_table_foreach_remove(cpu->pmu_event_ctr_map, | 27 | g_hash_table_foreach_remove(cpu->pmu_event_ctr_map, |
26 | pmu_remove_event_map, | 28 | pmu_remove_event_map, |
27 | GUINT_TO_POINTER(ctr_idx)); | 29 | GUINT_TO_POINTER(ctr_idx)); |
28 | 30 | ||
29 | -- | 31 | -- |
30 | 2.34.1 | 32 | 2.43.0 | diff view generated by jsdifflib |