mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 10:52:22 +00:00
List the IOMMU group members before adding a GPU to a VM and keep the NVENC patch state
- Add GPU to VM lists the devices from other slots that share the IOMMU group of the selected GPU before the summary - The NVIDIA installer keeps the patched flag of the installed driver while its version is unchanged - New messages translated into all languages
This commit is contained in:
@@ -1121,6 +1121,7 @@ analyze_iommu_group() {
|
||||
local group_dir="/sys/kernel/iommu_groups/${IOMMU_GROUP}/devices"
|
||||
local display_lines=""
|
||||
local extra_devices=0
|
||||
local other_slot_devices=0
|
||||
|
||||
for dev_path in "${group_dir}/"*; do
|
||||
[[ -e "$dev_path" ]] || continue
|
||||
@@ -1149,8 +1150,16 @@ analyze_iommu_group() {
|
||||
display_lines+=" • ${dev} ${dev_name} [${dev_driver}]\n"
|
||||
|
||||
[[ "$dev" != "$pci_full" ]] && extra_devices=$((extra_devices + 1))
|
||||
[[ "${dev%.*}" != "${pci_full%.*}" ]] && other_slot_devices=$((other_slot_devices + 1))
|
||||
done
|
||||
|
||||
if [[ $other_slot_devices -gt 0 ]]; then
|
||||
local box_h=$(( 13 + ${#IOMMU_DEVICES[@]} ))
|
||||
(( box_h > 24 )) && box_h=24
|
||||
_pmx_msgbox "$(translate 'IOMMU Group') ${IOMMU_GROUP}" \
|
||||
"\n$(translate 'These devices share the IOMMU group of the selected GPU and will be assigned to the VM with it:')\n\n${display_lines}\n$(translate 'The host loses access to them. If the group includes a network or storage controller the host needs, cancel at the summary.')" \
|
||||
"$box_h" 82
|
||||
fi
|
||||
}
|
||||
|
||||
# Returns 0 if the BDF at $1 is a real PCI audio device (class 04xx).
|
||||
|
||||
@@ -203,8 +203,14 @@ detect_driver_status() {
|
||||
|
||||
if [[ -n "$CURRENT_DRIVER_VERSION" ]]; then
|
||||
CURRENT_DRIVER_INSTALLED=true
|
||||
# Register the installed driver version in components_status.json
|
||||
update_component_status "nvidia_driver" "installed" "$CURRENT_DRIVER_VERSION" "gpu" '{"patched":false}'
|
||||
# Register the installed driver version in components_status.json,
|
||||
# keeping the patched flag while the recorded version is unchanged.
|
||||
local patched_json='{"patched":false}'
|
||||
if [[ "$(jq -r '.nvidia_driver.version // empty' "$COMPONENTS_STATUS_FILE" 2>/dev/null)" == "$CURRENT_DRIVER_VERSION" ]] \
|
||||
&& is_current_nvidia_patched; then
|
||||
patched_json='{"patched":true}'
|
||||
fi
|
||||
update_component_status "nvidia_driver" "installed" "$CURRENT_DRIVER_VERSION" "gpu" "$patched_json"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user