[Qemu-devel] [PATCH 17/42] tpm-tis: move TPMState to TIS header

Marc-André Lureau posted 42 patches 8 years, 4 months ago
[Qemu-devel] [PATCH 17/42] tpm-tis: move TPMState to TIS header
Posted by Marc-André Lureau 8 years, 4 months ago
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/tpm/tpm_int.h  | 23 ++---------------------
 hw/tpm/tpm_tis.h  | 19 +++++++++++++++++++
 hw/tpm/tpm_util.c |  1 +
 3 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/hw/tpm/tpm_int.h b/hw/tpm/tpm_int.h
index 252c4082ef..e231d0eb4f 100644
--- a/hw/tpm/tpm_int.h
+++ b/hw/tpm/tpm_int.h
@@ -12,28 +12,9 @@
 #ifndef TPM_TPM_INT_H
 #define TPM_TPM_INT_H
 
-#include "exec/memory.h"
-#include "tpm_tis.h"
+#include "qemu/osdep.h"
 
-/* overall state of the TPM interface */
-struct TPMState {
-    ISADevice busdev;
-    MemoryRegion mmio;
-
-    union {
-        TPMTISEmuState tis;
-    } s;
-
-    TPMBackendCmd cmd;
-
-    char *backend;
-    TPMBackend *be_driver;
-    TPMVersion be_tpm_version;
-};
-
-#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
-
-#define TPM_STANDARD_CMDLINE_OPTS \
+#define TPM_STANDARD_CMDLINE_OPTS               \
     { \
         .name = "type", \
         .type = QEMU_OPT_STRING, \
diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
index 31e612a7f4..30e35eef64 100644
--- a/hw/tpm/tpm_tis.h
+++ b/hw/tpm/tpm_tis.h
@@ -72,4 +72,23 @@ typedef struct TPMTISEmuState {
     uint32_t irq_num;
 } TPMTISEmuState;
 
+/* overall state of the TPM interface */
+struct TPMState {
+    ISADevice busdev;
+    MemoryRegion mmio;
+
+    union {
+        TPMTISEmuState tis;
+    } s;
+
+    uint8_t     locty_number;
+    TPMBackendCmd cmd;
+
+    char *backend;
+    TPMBackend *be_driver;
+    TPMVersion be_tpm_version;
+};
+
+#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
+
 #endif /* TPM_TPM_TIS_H */
diff --git a/hw/tpm/tpm_util.c b/hw/tpm/tpm_util.c
index fb929f6e92..7dc5b08824 100644
--- a/hw/tpm/tpm_util.c
+++ b/hw/tpm/tpm_util.c
@@ -22,6 +22,7 @@
 #include "qemu/osdep.h"
 #include "tpm_util.h"
 #include "tpm_int.h"
+#include "exec/memory.h"
 
 /*
  * Write an error message in the given output buffer.
-- 
2.14.1.146.gd35faa819


Re: [Qemu-devel] [PATCH 17/42] tpm-tis: move TPMState to TIS header
Posted by Stefan Berger 8 years, 4 months ago
On 10/09/2017 06:55 PM, Marc-André Lureau wrote:
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   hw/tpm/tpm_int.h  | 23 ++---------------------
>   hw/tpm/tpm_tis.h  | 19 +++++++++++++++++++
>   hw/tpm/tpm_util.c |  1 +
>   3 files changed, 22 insertions(+), 21 deletions(-)
>
> diff --git a/hw/tpm/tpm_int.h b/hw/tpm/tpm_int.h
> index 252c4082ef..e231d0eb4f 100644
> --- a/hw/tpm/tpm_int.h
> +++ b/hw/tpm/tpm_int.h
> @@ -12,28 +12,9 @@
>   #ifndef TPM_TPM_INT_H
>   #define TPM_TPM_INT_H
>   
> -#include "exec/memory.h"
> -#include "tpm_tis.h"
> +#include "qemu/osdep.h"
>   
> -/* overall state of the TPM interface */
> -struct TPMState {
> -    ISADevice busdev;
> -    MemoryRegion mmio;
> -
> -    union {
> -        TPMTISEmuState tis;
> -    } s;
> -
> -    TPMBackendCmd cmd;
> -
> -    char *backend;
> -    TPMBackend *be_driver;
> -    TPMVersion be_tpm_version;
> -};
> -
> -#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
> -
> -#define TPM_STANDARD_CMDLINE_OPTS \
> +#define TPM_STANDARD_CMDLINE_OPTS               \
>       { \
>           .name = "type", \
>           .type = QEMU_OPT_STRING, \
> diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
> index 31e612a7f4..30e35eef64 100644
> --- a/hw/tpm/tpm_tis.h
> +++ b/hw/tpm/tpm_tis.h
> @@ -72,4 +72,23 @@ typedef struct TPMTISEmuState {
>       uint32_t irq_num;
>   } TPMTISEmuState;
>   
> +/* overall state of the TPM interface */
> +struct TPMState {
> +    ISADevice busdev;
> +    MemoryRegion mmio;
> +
> +    union {
> +        TPMTISEmuState tis;
> +    } s;
> +
> +    uint8_t     locty_number;

This one probably shouldn't be here at this point. You seem to have 
added it in the move?



> +    TPMBackendCmd cmd;
> +
> +    char *backend;
> +    TPMBackend *be_driver;
> +    TPMVersion be_tpm_version;
> +};
> +
> +#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
> +
>   #endif /* TPM_TPM_TIS_H */
> diff --git a/hw/tpm/tpm_util.c b/hw/tpm/tpm_util.c
> index fb929f6e92..7dc5b08824 100644
> --- a/hw/tpm/tpm_util.c
> +++ b/hw/tpm/tpm_util.c
> @@ -22,6 +22,7 @@
>   #include "qemu/osdep.h"
>   #include "tpm_util.h"
>   #include "tpm_int.h"
> +#include "exec/memory.h"
>   
>   /*
>    * Write an error message in the given output buffer.



Re: [Qemu-devel] [PATCH 17/42] tpm-tis: move TPMState to TIS header
Posted by Marc-André Lureau 8 years, 4 months ago

----- Original Message -----
> On 10/09/2017 06:55 PM, Marc-André Lureau wrote:
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >   hw/tpm/tpm_int.h  | 23 ++---------------------
> >   hw/tpm/tpm_tis.h  | 19 +++++++++++++++++++
> >   hw/tpm/tpm_util.c |  1 +
> >   3 files changed, 22 insertions(+), 21 deletions(-)
> >
> > diff --git a/hw/tpm/tpm_int.h b/hw/tpm/tpm_int.h
> > index 252c4082ef..e231d0eb4f 100644
> > --- a/hw/tpm/tpm_int.h
> > +++ b/hw/tpm/tpm_int.h
> > @@ -12,28 +12,9 @@
> >   #ifndef TPM_TPM_INT_H
> >   #define TPM_TPM_INT_H
> >   
> > -#include "exec/memory.h"
> > -#include "tpm_tis.h"
> > +#include "qemu/osdep.h"
> >   
> > -/* overall state of the TPM interface */
> > -struct TPMState {
> > -    ISADevice busdev;
> > -    MemoryRegion mmio;
> > -
> > -    union {
> > -        TPMTISEmuState tis;
> > -    } s;
> > -
> > -    TPMBackendCmd cmd;
> > -
> > -    char *backend;
> > -    TPMBackend *be_driver;
> > -    TPMVersion be_tpm_version;
> > -};
> > -
> > -#define TPM(obj) OBJECT_CHECK(TPMState, (obj), TYPE_TPM_TIS)
> > -
> > -#define TPM_STANDARD_CMDLINE_OPTS \
> > +#define TPM_STANDARD_CMDLINE_OPTS               \
> >       { \
> >           .name = "type", \
> >           .type = QEMU_OPT_STRING, \
> > diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
> > index 31e612a7f4..30e35eef64 100644
> > --- a/hw/tpm/tpm_tis.h
> > +++ b/hw/tpm/tpm_tis.h
> > @@ -72,4 +72,23 @@ typedef struct TPMTISEmuState {
> >       uint32_t irq_num;
> >   } TPMTISEmuState;
> >   
> > +/* overall state of the TPM interface */
> > +struct TPMState {
> > +    ISADevice busdev;
> > +    MemoryRegion mmio;
> > +
> > +    union {
> > +        TPMTISEmuState tis;
> > +    } s;
> > +
> > +    uint8_t     locty_number;
> 
> This one probably shouldn't be here at this point. You seem to have
> added it in the move?
> 

good catch, removed

Thanks