WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Fix TPM support in HVM domains

To: "xen-devel" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix TPM support in HVM domains
From: "Cihula, Joseph" <joseph.cihula@xxxxxxxxx>
Date: Mon, 14 May 2007 14:23:57 -0700
Cc: Stefan Berger <stefanb@xxxxxxxxxx>, Jan Peter Stotz <Jan-Peter.Stotz@xxxxxxxxxxxxxxxxx>, xense-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 14 May 2007 14:22:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AceWbi5JtANJlqdUS66UhQ/QY3cVwQ==
Thread-topic: [PATCH] Fix TPM support in HVM domains
Attached and included is a patch that fixes (virtual) TPM support in HVM
domains.  I've also included a fix to the vTPM hotplug scripts by Jan.

Please apply.

Signed-off-by:  Joseph Cihula <joseph.cihula@xxxxxxxxx>
Signed-off-by:  Peter Yang <peisen.yang@xxxxxxxxx>


diff -r 3ef0510e44d0 tools/ioemu/hw/tpm_tis.c
--- a/tools/ioemu/hw/tpm_tis.c  Tue May 08 10:21:23 2007 +0100
+++ b/tools/ioemu/hw/tpm_tis.c  Mon May 14 14:11:41 2007 -0700
@@ -148,7 +148,7 @@ static int read_local_socket(tpmState *s
 static int read_local_socket(tpmState *s, tpmBuffer *);
 static int close_local_socket(tpmState *s, int force);
 static int has_channel_local_socket(tpmState *s);
-#define LOCAL_SOCKET_PATH      "/var/vtpm/vtpm_all.socket"
+#define LOCAL_SOCKET_PATH     "/var/vtpm/socks/%d.socket"


 #define NUM_TRANSPORTS 1
@@ -238,18 +238,33 @@ static int create_local_socket(tpmState
     if (s->tpmTx.fd[0] < 0) {
         s->tpmTx.fd[0] = socket(PF_LOCAL, SOCK_STREAM, 0);

+#ifdef DEBUG_TPM
+        fprintf(logfile," SOCKET FD %d errno %d \n",  s->tpmTx.fd[0],
errno );
+#endif
         if (has_channel_local_socket(s)) {
+            int ret;
             struct sockaddr_un addr;
             memset(&addr, 0x0, sizeof(addr));
             addr.sun_family = AF_LOCAL;
-            strcpy(addr.sun_path, LOCAL_SOCKET_PATH);
-            if (connect(s->tpmTx.fd[0],
-                        (struct sockaddr *)&addr,
-                        sizeof(addr)) != 0) {
+            snprintf(addr.sun_path, sizeof(addr.sun_path)-1,
+                    LOCAL_SOCKET_PATH, (uint32_t) vtpm_instance);
+#ifdef DEBUG_TPM
+           fprintf(logfile," SOCKET NAME %s \n",  addr.sun_path );
+#endif
+
+            if ((ret = connect(s->tpmTx.fd[0], (struct sockaddr
*)&addr,
+                              sizeof(addr))) != 0) {
                 close_local_socket(s, 1);
+#ifdef DEBUG_TPM
+               fprintf(logfile," RET %d  errno %d\n", ret, errno );
+#endif
                 success = 0;
             } else {
                 /* put filedescriptor in non-blocking mode for polling
*/
+#ifdef DEBUG_TPM
+             fprintf(logfile," put filedescriptor in non-blocking mode
"
+                     "for polling \n");
+#endif
                 int flags = fcntl(s->tpmTx.fd[0], F_GETFL);
                 fcntl(s->tpmTx.fd[0], F_SETFL, flags | O_NONBLOCK);
             }
diff -r 3ef0510e44d0 tools/examples/vtpm-impl
--- a/tools/examples/vtpm-impl  Tue May 08 10:21:23 2007 +0100
+++ b/tools/examples/vtpm-impl  Mon May 14 13:51:59 2007 -0700
@@ -83,7 +83,7 @@ function vtpm_manager_cmd() {
  release_lock vtpm_mgr

  #return whether the command was successful
- if [ $resp_hex ne $TPM_SUCCESS ]; then
+ if [ $resp_hex -ne $TPM_SUCCESS ]; then
    vtpm_fatal_error=1
    false
   else

Attachment: vtpm-hvm-0514.patch
Description: vtpm-hvm-0514.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix TPM support in HVM domains, Cihula, Joseph <=