[Qemu-devel] [PATCH v2 0/9] Provide support for the software TPM

Amarnath Valluri posted 9 patches 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1491575431-32170-1-git-send-email-amarnath.valluri@intel.com
Test checkpatch failed
Test docker failed
Test s390x passed
There is a newer version of this series
backends/tpm.c                   | 121 +++--
configure                        |  15 +-
hmp.c                            |  31 +-
hw/tpm/Makefile.objs             |   1 +
hw/tpm/tpm_emulator.c            | 927 +++++++++++++++++++++++++++++++++++++++
hw/tpm/tpm_ioctl.h               | 243 ++++++++++
hw/tpm/tpm_passthrough.c         | 221 +++-------
hw/tpm/tpm_util.c                |  25 ++
hw/tpm/tpm_util.h                |   4 +
include/sysemu/tpm_backend.h     |  65 ++-
include/sysemu/tpm_backend_int.h |  41 --
qapi-schema.json                 |  67 ++-
qemu-options.hx                  |  53 ++-
tpm.c                            |  36 +-
14 files changed, 1529 insertions(+), 321 deletions(-)
create mode 100644 hw/tpm/tpm_emulator.c
create mode 100644 hw/tpm/tpm_ioctl.h
delete mode 100644 include/sysemu/tpm_backend_int.h
[Qemu-devel] [PATCH v2 0/9] Provide support for the software TPM
Posted by Amarnath Valluri 7 years ago
Briefly, Theses set of patches introduces:
  - new TPM backend driver to support software TPM emulators(swtpm(1)).
  - and few supported fixes/enhancements/cleanup to existing tpm backend code.

  The similar idea was initiated earliar(2) by Stefan Berger(CCed) with slightly
  different approach, using CUSE. As swtpm has excellent support for unix domain
  sockets, hence this implementation uses unix domain sockets to communicate
  with
  swtpm.

  When Qemu is configured with 'emulator' tpm backend, it spawns 'swtpm' and
  communicates its via Unix domain sockets.

  1) https://github.com/stefanberger/swtpm
  2) https://lists.nongnu.org/archive/html/qemu-devel/2016-01/msg00089.html

** Changes in V2:
- Made spawnning swtpm optional
- used QIOChannel instead of plain unix sockets
- incorporated other fixes pointed in v1 review

Amarnath Valluri (9):
  tpm-backend: Remove unneeded member variable from backend class
  tpm-backend: Move thread handling inside TPMBackend
  tpm-backend: Initialize and free data members in it's own methods
  tpm-backend: Made few interface methods optional
  tmp backend: Add new api to read backend TpmInfo
  tpm-backend: Remove unneeded destroy() method from TpmDriverOps
    interface
  tpm-backend: Move realloc_buffer() implementation to base class
  tpm-passthrough: move reusable code to utils
  tpm: Added support for TPM emulator

 backends/tpm.c                   | 121 +++--
 configure                        |  15 +-
 hmp.c                            |  31 +-
 hw/tpm/Makefile.objs             |   1 +
 hw/tpm/tpm_emulator.c            | 927 +++++++++++++++++++++++++++++++++++++++
 hw/tpm/tpm_ioctl.h               | 243 ++++++++++
 hw/tpm/tpm_passthrough.c         | 221 +++-------
 hw/tpm/tpm_util.c                |  25 ++
 hw/tpm/tpm_util.h                |   4 +
 include/sysemu/tpm_backend.h     |  65 ++-
 include/sysemu/tpm_backend_int.h |  41 --
 qapi-schema.json                 |  67 ++-
 qemu-options.hx                  |  53 ++-
 tpm.c                            |  36 +-
 14 files changed, 1529 insertions(+), 321 deletions(-)
 create mode 100644 hw/tpm/tpm_emulator.c
 create mode 100644 hw/tpm/tpm_ioctl.h
 delete mode 100644 include/sysemu/tpm_backend_int.h

-- 
2.7.4


Re: [Qemu-devel] [PATCH v2 0/9] Provide support for the software TPM
Posted by no-reply@patchew.org 7 years ago
Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 1491575431-32170-1-git-send-email-amarnath.valluri@intel.com
Subject: [Qemu-devel] [PATCH v2 0/9] Provide support for the software TPM
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
fb65a2b tpm: Added support for TPM emulator
0588e1b tpm-passthrough: move reusable code to utils
3dc626f tpm-backend: Move realloc_buffer() implementation to base class
3f0ba45 tpm-backend: Remove unneeded destroy() method from TpmDriverOps interface
2badc93 tmp backend: Add new api to read backend TpmInfo
8bb890f tpm-backend: Made few interface methods optional
e7a1f98 tpm-backend: Initialize and free data members in it's own methods
7e162a1 tpm-backend: Move thread handling inside TPMBackend
b739744 tpm-backend: Remove unneeded member variable from backend class

=== OUTPUT BEGIN ===
Checking PATCH 1/9: tpm-backend: Remove unneeded member variable from backend class...
Checking PATCH 2/9: tpm-backend: Move thread handling inside TPMBackend...
ERROR: space prohibited between function name and open parenthesis '('
#30: FILE: backends/tpm.c:27:
+    assert (k->handle_request != NULL);

total: 1 errors, 0 warnings, 308 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 3/9: tpm-backend: Initialize and free data members in it's own methods...
Checking PATCH 4/9: tpm-backend: Made few interface methods optional...
Checking PATCH 5/9: tmp backend: Add new api to read backend TpmInfo...
Checking PATCH 6/9: tpm-backend: Remove unneeded destroy() method from TpmDriverOps interface...
Checking PATCH 7/9: tpm-backend: Move realloc_buffer() implementation to base class...
Checking PATCH 8/9: tpm-passthrough: move reusable code to utils...
Checking PATCH 9/9: tpm: Added support for TPM emulator...
ERROR: Macros with complex values should be enclosed in parenthesis
#206: FILE: hw/tpm/tpm_emulator.c:82:
+#define TPM_EMULATOR_IOCTL_TO_CMD(ioctlnum) \
+    ((ioctlnum >> _IOC_NRSHIFT) & _IOC_NRMASK) + 1

WARNING: line over 80 characters
#266: FILE: hw/tpm/tpm_emulator.c:142:
+    ret = qio_channel_read(tpm_pt->data_ioc, (char *)out, (size_t)out_len, NULL);

WARNING: line over 80 characters
#567: FILE: hw/tpm/tpm_emulator.c:443:
+static gboolean tpm_emulator_fd_handler(QIOChannel *ioc, GIOCondition cnd, void *opaque)

ERROR: trailing whitespace
#586: FILE: hw/tpm/tpm_emulator.c:462:
+ $

ERROR: trailing whitespace
#601: FILE: hw/tpm/tpm_emulator.c:477:
+ $

ERROR: spaces required around that '+' (ctx:VxV)
#640: FILE: hw/tpm/tpm_emulator.c:516:
+        char *argv[PARAM_MAX+1];
                             ^

ERROR: braces {} are necessary for all arms of this statement
#643: FILE: hw/tpm/tpm_emulator.c:519:
+        if (fds[0] >= 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#645: FILE: hw/tpm/tpm_emulator.c:521:
+        if (ctrl_fds[0] >= 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#715: FILE: hw/tpm/tpm_emulator.c:591:
+        if (data_fd >= 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#717: FILE: hw/tpm/tpm_emulator.c:593:
+        if (ctrl_fd >= 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#728: FILE: hw/tpm/tpm_emulator.c:604:
+        if (fds[1] >= 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#730: FILE: hw/tpm/tpm_emulator.c:606:
+        if (ctrl_fds[1] >= 0)
[...]

ERROR: space required before the open parenthesis '('
#733: FILE: hw/tpm/tpm_emulator.c:609:
+        while((rc = stat(TPM_EMULATOR_PIDFILE, &st)) < 0 && timeout--) {

ERROR: trailing whitespace
#735: FILE: hw/tpm/tpm_emulator.c:611:
+        } $

WARNING: line over 80 characters
#750: FILE: hw/tpm/tpm_emulator.c:626:
+        tpm_pt->ctrl_ioc = _iochannel_new(tpm_pt->ops->ctrl_path, ctrl_fds[0], NULL);

ERROR: spaces required around that '|' (ctx:VxV)
#761: FILE: hw/tpm/tpm_emulator.c:637:
+        qio_channel_add_watch(tpm_pt->data_ioc, G_IO_HUP|G_IO_ERR,
                                                         ^

total: 13 errors, 3 warnings, 1376 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org