diff options
author | Tadeusz Struk <tadeusz.struk@intel.com> | 2018-08-22 10:01:11 -0700 |
---|---|---|
committer | Philip Tricca <philip.b.tricca@intel.com> | 2018-08-24 08:09:16 -0700 |
commit | 3f2489b1c4572f203fb5c57b26364f9469ad716c (patch) | |
tree | b2fc270e63d2206934a0fca1de556b8efde592e8 /test | |
parent | 310abc4f8bfb98eb7e922d17f618ba7a2077bcd3 (diff) | |
download | tpm2-tss-3f2489b1c4572f203fb5c57b26364f9469ad716c.tar.gz |
tcti-device: enable nonblocking mode on tcti-device
Enable non-blocking mode on tcti-device. This new feature
requires the TPM driver to support asynchronous mode of operation.
(As of kernel v3.18 the driver doesn't support it)
It is therefor configure time enabled by a new flag called
enable-tcti-device-async (off by default)
There are two places where the new flag changes the behavior:
1. In tcti_device_get_poll_handles(), where if the flag is enabled,
the function will populate handles with the tcti_dev->fd,
set num_handles to 1, and return TSS2_RC_SUCCESS.
If the flag is not enabled the function returns
TSS2_TCTI_RC_NOT_IMPLEMENTED.
2. In tcti_device_receive(), where if the flag is not enabled
the only acceptable timeout value is TSS2_TCTI_TIMEOUT_BLOCK,
to enforce synchronous mode. If the flag is enabled the valid
timeout values are: -1 to block forever, 0 for nonblocking,
and any positive value as the actual timeout value in milliseconds.
The device interface will always be open in non-blocking mode
as the flag is ignored by the driver and invoking poll() currently
always returns with the POLLIN flag set.
When this feature will be supported by the driver and the
enable-tcti-device-async flag is not enabled the behavior
doesn't change because it it enforced to be synchronous
in tcti_device_get_poll_handles(), but if the flag is enabled
it will enable the asynchronous behavior of the tcti-device module.
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/tcti-device.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/unit/tcti-device.c b/test/unit/tcti-device.c index 4e0a9450..770c4a72 100644 --- a/test/unit/tcti-device.c +++ b/test/unit/tcti-device.c @@ -123,7 +123,12 @@ tcti_device_get_poll_handles_test (void **state) TSS2_RC rc; rc = Tss2_Tcti_GetPollHandles (ctx, handles, &num_handles); +#ifdef TCTI_ASYNC + assert_int_equal (rc, TSS2_RC_SUCCESS); + assert_int_equal (num_handles, 1); +#else assert_int_equal (rc, TSS2_TCTI_RC_NOT_IMPLEMENTED); +#endif } /* */ |