The PCI selector shows the IDs of the devices including the domain, so
the default '0000' domain was removed again before saving, as it is
optional in the hostpci option.
Since the refactoring in commit a7ec3666 ("ui: qemu/PCI Edit: code
cleanup/refactoring/modernize"), the result of the replace call is not
assigned anymore, so the domain is kept and a device that was
configured as '01:00.0' gets saved as '0000:01:00.0' on any edit of
the passthrough device.
Assign the result again, so the domain is only kept if it is not the
default one, like before.
Fixes: a7ec3666 ("ui: qemu/PCI Edit: code cleanup/refactoring/modernize")
Signed-off-by: Michal Fox <me@dualfroz.com>
When selecting a raw PCI device, a warning should be shown if the device
is not in a separate IOMMU group. To not count the other functions of
the selected device itself, the check only compares the bus and device
part of the PCI IDs, by taking their first five characters.
But since the PCI selector also shows the domain, for example
'0000:01:00.0', the first five characters are just the domain. So all
devices of the same domain were treated as functions of the selected
device and the warning was never shown.
Compare everything before the function instead, so the domain, bus and
device, like the IOMMU check in the PCI mapping editor does.
Fixes: f36240c5 ("gui: pci passthrough: consider domain in PCISelector")
Signed-off-by: Michal Fox <me@dualfroz.com>