From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web12.9159.1652802603076395185 for ; Tue, 17 May 2022 08:50:03 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=Ts+DJVAV; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: prapal@linux.microsoft.com) Received: from [192.168.68.144] (072-191-074-059.res.spectrum.com [72.191.74.59]) by linux.microsoft.com (Postfix) with ESMTPSA id 4E89820F7222 for ; Tue, 17 May 2022 08:50:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4E89820F7222 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1652802602; bh=jVLt48c3/9rRsAD/GCrNbfvE0tnASF6PEeHKUMPVE5c=; h=Date:Subject:From:To:Reply-To:References:In-Reply-To:From; b=Ts+DJVAVQlMI1ublNo8VB7Gbl+TuVxHg8LQa2PY6ehcVT5eBeinD8OFdEvm95KlAk IcxRDtEEnqpESUpYDxPXMlLfsQPlvcUgOY7Q8YedUjWSHAQgk5IFV7c/mRuP+DsTWt gdvL3SItnPOr6LW1BpgN2lx0sILde9T1MxDakO3U= Message-ID: <7716cb3a-e03b-8966-72c8-bfa4d2b3161e@linux.microsoft.com> Date: Tue, 17 May 2022 10:50:00 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [edk2-devel] vTPM support in cloud-Hypervisor in aarch64 From: "Praveen K Paladugu" To: devel@edk2.groups.io Reply-To: devel@edk2.groups.io, prapal@linux.microsoft.com References: <16E9DB2F22253A83.7308@groups.io> <16EB56FDE48A248C.20240@groups.io> In-Reply-To: <16EB56FDE48A248C.20240@groups.io> Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Closing the loop on this thread. With some support from folks at ARM, I was able to narrow down the issue=20 to Page Tables not correctly configured in EDKII to handle TPM device. After marking the pages in vTPM address range (start:0xFED40000,=20 len:0x5000) as device Pages (ARM_MEMORY_REGION_ATTRIBUTE_DEVICE), I was=20 able to overcome the below reported Exception. Regards, Praveen On 5/2/2022 11:35 AM, Praveen K Paladugu wrote: > Folks, > pinging on this thread to bubble it up. > I'd appreciate any pointers you can provide on this bug. >=20 >=20 > On 4/27/2022 1:00 PM, Praveen K Paladugu wrote: >> Folks, >> >> I am trying to enable vTPM support in Windows Guest while using >> cloud-hypervisor as the VMM and OVMF firmware from edk2 repo. >> >> The Firmware is built with the following command: >> >> build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtCloudHv.dsc -b DEBUG \ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 -D TPM2_ENABLE=3D= TRUE -D TPM2_CONFIG_ENABLE=3DTRUE \ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 -D SOURCE_DEBUG= _ENABLE >> >> Below is the FDT, I am passing to the guest/firmware from >> cloud-hypervisor: >> >> =C2=A0=C2=A0Printing the FDT: >> =C2=A0=C2=A0/ >> =C2=A0=C2=A0=C2=A0 compatible : "linux,dummy-virt " >> =C2=A0=C2=A0=C2=A0 #address-cells : [2] >> =C2=A0=C2=A0=C2=A0 #size-cells : [2] >> =C2=A0=C2=A0=C2=A0 interrupt-parent : [1] >> =C2=A0=C2=A0=C2=A0 cpus/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #address-cells : [1] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #size-cells : [0] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cpu@0/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 device_type : "cpu" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "arm,arm-v8 " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reg : [0] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 phandle : [6] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cpu-map/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cluster0/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 core0/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 thr= ead0/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 cpu : [6] >> =C2=A0=C2=A0=C2=A0 memory/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 device_type : "memory" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reg : [0, 40000000, 0, 80000000] >> =C2=A0=C2=A0=C2=A0 chosen/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bootargs : "earlycon=3Dpl011,mmio,0x090= 00000" >> =C2=A0=C2=A0=C2=A0 intc/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "arm,gic-v3 " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 interrupt-controller : [] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #interrupt-cells : [3] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reg : [0, 8FF0000, 0, 10000, 0, 8FD0000= , 0, 20000] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 phandle : [1] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #address-cells : [2] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #size-cells : [2] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ranges : [] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 interrupts : [1, 9, 4] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 msic/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "arm,gic-v3-it= s " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 msi-controller : [] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 phandle : [2] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reg : [0, 8FB0000, 0, 20000= ] >> =C2=A0=C2=A0=C2=A0 timer/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "arm,armv8-timer " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 always-on : [] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 interrupts : [1, D, 4, 1, E, 4, 1, B, 4= , 1, A, 4] >> =C2=A0=C2=A0=C2=A0 pmu/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "arm,armv8-pmuv3 " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 interrupts : [1, 7, 104] >> =C2=A0=C2=A0=C2=A0 apb-pclk/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "fixed-clock " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #clock-cells : [0] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 clock-frequency : "\u{1}n6" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 clock-output-names : "clk24mhz" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 phandle : [3] >> =C2=A0=C2=A0=C2=A0 psci/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "arm,psci-0.2 " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 method : "hvc" >> =C2=A0=C2=A0=C2=A0 tpm@FED40000/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "tcg,tpm-tis-mmio " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 interrupts : [0, 2C, 1] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reg : [0, FED40000, 0, 5000] >> =C2=A0=C2=A0=C2=A0 pl011@9000000/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "arm,pl011 arm,primecell " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reg : [0, 9000000, 0, 1000] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 clocks : [3] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 clock-names : "apb_pclk" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 interrupts : [0, B, 1] >> =C2=A0=C2=A0=C2=A0 rtc@9010000/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "arm,pl031 arm,primecell " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reg : [0, 9010000, 0, 1000] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 interrupts : [0, 8, 4] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 clocks : [3] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 clock-names : "apb_pclk" >> =C2=A0=C2=A0=C2=A0 pl061@9020000/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "arm,pl061 arm,primecell " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reg : [0, 9020000, 0, 1000] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 interrupts : [0, 9, 1] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 gpio-controller : [] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #gpio-cells : [2] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 clocks : [3] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 clock-names : "apb_pclk" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 phandle : [4] >> =C2=A0=C2=A0=C2=A0 gpio-keys/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "gpio-keys " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #size-cells : [0] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #address-cells : [1] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 button@1/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 label : "GPIO Key Poweroff" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 linux,code : [74] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 gpios : [4, 3, 0] >> =C2=A0=C2=A0=C2=A0 pci@30000000/ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 compatible : "pci-host-ecam-generic " >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 device_type : "pci" >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ranges : [1000000, 0, 0, 0, 9050000, 0,= 10000, 2000000, 0,=20 >> 10000000, 0, 10000000, 0, 20000000, 3000000, 2, 0, 2, 0, FD, 0] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bus-range : [0, 0] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 linux,pci-domain : [0] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #address-cells : [3] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #size-cells : [2] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 reg : [0, 30000000, 0, 100000] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #interrupt-cells : [1] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 interrupt-map : [] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 interrupt-map-mask : [] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dma-coherent : [] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 msi-map : [0, 2, 0, 100] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 msi-parent : [2] >> >> >> https://github.com/praveen-pk/edk2/commit/59cf5ce41ff6ad2f81273bbd5516= 0747637c3cc2=20 >> >> =C2=A0=C2=A0and >> https://github.com/praveen-pk/edk2/commit/55e7fcc21b7aeaaae457f60f8427= aaf1e2ff432c=20 >> >> >> are the changes made to enable TPM support in cloud-hypervisor's recip= e. >> >> >> With the above setup I am running into the following failure: >> >> """"" >> >> Install PPI: 6CC45765-CCE4-42FD-BC56-011AAAC6C9A8 >> Install PPI: 8C9F4DE3-7B90-47EF-9308-287CECD66DE8 >> Install PPI: E09F355D-DAE8-4910-B14A-92780FDCF7CB >> Install PPI: 75CF14AE-3441-49DC-AA10-BB35A7BA8BAB >> Loading PEIM BF7F2B0C-9F2F-4889-AB5C-12460022BE87 >> add-symbol-file=20 >> /root/winiot/edk2/Build/ArmVirtCloudHv-AARCH64/DEBUG_GCC5/AARCH64/Ovmf= Pkg/Tcg/Tcg2Config/Tcg2ConfigPei/DEBUG/Tcg2ConfigPei.dll=20 >> 0xBFAC1240 >> >> Loading PEIM at 0x000BFAC1160 EntryPoint=3D0x000BFAC2C2C Tcg2ConfigPei= .efi >> >> Synchronous Exception at 0xBFAC312 >> """" >> >> >> Further debugging I noticed the Exception happens during an MmioRead.=20 >> Below is the related trace: >> >> """" >> add-symbol-file=20 >> /root/winiot/edk2/Build/ArmVirtCloudHv-AARCH6/DEBUG_GCC5/AARCH64/OvmfP= kg/Tcg/Tcg2Config/Tcg2ConfigPei/DEBUG/Tcg2ConfigPei.dll=20 >> 0xBFAC1240 >> >> Loading PEIM at 0x000BFAC1160 EntryPoint=3D0x000BFAC2C2C Tcg2ConfigPei= .efi >> >> _ModuleEntryPoint >> ProcessLibraryConstructorList start _ModuleEntryPoint >> =C2=A0=C2=A0BaseDebugLibSerialPortConstructor >> =C2=A0=C2=A0TimerConstructor >> =C2=A0=C2=A0Tpm2DeviceLibConstructor >> =C2=A0=C2=A0Tpm2GetPtpInterface Register =3D FED40000 >> =C2=A0=C2=A0Tpm2IsPtpPresence Start, Reg =3D FED40000 >> =C2=A0=C2=A0ioLibArmVirt.c MmioRead8 >> =C2=A0=C2=A0ioLibArmVirt.c MmioRead8 >> Synchronous Exception at 0xBFAC312 >> """" >> >> Any thoughts on what could be going wrong with TPM device=20 >> configuration in the firmware? I'd appreciate any inputs on this issue= . >> >=20 --=20 Regards, Praveen K Paladugu