Re: [RFC PATCH 19/30] vfio/pci: Add TSM TDI bind/unbind IOCTLs for TEE-IO support

2025-06-16 Thread Aneesh Kumar K . V
Xu Yilun writes: > On Wed, Jun 04, 2025 at 07:07:18PM +0530, Aneesh Kumar K.V wrote: >> Xu Yilun writes: >> >> > On Sun, Jun 01, 2025 at 04:15:32PM +0530, Aneesh Kumar K.V wrote: >> >> Xu Yilun writes: >> >> >> >> > Add new IOCTLs to do TSM based TDI bind/unbind. These IOCTLs are >> >> > expe

Re: [RFC PATCH 19/30] vfio/pci: Add TSM TDI bind/unbind IOCTLs for TEE-IO support

2025-06-06 Thread Aneesh Kumar K . V
Jason Gunthorpe writes: > On Thu, Jun 05, 2025 at 09:47:01PM +0530, Aneesh Kumar K.V wrote: >> Jason Gunthorpe writes: >> >> > On Thu, Jun 05, 2025 at 05:33:52PM +0530, Aneesh Kumar K.V wrote: >> > >> >> > + >> >> > + /* To ensure no host side MMIO access is possible */ >> >> > + re

Re: [RFC PATCH 17/30] iommufd/device: Add TSM Bind/Unbind for TIO support

2025-06-06 Thread Aneesh Kumar K . V
Jason Gunthorpe writes: >> tsm_unbind in vdevice_destroy: >> >> vdevice_destroy() ends up calling tsm_unbind() while holding only the >> vdev_lock. At first glance, this seems unsafe. But in practice, it's >> fine because the corresponding iommufd_device has already been destroyed >> when

Re: [RFC PATCH 19/30] vfio/pci: Add TSM TDI bind/unbind IOCTLs for TEE-IO support

2025-06-05 Thread Aneesh Kumar K . V
Jason Gunthorpe writes: > On Thu, Jun 05, 2025 at 05:33:52PM +0530, Aneesh Kumar K.V wrote: > >> > + >> > + /* To ensure no host side MMIO access is possible */ >> > + ret = pci_request_regions_exclusive(pdev, "vfio-pci-tsm"); >> > + if (ret) >> > + goto out_unlock; >> > + >> > >> >>

Re: [RFC PATCH 19/30] vfio/pci: Add TSM TDI bind/unbind IOCTLs for TEE-IO support

2025-06-05 Thread Aneesh Kumar K . V
Xu Yilun writes: > On Wed, Jun 04, 2025 at 07:07:18PM +0530, Aneesh Kumar K.V wrote: >> Xu Yilun writes: >> >> > On Sun, Jun 01, 2025 at 04:15:32PM +0530, Aneesh Kumar K.V wrote: >> >> Xu Yilun writes: >> >> >> >> > Add new IOCTLs to do TSM based TDI bind/unbind. These IOCTLs are >> >> > expe

Re: [RFC PATCH 19/30] vfio/pci: Add TSM TDI bind/unbind IOCTLs for TEE-IO support

2025-06-05 Thread Aneesh Kumar K . V
Xu Yilun writes: > Add new IOCTLs to do TSM based TDI bind/unbind. These IOCTLs are > expected to be called by userspace when CoCo VM issues TDI bind/unbind > command to VMM. Specifically for TDX Connect, these commands are some > secure Hypervisor call named GHCI (Guest-Hypervisor Communication

Re: [RFC PATCH 17/30] iommufd/device: Add TSM Bind/Unbind for TIO support

2025-06-04 Thread Aneesh Kumar K . V
Jason Gunthorpe writes: > On Tue, Jun 03, 2025 at 02:20:51PM +0800, Xu Yilun wrote: >> > Wouldn’t it be simpler to skip the reference count increment altogether >> > and just call tsm_unbind in the virtual device’s destroy callback? >> > (iommufd_vdevice_destroy()) >> >> The vdevice refcount is

Re: [RFC PATCH 19/30] vfio/pci: Add TSM TDI bind/unbind IOCTLs for TEE-IO support

2025-06-04 Thread Aneesh Kumar K . V
Xu Yilun writes: > On Sun, Jun 01, 2025 at 04:15:32PM +0530, Aneesh Kumar K.V wrote: >> Xu Yilun writes: >> >> > Add new IOCTLs to do TSM based TDI bind/unbind. These IOCTLs are >> > expected to be called by userspace when CoCo VM issues TDI bind/unbind >> > command to VMM. Specifically for TDX

Re: [RFC PATCH 20/30] vfio/pci: Do TSM Unbind before zapping bars

2025-06-02 Thread Aneesh Kumar K . V
Xu Yilun writes: > When device is TSM Bound, some of its MMIO regions are controlled by > secure firmware. E.g. TDX Connect would require these MMIO regions > mappeed in S-EPT and never unmapped until device Unbound. Zapping bars > irrespective of TSM Bound state may cause unexpected secure firmw

Re: [RFC PATCH 27/30] PCI/TSM: Add PCI driver callbacks to handle TSM requirements

2025-06-02 Thread Aneesh Kumar K . V
Xu Yilun writes: > Add optional PCI driver callbacks to notify TSM events. For now, these > handlers may be called during pci_tsm_unbind(). By calling these > handlers, TSM driver askes for external collaboration to finish entire > TSM unbind flow. > > If platform TSM driver could finish TSM bind

Re: [RFC PATCH 17/30] iommufd/device: Add TSM Bind/Unbind for TIO support

2025-06-02 Thread Aneesh Kumar K . V
Xu Yilun writes: > +/** > + * iommufd_device_tsm_bind - Move a device to TSM Bind state > + * @idev: device to attach > + * @vdev_id: Input a IOMMUFD_OBJ_VDEVICE > + * > + * This configures for device Confidential Computing(CC), and moves the > device > + * to the TSM Bind state. Once this

Re: [RFC PATCH 20/30] vfio/pci: Do TSM Unbind before zapping bars

2025-06-01 Thread Aneesh Kumar K . V
Xu Yilun writes: > When device is TSM Bound, some of its MMIO regions are controlled by > secure firmware. E.g. TDX Connect would require these MMIO regions > mappeed in S-EPT and never unmapped until device Unbound. Zapping bars > irrespective of TSM Bound state may cause unexpected secure firmw

Re: [RFC PATCH 19/30] vfio/pci: Add TSM TDI bind/unbind IOCTLs for TEE-IO support

2025-06-01 Thread Aneesh Kumar K . V
Xu Yilun writes: > Add new IOCTLs to do TSM based TDI bind/unbind. These IOCTLs are > expected to be called by userspace when CoCo VM issues TDI bind/unbind > command to VMM. Specifically for TDX Connect, these commands are some > secure Hypervisor call named GHCI (Guest-Hypervisor Communication