Within the i915 driver, intel_pxp_fini is called through different paths.

i915_pci_shutdown → i915_driver_shutdown → intel_pxp_fini  (new added)
i915_pci_remove → i915_driver_remove → i915_driver_unregister → intel_pxp_fini

For MEI-based PXP,  which is mentioned in the commit message.
> 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.

>From i915

Kernel_kexec
        -> kernel_restart_prepare
                -> pci_device_shutdown
                        -> i915_driver_shutdown
                                ->  intel_pxp_fini
                                        -> intel_pxp_tee_component_fini         
       // will delete component

>From mei

Kernel_kexec
        -> kernel_restart_prepare
                -> pci_device_shutdown
                        -> mei_me_shutdown
                                -> mei_stop
                                        -> mei_cl_bus_remove_device
                                                -> device_release_driver
                                                        -> 
device_release_driver_internal
                                                                -> 
mei_cl_device_remove
                                                                        -> 
mei_pxp_remove
                                                                                
-> component_master_del
                                                                                
        ->take_down_aggregate_device
                                                                                
                -> mei_component_master_unbind
                                                                                
                        ->component_unbind_all
                                                                                
                                ->component_unbind                    // will 
not be called
                                                                                
                                        ->i915_pxp_tee_component_unbind
                                                                                
                                                -> intel_pxp_fini_hw


After intel_pxp_tee_component_fini is called,  for mei_me_shutdown stack,  
component_unbind will not be called for component has been deleted.

-----Original Message-----
From: Jani Nikula <[email protected]> 
Sent: Tuesday, January 20, 2026 1:51 AM
To: Yao, Jia <[email protected]>; [email protected]
Cc: Yao, Jia <[email protected]>; Zuo, Alex <[email protected]>; Lin, 
Shuicheng <[email protected]>; Askar Safin <[email protected]>; 
Pingfan Liu <[email protected]>; Chris Wilson <[email protected]>
Subject: Re: [PATCH v3] drm/i915: Clearing the Memory Space Enable bit when 
disabling i915

On Tue, 20 Jan 2026, Jia Yao <[email protected]> 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.
>
> 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);

This is now called twice. Please fix it.

>       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)

--
Jani Nikula, Intel

Reply via email to