From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypa14-0007po-W7 for qemu-devel@nongnu.org; Tue, 05 May 2015 06:23:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ypa11-0001Ux-OJ for qemu-devel@nongnu.org; Tue, 05 May 2015 06:23:54 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:52332) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypa11-0001Uk-Ha for qemu-devel@nongnu.org; Tue, 05 May 2015 06:23:51 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 May 2015 04:23:50 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id EDBAE1FF0045 for ; Tue, 5 May 2015 04:14:57 -0600 (MDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t45ANNRt33554472 for ; Tue, 5 May 2015 03:23:23 -0700 Received: from d03av03.boulder.ibm.com (localhost [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t45ANkDZ020299 for ; Tue, 5 May 2015 04:23:47 -0600 Message-ID: <55489A31.40302@linux.vnet.ibm.com> Date: Tue, 05 May 2015 06:23:45 -0400 From: Stefan Berger MIME-Version: 1.0 References: <1430724181-476-1-git-send-email-quan.xu@intel.com> <1430724181-476-4-git-send-email-quan.xu@intel.com> <554791E7.8020008@linux.vnet.ibm.com> <945CA011AD5F084CBEA3E851C0AB28890E8F5564@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <945CA011AD5F084CBEA3E851C0AB28890E8F5564@SHSMSX101.ccr.corp.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v6 3/6] Qemu-Xen-vTPM: Xen frontend driver infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Xu, Quan" Cc: "dgdegra@tycho.nsa.gov" , "xen-devel@lists.xen.org" , "wei.liu2@citrix.com" , "qemu-devel@nongnu.org" , "stefano.stabellini@eu.citrix.com" On 05/04/2015 10:41 PM, Xu, Quan wrote: > >> -----Original Message----- >> From: Stefan Berger [mailto:stefanb@linux.vnet.ibm.com] >> Sent: Monday, May 04, 2015 11:36 PM >> To: Xu, Quan; stefano.stabellini@eu.citrix.com; eblake@redhat.com >> Cc: qemu-devel@nongnu.org; wei.liu2@citrix.com; dgdegra@tycho.nsa.gov; >> xen-devel@lists.xen.org >> Subject: Re: [PATCH v6 3/6] Qemu-Xen-vTPM: Xen frontend driver infrastructure >> >> On 05/04/2015 03:22 AM, Quan Xu wrote: >>> This patch adds infrastructure for xen front drivers living in qemu, >>> so drivers don't need to implement common stuff on their own. It's >>> mostly xenbus management stuff: some functions to access XenStore, >>> setting up XenStore watches, callbacks on device discovery and state >>> changes, and handle event channel between the virtual machines. >>> >>> Call xen_fe_register() function to register XenDevOps, and make sure, >>> [...] >>> 3 = "" >>> [...] >>> device = "" (frontend device, the backend is running in QEMU/.etc) >>> vkbd = "" >>> [...] >>> vif = "" >>> [...] >>> >>> .. >>> >>> (QEMU) xen_vtpmdev_ops is initialized with the following process: >>> xen_hvm_init() >>> [...] >>> -->xen_fe_register("vtpm", ...) >>> -->xenstore_fe_scan() >>> -->xen_fe_try_init(ops) >>> --> XenDevOps.init() >>> -->xen_fe_get_xendev() >>> --> XenDevOps.alloc() >>> -->xen_fe_check() >>> -->xen_fe_try_initialise() >>> --> XenDevOps.initialise() >>> -->xen_fe_try_connected() >>> --> XenDevOps.connected() >>> -->xs_watch() >>> [...] >>> >>> Signed-off-by: Quan Xu >>> >>> --Changes in v6: >>> -Replace buf_size with PAGE_SIZE and use length rather than >>> shr->length. >>> --- >>> hw/tpm/Makefile.objs | 1 + >>> hw/tpm/xen_vtpm_frontend.c | 315 >> +++++++++++++++++++++++++++++++++++++++++++ >>> hw/xen/xen_frontend.c | 20 +++ >>> include/hw/xen/xen_backend.h | 5 + >>> include/hw/xen/xen_common.h | 6 + >>> xen-hvm.c | 5 + >>> 6 files changed, 352 insertions(+) >>> create mode 100644 hw/tpm/xen_vtpm_frontend.c >>> >>> diff --git a/hw/tpm/Makefile.objs b/hw/tpm/Makefile.objs index >>> 99f5983..57919fa 100644 >>> --- a/hw/tpm/Makefile.objs >>> +++ b/hw/tpm/Makefile.objs >>> @@ -1,2 +1,3 @@ >>> common-obj-$(CONFIG_TPM_TIS) += tpm_tis.o >>> common-obj-$(CONFIG_TPM_PASSTHROUGH) += tpm_passthrough.o >>> +common-obj-$(CONFIG_TPM_XENSTUBDOMS) += xen_vtpm_frontend.o >>> diff --git a/hw/tpm/xen_vtpm_frontend.c b/hw/tpm/xen_vtpm_frontend.c >>> new file mode 100644 index 0000000..d6e7cc6 >>> --- /dev/null >>> +++ b/hw/tpm/xen_vtpm_frontend.c >>> @@ -0,0 +1,315 @@ >>> +/* >>> + * Connect to Xen vTPM stubdom domain >>> + * >>> + * Copyright (c) 2015 Intel Corporation >>> + * Authors: >>> + * Quan Xu >>> + * >>> + * This library is free software; you can redistribute it and/or >>> + * modify it under the terms of the GNU Lesser General Public >>> + * License as published by the Free Software Foundation; either >>> + * version 2 of the License, or (at your option) any later version. >>> + * >>> + * This library is distributed in the hope that it will be useful, >>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >>> + * Lesser General Public License for more details. >>> + * >>> + * You should have received a copy of the GNU Lesser General Public >>> + * License along with this library; if not, see >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> + >>> +#include "hw/hw.h" >>> +#include "block/aio.h" >>> +#include "hw/xen/xen_backend.h" >>> + >>> +#ifndef XS_STUBDOM_VTPM_ENABLE >>> +#define XS_STUBDOM_VTPM_ENABLE "1" >>> +#endif >>> + >>> +#ifndef PAGE_SIZE >>> +#define PAGE_SIZE 4096 >>> +#endif >> You should be able to use TARGET_PAGE_SIZE from exec/cpu-all.h I think. >> >> With this change: Reviewed-by: Stefan Berger >> > > Stefan, thanks. > I will use TARGET_PAGE_SIZE from exec/cpu-all.h in next version. > Could I redefine PAGE_SIZE as kvm-all.c? > +#define PAGE_SIZE TARGET_PAGE_SIZE I guess it would be ok. Stefan