On Wed, Nov 17, 2021 at 09:39:17AM +0100, Jan Beulich wrote: > On 13.09.2021 11:02, Jan Beulich wrote: > > libxl__domain_config_setdefault() checks whether PoD is going to be > > enabled and fails domain creation if at the same time devices would get > > assigned. Nevertheless setting up of IOMMU page tables is allowed.
I'm unsure whether allowing enabling the IOMMU with PoD is the right thing to do, at least for our toolstack. > > However, when later assigning a device to a domain which has IOMMU page > > tables, libxl__device_pci_add() does not appear to be concerned of PoD: > > - xc_test_assign_device() / XEN_DOMCTL_test_assign_device only check the > > device for being available to assign, > > - libxl__device_pci_setdefault() is only concerned about the RDM policy, > > - other functions called look to not be related to such checking at all. > > I've now verified this to be the case. In fact creating the guest and > assigning it a device while the guest still sits in the boot loader > allowed the (oldish) Linux guest I've been using to recognize the device > (and hence load its driver) even without any hotplug driver. Obviously > while still in the boot loader ... > > > IMO assignment should fail if pod.count != pod.entry_count, > > ... this holds, and hence assignment should have failed. > > IOW this approach currently is a simple "workaround" to avoid the "PCI > device assignment for HVM guest failed due to PoD enabled" error upon > domain creation. > > I'll see if I can find a reasonable place to add the missing check; I'm > less certain about ... > > > and all PoD > > entries should be resolved otherwise (whether explicitly by the > > hypervisor or through some suitable existing hypercalls - didn't check > > yet whether there are any reasonable candidates - by the tool stack is > > secondary). > > ... the approach to take here. I think forcing all entries to be resolved would be unexpected when assigning a device. I would rather print a message saying that either the guest must balloon down to the requested amount of memory, or that all entries should be resolved (ie: using mem-set to match the mem-max value). Thanks, Roger.