Skip to content

Conversation

pothos
Copy link
Member

@pothos pothos commented Aug 11, 2025

When the virtio graphic mode instead of qemu's bochs was used, the
interactive console did not show up because fbdev emulation recently
got disabled.
Reenable fbdev emulation and also add the "simple" and QXL FB DRM
driver to make TTM_HELPER available for the out-of-tree nvidia driver
(which is needed when fbdev emulation is enabled).

Fixes flatcar/Flatcar#1834

How to use

Testing done

./flatcar_production_qemu.sh -- -vga virtio now gives an interactive login prompt

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

@pothos pothos requested a review from a team as a code owner August 11, 2025 14:35
@chewi
Copy link
Contributor

chewi commented Aug 11, 2025

I'm not sure why @jepio didn't do this to begin with. Maybe he thought CONFIG_DRM_SIMPLEDRM would be too large? Please let us know the size increase in any case.

Copy link

github-actions bot commented Aug 11, 2025

Build action triggered: https://github.com/flatcar/scripts/actions/runs/16918629964

@jepio
Copy link
Member

jepio commented Aug 11, 2025

If it works then good but it doesn't look like SIMPLEDRM selects DRM_TTM_HELPER so this might not work.

@pothos
Copy link
Member Author

pothos commented Aug 11, 2025

I first tried it with DRM_BOCHS and that worked. But it has the side effect of giving a large screen in the qemu script (same as with the uefi script). I tried with simple DRM but that isn't enough to enable the helpers required for nvidia. I guess the bochs support is an ok workaround? It would mean that the qemu window size is always the same in the end, regardless of UEFI or BIOS. One can still get the old behavior with setting, e.g., -vga qxl. We could also try it the other way round, otherwise: Enable DRM support for something like qxl and then the bochs mode would stay as is.

@pothos
Copy link
Member Author

pothos commented Aug 11, 2025

With bochs the vmlinuz size increase was 200 KB

@pothos
Copy link
Member Author

pothos commented Aug 11, 2025

I've added bochs now and if we don't like the new behavior we can also enable qxl instead of something less used.

@pothos
Copy link
Member Author

pothos commented Aug 11, 2025

With -vga virtio one also does't get a large screen under BIOS.

@chewi
Copy link
Contributor

chewi commented Aug 11, 2025

I tend to think of Bochs as a legacy option. QXL may be better, but I normally only use that with Windows. I would say CONFIG_DRM_VIRTIO_GPU is the best choice, but that doesn't enable the helper either. Are we sure there isn't a way to enable the helper unconditionally?

@pothos
Copy link
Member Author

pothos commented Aug 11, 2025

Ah, with QXL only TTM but not VRAM gets enabled. Yes, I don't know if there's a better way (CONFIG_DRM_VIRTIO_GPU=m is already in use).

@pothos
Copy link
Member Author

pothos commented Aug 11, 2025

Jeremi only mentioned TTM, maybe that's enough then?

@jepio
Copy link
Member

jepio commented Aug 11, 2025

Ah, with QXL only TTM but not VRAM gets enabled. Yes, I don't know if there's a better way (CONFIG_DRM_VIRTIO_GPU=m is already in use).

I think any one of these work:

$ git grep DRM_TTM_HELPER
drivers/gpu/drm/Kconfig:232:config DRM_TTM_HELPER
drivers/gpu/drm/Makefile:128:obj-$(CONFIG_DRM_TTM_HELPER) += drm_ttm_helper.o
drivers/gpu/drm/amd/amdgpu/Kconfig:18:  select DRM_TTM_HELPER
drivers/gpu/drm/hisilicon/hibmc/Kconfig:11:     select DRM_TTM_HELPER
drivers/gpu/drm/loongson/Kconfig:10:    select DRM_TTM_HELPER
drivers/gpu/drm/nouveau/Kconfig:14:     select DRM_TTM_HELPER
drivers/gpu/drm/qxl/Kconfig:8:  select DRM_TTM_HELPER
drivers/gpu/drm/radeon/Kconfig:14:      select DRM_TTM_HELPER
drivers/gpu/drm/vboxvideo/Kconfig:9:    select DRM_TTM_HELPER
drivers/gpu/drm/vmwgfx/Kconfig:8:       select DRM_TTM_HELPER
drivers/gpu/drm/xe/Kconfig:40:  select DRM_TTM_HELPER

@pothos
Copy link
Member Author

pothos commented Aug 11, 2025

Good, when qxl is enough it makes sense to set the drm support for it instead of bochs to leave the qemu script window size as is.

@chewi
Copy link
Contributor

chewi commented Aug 11, 2025

I haven't tried it, but I think one way to force it is to patch the kernel like this:

--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -300,7 +300,7 @@ config DRM_VRAM_HELPER
          Helpers for VRAM memory management
 
 config DRM_TTM_HELPER
-       tristate
+       tristate "I REALLY WANT THIS ON"
        depends on DRM
        select DRM_TTM
        select DRM_KMS_HELPER if DRM_FBDEV_EMULATION

I'd be up for that. This is a relatively low traffic part of the code.

@chewi
Copy link
Contributor

chewi commented Aug 11, 2025

I haven't tried this either, but Copilot tells me that it should work if we do this after our call to make olddefconfig... and possibly make savedefconfig.

./scripts/config --enable CONFIG_DRM_TTM_HELPER

@pothos
Copy link
Member Author

pothos commented Aug 11, 2025

The kernel image is 267 KiB larger now compared to the last Alpha, which I find acceptable.

Patching is a fun idea - I still think that a plain config based way is a bit nicer even if the patch could be easily rebased. Less differences compared to other distro's kernel configs also helps against hitting weird corner cases (like the one we are fixing here).

@chewi
Copy link
Contributor

chewi commented Aug 12, 2025

I haven't tried this either, but Copilot tells me that it should work if we do this after our call to make olddefconfig... and possibly make savedefconfig.

./scripts/config --enable CONFIG_DRM_TTM_HELPER

Unfortunately, this doesn't work. The build process calls make syncconfig, which resets it.

The kernel image is 267 KiB larger now compared to the last Alpha, which I find acceptable.

I don't think we can afford that. We're down to our last 850KB per kernel image. It may not look like this in CI, but I've been tracking this over time across different releases. If you originally installed 3975.2 and upgrade 4368.0.0 then 4372.0.1, you would have about 1700KB left in /boot.

Dealing this was my number 1 priority this year until very recently. Something else has jumped in front, but I intend to get back to it very soon. I would gladly enable most of the DRM drivers once this is fixed.

When the virtio graphic mode instead of qemu's bochs was used, the
interactive console did not show up because fbdev emulation recently
got disabled.
Reenable fbdev emulation and also add the "simple" and QXL FB DRM
driver to make TTM_HELPER available for the out-of-tree nvidia driver
(which is needed when fbdev emulation is enabled).

Fixes flatcar/Flatcar#1834

Signed-off-by: Kai Lueke <[email protected]>
@pothos
Copy link
Member Author

pothos commented Aug 12, 2025

Together with flatcar/bootengine#108 we are 389 KB smaller than Alpha (one more thing to do as a follow-up is the tpm2 wrapper which became a binary again).
We have enough breathing room for now while we look into a permanent solution such as a tiny (initial) initrd or loading unneeded firmware/modules from /usr etc.

@pothos pothos merged commit a29d5b5 into main Aug 13, 2025
1 of 5 checks passed
@pothos pothos deleted the kai/drm-console branch August 13, 2025 14:21
pothos added a commit that referenced this pull request Aug 13, 2025
sys-kernel/coreos-modules: Reenable console support for DRM
pothos added a commit that referenced this pull request Aug 13, 2025
sys-kernel/coreos-modules: Reenable console support for DRM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

[Regression] Graphical console doesn't work in libvirt/QEMU
4 participants