Skip to content

Conversation

@my-mayfly
Copy link
Contributor

@my-mayfly my-mayfly commented Dec 2, 2025

The branch predictor configuration in V3 differs from that in V2, so the custom CSR register sbpctl is also different between the two versions. Due to the differing bit widths of sbpctl, reads may return inconsistent values, causing difftest mismatches and CI test case "misc" to fail.

Copy link
Member

@cebarobot cebarobot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. If you want add a new config marco, you have to edit the Kconfig file.
  2. Please follow the failed CI instruction to update all defconfig.
  3. Is this a good way to control custom CSRs? I think we need a better way to control those custom CSRs.

uint64_t ras_enable : 1; // [5]
uint64_t loop_enable : 1; // [6]
CSR_STRUCT_END(sbpctl)
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comment for else and #endif.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, i'll make the changes as you suggested.

#define CUSTOM_CSR_SBPCTL_WMASK 0xff
#else
#define CUSTOM_CSR_SBPCTL_WMASK 0x7f
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comment for else and #endif.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, i will make changes as you suggested.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not this comment. Please check other #ifdef and #endif pairs.

#ifdef CONFIG_RV_MBMC
  something();
#else // CONFIG_RV_MBMC
  otherthing();
#endif // CONFIG_RV_MBMC

CONFIG_INSTR_CNT_BY_INSTR=y
CONFIG_ENABLE_INSTR_CNT=y
# end of Miscellaneous
CONFIG_KUNMINGHU_V3=y No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only adding here without adding config in Kconfig makes no sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much -- i've noticed it

#define CUSTOM_CSR_SBPCTL_WMASK 0xff
#else
#define CUSTOM_CSR_SBPCTL_WMASK 0x7f
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not this comment. Please check other #ifdef and #endif pairs.

#ifdef CONFIG_RV_MBMC
  something();
#else // CONFIG_RV_MBMC
  otherthing();
#endif // CONFIG_RV_MBMC

bool "Kunminghu Version 3"
default n
help
Enables Kunminghu V3-specific configurations, which differ from V2.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please place this configuration a bit later. It is not that important.
  2. Please use a more specific name and prompt. This config is about custom CSRs right? So what about config CUSTOM_CSR_KMHV3?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, i will make changes as you suggested.

uint64_t utage_enable : 1; // [7]
CSR_STRUCT_END(sbpctl)
#else
CSR_STRUCT_START(sbpctl)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think put ifdef inside CSR_STRUCT_START may be a better solution. Like

CSR_STRUCT_START(sbpctl)
#ifdef CONFIG_SOMETHING
  something;
#else // CONFIG_SOMETHING
  something;
#endif // CONFIG_SOMETHING
CSR_STRUCT_END(sbpctl)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, i will make changes as you suggested.

@my-mayfly my-mayfly marked this pull request as draft December 2, 2025 09:52
@my-mayfly my-mayfly force-pushed the fix-sbpctl-v3 branch 2 times, most recently from d708f89 to a2b4f9c Compare December 3, 2025 05:19
@my-mayfly my-mayfly marked this pull request as ready for review December 5, 2025 02:09
@my-mayfly my-mayfly requested a review from cebarobot December 5, 2025 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants