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

core: firewall: add firewall framework #6837

Merged
merged 1 commit into from
May 28, 2024

Conversation

GseoC
Copy link
Contributor

@GseoC GseoC commented May 15, 2024

The need for such framework arises from the fact that there are multiple hardware firewalls implemented across multiple products. When it comes to firewalls, the purpose mostly stays the same: protect and filter hardware resources.

Add a firewall framework that offers:

Firewall device consumers APIs to check, acquire accesses against firewall controllers and firewall reconfiguration as there are cases when a firewall configuration could be dynamic.
Firewall controllers APIs to register/unregister to the framework and populate their bus.
This firewall framework relies on the access-controllers device tree binding that was acked in the Linux kernel and is present in the Linux-next branch.
How the arguments passed along with this property and how they're used by the controllers to filter the accesses or set configurations is platform-specific AND specific to the firewall controller. Meaning that all the filtering logic should be present in the firewall controller drivers. Firewall consumers do not have the knowledge on the controller and should rely on the device API.

Copy link
Contributor

@jforissier jforissier left a comment

Choose a reason for hiding this comment

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

Hi @GseoC,

Some comments below, mostly cosmetic. Thanks!

core/include/drivers/firewall.h Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Show resolved Hide resolved
core/drivers/firewall/firewall.c Outdated Show resolved Hide resolved
core/drivers/firewall/firewall.c Outdated Show resolved Hide resolved
core/drivers/firewall/firewall.c Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Outdated Show resolved Hide resolved
core/include/drivers/firewall.h Outdated Show resolved Hide resolved
@GseoC
Copy link
Contributor Author

GseoC commented May 15, 2024

Updated with comments applied

core/include/drivers/firewall.h Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Outdated Show resolved Hide resolved
core/drivers/firewall/firewall.c Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Outdated Show resolved Hide resolved
core/drivers/firewall/firewall.c Outdated Show resolved Hide resolved
core/include/drivers/firewall.h Show resolved Hide resolved
core/include/drivers/firewall_device.h Show resolved Hide resolved
core/include/drivers/firewall.h Outdated Show resolved Hide resolved
core/include/drivers/firewall.h Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Outdated Show resolved Hide resolved
core/include/drivers/firewall.h Outdated Show resolved Hide resolved
core/drivers/firewall/firewall.c Outdated Show resolved Hide resolved
core/include/drivers/firewall.h Outdated Show resolved Hide resolved
@GseoC
Copy link
Contributor Author

GseoC commented May 22, 2024

Updated with comments addressed. I also modified a bit more some comments. I can squash the commits on-demand.

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Some last comments. I'm fine with the proposed API. As for me, I can you squash all fixup commits.

core/drivers/firewall/firewall.c Outdated Show resolved Hide resolved
core/include/drivers/firewall.h Show resolved Hide resolved
core/include/drivers/firewall.h Outdated Show resolved Hide resolved
core/include/drivers/firewall.h Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Outdated Show resolved Hide resolved
core/include/drivers/firewall_device.h Show resolved Hide resolved
@GseoC
Copy link
Contributor Author

GseoC commented May 24, 2024

Updated with review commits squashed and comments applied

@GseoC
Copy link
Contributor Author

GseoC commented May 24, 2024

Updated with @etienne-lms last suggetion

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

The API look good to me. last comment on trace messages. With that addressed,
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>

core/drivers/firewall/firewall.c Outdated Show resolved Hide resolved
core/drivers/firewall/firewall.c Outdated Show resolved Hide resolved
Add a generic firewall controller framework. The goal of this framework
is to offer access control and configuration APIs, that are implemented
in the firewall controllers drivers, to the firewall consumers. This
framework requires an embedded device tree.

A firewall controller is an access controller [1]. It should register
itself as a provider to the framework. Firewall controllers have the
possibility to populate their bus according to defined firewall accesses
defined in the "access-controllers" property in each of the device's
node.

Any device that consumes one or more firewall should refer it/them in
their "access-controllers" property. Arguments can be passed along with
the phandle of the firewall controller(s).

Link: https://patchwork.kernel.org/project/linux-media/patch/20240105130404.301172-2-gatien.chevallier@foss.st.com/ [1]
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
@GseoC
Copy link
Contributor Author

GseoC commented May 28, 2024

Updated with last comments and review tag applied, thanks!

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

I'm fine with the DT bindings. As i've been told, access-controllers DT bindings and stm32 etzpc driver have been merged in Linux source tree v6.10-rc1 (commits d7218d and 2eeb74).

@jforissier jforissier merged commit 48a1cce into OP-TEE:master May 28, 2024
7 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.

None yet

3 participants