hw/tpm: Make TRACE_TPM_UTIL_SHOW_BUFFER check local to tpm_util.c
The trace_event_get_state_backends() call is useful to avoid making extensive calls (usually preparing arguments passed to the tracing framework. In this case, the extensive work is done in tpm_util_show_buffer(), and the arguments used to call it don't involve extra processing. Simplify by moving the TRACE_TPM_UTIL_SHOW_BUFFER check to tpm_util_show_buffer. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-id: 20200612085444.8362-9-philmd@redhat.com Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
6807256517
commit
f670a562af
@ -78,9 +78,7 @@ static void tpm_tis_sts_set(TPMLocality *l, uint32_t flags)
|
|||||||
*/
|
*/
|
||||||
static void tpm_tis_tpm_send(TPMState *s, uint8_t locty)
|
static void tpm_tis_tpm_send(TPMState *s, uint8_t locty)
|
||||||
{
|
{
|
||||||
if (trace_event_get_state_backends(TRACE_TPM_UTIL_SHOW_BUFFER)) {
|
tpm_util_show_buffer(s->buffer, s->be_buffer_size, "To TPM");
|
||||||
tpm_util_show_buffer(s->buffer, s->be_buffer_size, "To TPM");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* rw_offset serves as length indicator for length of data;
|
* rw_offset serves as length indicator for length of data;
|
||||||
@ -246,9 +244,7 @@ void tpm_tis_request_completed(TPMState *s, int ret)
|
|||||||
s->loc[locty].state = TPM_TIS_STATE_COMPLETION;
|
s->loc[locty].state = TPM_TIS_STATE_COMPLETION;
|
||||||
s->rw_offset = 0;
|
s->rw_offset = 0;
|
||||||
|
|
||||||
if (trace_event_get_state_backends(TRACE_TPM_UTIL_SHOW_BUFFER)) {
|
tpm_util_show_buffer(s->buffer, s->be_buffer_size, "From TPM");
|
||||||
tpm_util_show_buffer(s->buffer, s->be_buffer_size, "From TPM");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TPM_TIS_IS_VALID_LOCTY(s->next_locty)) {
|
if (TPM_TIS_IS_VALID_LOCTY(s->next_locty)) {
|
||||||
tpm_tis_abort(s);
|
tpm_tis_abort(s);
|
||||||
|
@ -357,6 +357,9 @@ void tpm_util_show_buffer(const unsigned char *buffer,
|
|||||||
size_t len, i;
|
size_t len, i;
|
||||||
char *line_buffer, *p;
|
char *line_buffer, *p;
|
||||||
|
|
||||||
|
if (!trace_event_get_state_backends(TRACE_TPM_UTIL_SHOW_BUFFER)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
len = MIN(tpm_cmd_get_size(buffer), buffer_size);
|
len = MIN(tpm_cmd_get_size(buffer), buffer_size);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user