From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR6Kz-00073x-62 for qemu-devel@nongnu.org; Wed, 24 Oct 2012 15:09:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TR6Kx-0003Vx-UA for qemu-devel@nongnu.org; Wed, 24 Oct 2012 15:09:57 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:53937) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR6Kx-0003Vq-QB for qemu-devel@nongnu.org; Wed, 24 Oct 2012 15:09:55 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 24 Oct 2012 15:09:55 -0400 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 755AFC9014A for ; Wed, 24 Oct 2012 15:07:19 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9OJ7JlH305972 for ; Wed, 24 Oct 2012 15:07:19 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9OJ7IR9025442 for ; Wed, 24 Oct 2012 17:07:18 -0200 Message-ID: <50883C66.9090505@linux.vnet.ibm.com> Date: Wed, 24 Oct 2012 15:07:18 -0400 From: Stefan Berger MIME-Version: 1.0 References: <1338838668-7544-1-git-send-email-stefanb@linux.vnet.ibm.com> <1338838668-7544-6-git-send-email-stefanb@linux.vnet.ibm.com> <50646287.9000107@linux.vnet.ibm.com> In-Reply-To: <50646287.9000107@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V19 5/7] Add a TPM Passthrough backend driver implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Corey Bryant Cc: mst@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws, andreas.niederl@iaik.tugraz.at On 09/27/2012 10:28 AM, Corey Bryant wrote: > > > On 06/04/2012 03:37 PM, Stefan Berger wrote: >> + >> +/* borrowed from qemu-char.c */ >> +static int tpm_passthrough_unix_write(int fd, const uint8_t *buf, >> uint32_t len) >> +{ >> + return send_all(fd, buf, len); >> +} >> + >> +static int tpm_passthrough_unix_read(int fd, uint8_t *buf, uint32_t >> len) > > It would probably be useful to other parts of QEMU if you defined this > function as recv_all() and put it in qemu-char.c (to correspond with > send_all()). > Ok. I'd keep this patch to qemu-char.c inside of this patch, though, unless someone opposes. >> + >> +static int tpm_passthrough_startup_tpm(TPMBackend *tb) >> +{ >> + TPMPassthruState *tpm_pt = tb->s.tpm_pt; >> + int rc; >> + >> + rc = tpm_passthrough_do_startup_tpm(tb); >> + if (rc) { >> + tpm_pt->had_startup_error = true; > > tpm_passthrough_do_startup_tpm() always returns zero, so > had_startup_error will never be set to true. > I am consolidating the code into tpm_passthrough_startup_tpm() but let that return an int considering that other backend drivers may return an error code. >> +static void tpm_passthrough_reset(TPMBackend *tb) >> +{ >> + TPMPassthruState *tpm_pt = tb->s.tpm_pt; >> + >> + dprintf("tpm_passthrough: CALL TO TPM_RESET!\n"); >> + >> + tpm_backend_thread_end(&tpm_pt->tbt); > > Should the thread be restarted here? > No. If the backend needs to be restarted, the frontend will invoke the startup_tpm function. >> +static bool tpm_passthrough_get_tpm_established_flag(TPMBackend *tb) >> +{ >> + return false; > > Can a T/OS never be established with the passthrough backend? > Following the specs, this bit is set when locality 5 is used and a hash operation is started. See part 2 of the TPM specs. The establishment bit could be read from the hardware TPM's permanent flags. The question is what it means to show this bit inside the VM. I wasn't sure, so I hardcoded it to always return false. Stefan