Skip to contentSkip to conversation

target/riscv: Add missing include guard in pmu.h

PATCH Applied [email protected] 5 participants 6 messages Feb 20, 2024 – Feb 23, 2024 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/riscv: Add missing include guard in pmu.h

From: Frank Chang <[email protected]>

Add missing include guard in pmu.h to avoid the problem of double inclusion.

---
 target/riscv/pmu.h | 5 +++++
 1 file changed, 5 insertions(+)
target/riscv/pmu.h +5 -0
index 505fc850d3..7c0ad661e0 100644
@@ -16,6 +16,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef RISCV_PMU_H
+#define RISCV_PMU_H
+
 #include "cpu.h"
 #include "qapi/error.h"
 
@@ -31,3 +34,5 @@ int riscv_pmu_incr_ctr(RISCVCPU *cpu, enum riscv_pmu_event_idx event_idx);
 void riscv_pmu_generate_fdt_node(void *fdt, uint32_t cmask, char *pmu_name);
 int riscv_pmu_setup_timer(CPURISCVState *env, uint64_t value,
                           uint32_t ctr_idx);
+
+#endif /* RISCV_PMU_H */
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · On 20/2/24 12:08, [email protected] wrote:

From: Frank Chang <[email protected]>

Add missing include guard in pmu.h to avoid the problem of double inclusion.

In case it needs to be backported to stable releases:

Fixes 3780e33732 ("target/riscv: Support mcycle/minstret write operation")
Quoted 25 lines
---
  target/riscv/pmu.h | 5 +++++
  1 file changed, 5 insertions(+)
target/riscv/pmu.h +5 -0
index 505fc850d3..7c0ad661e0 100644
@@ -16,6 +16,9 @@
   * this program.  If not, see <http://www.gnu.org/licenses/>.
   */
 
+#ifndef RISCV_PMU_H
+#define RISCV_PMU_H
+
  #include "cpu.h"
  #include "qapi/error.h"
 
@@ -31,3 +34,5 @@ int riscv_pmu_incr_ctr(RISCVCPU *cpu, enum riscv_pmu_event_idx event_idx);
  void riscv_pmu_generate_fdt_node(void *fdt, uint32_t cmask, char *pmu_name);
  int riscv_pmu_setup_timer(CPURISCVState *env, uint64_t value,
                            uint32_t ctr_idx);
+
+#endif /* RISCV_PMU_H */
Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 7 lines · On 2/20/24 08:08, [email protected] wrote:

From: Frank Chang <[email protected]>

Add missing include guard in pmu.h to avoid the problem of double inclusion.

---

Quoted 23 lines
  target/riscv/pmu.h | 5 +++++
  1 file changed, 5 insertions(+)
target/riscv/pmu.h +5 -0
index 505fc850d3..7c0ad661e0 100644
@@ -16,6 +16,9 @@
   * this program.  If not, see <http://www.gnu.org/licenses/>.
   */
 
+#ifndef RISCV_PMU_H
+#define RISCV_PMU_H
+
  #include "cpu.h"
  #include "qapi/error.h"
 
@@ -31,3 +34,5 @@ int riscv_pmu_incr_ctr(RISCVCPU *cpu, enum riscv_pmu_event_idx event_idx);
  void riscv_pmu_generate_fdt_node(void *fdt, uint32_t cmask, char *pmu_name);
  int riscv_pmu_setup_timer(CPURISCVState *env, uint64_t value,
                            uint32_t ctr_idx);
+
+#endif /* RISCV_PMU_H */
Reviewed-by
#3 lore raw
Quoted 27 lines · Daniel Henrique Barboza
Quoted 7 lines · On 2/20/24 08:08, [email protected] wrote:

From: Frank Chang <[email protected]>

Add missing include guard in pmu.h to avoid the problem of double inclusion.

---

Quoted 14 lines

  target/riscv/pmu.h | 5 +++++

  1 file changed, 5 insertions(+)
target/riscv/pmu.h +3 -0
index 505fc850d3..7c0ad661e0 100644
@@ -16,6 +16,9 @@
    * this program.  If not, see <http://www.gnu.org/licenses/>.
    */
+#ifndef RISCV_PMU_H
+#define RISCV_PMU_H
+
   #include "cpu.h"
Quoted 9 lines

target/riscv/pmu.h int riscv_pmu_incr_ctr(RISCVCPU *cpu, enum riscv_pmu_event_idx event_idx); · line 38

Quoted 8 lines
target/riscv/pmu.h +0 -0
   #include "qapi/error.h"
@@ -31,3 +34,5 @@ int riscv_pmu_incr_ctr(RISCVCPU *cpu, enum 
 riscv_pmu_event_idx event_idx);
   void riscv_pmu_generate_fdt_node(void *fdt, uint32_t cmask, char *pmu_name);
   int riscv_pmu_setup_timer(CPURISCVState *env, uint64_t value,

                            uint32_t ctr_idx);

target/riscv/pmu.h +2 -0
+
+#endif /* RISCV_PMU_H */

Oops. Thanks for the fix.

Reviewed-by on v1 1/1
#4 lore raw
In reply to [email protected]
Quoted 7 lines · On Tue, Feb 20, 2024 at 9:09 PM <[email protected]> wrote:

From: Frank Chang <[email protected]>

Add missing include guard in pmu.h to avoid the problem of double inclusion.

Alistair

Quoted 28 lines
---
 target/riscv/pmu.h | 5 +++++
 1 file changed, 5 insertions(+)
target/riscv/pmu.h +5 -1
index 505fc850d3..7c0ad661e0 100644
@@ -16,6 +16,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef RISCV_PMU_H
+#define RISCV_PMU_H
+
 #include "cpu.h"
 #include "qapi/error.h"
 
@@ -31,3 +34,5 @@ int riscv_pmu_incr_ctr(RISCVCPU *cpu, enum riscv_pmu_event_idx event_idx);
 void riscv_pmu_generate_fdt_node(void *fdt, uint32_t cmask, char *pmu_name);
 int riscv_pmu_setup_timer(CPURISCVState *env, uint64_t value,
                           uint32_t ctr_idx);
+
+#endif /* RISCV_PMU_H */
--

2.43.0

#5 lore raw
In reply to [email protected]
Quoted 7 lines · On Tue, Feb 20, 2024 at 9:09 PM <[email protected]> wrote:

From: Frank Chang <[email protected]>

Add missing include guard in pmu.h to avoid the problem of double inclusion.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 28 lines
---
 target/riscv/pmu.h | 5 +++++
 1 file changed, 5 insertions(+)
target/riscv/pmu.h +5 -1
index 505fc850d3..7c0ad661e0 100644
@@ -16,6 +16,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef RISCV_PMU_H
+#define RISCV_PMU_H
+
 #include "cpu.h"
 #include "qapi/error.h"
 
@@ -31,3 +34,5 @@ int riscv_pmu_incr_ctr(RISCVCPU *cpu, enum riscv_pmu_event_idx event_idx);
 void riscv_pmu_generate_fdt_node(void *fdt, uint32_t cmask, char *pmu_name);
 int riscv_pmu_setup_timer(CPURISCVState *env, uint64_t value,
                           uint32_t ctr_idx);
+
+#endif /* RISCV_PMU_H */
--

2.43.0