From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id j21-20020a05600c42d500b003b492753826sm739610wme.43.2022.10.27.01.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 01:06:01 -0700 (PDT) Received: from zen (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 919ED1FFB7; Thu, 27 Oct 2022 09:06:00 +0100 (BST) References: <20221015050750.4185-1-vikram.garhwal@amd.com> <20221015050750.4185-11-vikram.garhwal@amd.com> User-agent: mu4e 1.9.1; emacs 28.2.50 From: Alex =?utf-8?Q?Benn=C3=A9e?= To: Vikram Garhwal Cc: qemu-devel@nongnu.org, stefano.stabellini@amd.com, Peter Maydell , Stefano Stabellini , Anthony Perard , Paul Durrant , "open list:ARM TCG CPUs" , xen-devel@lists.xenproject.org Subject: Re: [PATCH v1 10/12] hw/arm: introduce xenpv machine Date: Thu, 27 Oct 2022 09:02:54 +0100 In-reply-to: <20221015050750.4185-11-vikram.garhwal@amd.com> Message-ID: <87wn8l3d3r.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-TUID: CluihL3DhOeQ Vikram Garhwal writes: > Optional: When CONFIG_TPM is enabled, it also creates a tpm-tis-device, a= dds a > TPM emulator and connects to swtpm running on host machine via chardev so= cket > and support TPM functionalities for a guest domain. > > Extra command line for aarch64 xenpv QEMU to connect to swtpm: > -chardev socket,id=3Dchrtpm,path=3D/tmp/myvtpm2/swtpm-sock \ > -tpmdev emulator,id=3Dtpm0,chardev=3Dchrtpm \ > > swtpm implements a TPM software emulator(TPM 1.2 & TPM 2) built on libtpm= s and > provides access to TPM functionality over socket, chardev and CUSE interf= ace. > Github repo: https://github.com/stefanberger/swtpm > Example for starting swtpm on host machine: > mkdir /tmp/vtpm2 > swtpm socket --tpmstate dir=3D/tmp/vtpm2 \ > --ctrl type=3Dunixio,path=3D/tmp/vtpm2/swtpm-sock & > +static void xen_enable_tpm(void) > +{ > +/* qemu_find_tpm_be is only available when CONFIG_TPM is enabled. */ > +#ifdef CONFIG_TPM > + Error *errp =3D NULL; > + DeviceState *dev; > + SysBusDevice *busdev; > + > + TPMBackend *be =3D qemu_find_tpm_be("tpm0"); > + if (be =3D=3D NULL) { > + DPRINTF("Couldn't fine the backend for tpm0\n"); > + return; > + } > + dev =3D qdev_new(TYPE_TPM_TIS_SYSBUS); > + object_property_set_link(OBJECT(dev), "tpmdev", OBJECT(be), &errp); > + object_property_set_str(OBJECT(dev), "tpmdev", be->id, &errp); > + busdev =3D SYS_BUS_DEVICE(dev); > + sysbus_realize_and_unref(busdev, &error_fatal); > + sysbus_mmio_map(busdev, 0, GUEST_TPM_BASE); I'm not sure what has gone wrong here but I'm getting: ../../hw/arm/xen_arm.c: In function =E2=80=98xen_enable_tpm=E2=80=99: ../../hw/arm/xen_arm.c:120:32: error: =E2=80=98GUEST_TPM_BASE=E2=80=99 un= declared (first use in this function); did you mean =E2=80=98GUEST_RAM_BASE= =E2=80=99? 120 | sysbus_mmio_map(busdev, 0, GUEST_TPM_BASE); | ^~~~~~~~~~~~~~ | GUEST_RAM_BASE ../../hw/arm/xen_arm.c:120:32: note: each undeclared identifier is report= ed only once for each function it appears in In my cross build: # Configured with: '../../configure' '--disable-docs' '--target-list=3Daa= rch64-softmmu' '--disable-kvm' '--enable-xen' '--disable-opengl' '--disable= -libudev' '--enable-tpm' '--disable-xen-pci-passthrough' '--cross-prefix=3D= aarch64-linux-gnu-' '--skip-meson' which makes me wonder if this is a configure failure or a confusion about being able to have host swtpm implementations during emulation but needing target tpm for Xen? --=20 Alex Benn=C3=A9e