Skip to content

Add support for OCP protocol - #20

Draft
n-ramacciotti wants to merge 4 commits into
coconut-svsm:svsmfrom
n-ramacciotti:ocp_module
Draft

Add support for OCP protocol#20
n-ramacciotti wants to merge 4 commits into
coconut-svsm:svsmfrom
n-ramacciotti:ocp_module

Conversation

@n-ramacciotti

@n-ramacciotti n-ramacciotti commented Jun 24, 2026

Copy link
Copy Markdown

RFC PR for observability and configuration protocol

This is the linux-side handler.

It is still a work in progress. For now it is only used to test SVSM_OCP_LIST request.
It contains the platform device and driver registration + all the ocp calls implementation.

This contains a [test] commit with a module that can be loaded and will do a single call to SVSM_OCP_LIST during initialization. The parameter of this call can be changed based on a configuration parameter that can be specified when inserting the module. This can be inserted and removed multiple times.

see PR coconut-svsm/svsm#1138

@n-ramacciotti

Copy link
Copy Markdown
Author

v2:

  • Introduced support for read and write
  • Introduced testing for write operation

@n-ramacciotti
n-ramacciotti force-pushed the ocp_module branch 8 times, most recently from 7c5394b to 1b7a412 Compare July 8, 2026 11:48
@n-ramacciotti

n-ramacciotti commented Jul 22, 2026

Copy link
Copy Markdown
Author

v3:

  • updated svsm calls to account for the two list functionalities
  • add platform driver with basic registration and memory allocation (similarly to vtpm)
  • add platform device (similarly to vtpm)

TODO:

  • add ioctl interface

Add and export some utitily functions to interact with svsm as defined in
the ocp draft protocol.

Signed-off-by: Nicola Ramacciotti <niko.ramak@gmail.com>
Add a minimal driver for svsm ocp protocol.

Signed-off-by: Nicola Ramacciotti <niko.ramak@gmail.com>
Add `ocp-svsm` device that can be handled by the platform driver added in
the previous commits in `drivers/char/ocp_svsm.c`

TODO:
Register the platform device only when SVSM is available and it supports
OCP calls.

Signed-off-by: Nicola Ramacciotti <niko.ramak@gmail.com>
@n-ramacciotti

n-ramacciotti commented Jul 24, 2026

Copy link
Copy Markdown
Author

v4:

  • added ioctl interface
  • formatted based on scripts/checkpatch.pl feedback:
    • used kzalloc_obj instead of kzalloc
    • other formatting issues

Tested locally (without SNP, but with fake replies and a very basic userspace application)

TODO:

  • test with snp
  • Introduce userspace application (will be in a separate repository)
  • for the moment one ioctl call is one svsm call, but it is possible to query svsm multiple times if user requires more bytes than max allowed in a single svsm call
  • return bytes_read/written, number of sources/object as ioctl return value instead of 0?
  • write call in ioctl is a copy-paste of read and should be fixed
  • Does it make sense to keep "Source" and "Details" in uapi? As these are not used by kernel but only by svsm and guest

@n-ramacciotti
n-ramacciotti force-pushed the ocp_module branch 4 times, most recently from 9b25fc1 to 8326c56 Compare July 28, 2026 10:03
@n-ramacciotti

n-ramacciotti commented Jul 28, 2026

Copy link
Copy Markdown
Author

v5:

  • added WITH Linux-syscall-note in ocp_svsm.h
  • fixed typo in list_object_sources where list_objects was used instead of list_sources
  • Add support for missing struct in uapi (object_details)
  • Add size assertion in uapi
  • Fixed write source call

Other todo in #20 (comment) are open

@n-ramacciotti
n-ramacciotti force-pushed the ocp_module branch 2 times, most recently from f0a50c2 to f1aa9c7 Compare July 29, 2026 10:20
todo

Signed-off-by: Nicola Ramacciotti <niko.ramak@gmail.com>
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.

1 participant