On Fri, Jul 14, 2023 at 11:01 AM Stefan Berger <stef...@linux.ibm.com> wrote: > > > > On 7/14/23 13:46, Joelle van Dyne wrote: > > On Fri, Jul 14, 2023 at 10:43 AM Stefan Berger <stef...@linux.ibm.com> > > wrote: > >> > >> > >> > >> On 7/14/23 13:39, Joelle van Dyne wrote: > >>> On Fri, Jul 14, 2023 at 10:37 AM Stefan Berger <stef...@linux.ibm.com> > >>> wrote: > >>>> > >>>> > >>>> > >>>> On 7/14/23 13:29, Joelle van Dyne wrote: > >>>>> On Fri, Jul 14, 2023 at 9:19 AM Stefan Berger <stef...@linux.ibm.com> > >>>>> wrote: > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> I don't know whether we would want multiple devices. tpm_find() usage > >>>>>> is certainly not prepared for multiple devices. > >>>>> Sorry, "multiple TPM interfaces" here does not mean "at the same > >>>>> time". Will clarify the description. > >>>>> > >>>>>> > >>>>>> > >>>>>> Good for the consolidation. > >>>>>> > >>>>>> > >>>>>> Does moving the TIS to a different address help on aarch64? > >>>>> That was the first thing we tried and no it doesn't help. > >>>> > >>>> I would remove it if we don't have a known alternative address that > >>>> makes it work. If we do, I think we should document it in tpm.rst. > >>> "It" is referring to tpm-tis-device? Note that it does work fine with > >>> Linux VMs. > >> > >> yes, tpm_tis_sysbus and I know it works with Liunux but I see this > >> discussion here around Win 11 on aarch64. Why do we need to user another > >> address than the standard address if for Win 11 on aarch64 it doesn't get > >> it to work. > > The standard address won't work for Linux either. > > > > TPM TIS on standard address on ARM64 Virt machines = collision with > > DRAM, will not instantiate > > I thought that this was working with Linux on the aarch64 virt board as > contributed by Eric Auger. > > https://github.com/qemu/qemu/commit/fcaa204194e15ba24cd53087dd616aabbc29e64f > > Also I had tested it to some extent: > https://github.com/stefanberger/swtpm/issues/493#issuecomment-885221109 I think I know where the confusion is. Both your examples use "tpm-tis-device" which indeed uses the SysBus and gets a dynamic address. In this patch, the removed code that generates the AML gets this address by poking into the SysBus device, getting its base, then adding the offset from the TIS device to it. In the change, we move that code to get the address to earlier in the Virt init sequence (before the machine is realized) in order to tell the TIS device what its own base address is. Then, during the AML generation phase, we can just tell the TIS device to "generate your own AML" which is now possible because it knows its own base address. This is also how the TIS ISA bus device does it but that is simpler because it can just use the default address.
Separately, there is a `build_tpm2` table function which also needs the device base address but only for CRB devices (TIS has the field set to 0) so it's irrelevant here. > > > > > TPM TIS on SysBus with dynamically allocated address = works on Linux, > > cannot start on Windows > > > >> > >>> > >>>> > >>>> > >>>>>> > >>>>>> Can the size really be an option? I don't see it useful and if one > >>>>>> gave the wrong size it may break things. > >>>>> It was added for consistency (otherwise we have to determine the size > >>>>> by looking at the interface everywhere). Also, it is possible for the > >>>>> size to be larger than the constant. For example, Apple Silicon uses > >>>>> 16KiB page sizes and we may decide to force the device to be 16KiB > >>>>> aligned (not sure if this is needed yet while we still track down why > >>>>> the dual mapping was not working). In that case, we would need to > >>>>> inform the OS of the true region size to prevent any overlap issues. > >>>>> Both baseaddr and size should be provided only by the plug handler in > >>>>> the virt machine, otherwise things may break even if we get rid of > >>>>> size and have just an incorrect baseaddr. > >>>>> > >>>>>> > >>>>>> > >>>>>>