#!/bin/bash PLAT_FUNCS="/usr/local/sbin/nv_scripts/plat_funcs.bash" GENERAL_FUNCS="/usr/local/sbin/nv_scripts/general_funcs.bash" CONF_FILE="/etc/default/grub.d/iommu.cfg" OLD_CONF_FILE="/etc/default/grub.d/iommu-pt.cfg" . "${GENERAL_FUNCS}" . "${PLAT_FUNCS}" UPDATE_GRUB=false if [ -e $OLD_CONF_FILE ]; then rm $OLD_CONF_FILE UPDATE_GRUB=true fi if ! skip_platform_detection && plat_needs_iommu_pt; then IOMMU_PT=" iommu=pt" UPDATE_GRUB=true else IOMMU_PT="" fi # Model: 207 is Emerald Rapids (EMR) # Model: 173 is Granite Rapids (GNR) # # 10/30/2024: The current recommendation for better performance # is that intel_iommu=on should only be enabled on platforms with # the Emerald Rapids CPU. # 08/22/2025: Recommendation is to add "intel_iommu=on iommu=pt" # for Intel CPUs which is EMR and GNR. EMR_CPUTYPE="207" GNR_CPUTYPE="173" CPUTYPE=$(lscpu | grep "Model:" | awk '{print $2}') # Check if CPU is either EMR or GNR if [ "$CPUTYPE" == "$EMR_CPUTYPE" ] || [ "$CPUTYPE" == "$GNR_CPUTYPE" ]; then # Force both settings for GNR and EMR CPUs INTEL_IOMMU=" intel_iommu=on" IOMMU_PT=" iommu=pt" # Override with forced setting for GNR/EMR UPDATE_GRUB=true else INTEL_IOMMU="" fi if $UPDATE_GRUB; then if [[ "$IOMMU_PT" != "" || "$INTEL_IOMMU" != "" ]]; then echo "GRUB_CMDLINE_LINUX=\"\$GRUB_CMDLINE_LINUX${IOMMU_PT}${INTEL_IOMMU}\"" > ${CONF_FILE} fi /usr/sbin/update-grub ||: fi exit 0