> -----Original Message----- > From: Nicolin Chen <nicolinc@nvidia.com> > Sent: Thursday, February 6, 2025 8:33 PM > To: Shameerali Kolothum Thodi > <shameerali.kolothum.thodi@huawei.com>; Daniel P. Berrangé > <berrange@redhat.com>; Jason Gunthorpe <jgg@nvidia.com> > Cc: qemu-arm@nongnu.org; qemu-devel@nongnu.org; > eric.auger@redhat.com; peter.maydell@linaro.org; ddutile@redhat.com; > Linuxarm <linuxarm@huawei.com>; Wangzhou (B) > <wangzhou1@hisilicon.com>; jiangkunkun <jiangkunkun@huawei.com>; > Jonathan Cameron <jonathan.cameron@huawei.com>; > zhangfei.gao@linaro.org; nathanc@nvidia.com > Subject: Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable > nested SMMUv3 > > On Thu, Feb 06, 2025 at 02:22:01PM -0400, Jason Gunthorpe wrote: > > On Thu, Feb 06, 2025 at 06:18:14PM +0000, Shameerali Kolothum Thodi > wrote: > > > > > > So even if you invent an iommu ID we cannot accept it as a handle to > > > > create viommu in iommufd. > > > > > > Creating the vIOMMU only happens when the user does a cold/hot > plug of > > > a VFIO device. At that time Qemu checks whether the assigned id > matches > > > with whatever the kernel tell it. > > > > This is not hard up until the guest is started. If you boot a guest > > without a backing viommu iommufd object then there will be some more > > complexities. > > Yea, I imagined that things would be complicated with hotplugs.. > > On one hand, I got the part that we need some fixed link forehand > to ease migration/hotplugs. > > On the other hand, all IOMMUFD ioctls need a VFIO device FD, which > brings the immediate attention that we cannot even decide vSMMU's > capabilities being reflected in its IDR/IIDR registers, without a > coldplug device -- if we boot a VM (one vSMMU<->pSMMU) with only a > hotplug device, the IOMMU_GET_HW_INFO cannot be done during guest Right. I forgot about the call to smmu_dev_get_info() during the reset. That means we need at least one dev per Guest SMMU during Guest boot :( Thanks, Shameer
On Fri, Feb 07, 2025 at 10:21:17AM +0000, Shameerali Kolothum Thodi wrote: > > > > -----Original Message----- > > From: Nicolin Chen <nicolinc@nvidia.com> > > Sent: Thursday, February 6, 2025 8:33 PM > > To: Shameerali Kolothum Thodi > > <shameerali.kolothum.thodi@huawei.com>; Daniel P. Berrangé > > <berrange@redhat.com>; Jason Gunthorpe <jgg@nvidia.com> > > Cc: qemu-arm@nongnu.org; qemu-devel@nongnu.org; > > eric.auger@redhat.com; peter.maydell@linaro.org; ddutile@redhat.com; > > Linuxarm <linuxarm@huawei.com>; Wangzhou (B) > > <wangzhou1@hisilicon.com>; jiangkunkun <jiangkunkun@huawei.com>; > > Jonathan Cameron <jonathan.cameron@huawei.com>; > > zhangfei.gao@linaro.org; nathanc@nvidia.com > > Subject: Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable > > nested SMMUv3 > > > > On Thu, Feb 06, 2025 at 02:22:01PM -0400, Jason Gunthorpe wrote: > > > On Thu, Feb 06, 2025 at 06:18:14PM +0000, Shameerali Kolothum Thodi > > wrote: > > > > > > > > So even if you invent an iommu ID we cannot accept it as a handle to > > > > > create viommu in iommufd. > > > > > > > > Creating the vIOMMU only happens when the user does a cold/hot > > plug of > > > > a VFIO device. At that time Qemu checks whether the assigned id > > matches > > > > with whatever the kernel tell it. > > > > > > This is not hard up until the guest is started. If you boot a guest > > > without a backing viommu iommufd object then there will be some more > > > complexities. > > > > Yea, I imagined that things would be complicated with hotplugs.. > > > > On one hand, I got the part that we need some fixed link forehand > > to ease migration/hotplugs. > > > > On the other hand, all IOMMUFD ioctls need a VFIO device FD, which > > brings the immediate attention that we cannot even decide vSMMU's > > capabilities being reflected in its IDR/IIDR registers, without a > > coldplug device -- if we boot a VM (one vSMMU<->pSMMU) with only a > > hotplug device, the IOMMU_GET_HW_INFO cannot be done during guest > > Right. I forgot about the call to smmu_dev_get_info() during the reset. > That means we need at least one dev per Guest SMMU during Guest > boot :( That's pretty unpleasant as a usage restriction. It sounds like there needs to be a way to configure & control the vIOMMU independantly of attaching a specific VFIO device. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
> -----Original Message----- > From: Daniel P. Berrangé <berrange@redhat.com> > Sent: Friday, February 7, 2025 10:32 AM > To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com> > Cc: Nicolin Chen <nicolinc@nvidia.com>; Jason Gunthorpe > <jgg@nvidia.com>; qemu-arm@nongnu.org; qemu-devel@nongnu.org; > eric.auger@redhat.com; peter.maydell@linaro.org; ddutile@redhat.com; > Linuxarm <linuxarm@huawei.com>; Wangzhou (B) > <wangzhou1@hisilicon.com>; jiangkunkun <jiangkunkun@huawei.com>; > Jonathan Cameron <jonathan.cameron@huawei.com>; > zhangfei.gao@linaro.org; nathanc@nvidia.com > Subject: Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable > nested SMMUv3 > > On Fri, Feb 07, 2025 at 10:21:17AM +0000, Shameerali Kolothum Thodi > wrote: > > > > > > > -----Original Message----- > > > From: Nicolin Chen <nicolinc@nvidia.com> > > > Sent: Thursday, February 6, 2025 8:33 PM > > > To: Shameerali Kolothum Thodi > > > <shameerali.kolothum.thodi@huawei.com>; Daniel P. Berrangé > > > <berrange@redhat.com>; Jason Gunthorpe <jgg@nvidia.com> > > > Cc: qemu-arm@nongnu.org; qemu-devel@nongnu.org; > > > eric.auger@redhat.com; peter.maydell@linaro.org; > ddutile@redhat.com; > > > Linuxarm <linuxarm@huawei.com>; Wangzhou (B) > > > <wangzhou1@hisilicon.com>; jiangkunkun <jiangkunkun@huawei.com>; > > > Jonathan Cameron <jonathan.cameron@huawei.com>; > > > zhangfei.gao@linaro.org; nathanc@nvidia.com > > > Subject: Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user- > creatable > > > nested SMMUv3 > > > > > > On Thu, Feb 06, 2025 at 02:22:01PM -0400, Jason Gunthorpe wrote: > > > > On Thu, Feb 06, 2025 at 06:18:14PM +0000, Shameerali Kolothum > Thodi > > > wrote: > > > > > > > > > > So even if you invent an iommu ID we cannot accept it as a handle > to > > > > > > create viommu in iommufd. > > > > > > > > > > Creating the vIOMMU only happens when the user does a cold/hot > > > plug of > > > > > a VFIO device. At that time Qemu checks whether the assigned id > > > matches > > > > > with whatever the kernel tell it. > > > > > > > > This is not hard up until the guest is started. If you boot a guest > > > > without a backing viommu iommufd object then there will be some > more > > > > complexities. > > > > > > Yea, I imagined that things would be complicated with hotplugs.. > > > > > > On one hand, I got the part that we need some fixed link forehand > > > to ease migration/hotplugs. > > > > > > On the other hand, all IOMMUFD ioctls need a VFIO device FD, which > > > brings the immediate attention that we cannot even decide vSMMU's > > > capabilities being reflected in its IDR/IIDR registers, without a > > > coldplug device -- if we boot a VM (one vSMMU<->pSMMU) with only a > > > hotplug device, the IOMMU_GET_HW_INFO cannot be done during > guest > > > > Right. I forgot about the call to smmu_dev_get_info() during the reset. > > That means we need at least one dev per Guest SMMU during Guest > > boot :( > > That's pretty unpleasant as a usage restriction. It sounds like there > needs to be a way to configure & control the vIOMMU independantly of > attaching a specific VFIO device. Yes, that would be ideal. Just wondering whether we can have something like the vfio_register_iommu_driver() for iommufd subsystem by which it can directly access iommu drivers ops(may be a restricted set). Not sure about the layering violations and other security issues with that... Thanks, Shameer
On Fri, Feb 07, 2025 at 12:21:54PM +0000, Shameerali Kolothum Thodi wrote: > Just wondering whether we can have something like the > vfio_register_iommu_driver() for iommufd subsystem by which it can directly > access iommu drivers ops(may be a restricted set). I very much want to try hard to avoid that. AFAICT you do not need a VFIO device, or access to the HW_INFO of the smmu to start up a SMMU driver. Yes, you cannot later attach a VFIO device with a pSMMU that materially differs from vSMMU setup, but that is fine. qemu has long had a duality where you can either "inherit from host" for an easy setup or be "fully specified" and support live migration/etc. CPUID as a simple example. So, what the smmu patches are doing now is "inherit from host" and that requires a VFIO device to work. I think that is fine. If you want to do full hotplug then you need to "fully specified" on the command line so a working vSMMU can be shown to the guest with no devices, and no kernel involvement. Obviously this is a highly advanced operating mode as things like IIDR and errata need to be considered, but I would guess booting with no vPCI devices is already abnormal. Jason
© 2016 - 2025 Red Hat, Inc.