Bug 1216464 - Broken PCI Pass trough under LibVirt (KVM+Qemu).
Summary: Broken PCI Pass trough under LibVirt (KVM+Qemu).
Status: RESOLVED FEATURE
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Virtualization:Tools (show other bugs)
Version: Current
Hardware: x86-64 openSUSE Tumbleweed
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: virt-bugs list
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-22 14:10 UTC by Sławomir Lach
Modified: 2024-03-12 20:47 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sławomir Lach 2023-10-22 14:10:50 UTC
Without enabling IOMMU and load vfio-pci, there is possibility of hang system during poweroff and hang virt-manager.

Virt-manager does not complains about missing option, or does not clarify what happens, just running VM is broken after trying to pass through PCI device without do some task earlier.

Solution: made virt-manager check if IOMMU is enabled, etc. If check fail, show message explaining, what user should do.

Solution 2: add virtualization configure page to Yast-OpenSUSE-Installer. User could select server role, so add virtualization checkbox somewhere near. If checked and user press next, virtualization configuration page will appear, where user could add devices to pass through. If user do that, then check CPU type, enable IOMMU and configure vfio-pci module.
Maybe integrate it with Virtualization page under Yast in future?
Comment 1 James Fehlig 2023-10-22 21:47:35 UTC
(In reply to Sławomir Lach from comment #0)
> Solution: made virt-manager check if IOMMU is enabled, etc. If check fail,
> show message explaining, what user should do.

Or use the virt-host-validate tool from the libvirt-daemon-common package.

> Solution 2: add virtualization configure page to Yast-OpenSUSE-Installer.
> User could select server role, so add virtualization checkbox somewhere
> near. If checked and user press next, virtualization configuration page will
> appear, where user could add devices to pass through. If user do that, then
> check CPU type, enable IOMMU and configure vfio-pci module.
> Maybe integrate it with Virtualization page under Yast in future?

Perhaps the 'Install hypervisor and tools' yast module could add 'intel_iommu=on' to the kernel cmdline, if it doesn't do so already. IIRC, libvirt will automatically load the vfio-pci module if needed.
Comment 2 Charles Arnold 2024-03-04 22:20:23 UTC
(In reply to James Fehlig from comment #1)
> (In reply to Sławomir Lach from comment #0)
> > Solution: made virt-manager check if IOMMU is enabled, etc. If check fail,
> > show message explaining, what user should do.
> 
> Or use the virt-host-validate tool from the libvirt-daemon-common package.
> 
> > Solution 2: add virtualization configure page to Yast-OpenSUSE-Installer.
> > User could select server role, so add virtualization checkbox somewhere
> > near. If checked and user press next, virtualization configuration page will
> > appear, where user could add devices to pass through. If user do that, then
> > check CPU type, enable IOMMU and configure vfio-pci module.
> > Maybe integrate it with Virtualization page under Yast in future?
> 
> Perhaps the 'Install hypervisor and tools' yast module could add
> 'intel_iommu=on' to the kernel cmdline, if it doesn't do so already. IIRC,
> libvirt will automatically load the vfio-pci module if needed.

I believe this is already set by default in our kernels. Running,
cat /proc/config.gz | gunzip | grep IOMMU

will show among the options,

CONFIG_AMD_IOMMU=y
CONFIG_INTEL_IOMMU=y
Comment 3 Charles Arnold 2024-03-12 20:47:09 UTC
The feature is not broken, just not user friendly to use and it requires setup
outside the virtualization tools.

Setting up PCI passthrough requires host level configuration and
virt-manager does not check or report on whether that has been done.
Having the 'Install hypervisor and tools' yast module add the kernel command
line option automatically may not be correct for all users of virtualization
so it would need to be presented as a question (or checkbox) before enabling.

In either case, this bug sounds more like a feature request to improve how
PCI pasthrough is configured.