Skip to content

Conversation

@miguelafsilva5
Copy link
Member

@miguelafsilva5 miguelafsilva5 commented Oct 17, 2025

PR description

This PR introduces support for slave-side MMIO protection. This is needed on MCU platforms that otherwise would require each device to be mapped in the MPU. With this PR, the entire MMIO region(s) is mapped on the MPU and each architecture/platform needs to implement a functions that enables and controls the access to each device. This function is called during vm device initialization.

It is important to note that, when installing an emul handler for a device inside the mmio region, if slave side mmio protection is enabled, we have to unmap the device memory range.

This PR was only tested for TC4, as it is the current platform that needs this feature. Before accepting the PR we have to make sure all other platforms are running as expected.

@miguelafsilva5 miguelafsilva5 force-pushed the feat/slave-side-prot branch 3 times, most recently from a2a4944 to e239802 Compare October 24, 2025 12:28
Base automatically changed from ref/as to main October 31, 2025 11:39
@josecm
Copy link
Member

josecm commented Nov 4, 2025

@miguelafsilva5 please resolve conflicts

@miguelafsilva5 miguelafsilva5 force-pushed the feat/slave-side-prot branch 3 times, most recently from 7849408 to b0a283a Compare November 4, 2025 14:04
@josecm
Copy link
Member

josecm commented Nov 12, 2025

@miguelafsilva5 please resolve conflicts again. Ping me as soon as it is done so it doesn't happen again with other PRs accepted to main.

The mmio regions present in the platform description are to be mapped
accessible for all address spaces.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Each architecture needs to implement their access control function.
This function is called during the dev init for vms, and is executed instead
of the original memory mapping.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
@miguelafsilva5
Copy link
Member Author

@miguelafsilva5 please resolve conflicts again. Ping me as soon as it is done so it doesn't happen again with other PRs accepted to main.

@josecm should be fixed

@josecm
Copy link
Member

josecm commented Nov 13, 2025

@danielRep @DavidMCerdeira please review this PR

Comment on lines +207 to +213

ifeq ($(mmio_slave_side_prot),y)
build_macros+=-DMMIO_SLAVE_SIDE_PROT

ifneq ($(arch_mem_prot),mpu)
$(error mmio_slave_side_prot=y requires arch_mem_prot=mpu)
endif
Copy link
Member

Choose a reason for hiding this comment

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

deleted by mistake?

ifeq ($(phys_irqs_only),y)
	build_macros+=-DPHYS_IRQS_ONLY


cpu_sync_init(&vm->sync, vm->cpu_num);

vm_mem_prot_init(vm, vm_config);
Copy link
Member

@josecm josecm Nov 14, 2025

Choose a reason for hiding this comment

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

Also deleted by mistake? Why are we removing this?

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.

4 participants