Skip to content

Commit

Permalink
Added capabilities to tsm_info
Browse files Browse the repository at this point in the history
Signed-off-by: Wojciech Ozga <[email protected]>
  • Loading branch information
wojciechozga committed Jun 20, 2024
1 parent a6a54ac commit 1aae73e
Showing 1 changed file with 61 additions and 17 deletions.
78 changes: 61 additions & 17 deletions src/sbi_cove.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -740,13 +740,21 @@ enum tvm_state {
[source, C]
-----
struct sbiret sbi_covh_get_tsm_info(unsigned long tsm_info_address,
unsigned long tsm_info_len);
unsigned long tsm_info_len);
-----
Writes up to `tsm_info_len` bytes of information at the physical memory address
specified by `tsm_info_address`. `tsm_info_len` should be the size of the
`tsm_info` struct below. The information returned by the call can be used to
determine the current state of the TSM, and configure parameters for other
TVM-related calls.
Reads the current TSM state, its configuration, and supported features. The
information returned by the call should be used to configure parameters for

This comment has been minimized.

Copy link
@gdhh

gdhh Jun 25, 2024

Contributor

The information returned by the call is intended to be used by the VMM to configure parameters for other TVM-related calls.

This comment has been minimized.

Copy link
@wojciechozga

wojciechozga Jun 25, 2024

Author Contributor

ok

other TVM-related calls.

`tsm_info_address` must be the 4B-aligned physical memory address to which the
TSM will write the content of the `tsm_info` struct.
`tsm_info_len` should be the size of the `tsm_info` struct below.
The entire buffer must reside in a physical memory region that the OS/VMM can

This comment has been minimized.

Copy link
@gdhh

gdhh Jun 25, 2024

Contributor

The entire buffer must reside in a physical memory region that the OS/VMM and TSM can access.

This comment has been minimized.

Copy link
@wojciechozga

wojciechozga Jun 25, 2024

Author Contributor

ok

access.

`tsm_info.tsm_capabilities` defines features supported by the TSM and hardware.
The OS/VMM can verify that the TSM and hardware support capability `i`, by
checking that the bit `i` is set, i.e., `tsm_info.tsm_capabilities & 1<<i > 0`.

This comment has been minimized.

Copy link
@gdhh

gdhh Jun 25, 2024

Contributor

The VMM can check the hardware capabilities on its own. IT is not clear here if you are asking the TSM to only what it supports or asking it to supply only those things supported by both the hardware and the TSM. The call could work either way. If you want to cove both, perhaps the best way to start is:
"... defines features supported by both the TSM and hardware."
In my view this makes it clearer that we are supplying features supported by both.
If you want to cover only those features supported by the TSM (as indicated by the constants in lines 772 - 775' perhaps this is a better first sentence.
" .... defines features supported by the TSM." or " ... defines hardware/software features supported by the TSM."

This comment has been minimized.

Copy link
@wojciechozga

wojciechozga Jun 25, 2024

Author Contributor

OS/VMM is interested in features supported by both TSM and hardware. There is no advantage for OS/VMM to know that there exist certain hardware feature that is not supported by the TSM. I will rephrase then to "... defines features supported by both the TSM and hardware."


*Returns* the number of bytes written to `tsm_info_address` on success.

Expand All @@ -761,30 +769,66 @@ enum tsm_state {
TSM_READY = 2
};
#define COVE_TSM_CAP_PROMOTE_TO_TVM 0x1
#define COVE_TSM_CAP_LOCAL_ATTESTATION 0x2

This comment has been minimized.

Copy link
@gdhh

gdhh Jul 3, 2024

Contributor

We should add
#define COVE_TSM_CAP_REMOTE_ATTESTATION

#define COVE_TSM_CAP_AIA 0x3
#define COVE_TSM_CAP_DYN_PAGE_CONVERSION 0x4
struct tsm_info {
/*
* The current state of the TSM (see tsm_state enum above).
* If the state is not TSM_READY, the remaining fields are invalid and will
* be initialized to 0.
* The current state of the TSM (see `tsm_state` enum above).
* If the state is not `TSM_READY`, the remaining fields are invalid and
* will be initialized to `0`.
*/
uint32_t tsm_state;
/* Version number of the running TSM. */
/*
* Identifier of the TSM implementation.
* It is intended to distinguish among different TSM implementations,
* potentially managed by different organizations, that might target
* different deployment models and, thus, implement subset of CoVE spec.
*/
uint32_t tsm_impl_id;
/*
* Version number of the running TSM.
*/
uint32_t tsm_version;
/*
* CoVE features supported by the running TSM.
* Enabled bit `i` indicates that the TSM and underly supports capability `i` and there

This comment has been minimized.

Copy link
@gdhh

gdhh Jun 25, 2024

Contributor

I do not understand line 797

This comment has been minimized.

Copy link
@wojciechozga

wojciechozga Jun 25, 2024

Author Contributor

Every bit in this field corresponds to a capability defined by COVE_TSM_CAP_* constants. Presence of bit i indicates that both the TSM and hardware support the corresponding capability.

* is hardware support.
*/
uint64_t tsm_capabilities;
/*
* The number of 4KiB pages which must be donated to the TSM for storing TVM
* state in sbi_covh_create_tvm_vcpu().
* state in sbi_covh_create_tvm_vcpu(). `0` if the TSM does not support the
* dynamic page conversion capability.
*/
unsigned long tvm_state_pages;
/* The maximum number of vCPUs a TVM can support. */
unsigned long tvm_max_vcpus;
uint64_t tvm_state_pages;
/*
* The maximum number of vCPUs a TVM can support.
*/
uint64_t tvm_max_vcpus;
/*
* The number of 4KB pages which must be donated to the TSM when
* creating a new vCPU.
* The number of 4KiB pages which must be donated to the TSM when creating
* a new vCPU. `0` if the TSM does not support the dynamic page conversion
* capability.
*/
unsigned long tvm_vcpu_state_pages;
uint64_t tvm_vcpu_state_pages;
};
------


[#table_sbi_covh_get_tsm_info_capabilities]
.COVE TSM Capabilities
[cols="3,3", width=90%, align="center", options="header"]
|===
| Bit | Name | Definition
| 1 | COVE_TSM_CAP_PROMOTE_TO_TVM | TSM supports single-step TVM creation.
| 2 | COVE_TSM_CAP_LOCAL_ATTESTATION | TSM supports local attestation.
| 3 | COVE_TSM_CAP_AIA | TSM supports RISC-V AIA
| 4 | COVE_TSM_CAP_DYN_PAGE_CONVERSION | TSM supports dynamic page conversion.
|===

The possible error codes returned in `sbiret.error` are shown below.

[#table_sbi_covh_get_tsm_info_errors]
Expand Down

1 comment on commit 1aae73e

@gdhh
Copy link
Contributor

@gdhh gdhh commented on 1aae73e Jun 25, 2024

Choose a reason for hiding this comment

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

My comments are in the text above.

Please sign in to comment.