On Fri, Jan 10, 2025 at 09:31:16AM -0400, Jason Gunthorpe wrote: > On Fri, Jan 10, 2025 at 12:40:28AM +0800, Xu Yilun wrote: > > > So then we face with the shared <-> private device conversion in CoCo VM, > > and in turn shared <-> private MMIO conversion. MMIO region has only one > > physical backend so it is a bit like in-place conversion which is > > complicated. I wanna simply the MMIO conversion routine based on the fact > > that VMM never needs to access assigned MMIO for feature emulation, so > > always disallow userspace MMIO mapping during the whole lifecycle. That's > > why the flag is introduced. > > The VMM can simply not map it if for these cases. As part of the TDI > flow the kernel can validate it is not mapped. That's a good point. I can try on that. > > > > can be sure what is the correct UAPI. In other words, make the > > > VFIO device into a CC device should also prevent mmaping it and so on. > > > > My idea is prevent mmaping first, then allow VFIO device into CC dev (TDI). > > I think you need to start the TDI process much earlier. Some arches > are going to need work to prepare the TDI before the VM is started. Could you elaborate more on that? AFAICS Intel & AMD are all good on "late bind", but not sure for other architectures. This relates to the definition of TSM verbs and is the right time we collect the needs for Dan's series. > > The other issue here is that Intel is somewhat different from others > and when we build uapi for TDI it has to accommodate everyone. Sure, this is the aim for PCI TSM core, and VFIO as a PCI TSM user should not be TDX awared. > > > Yes. It carries out the idea of "KVM maps MMIO resources without firstly > > mapping into the host" even for normal VM. That's why I think it could > > be an independent patchset. > > Yes, just remove this patch and other TDI focused stuff. Just > infrastructure to move to FD based mapping instead of VMA. Yes. Thanks, Yilun > > Jason