Skip to content

Commit

Permalink
[racl,racl_ctrl,doc] Allow description for RACL policies
Browse files Browse the repository at this point in the history
Signed-off-by: David Schrammel <[email protected]>
  • Loading branch information
davidschrammel committed Feb 11, 2025
1 parent 1c814a0 commit 9f6cebf
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 18 deletions.
6 changes: 3 additions & 3 deletions hw/ip_templates/racl_ctrl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ racl_mappings: {
}
policies: {
Null: [
// Standard policies allowing all roles to access a register
{ name: "ALL_RD_WR"
desc: "Standard policies allowing all roles to access a register"
allowed_rd: [ "ROT", "ROLE1", "SOC" ]
allowed_wr: [ "ROT", "ROLE1", "SOC" ]
}
// Standard policies allowing only the ROT role to access a register
{ name: "ROT_PRIVATE"
desc: "Standard policies allowing only the ROT role to access a register"
rot_private: true
allowed_rd: [ "ROT" ]
allowed_wr: [ "ROT" ]
}
// Custom policy
{ name: "SOC_ROT"
desc: "Custom policy"
allowed_rd: [ "ROT", "SOC" ]
allowed_wr: [ "ROT", "SOC" ]
}
Expand Down
3 changes: 3 additions & 0 deletions hw/top_darjeeling/data/autogen/top_darjeeling.gen.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -17719,6 +17719,7 @@
[
{
name: ALL_RD_WR
desc: Standard policies allowing all roles to access a register
allowed_rd:
[
ROT
Expand All @@ -17737,6 +17738,7 @@
{
name: ROT_PRIVATE
rot_private: true
desc: Standard policies allowing only the ROT role to access a register
allowed_rd:
[
ROT
Expand All @@ -17750,6 +17752,7 @@
}
{
name: SOC_ROT
desc: Custom policy
allowed_rd:
[
ROT
Expand Down
6 changes: 3 additions & 3 deletions hw/top_darjeeling/data/racl/racl.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
}
policies: {
Null: [
// Standard policies allowing all roles to access a register
{ name: "ALL_RD_WR"
desc: "Standard policies allowing all roles to access a register"
allowed_rd: [ "ROT", "ROLE1", "SOC" ]
allowed_wr: [ "ROT", "ROLE1", "SOC" ]
}
// Standard policies allowing only the ROT role to access a register
{ name: "ROT_PRIVATE"
rot_private: true
desc: "Standard policies allowing only the ROT role to access a register"
allowed_rd: [ "ROT" ]
allowed_wr: [ "ROT" ]
}
// Custom policy
{ name: "SOC_ROT"
desc: "Custom policy"
allowed_rd: [ "ROT", "SOC" ]
allowed_wr: [ "ROT", "SOC" ]
}
Expand Down
6 changes: 3 additions & 3 deletions hw/top_darjeeling/ip_autogen/racl_ctrl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ racl_mappings: {
}
policies: {
Null: [
// Standard policies allowing all roles to access a register
{ name: "ALL_RD_WR"
desc: "Standard policies allowing all roles to access a register"
allowed_rd: [ "ROT", "ROLE1", "SOC" ]
allowed_wr: [ "ROT", "ROLE1", "SOC" ]
}
// Standard policies allowing only the ROT role to access a register
{ name: "ROT_PRIVATE"
desc: "Standard policies allowing only the ROT role to access a register"
rot_private: true
allowed_rd: [ "ROT" ]
allowed_wr: [ "ROT" ]
}
// Custom policy
{ name: "SOC_ROT"
desc: "Custom policy"
allowed_rd: [ "ROT", "SOC" ]
allowed_wr: [ "ROT", "SOC" ]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[
{
name: ALL_RD_WR
desc: Standard policies allowing all roles to access a register
allowed_rd:
[
ROT
Expand All @@ -32,6 +33,7 @@
{
name: ROT_PRIVATE
rot_private: true
desc: Standard policies allowing only the ROT role to access a register
allowed_rd:
[
ROT
Expand All @@ -45,6 +47,7 @@
}
{
name: SOC_ROT
desc: Custom policy
allowed_rd:
[
ROT
Expand Down
10 changes: 5 additions & 5 deletions hw/top_darjeeling/ip_autogen/racl_ctrl/doc/racl_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

### RACL group: Null

| Policy Name | Index |
|:--------------|--------:|
| ALL_RD_WR | 0 |
| ROT_PRIVATE | 1 |
| SOC_ROT | 2 |
| Policy Name | Index | Description |
|:--------------|--------:|:------------------------------------------------------------------|
| ALL_RD_WR | 0 | Standard policies allowing all roles to access a register |
| ROT_PRIVATE | 1 | Standard policies allowing only the ROT role to access a register |
| SOC_ROT | 2 | Custom policy |


## RACL configuration
Expand Down
7 changes: 3 additions & 4 deletions util/raclgen/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,13 @@ def gen_md_header(racl_config: Dict[str, object], output: TextIO = sys.stdout):
output.write(title('RACL groups', 2))
output.write('\n')

header = ['Policy Name', 'Index']
header = ['Policy Name', 'Index', 'Description']

for racl_group in racl_config['policies']:
policies_for_racl_group = racl_config['policies'][racl_group]
policy_names = [policy['name'] for policy in policies_for_racl_group]
rows: List[List[str]] = []
for policy_idx, policy_name in enumerate(policy_names):
rows.append([policy_name, str(policy_idx)])
for policy_idx, policy in enumerate(policies_for_racl_group):
rows.append([policy['name'], str(policy_idx), policy.get('desc', '')])

output.write(title(f'RACL group: {racl_group}', 3))
output.write(table(header, rows))
Expand Down

0 comments on commit 9f6cebf

Please sign in to comment.