Skip to content

Commit

Permalink
x86: make i915 as a kmod with required firmware
Browse files Browse the repository at this point in the history
i915 driver requires to load correct firmware to work on latest x86
GPU, it is more reasonable to make it as a kernel module, so that
initramfs is not required, and it can also save some space from the
kernel image comparing being a built-in driver

Signed-off-by: Joe Zheng <joe.zheng@intel.com>
Signed-off-by: Robert Marko <robimarko@gmail.com>
  • Loading branch information
joez committed Dec 25, 2024
1 parent aeac24f commit 55be1d6
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 138 deletions.
144 changes: 43 additions & 101 deletions package/firmware/linux-firmware/intel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -224,107 +224,49 @@ define Package/e100-firmware/install
endef
$(eval $(call BuildPackage,e100-firmware))

Package/i915-firmware = $(call Package/firmware-default,Intel GPU firmware)
i915_deps:=+i915-firmware-dmc +i915-firmware-guc +i915-firmware-huc +i915-firmware-gsc
Package/i915-firmware = $(call Package/firmware-default,Intel I915 firmware \(meta package\),$(i915_deps))
define Package/i915-firmware/install
$(INSTALL_DIR) $(1)/lib/firmware/i915
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_dmc_ver1_09.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_dmc_ver2_09.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_dmc_ver2_10.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_dmc_ver2_12.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_dmc_ver2_14.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_dmc_ver2_16.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_guc_62.0.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_guc_69.0.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_guc_70.1.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adlp_guc_70.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/adls_dmc_ver2_01.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_dmc_ver1_07.bin $(1)/lib/firmware/i915/
ln -s /lib/firmware/i915/bxt_dmc_ver1_07.bin $(1)/lib/firmware/i915/bxt_dmc_ver1.bin
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_32.0.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_33.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_49.0.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_62.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_ver8_7.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_guc_ver9_29.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_huc_2.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_huc_ver01_07_1398.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/bxt_huc_ver01_8_2893.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cml_guc_33.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cml_guc_49.0.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cml_guc_62.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cml_huc_4.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cnl_dmc_ver1_06.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/cnl_dmc_ver1_07.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/dg1_dmc_ver2_02.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/dg1_guc_49.0.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/dg1_guc_62.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/dg1_huc_7.7.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/dg1_huc_7.9.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_guc_33.0.4.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_guc_49.0.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_guc_62.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_guc_69.0.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_guc_70.1.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/ehl_huc_9.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_dmc_ver1_04.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_guc_32.0.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_guc_33.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_guc_49.0.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_guc_62.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_guc_70.1.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_huc_4.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/glk_huc_ver03_01_2893.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_dmc_ver1_07.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_dmc_ver1_09.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_guc_32.0.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_guc_33.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_guc_49.0.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_guc_62.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_huc_9.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/icl_huc_ver8_4_3238.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_dmc_ver1_01.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_dmc_ver1_04.bin $(1)/lib/firmware/i915/
ln -s /lib/firmware/i915/kbl_dmc_ver1_04.bin $(1)/lib/firmware/i915/kbl_dmc_ver1.bin
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_32.0.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_33.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_49.0.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_62.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_70.1.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_ver9_14.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_guc_ver9_39.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_huc_4.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/kbl_huc_ver02_00_1810.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/rkl_dmc_ver2_02.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/rkl_dmc_ver2_03.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_dmc_ver1_23.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_dmc_ver1_26.bin $(1)/lib/firmware/i915/
ln -s /lib/firmware/i915/skl_dmc_ver1_26.bin $(1)/lib/firmware/i915/skl_dmc_ver1.bin
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_dmc_ver1_27.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_32.0.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_33.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_49.0.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_62.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_ver1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_ver4.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_ver6_1.bin $(1)/lib/firmware/i915/
ln -s /lib/firmware/i915/skl_guc_ver6_1.bin $(1)/lib/firmware/i915/skl_guc_ver6.bin
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_guc_ver9_33.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_huc_2.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/skl_huc_ver01_07_1398.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_dmc_ver2_04.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_dmc_ver2_06.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_dmc_ver2_08.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_dmc_ver2_12.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_guc_35.2.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_guc_49.0.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_guc_62.0.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_guc_69.0.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_guc_70.1.1.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_guc_70.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_huc.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_huc_7.0.12.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_huc_7.0.3.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_huc_7.5.0.bin $(1)/lib/firmware/i915/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/i915/tgl_huc_7.9.3.bin $(1)/lib/firmware/i915/
true
endef
$(eval $(call BuildPackage,i915-firmware))

Package/i915-firmware-dmc = $(call Package/firmware-default,Intel I915 DMC firmware)
define Package/i915-firmware-dmc/install
$(INSTALL_DIR) $(1)/lib/firmware/i915
for f in $(PKG_BUILD_DIR)/i915/*_dmc*.bin; do \
t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \
if [ "$$$$t" = dmc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \
done
endef
$(eval $(call BuildPackage,i915-firmware-dmc))

Package/i915-firmware-guc = $(call Package/firmware-default,Intel I915 GUC firmware)
define Package/i915-firmware-guc/install
$(INSTALL_DIR) $(1)/lib/firmware/i915
for f in $(PKG_BUILD_DIR)/i915/*_guc*.bin; do \
t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \
if [ "$$$$t" = guc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \
done
endef
$(eval $(call BuildPackage,i915-firmware-guc))

Package/i915-firmware-huc = $(call Package/firmware-default,Intel I915 HUC firmware)
define Package/i915-firmware-huc/install
$(INSTALL_DIR) $(1)/lib/firmware/i915
for f in $(PKG_BUILD_DIR)/i915/*_huc*.bin; do \
t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \
if [ "$$$$t" = huc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \
done
endef
$(eval $(call BuildPackage,i915-firmware-huc))

Package/i915-firmware-gsc = $(call Package/firmware-default,Intel I915 GSC firmware)
define Package/i915-firmware-gsc/install
$(INSTALL_DIR) $(1)/lib/firmware/i915
for f in $(PKG_BUILD_DIR)/i915/*_gsc*.bin; do \
t=`echo $$$${f##*/} | cut -d_ -f2 | cut -d. -f1`; \
if [ "$$$$t" = gsc ]; then $(CP) $$$$f $(1)/lib/firmware/i915/; fi \
done
endef
$(eval $(call BuildPackage,i915-firmware-gsc))
81 changes: 44 additions & 37 deletions package/kernel/linux/modules/video.mk
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,50 @@ endef

$(eval $(call KernelPackage,drm-amdgpu))

define KernelPackage/drm-i915
SUBMENU:=$(VIDEO_MENU)
TITLE:=Intel i915 DRM support
DEPENDS:=@(TARGET_x86_64||TARGET_x86_generic||TARGET_x86_legacy) \
@DISPLAY_SUPPORT +i915-firmware-dmc +kmod-backlight +kmod-drm-ttm \
+kmod-drm-ttm-helper +kmod-drm-kms-helper +kmod-i2c-algo-bit \
+(LINUX_6_1||LINUX_6_6||LINUX_6_12):kmod-drm-display-helper \
+(LINUX_6_1||LINUX_6_6||LINUX_6_12):kmod-acpi-video \
+kmod-drm-buddy +kmod-drm-exec +kmod-drm-suballoc-helper
KCONFIG:=CONFIG_DRM_I915 \
CONFIG_DRM_I915_CAPTURE_ERROR=y \
CONFIG_DRM_I915_COMPRESS_ERROR=y \
CONFIG_DRM_I915_DEBUG=n \
CONFIG_DRM_I915_DEBUG_GUC=n \
CONFIG_DRM_I915_DEBUG_MMIO=n \
CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n \
CONFIG_DRM_I915_DEBUG_VBLANK_EVADE=n \
CONFIG_DRM_I915_FENCE_TIMEOUT=10000 \
CONFIG_DRM_I915_FORCE_PROBE="" \
CONFIG_DRM_I915_HEARTBEAT_INTERVAL=2500 \
CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS=n \
CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000 \
CONFIG_DRM_I915_PREEMPT_TIMEOUT=640 \
CONFIG_DRM_I915_PREEMPT_TIMEOUT_COMPUTE=7500 \
CONFIG_DRM_I915_REQUEST_TIMEOUT=20000 \
CONFIG_DRM_I915_SELFTEST=n \
CONFIG_DRM_I915_STOP_TIMEOUT=100 \
CONFIG_DRM_I915_SW_FENCE_CHECK_DAG=n \
CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS=n \
CONFIG_DRM_I915_TIMESLICE_DURATION=1 \
CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND=250 \
CONFIG_DRM_I915_USERPTR=y \
CONFIG_DRM_I915_WERROR=n \
CONFIG_FB_INTEL=n
FILES:=$(LINUX_DIR)/drivers/gpu/drm/i915/i915.ko
AUTOLOAD:=$(call AutoProbe,i915)
endef

define KernelPackage/drm-i915/description
Direct Rendering Manager (DRM) support for Intel GPU
endef

$(eval $(call KernelPackage,drm-i915))


define KernelPackage/drm-imx
SUBMENU:=$(VIDEO_MENU)
Expand Down Expand Up @@ -1372,40 +1416,3 @@ define KernelPackage/video-tw686x/description
endef

$(eval $(call KernelPackage,video-tw686x))

define KernelPackage/drm-i915
SUBMENU:=$(VIDEO_MENU)
TITLE:=Intel GPU drm support
DEPENDS:=@TARGET_x86 +kmod-drm-buddy +kmod-drm-ttm +kmod-drm-kms-helper +i915-firmware \
+(LINUX_6_1||LINUX_6_6||LINUX_6_12):kmod-drm-display-helper +(LINUX_6_1||LINUX_6_6||LINUX_6_12):kmod-acpi-video
KCONFIG:= \
CONFIG_INTEL_GTT \
CONFIG_DRM_I915 \
CONFIG_DRM_I915_CAPTURE_ERROR \
CONFIG_DRM_I915_COMPRESS_ERROR \
CONFIG_DRM_I915_DEBUG=n \
CONFIG_DRM_I915_DEBUG_GUC=n \
CONFIG_DRM_I915_DEBUG_MMIO=n \
CONFIG_DRM_I915_DEBUG_RUNTIME_PM=n \
CONFIG_DRM_I915_DEBUG_VBLANK_EVADE=n \
CONFIG_DRM_I915_GVT=y \
CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS=n \
CONFIG_DRM_I915_SELFTEST=n \
CONFIG_DRM_I915_SW_FENCE_CHECK_DAG=n \
CONFIG_DRM_I915_SW_FENCE_DEBUG_OBJECTS=n \
CONFIG_DRM_I915_USERPTR=y \
CONFIG_DRM_I915_WERROR=n
FILES:= \
$(LINUX_DIR)/drivers/gpu/drm/i915/i915.ko
AUTOLOAD:=$(call AutoProbe,i915)
endef

define KernelPackage/drm-i915/description
Direct Rendering Manager (DRM) support for "Intel Graphics
Media Accelerator" or "HD Graphics" integrated graphics,
including 830M, 845G, 852GM, 855GM, 865G, 915G, 945G, 965G,
G35, G41, G43, G45 chipsets and Celeron, Pentium, Core i3,
Core i5, Core i7 as well as Atom CPUs with integrated graphics.
endef

$(eval $(call KernelPackage,drm-i915))

0 comments on commit 55be1d6

Please sign in to comment.