Message ID | 20240722070713.1342711-2-zhenzhong.duan@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Don't initialize HOST_IOMMU_DEVICE with mdev | expand |
On 22/07/2024 08:07, Zhenzhong Duan wrote: > mdevs aren't "physical" devices and when asking for backing IOMMU info, > it fails the entire provisioning of the guest. Fix that by setting > vbasedev->mdev true so skipping HostIOMMUDevice initialization in the > presence of mdevs. > > Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler") > Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Joao Martins <joao.m.martins@oracle.com> > --- > hw/vfio/ap.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c > index 0c4354e3e7..391bfb72ca 100644 > --- a/hw/vfio/ap.c > +++ b/hw/vfio/ap.c > @@ -230,6 +230,9 @@ static void vfio_ap_instance_init(Object *obj) > */ > vfio_device_init(vbasedev, VFIO_DEVICE_TYPE_AP, &vfio_ap_ops, > DEVICE(vapdev), true); > + > + /* AP device is mdev type device */ > + vbasedev->mdev = true; > } > > #ifdef CONFIG_IOMMUFD
On 7/22/24 5:18 AM, Joao Martins wrote: > On 22/07/2024 08:07, Zhenzhong Duan wrote: >> mdevs aren't "physical" devices and when asking for backing IOMMU info, >> it fails the entire provisioning of the guest. Fix that by setting >> vbasedev->mdev true so skipping HostIOMMUDevice initialization in the >> presence of mdevs. >> >> Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler") >> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> I'm at a bit of a loss here. We've been starting guests with AP devices being passed through using VFIO for years. Did the fix for 930589520128 precipitate this? Is there a bugzilla or something that describes how this problem was encountered? > Reviewed-by: Joao Martins <joao.m.martins@oracle.com> > >> --- >> hw/vfio/ap.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c >> index 0c4354e3e7..391bfb72ca 100644 >> --- a/hw/vfio/ap.c >> +++ b/hw/vfio/ap.c >> @@ -230,6 +230,9 @@ static void vfio_ap_instance_init(Object *obj) >> */ >> vfio_device_init(vbasedev, VFIO_DEVICE_TYPE_AP, &vfio_ap_ops, >> DEVICE(vapdev), true); >> + >> + /* AP device is mdev type device */ >> + vbasedev->mdev = true; >> } >> >> #ifdef CONFIG_IOMMUFD
On 22/07/2024 16:46, Anthony Krowiak wrote: > > On 7/22/24 5:18 AM, Joao Martins wrote: >> On 22/07/2024 08:07, Zhenzhong Duan wrote: >>> mdevs aren't "physical" devices and when asking for backing IOMMU info, >>> it fails the entire provisioning of the guest. Fix that by setting >>> vbasedev->mdev true so skipping HostIOMMUDevice initialization in the >>> presence of mdevs. >>> >>> Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() >>> handler") >>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> > > > I'm at a bit of a loss here. We've been starting guests with AP devices being > passed through using VFIO for years. Did the fix for > > 930589520128 precipitate this? Yes. The fix commit ids introduced this and it was not intended. Also the failure, again, is only reproduceable with IOMMUFD and it doesn't apply for type1-iommu that you are likely using. Both are different IOMMU backends. Joao
diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 0c4354e3e7..391bfb72ca 100644 --- a/hw/vfio/ap.c +++ b/hw/vfio/ap.c @@ -230,6 +230,9 @@ static void vfio_ap_instance_init(Object *obj) */ vfio_device_init(vbasedev, VFIO_DEVICE_TYPE_AP, &vfio_ap_ops, DEVICE(vapdev), true); + + /* AP device is mdev type device */ + vbasedev->mdev = true; } #ifdef CONFIG_IOMMUFD
mdevs aren't "physical" devices and when asking for backing IOMMU info, it fails the entire provisioning of the guest. Fix that by setting vbasedev->mdev true so skipping HostIOMMUDevice initialization in the presence of mdevs. Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler") Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> --- hw/vfio/ap.c | 3 +++ 1 file changed, 3 insertions(+)