Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Vector context save support on RISC-V #1260

Merged
merged 4 commits into from
Mar 27, 2025

Conversation

cubidesj
Copy link
Contributor

Save the vector context when changing the task

Description

An approach similar to #1250 has been used:

  • Add the storage for the vector context next to the FPU context
  • Enable the VPU as part of the task stack preparation
  • Use the VS flags and values to avoid saving and restoring the context
  • Save the 32 vector registers, vl, vtype, vstart and vcsr
    • The 32 vector registers are saved/restored according to the configured length

Test Steps

A separate PR in the FreeRTOS repository will be created. That PR contains an enhanced RegTest that includes the vector registers.

Checklist:

  • [ X ] I have tested my changes. No regression in existing tests.
  • [ X ] I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

An approach similar to #1250 was followed. I'll link the corresponding PR with the Demo once it is created

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@cubidesj
Copy link
Contributor Author

Associated PR in FreeRTOS repo FreeRTOS/FreeRTOS#1334

kstribrnAmzn
kstribrnAmzn previously approved these changes Mar 21, 2025
Copy link

codecov bot commented Mar 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.53%. Comparing base (60f34f8) to head (5b1a05f).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1260      +/-   ##
==========================================
- Coverage   91.59%   91.53%   -0.06%     
==========================================
  Files           6        6              
  Lines        3259     3261       +2     
  Branches      902      904       +2     
==========================================
  Hits         2985     2985              
  Misses        132      132              
- Partials      142      144       +2     
Flag Coverage Δ
unittests 91.53% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kstribrnAmzn
Copy link
Member

kstribrnAmzn commented Mar 21, 2025

The codecov/project workflow is failing (link) due to assertions added in this PR. This is unrelated to this code change and can be ignored.

Coverage can be fixed in a separate PR.

cookpate
cookpate previously approved these changes Mar 25, 2025
@aggarg
Copy link
Member

aggarg commented Mar 26, 2025

The current context save code clobbers the saved vstart and vcsr registers when mcause and epc are saved. This results in vstart and vcsr registers getting programmed to incorrect value when context is restored. The following patch address this issue and contains some other minor suggestions: 0001-Code-review-suggestions.patch. Please apply this patch and refresh from the upstream main.

@cubidesj cubidesj dismissed stale reviews from cookpate and kstribrnAmzn via 26e5060 March 27, 2025 08:25
@cubidesj
Copy link
Contributor Author

Thanks for your suggestions @aggarg. I applied your patch.

@aggarg
Copy link
Member

aggarg commented Mar 27, 2025

Thank you @cubidesj ! Please refresh from upstream main branch to enable us to merge this PR.

@aggarg aggarg merged commit 0030d60 into FreeRTOS:main Mar 27, 2025
17 checks passed
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.

5 participants