Skip to content

Commit

Permalink
Merge pull request #145 from iamKarthikBK/fix-satp-checks
Browse files Browse the repository at this point in the history
Fix satp checks
  • Loading branch information
neelgala authored Sep 20, 2023
2 parents e0bbdb6 + 5693051 commit 1fa3713
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.13.2] - 2023-09-20
- Perform satp checks only when the CSR is accessible.

## [3.13.1] - 2023-08-21
- Add support for Code Size Reduction (Zce) extension

Expand Down
2 changes: 1 addition & 1 deletion riscv_config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
__version__ = '3.13.1'
__version__ = '3.13.2'
43 changes: 22 additions & 21 deletions riscv_config/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1367,29 +1367,30 @@ def check_supervisor(spec, logging=False):
msb = 63 if xlen == 64 else 31
lsb = 60 if xlen == 64 else 31
virt_modes = [1] if xlen == 32 else [8,9,10,11]
satp_mode_impl = spec['satp'][f'rv{xlen}']['mode']['implemented']
satp_mode_type = spec['satp'][f'rv{xlen}']['mode']['type']
virtualization_possible = False
if 'ro_constant' in satp_mode_type:
if satp_mode_type['ro_constant'] == 0:
virtualization_possible = False
else:
virtualization_possible = True
elif 'warl' in satp_mode_type:
# these are the checks from _check_with_satp_modes64
if xlen == 64:
warl_inst = warl_class(satp_mode_type['warl'], 'satp::mode',63, 60)
for x in [1,2,3,4,5,6,7,11,12,13]:
if spec['satp'][f'rv{xlen}']['accessible']: # perform satp checks only if it is accessible
satp_mode_impl = spec['satp'][f'rv{xlen}']['mode']['implemented']
satp_mode_type = spec['satp'][f'rv{xlen}']['mode']['type']
virtualization_possible = False
if 'ro_constant' in satp_mode_type:
if satp_mode_type['ro_constant'] == 0:
virtualization_possible = False
else:
virtualization_possible = True
elif 'warl' in satp_mode_type:
# these are the checks from _check_with_satp_modes64
if xlen == 64:
warl_inst = warl_class(satp_mode_type['warl'], 'satp::mode',63, 60)
for x in [1,2,3,4,5,6,7,11,12,13]:
err = warl_inst.islegal(x)
if not err:
errors['satp_mode_checks'] = f'warl function for satp::mode accepts \
"{x}" as a legal value - which is incorrect'
warl_inst = warl_class(satp_mode_type['warl'], 'satp::mode', msb, lsb, spec)
for x in virt_modes:
err = warl_inst.islegal(x)
if not err:
errors['satp_mode_checks'] = f'warl function for satp::mode accepts \
"{x}" as a legal value - which is incorrect'
warl_inst = warl_class(satp_mode_type['warl'], 'satp::mode', msb, lsb, spec)
for x in virt_modes:
err = warl_inst.islegal(x)
if not err:
virtualization_possible = True
break
virtualization_possible = True
break

if pte_ad_hw_update and not virtualization_possible:
errors['pte_ad_hw_update'] = ['pte_ad_hw_update should be True only if satp.mode can be \
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.13.1
current_version = 3.13.2
commit = True
tag = True

Expand Down

0 comments on commit 1fa3713

Please sign in to comment.