1. 31 1月, 2018 32 次提交
  2. 30 1月, 2018 8 次提交
    • P
      Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2018-01-26-2' into staging · 6521130b
      Peter Maydell 提交于
      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 <stefanb@linux.vnet.ibm.com>"
      # 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: NPeter Maydell <peter.maydell@linaro.org>
      6521130b
    • P
      linux-user/signal.c: Rename MC_* defines · 8ebb314b
      Peter Maydell 提交于
      The SPARC code in linux-user/signal.c defines a set of
      MC_* constants. On some SPARC hosts these are also defined
      by sys/ucontext.h, resulting in build failures:
      
      linux-user/signal.c:2786:0: error: "MC_NGREG" redefined [-Werror]
       #define MC_NGREG 19
      
      In file included from /usr/include/signal.h:302:0,
                       from include/qemu/osdep.h:86,
                       from linux-user/signal.c:19:
      /usr/include/sparc64-linux-gnu/sys/ucontext.h:59:0: note: this is the location of the previous definition
       # define MC_NGREG __MC_NGREG
      
      Rename all these constants to SPARC_MC_* to avoid the clash.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Message-id: 1517318239-15764-1-git-send-email-peter.maydell@linaro.org
      8ebb314b
    • P
      Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging · 11ed801d
      Peter Maydell 提交于
      # gpg: Signature made Mon 29 Jan 2018 15:49:05 GMT
      # gpg:                using RSA key 0x9CA4ABB381AB73C8
      # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
      # gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
      # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8
      
      * remotes/stefanha/tags/tracing-pull-request:
        tracetool: report error on foo() instead of foo(void)
        tracetool: clarify that "formats" means "format strings"
        tracetool: prefix parse errors with line numbers
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      11ed801d
    • M
      tpm: add CRB device · 4ab6cb4c
      Marc-André Lureau 提交于
      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: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      4ab6cb4c
    • M
      tpm: report backend request error · 6a8a2354
      Marc-André Lureau 提交于
      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: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      6a8a2354
    • M
      tpm: replace GThreadPool with AIO threadpool · c4fb8561
      Marc-André Lureau 提交于
      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: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      c4fb8561
    • M
      tpm: lookup cancel path under tpm device class · 05b71fb2
      Marc-André Lureau 提交于
      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: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      05b71fb2
    • M
      tpm: fix alignment issues · cc1b6c55
      Marc-André Lureau 提交于
      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: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      cc1b6c55