On Tue, Jan 20, 2026 at 04:42:03AM +0000, Jia Yao wrote: > In a kexec reboot scenario, the GPU's Global Graphics Translation Table > (GGTT) retains its previous state after the kernel is reloaded, until i915 > reinitializes the GGTT. > > The simple-framebuffer driver is initialized before i915 and accesses the > PCIe memory space (GPU aperture) through outdated GGTT entries. This leads > to invalid physical memory accesses, causing GPF or data corruption. > > To prevent such issues, the Memory Space Enable (MSE) bit in the PCI Command > Register is cleared during i915_driver_shutdown. This disables all PCIe > memory space access (including MMIO and aperture) at the hardware level. > After the kernel is reloaded, access to the PCIe memory space will be > forbidden until i915 is re-initialized.
Still looks like a hack. I think the correct fix would involve preventing the kexec'd kernel from initializing the fb driver that is doing the invalid memory accesses. > > Since disabling PCIe memory space affects all MMIO operations, PXP shutdown > needs to be completed before this point. Calls intel_pxp_fini() before > disabling memory space to ensure PXP cleanup can still access MMIO registers. > > v2: > - follow brace style > > v3: > - revise description > > Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14598 > Cc: Alex Zuo <[email protected]> > Cc: Shuicheng Lin <[email protected]> > Cc: Askar Safin <[email protected]> > Cc: Pingfan Liu <[email protected]> > Suggested-by: Chris Wilson <[email protected]> > Signed-off-by: Jia Yao <[email protected]> > --- > drivers/gpu/drm/i915/i915_driver.c | 35 +++++++++++++++++++++++++++--- > 1 file changed, 32 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_driver.c > b/drivers/gpu/drm/i915/i915_driver.c > index b46cb54ef5dc..766f85726b67 100644 > --- a/drivers/gpu/drm/i915/i915_driver.c > +++ b/drivers/gpu/drm/i915/i915_driver.c > @@ -118,6 +118,33 @@ > > static const struct drm_driver i915_drm_driver; > > +static int i915_enable_device(struct pci_dev *pdev) > +{ > + u32 cmd; > + int ret; > + > + ret = pci_enable_device(pdev); > + if (ret) > + return ret; > + > + pci_read_config_dword(pdev, PCI_COMMAND, &cmd); > + if (!(cmd & PCI_COMMAND_MEMORY)) > + pci_write_config_dword(pdev, PCI_COMMAND, cmd | > PCI_COMMAND_MEMORY); > + > + return 0; > +} > + > +static void i915_disable_device(struct pci_dev *pdev) > +{ > + u32 cmd; > + > + pci_read_config_dword(pdev, PCI_COMMAND, &cmd); > + if (cmd & PCI_COMMAND_MEMORY) > + pci_write_config_dword(pdev, PCI_COMMAND, cmd & > ~PCI_COMMAND_MEMORY); > + > + pci_disable_device(pdev); > +} > + > static int i915_workqueues_init(struct drm_i915_private *dev_priv) > { > /* > @@ -788,7 +815,7 @@ int i915_driver_probe(struct pci_dev *pdev, const struct > pci_device_id *ent) > struct intel_display *display; > int ret; > > - ret = pci_enable_device(pdev); > + ret = i915_enable_device(pdev); > if (ret) { > pr_err("Failed to enable graphics device: %pe\n", ERR_PTR(ret)); > return ret; > @@ -796,7 +823,7 @@ int i915_driver_probe(struct pci_dev *pdev, const struct > pci_device_id *ent) > > i915 = i915_driver_create(pdev, ent); > if (IS_ERR(i915)) { > - pci_disable_device(pdev); > + i915_disable_device(pdev); > return PTR_ERR(i915); > } > > @@ -885,7 +912,7 @@ int i915_driver_probe(struct pci_dev *pdev, const struct > pci_device_id *ent) > enable_rpm_wakeref_asserts(&i915->runtime_pm); > i915_driver_late_release(i915); > out_pci_disable: > - pci_disable_device(pdev); > + i915_disable_device(pdev); > i915_probe_error(i915, "Device initialization failed (%d)\n", ret); > return ret; > } > @@ -1003,6 +1030,7 @@ void i915_driver_shutdown(struct drm_i915_private *i915) > > intel_dmc_suspend(display); > > + intel_pxp_fini(i915); > i915_gem_suspend(i915); > > /* > @@ -1020,6 +1048,7 @@ void i915_driver_shutdown(struct drm_i915_private *i915) > enable_rpm_wakeref_asserts(&i915->runtime_pm); > > intel_runtime_pm_driver_last_release(&i915->runtime_pm); > + i915_disable_device(to_pci_dev(i915->drm.dev)); > } > > static bool suspend_to_idle(struct drm_i915_private *dev_priv) > -- > 2.34.1 -- Ville Syrjälä Intel
