qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 302705: tpm: Set the flags of the CMD_INIT co


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 302705: tpm: Set the flags of the CMD_INIT command to 0
Date: Tue, 30 Jan 2018 08:53:03 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 302705876492a39f568035ce346e2c9176f5665e
      
https://github.com/qemu/qemu/commit/302705876492a39f568035ce346e2c9176f5665e
  Author: Stefan Berger <address@hidden>
  Date:   2018-01-29 (Mon, 29 Jan 2018)

  Changed paths:
    M hw/tpm/tpm_emulator.c

  Log Message:
  -----------
  tpm: Set the flags of the CMD_INIT command to 0

The flags of the CMD_INIT control channel command were not
initialized properly. Fix this and set to 0.

Signed-off-by: Stefan Berger <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>


  Commit: cc1b6c5533b77eac7caea269897b03a940797a8c
      
https://github.com/qemu/qemu/commit/cc1b6c5533b77eac7caea269897b03a940797a8c
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-01-29 (Mon, 29 Jan 2018)

  Changed paths:
    M hw/tpm/tpm_emulator.c
    M hw/tpm/tpm_passthrough.c
    M hw/tpm/tpm_util.c
    M hw/tpm/tpm_util.h

  Log Message:
  -----------
  tpm: fix alignment issues

The new tpm-crb-test fails on sparc host:

TEST: tests/tpm-crb-test... (pid=230409)
  /i386/tpm-crb/test:
Broken pipe
FAIL
GTester: last random seed: R02S29cea50247fe1efa59ee885a26d51a85
(pid=230423)
FAIL: tests/tpm-crb-test

and generates a new clang sanitizer runtime warning:

/home/petmay01/linaro/qemu-for-merges/hw/tpm/tpm_util.h:36:24: runtime
error: load of misaligned address 0x7fdc24c00002 for type 'const
uint32_t' (aka 'const unsigned int'), which requires 4 byte alignment
0x7fdc24c00002: note: pointer points here
<memory cannot be printed>

The sparc architecture does not allow misaligned loads and will
segfault if you try them.  For example, this function:

static inline uint32_t tpm_cmd_get_size(const void *b)
{
    return be32_to_cpu(*(const uint32_t *)(b + 2));
}

Should read,
    return ldl_be_p(b + 2);

As a general rule you can't take an arbitrary pointer into a byte
buffer and try to interpret it as a structure or a pointer to a
larger-than-bytesize-data simply by casting the pointer.

Use this clean up as an opportunity to remove unnecessary temporary
buffers and casts.

Reported-by: Peter Maydell <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Stefan Berger <address@hidden>
Signed-off-by: Stefan Berger <address@hidden>


  Commit: 05b71fb207ab7f016e067bd2a40fc0804362eb74
      
https://github.com/qemu/qemu/commit/05b71fb207ab7f016e067bd2a40fc0804362eb74
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-01-29 (Mon, 29 Jan 2018)

  Changed paths:
    M hw/tpm/tpm_passthrough.c

  Log Message:
  -----------
  tpm: lookup cancel path under tpm device class

Since Linux commit 313d21eeab9282e, tpm devices have their own device
class "tpm" and the cancel path must be looked up under
/sys/class/tpm/ instead of /sys/class/misc/.

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Stefan Berger <address@hidden>
Signed-off-by: Stefan Berger <address@hidden>


  Commit: c4fb8561bcec5f3ae3ae2d8a688d1e1aeb247a91
      
https://github.com/qemu/qemu/commit/c4fb8561bcec5f3ae3ae2d8a688d1e1aeb247a91
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-01-29 (Mon, 29 Jan 2018)

  Changed paths:
    M backends/tpm.c
    M include/sysemu/tpm_backend.h

  Log Message:
  -----------
  tpm: replace GThreadPool with AIO threadpool

The TPM backend uses a GThreadPool to handle IO in a seperate
thread. However, GThreadPool isn't integrated with Qemu main loops,
making it unnecessarily complicated to deal with.

Qemu has a AIO threadpool, that is better integrated with loops and
various IO functions, provides completion BH by default etc.

Remove the only user of GThreadPool from qemu, use AIO threadpool.

Note that the backend:
- no longer accepts queing multiple requests (unneeded so far)
- increase ref to itself when handling a command, for extra safety
- tpm_backend_thread_end() is renamed tpm_backend_finish_sync() and
will wait for completion of BH (request_completed), which will help
migration handling.

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Stefan Berger <address@hidden>
Signed-off-by: Stefan Berger <address@hidden>


  Commit: 6a8a23549a6ddb4af47b032db76badf131c5c2e6
      
https://github.com/qemu/qemu/commit/6a8a23549a6ddb4af47b032db76badf131c5c2e6
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-01-29 (Mon, 29 Jan 2018)

  Changed paths:
    M backends/tpm.c
    M hw/tpm/tpm_emulator.c
    M hw/tpm/tpm_passthrough.c
    M hw/tpm/tpm_tis.c
    M include/sysemu/tpm.h
    M include/sysemu/tpm_backend.h

  Log Message:
  -----------
  tpm: report backend request error

Use an Error** for request to let the caller handle error reporting.

This will also allow to inform the frontend of a backend error.

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Stefan Berger <address@hidden>
Signed-off-by: Stefan Berger <address@hidden>


  Commit: 4ab6cb4c62273bb46102e5ae1d6af691b47cbcd8
      
https://github.com/qemu/qemu/commit/4ab6cb4c62273bb46102e5ae1d6af691b47cbcd8
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-01-29 (Mon, 29 Jan 2018)

  Changed paths:
    M default-configs/i386-softmmu.mak
    M default-configs/x86_64-softmmu.mak
    M hw/i386/acpi-build.c
    M hw/tpm/Makefile.objs
    A hw/tpm/tpm_crb.c
    M include/hw/acpi/tpm.h
    M include/sysemu/tpm.h
    M qapi/tpm.json
    M tests/Makefile.include
    A tests/tpm-crb-test.c

  Log Message:
  -----------
  tpm: add CRB device

tpm_crb is a device for TPM 2.0 Command Response Buffer (CRB)
Interface as defined in TCG PC Client Platform TPM Profile (PTP)
Specification Family “2.0” Level 00 Revision 01.03 v22.

The PTP allows device implementation to switch between TIS and CRB
model at run time, but given that CRB is a simpler device to
implement, I chose to implement it as a different device.

The device doesn't implement other locality than 0 for now (my laptop
TPM doesn't either, so I assume this isn't so bad)

Tested with some success with Linux upstream and Windows 10, seabios &
modified ovmf. The device is recognized and correctly transmit
command/response with passthrough & emu. However, we are missing PPI
ACPI part atm.

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Stefan Berger <address@hidden>
Signed-off-by: Stefan Berger <address@hidden>


  Commit: 6521130b0a7f699fdb82446d57df5627bfa7ed3c
      
https://github.com/qemu/qemu/commit/6521130b0a7f699fdb82446d57df5627bfa7ed3c
  Author: Peter Maydell <address@hidden>
  Date:   2018-01-30 (Tue, 30 Jan 2018)

  Changed paths:
    M backends/tpm.c
    M default-configs/i386-softmmu.mak
    M default-configs/x86_64-softmmu.mak
    M hw/i386/acpi-build.c
    M hw/tpm/Makefile.objs
    A hw/tpm/tpm_crb.c
    M hw/tpm/tpm_emulator.c
    M hw/tpm/tpm_passthrough.c
    M hw/tpm/tpm_tis.c
    M hw/tpm/tpm_util.c
    M hw/tpm/tpm_util.h
    M include/hw/acpi/tpm.h
    M include/sysemu/tpm.h
    M include/sysemu/tpm_backend.h
    M qapi/tpm.json
    M tests/Makefile.include
    A tests/tpm-crb-test.c

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/stefanberger/tags/pull-tpm-2018-01-26-2' into staging

Merge tpm 2018/01/26 v2

# gpg: Signature made Mon 29 Jan 2018 22:20:05 GMT
# gpg:                using RSA key 0x75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <address@hidden>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* remotes/stefanberger/tags/pull-tpm-2018-01-26-2:
  tpm: add CRB device
  tpm: report backend request error
  tpm: replace GThreadPool with AIO threadpool
  tpm: lookup cancel path under tpm device class
  tpm: fix alignment issues
  tpm: Set the flags of the CMD_INIT command to 0

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/8ebb314b9574...6521130b0a7f

reply via email to

[Prev in Thread] Current Thread [Next in Thread]