VRAM Self Refresh
Subsystems (6)
v3 cover VRAM Self Refresh
This revision has fixed the below review comment on rev2 series.
PCIe ACPI Patches:
- dropped the notifier block code and added patch to allow only one Aux power limit request per root port (Rafael)
- Addressed Review comments (Rafael J. Wysocki, Bjorn Helgaas)
Xe Pacthes:
- Addressed Review comments (Bjorn Helgaas)
Anshuman Gupta (6):
PCI/ACPI: Add D3cold Aux Power Limit_DSM method PCI/ACPI: Add PERST# Assertion Delay _DSM method drm/xe/vrsr: Detect VRSR Capability drm/xe/vrsr: Refactor d3cold.allowed to a enum drm/xe/pm: D3Cold target state drm/xe/vrsr: Enable VRSR
Badal Nilawar (5):
PCI/ACPI: Per root port allow one Aux power limit request drm/xe/vrsr: Introduce flag has_vrsr drm/xe/vrsr: Initialize VRSR feature drm/xe/vrsr: Enable VRSR on default VGA boot device drm/xe/vrsr: Introduce a debugfs node named vrsr_capable
drivers/acpi/scan.c | 1 + drivers/gpu/drm/xe/display/xe_display.c | 28 +++- drivers/gpu/drm/xe/display/xe_display.h | 2 + drivers/gpu/drm/xe/regs/xe_regs.h | 3 + drivers/gpu/drm/xe/xe_debugfs.c | 20 +++ drivers/gpu/drm/xe/xe_device_types.h | 12 +- drivers/gpu/drm/xe/xe_pci.c | 13 +- drivers/gpu/drm/xe/xe_pcode_api.h | 7 + drivers/gpu/drm/xe/xe_pm.c | 206 +++++++++++++++++++++--- drivers/gpu/drm/xe/xe_pm.h | 9 +- drivers/pci/pci-acpi.c | 167 +++++++++++++++++++ include/acpi/acpi_bus.h | 2 + include/linux/pci-acpi.h | 16 +- 13 files changed, 456 insertions(+), 30 deletions(-)
Signature · 1 line
2.34.1
PATCH v3 1/11 PCI/ACPI: Add D3cold Aux Power Limit_DSM method
From: Anshuman Gupta <[email protected]>
Implement _DSM method 0Ah according to PCI firmware specifications, section 4.6.10 Rev 3.3., to request auxilary power needed for the device when in D3Cold.
Note that this implementation assumes only a single device below the Downstream Port will request for Aux Power Limit under a given Root Port because it does not track and aggregate requests from all child devices below the Downstream Port as required by Section 4.6.10 Rev 3.3.
One possible mitigation would be only allowing only first PCIe Non-Bridge Endpoint Function 0 driver to call_DSM method 0Ah.
V2(Bjorn/Rafael):
- Call acpi_dsm_check() to find method 0Ah supported
- Return retry interval to caller
--- drivers/pci/pci-acpi.c | 87 ++++++++++++++++++++++++++++++++++++++++ include/linux/pci-acpi.h | 8 ++++ 2 files changed, 95 insertions(+)
drivers/pci/pci-acpi.c +87 -0
@@ -1421,6 +1421,93 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,ACPI_FREE (obj); } +/** +* pci_acpi_request_d3cold_aux_power - Request aux power while device is in D3Cold +* @dev: PCI device instance +* @requested_power: Requested auxiliary power in milliwatts +* @retry_interval: Retry interval returned by platform to retry auxiliary +* power request +* +* This function sends a request to the host BIOS via root port ACPI _DSM Function 0Ah +* for the auxiliary power needed by the PCI device when it is in D3Cold. +* It checks and evaluates the _DSM (Device Specific Method) to request the auxiliary +* power and handles the response accordingly. +* +* This function shall be only called by 1st non-bridge Endpoint driver +* on Function 0. For a Multi-Function Device, the driver for Function 0 is +* required to report an aggregate power requirement covering all +* functions contained within the device. +* +* Return: Returns 0 on success and errno on failure. +*/ +int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power, +u32 *retry_interval) +{ +union acpi_object in_obj = { + .integer.type =ACPI_TYPE_INTEGER , + .integer.value = requested_power, + }; + +union acpi_object *out_obj; +acpi_handle handle; +int result, ret = -EINVAL ; + +if (!dev) +return -EINVAL ; + + handle =ACPI_HANDLE (&dev->dev); +if (!handle) +return -EINVAL ; + +if (!acpi_check_dsm (handle, &pci_acpi_dsm_guid,4 ,1 <<DSM_PCI_D3COLD_AUX_POWER_LIMIT )) { +pci_dbg (dev,"ACPI _DSM 0%Xh not supported\n" ,DSM_PCI_D3COLD_AUX_POWER_LIMIT ); +return -ENODEV ; + } + + out_obj =acpi_evaluate_dsm_typed (handle, &pci_acpi_dsm_guid,4 , +DSM_PCI_D3COLD_AUX_POWER_LIMIT , + &in_obj,ACPI_TYPE_INTEGER ); +if (!out_obj) +return -EINVAL ; + + result = out_obj->integer.value; +if (retry_interval) + *retry_interval =0 ; + +switch (result) { +case 0x0 : +pci_dbg (dev,"D3cold Aux Power %u mW request denied\n" , + requested_power); +break ; +case 0x1 : +pci_info (dev,"D3cold Aux Power request granted: %u mW\n" , + requested_power); + ret =0 ; +break ; +case 0x2 : +pci_info (dev,"D3cold Aux Power: Main power won't be removed\n" ); + ret = -EBUSY ; +break ; +default : +if (result >=0x11 && result <=0x1F ) { +if (retry_interval) { + *retry_interval = result &0xF ; +pci_warn (dev,"D3cold Aux Power request needs retry interval: %u seconds\n" , + *retry_interval); + ret = -EAGAIN ; + } + }else { +pci_err (dev,"D3cold Aux Power: Reserved or unsupported response: 0x%x\n" , + result); + } +break ; + } + +ACPI_FREE (out_obj); +return ret; +} +EXPORT_SYMBOL_GPL (pci_acpi_request_d3cold_aux_power); +static void pci_acpi_set_external_facing (struct pci_dev *dev) {u8 val;
include/linux/pci-acpi.h +8 -0
@@ -121,6 +121,7 @@ extern const guid_t pci_acpi_dsm_guid;#define DSM_PCI_DEVICE_NAME 0x07#define DSM_PCI_POWER_ON_RESET_DELAY 0x08#define DSM_PCI_DEVICE_READINESS_DURATIONS 0x09 +#define DSM_PCI_D3COLD_AUX_POWER_LIMIT 0x0A#ifdef CONFIG_PCIE_EDR void pci_acpi_add_edr_notifier (struct pci_dev *pdev);
@@ -132,10 +133,17 @@ static inline void pci_acpi_remove_edr_notifier(struct pci_dev *pdev) { }int pci_acpi_set_companion_lookup_hook (struct acpi_device *(*func)(struct pci_dev *));void pci_acpi_clear_companion_lookup_hook (void ); +int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power, +u32 *retry_interval);#else /* CONFIG_ACPI */ static inline void acpi_pci_add_bus (struct pci_bus *bus) { }static inline void acpi_pci_remove_bus (struct pci_bus *bus) { } +static int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power, +u32 *retry_interval) +{ +return -EOPNOTSUPP ; +}#endif /* CONFIG_ACPI */ #endif /* _PCI_ACPI_H_ */
Signature · 1 line
2.34.1
Re: [PATCH v3 01/11] PCI/ACPI: Add D3cold Aux Power Limit_DSM method
Quoted 11 lines · Badal Nilawar
From: Anshuman Gupta<[email protected]>
Implement
_DSMmethod 0Ah according to PCI firmware specifications, section 4.6.10 Rev 3.3., to request auxilary power needed for the device when in D3Cold.Note that this implementation assumes only a single device below the Downstream Port will request for Aux Power Limit under a given Root Port because it does not track and aggregate requests from all child devices below the Downstream Port as required by Section 4.6.10 Rev 3.3.
Add some info about why you are not adding this support?
Quoted 46 lines
One possible mitigation would be only allowing only first PCIe Non-Bridge Endpoint Function 0 driver to
call_DSMmethod 0Ah.V2(Bjorn/Rafael):
- Callacpi_dsm_check()to find method 0Ah supported
- Return retry interval to callerSigned-off-by Varun Gupta<[email protected]>Signed-off-by Badal Nilawar<[email protected]>Signed-off-by Anshuman Gupta<[email protected]>--- drivers/pci/pci-acpi.c | 87 ++++++++++++++++++++++++++++++++++++++++ include/linux/pci-acpi.h | 8 ++++ 2 files changed, 95 insertions(+)drivers/pci/pci-acpi.c +23
-0@@ -1421,6 +1421,93 @@ static void pci_acpi_optimize_delay(struct pci_dev *pdev,ACPI_FREE (obj); } +/** +* pci_acpi_request_d3cold_aux_power - Request aux power while device is in D3Cold +* @dev: PCI device instance +* @requested_power: Requested auxiliary power in milliwatts +* @retry_interval: Retry interval returned by platform to retry auxiliary +* power request +* +* This function sends a request to the host BIOS via root port ACPI _DSM Function 0Ah +* for the auxiliary power needed by the PCI device when it is in D3Cold. +* It checks and evaluates the _DSM (Device Specific Method) to request the auxiliary +* power and handles the response accordingly. +* +* This function shall be only called by 1st non-bridge Endpoint driver +* on Function 0. For a Multi-Function Device, the driver for Function 0 is +* required to report an aggregate power requirement covering all +* functions contained within the device. +* +* Return: Returns 0 on success and errno on failure. +*/ +int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power, +u32 *retry_interval) +{ +union acpi_object in_obj = {
drivers/pci/pci-acpi.c static void pci_acpi_optimize_delay(struct pci_dev *pdev, · line 1456
Quoted 10 lines
drivers/pci/pci-acpi.c +10
-0+ .integer.type = ACPI_TYPE_INTEGER, + .integer.value = requested_power, + }; + +union acpi_object *out_obj; +acpi_handle handle; +int result, ret = -EINVAL ; + +if (!dev) +return -EINVAL ;
Is retry_interval param optional? If not may be a check here for non NULL condition is needed.
Quoted 14 lines
drivers/pci/pci-acpi.c +14
-0+ + handle =ACPI_HANDLE (&dev->dev); +if (!handle) +return -EINVAL ; + +if (!acpi_check_dsm (handle, &pci_acpi_dsm_guid,4 ,1 <<DSM_PCI_D3COLD_AUX_POWER_LIMIT )) { +pci_dbg (dev,"ACPI _DSM 0%Xh not supported\n" ,DSM_PCI_D3COLD_AUX_POWER_LIMIT ); +return -ENODEV ; + } + + out_obj =acpi_evaluate_dsm_typed (handle, &pci_acpi_dsm_guid,4 , +DSM_PCI_D3COLD_AUX_POWER_LIMIT , + &in_obj,ACPI_TYPE_INTEGER ); +if (!out_obj)
drivers/pci/pci-acpi.c static void pci_acpi_optimize_delay(struct pci_dev *pdev, · line 1480
Quoted 10 lines
drivers/pci/pci-acpi.c +10
-0+return -EINVAL ; + + result = out_obj->integer.value; +if (retry_interval) + *retry_interval =0 ; + +switch (result) { +case 0x0 : +pci_dbg (dev,"D3cold Aux Power %u mW request denied\n" , + requested_power);
is this not a error?
Quoted 63 lines
drivers/pci/pci-acpi.c +30
-0+break ; +case 0x1 : +pci_info (dev,"D3cold Aux Power request granted: %u mW\n" , + requested_power); + ret =0 ; +break ; +case 0x2 : +pci_info (dev,"D3cold Aux Power: Main power won't be removed\n" ); + ret = -EBUSY ; +break ; +default : +if (result >=0x11 && result <=0x1F ) { +if (retry_interval) { + *retry_interval = result &0xF ; +pci_warn (dev,"D3cold Aux Power request needs retry interval: %u seconds\n" , + *retry_interval); + ret = -EAGAIN ; + } + }else { +pci_err (dev,"D3cold Aux Power: Reserved or unsupported response: 0x%x\n" , + result); + } +break ; + } + +ACPI_FREE (out_obj); +return ret; +} +EXPORT_SYMBOL_GPL (pci_acpi_request_d3cold_aux_power); +static void pci_acpi_set_external_facing (struct pci_dev *dev) {u8 val;include/linux/pci-acpi.h +8
-0@@ -121,6 +121,7 @@ extern const guid_t pci_acpi_dsm_guid;#define DSM_PCI_DEVICE_NAME 0x07#define DSM_PCI_POWER_ON_RESET_DELAY 0x08#define DSM_PCI_DEVICE_READINESS_DURATIONS 0x09 +#define DSM_PCI_D3COLD_AUX_POWER_LIMIT 0x0A#ifdef CONFIG_PCIE_EDR void pci_acpi_add_edr_notifier (struct pci_dev *pdev);@@ -132,10 +133,17 @@ static inline void pci_acpi_remove_edr_notifier(struct pci_dev *pdev) { }int pci_acpi_set_companion_lookup_hook (struct acpi_device *(*func)(struct pci_dev *));void pci_acpi_clear_companion_lookup_hook (void ); +int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power, +u32 *retry_interval);#else /* CONFIG_ACPI */ static inline void acpi_pci_add_bus (struct pci_bus *bus) { }static inline void acpi_pci_remove_bus (struct pci_bus *bus) { } +static int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power, +u32 *retry_interval) +{ +return -EOPNOTSUPP ; +}#endif /* CONFIG_ACPI */ #endif /* _PCI_ACPI_H_ */
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer
Re: [PATCH v3 01/11] PCI/ACPI: Add D3cold Aux Power Limit_DSM method
Quoted 8 lines · Sathyanarayanan Kuppuswamy
Quoted 6 lines · Badal Nilawar
From: Anshuman Gupta<[email protected]>
Implement
_DSMmethod 0Ah according to PCI firmware specifications, section 4.6.10 Rev 3.3., to request auxilary power needed for the device when in D3Cold.
Quoted 7 lines
Quoted 5 lines
Note that this implementation assumes only a single device below the Downstream Port will request for Aux Power Limit under a given Root Port because it does not track and aggregate requests from all child devices below the Downstream Port as required by Section 4.6.10 Rev 3.3.
Add some info about why you are not adding this support?
Scope is limited to enable the use case of VRAM-SR on BMG GPU. I will mention this in cover letter.
Quoted 58 lines
Quoted 58 lines
One possible mitigation would be only allowing only first PCIe Non-Bridge Endpoint Function 0 driver to
call_DSMmethod 0Ah.V2(Bjorn/Rafael):
- Callacpi_dsm_check()to find method 0Ah supported
- Return retry interval to callerSigned-off-by Varun Gupta<[email protected]>Signed-off-by Badal Nilawar<[email protected]>Signed-off-by Anshuman Gupta<[email protected]>---
drivers/pci/pci-acpi.c | 87 ++++++++++++++++++++++++++++++++++++++++include/linux/pci-acpi.h| 8 ++++2 files changed, 95 insertions(+)drivers/pci/pci-acpi.c +0
-0@@ -1421,6 +1421,93 @@ static void pci_acpi_optimize_delay(structpci_dev *pdev, ACPI_FREE(obj); }+/**
+ *pci_acpi_request_d3cold_aux_power- Request aux power while device is in D3Cold
+ * @dev: PCI device instance
+ * @requested_power: Requested auxiliary power in milliwatts
+ * @retry_interval: Retry interval returned by platform to retry auxiliary
+ * power request
+ *
+ * This function sends a request to the host BIOS via root port ACPI_DSMFunction 0Ah
+ * for the auxiliary power needed by the PCI device when it is in D3Cold.
+ * It checks and evaluates the_DSM(Device Specific Method) to request the auxiliary
+ * power and handles the response accordingly.
+ *
+ * This function shall be only called by 1st non-bridge Endpoint driver
+ * on Function 0. For a Multi-Function Device, the driver for Function 0 is
+ * required to report an aggregate power requirement covering all
+ * functions contained within the device.
+ *
+ * Return: Returns 0 on success and errno on failure.
+ */
+int pci_acpi_request_d3cold_aux_power(structpci_dev*dev, u32requested_power,
+ u32*retry_interval)drivers/pci/pci-acpi.c +6
-0+{ + union acpi_object in_obj = { + .integer.type = ACPI_TYPE_INTEGER, + .integer.value = requested_power, + }; +
Quoted 8 lines
Quoted 6 lines
+ union
acpi_object*out_obj;
+acpi_handlehandle;
+ int result, ret =-EINVAL;
+
+ if (!dev)
+ return-EINVAL;Is
retry_intervalparam optional? If not may be a check here for non NULL condition is needed.
Yes its optional, its up to caller weather to retry or not.
Quoted 21 lines
Quoted 21 lines
drivers/pci/pci-acpi.c +6
-0+ + handle = ACPI_HANDLE(&dev->dev); + if (!handle) + return -EINVAL; + + if (!acpi_check_dsm(handle, &pci_acpi_dsm_guid, 4, 1 <<
DSM_PCI_D3COLD_AUX_POWER_LIMIT)) {
+pci_dbg(dev, "ACPI _DSM 0%Xh not supported\n", DSM_PCI_D3COLD_AUX_POWER_LIMIT);
+ return-ENODEV;
+ }drivers/pci/pci-acpi.c +9
-0+ + out_obj = acpi_evaluate_dsm_typed(handle, &pci_acpi_dsm_guid, 4, + DSM_PCI_D3COLD_AUX_POWER_LIMIT, + &in_obj, ACPI_TYPE_INTEGER); + if (!out_obj) + return -EINVAL; + + result = out_obj->integer.value; + if (retry_interval)
Quoted 8 lines
Quoted 6 lines
+
*retry_interval= 0;
+
+ switch (result) {
+ case0x0:
+pci_dbg(dev, "D3cold Aux Power %u mW request denied\n", + requested_power);is this not a error?
No its not error. BIOS Firmware can deny the aux power request.
Regards,
Badal
Quoted 67 lines
Quoted 66 lines
+ break;
+ case0x1:
+pci_info(dev, "D3cold Aux Power request granted: %u mW\n", + requested_power);
+ ret = 0;
+ break;
+ case0x2:
+pci_info(dev, "D3cold Aux Power: Main power won't be removed\n");
+ ret =-EBUSY;
+ break;
+ default:
+ if (result >=0x11&& result <=0x1F) {
+ if (retry_interval) {
+*retry_interval= result &0xF;
+ pci_warn(dev, "D3cold Aux Power request needs retry
interval: %u seconds\n",
+*retry_interval);
+ ret =-EAGAIN;
+ }
+ } else {
+ pci_err(dev, "D3cold Aux Power: Reserved or unsupported
response: 0x%x\n",
+ result);
+ }
+ break;
+ }drivers/pci/pci-acpi.c +6
-0+ + ACPI_FREE(out_obj); + return ret; +} +EXPORT_SYMBOL_GPL (pci_acpi_request_d3cold_aux_power); +static void
pci_acpi_set_external_facing(struct pci_dev *dev){
u8 val;include/linux/pci-acpi.h +8
-0@@ -121,6 +121,7 @@ extern const guid_t pci_acpi_dsm_guid; #define DSM_PCI_DEVICE_NAME 0x07 #define DSM_PCI_POWER_ON_RESET_DELAY 0x08 #define DSM_PCI_DEVICE_READINESS_DURATIONS 0x09 +#define DSM_PCI_D3COLD_AUX_POWER_LIMIT 0x0A #ifdef CONFIG_PCIE_EDR void pci_acpi_add_edr_notifier(struct pci_dev *pdev);@@ -132,10 +133,17 @@ static inline void pci_acpi_remove_edr_notifier(struct pci_dev *pdev) { } int pci_acpi_set_companion_lookup_hook(struct acpi_device *(*func)(struct pci_dev *)); void pci_acpi_clear_companion_lookup_hook(void); +int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power, + u32 *retry_interval); #else /* CONFIG_ACPI */ static inline void acpi_pci_add_bus(struct pci_bus *bus) { } static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } +static int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power, + u32 *retry_interval) +{ + return -EOPNOTSUPP; +} #endif /* CONFIG_ACPI */ #endif /* _PCI_ACPI_H_ */
Re: [PATCH v3 01/11] PCI/ACPI: Add D3cold Aux Power Limit_DSM method
Quoted 86 lines · Badal
Quoted 8 lines · Sathyanarayanan Kuppuswamy
Quoted 6 lines · Badal Nilawar
From: Anshuman Gupta<[email protected]>
Implement
_DSMmethod 0Ah according to PCI firmware specifications, section 4.6.10 Rev 3.3., to request auxilary power needed for the device when in D3Cold.Quoted 7 lines
Quoted 5 lines
Note that this implementation assumes only a single device below the Downstream Port will request for Aux Power Limit under a given Root Port because it does not track and aggregate requests from all child devices below the Downstream Port as required by Section 4.6.10 Rev 3.3.
Add some info about why you are not adding this support?
Scope is limited to enable the use case of VRAM-SR on BMG GPU. I will mention this in cover letter.
Quoted 60 lines
Quoted 60 lines
One possible mitigation would be only allowing only first PCIe Non-Bridge Endpoint Function 0 driver to
call_DSMmethod 0Ah.V2(Bjorn/Rafael):
- Callacpi_dsm_check()to find method 0Ah supported
- Return retry interval to callerSigned-off-by Varun Gupta<[email protected]>Signed-off-by Badal Nilawar<[email protected]>Signed-off-by Anshuman Gupta<[email protected]>---
drivers/pci/pci-acpi.c | 87
++++++++++++++++++++++++++++++++++++++++
include/linux/pci-acpi.h| 8 ++++2 files changed, 95 insertions(+)drivers/pci/pci-acpi.c +0
-0@@ -1421,6 +1421,93 @@ static void pci_acpi_optimize_delay(structpci_dev *pdev, ACPI_FREE(obj); }+/**
+ *pci_acpi_request_d3cold_aux_power- Request aux power while device is in D3Cold
+ * @dev: PCI device instance
+ * @requested_power: Requested auxiliary power in milliwatts
+ * @retry_interval: Retry interval returned by platform to retry auxiliary
+ * power request
+ *
+ * This function sends a request to the host BIOS via root port ACPI_DSMFunction 0Ah
+ * for the auxiliary power needed by the PCI device when it is in D3Cold.
+ * It checks and evaluates the_DSM(Device Specific Method) to request the auxiliary
+ * power and handles the response accordingly.
+ *
+ * This function shall be only called by 1st non-bridge Endpoint driver
+ * on Function 0. For a Multi-Function Device, the driver for Function 0 is
+ * required to report an aggregate power requirement covering all
+ * functions contained within the device.
+ *
+ * Return: Returns 0 on success and errno on failure.
+ */
+int pci_acpi_request_d3cold_aux_power(structpci_dev*dev, u32requested_power,
+ u32*retry_interval)drivers/pci/pci-acpi.c +6
-0+{ + union acpi_object in_obj = { + .integer.type = ACPI_TYPE_INTEGER, + .integer.value = requested_power, + }; +Quoted 8 lines
Quoted 6 lines
+ union
acpi_object*out_obj;
+acpi_handlehandle;
+ int result, ret =-EINVAL;
+
+ if (!dev)
+ return-EINVAL;Is
retry_intervalparam optional? If not may be a check here for non NULL condition is needed.
Quoted 1 line
Yes its optional, its up to caller weather to retry or not.
I will make this param mandatory and add NULL check here. Then its up to caller to decide whether to retry.
Thanks,
Badal
Quoted 102 lines
Quoted 21 lines
Quoted 21 lines
drivers/pci/pci-acpi.c +6
-0+ + handle = ACPI_HANDLE(&dev->dev); + if (!handle) + return -EINVAL; + + if (!acpi_check_dsm(handle, &pci_acpi_dsm_guid, 4, 1 <<
DSM_PCI_D3COLD_AUX_POWER_LIMIT)) {
+pci_dbg(dev, "ACPI _DSM 0%Xh not supported\n", DSM_PCI_D3COLD_AUX_POWER_LIMIT);
+ return-ENODEV;
+ }drivers/pci/pci-acpi.c +9
-0+ + out_obj = acpi_evaluate_dsm_typed(handle, &pci_acpi_dsm_guid, 4, + DSM_PCI_D3COLD_AUX_POWER_LIMIT, + &in_obj, ACPI_TYPE_INTEGER); + if (!out_obj) + return -EINVAL; + + result = out_obj->integer.value; + if (retry_interval)Quoted 8 lines
Quoted 6 lines
+
*retry_interval= 0;
+
+ switch (result) {
+ case0x0:
+pci_dbg(dev, "D3cold Aux Power %u mW request denied\n", + requested_power);is this not a error?
No its not error. BIOS Firmware can deny the aux power request.
Regards,
BadalQuoted 67 lines
Quoted 66 lines
+ break;
+ case0x1:
+pci_info(dev, "D3cold Aux Power request granted: %u mW\n", + requested_power);
+ ret = 0;
+ break;
+ case0x2:
+pci_info(dev, "D3cold Aux Power: Main power won't be removed\n");
+ ret =-EBUSY;
+ break;
+ default:
+ if (result >=0x11&& result <=0x1F) {
+ if (retry_interval) {
+*retry_interval= result &0xF;
+ pci_warn(dev, "D3cold Aux Power request needs retry
interval: %u seconds\n",
+*retry_interval);
+ ret =-EAGAIN;
+ }
+ } else {
+ pci_err(dev, "D3cold Aux Power: Reserved or unsupported
response: 0x%x\n",
+ result);
+ }
+ break;
+ }drivers/pci/pci-acpi.c +6
-0+ + ACPI_FREE(out_obj); + return ret; +} +EXPORT_SYMBOL_GPL (pci_acpi_request_d3cold_aux_power); +static void
pci_acpi_set_external_facing(struct pci_dev *dev){
u8 val;include/linux/pci-acpi.h +8
-0@@ -121,6 +121,7 @@ extern const guid_t pci_acpi_dsm_guid; #define DSM_PCI_DEVICE_NAME 0x07 #define DSM_PCI_POWER_ON_RESET_DELAY 0x08 #define DSM_PCI_DEVICE_READINESS_DURATIONS 0x09 +#define DSM_PCI_D3COLD_AUX_POWER_LIMIT 0x0A #ifdef CONFIG_PCIE_EDR void pci_acpi_add_edr_notifier(struct pci_dev *pdev);@@ -132,10 +133,17 @@ static inline void pci_acpi_remove_edr_notifier(struct pci_dev *pdev) { } int pci_acpi_set_companion_lookup_hook(struct acpi_device *(*func)(struct pci_dev *)); void pci_acpi_clear_companion_lookup_hook(void); +int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power, + u32 *retry_interval); #else /* CONFIG_ACPI */ static inline void acpi_pci_add_bus(struct pci_bus *bus) { } static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } +static int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power, + u32 *retry_interval) +{ + return -EOPNOTSUPP; +} #endif /* CONFIG_ACPI */ #endif /* _PCI_ACPI_H_ */
PATCH v3 2/11 PCI/ACPI: Per root port allow one Aux power limit request
In reply to Badal NilawarFor given root port allow one Aux power limit request.
--- drivers/acpi/scan.c | 1 + drivers/pci/pci-acpi.c | 25 ++++++++++++++++++++++++- include/acpi/acpi_bus.h | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-)
drivers/acpi/scan.c +1 -0
@@ -745,6 +745,7 @@ int acpi_device_add(struct acpi_device *device)INIT_LIST_HEAD (&device->physical_node_list);INIT_LIST_HEAD (&device->del_list);mutex_init (&device->physical_node_lock); +mutex_init (&device->power.aux_pwr_lock);mutex_lock (&acpi_device_lock);
drivers/pci/pci-acpi.c +24 -1
@@ -1451,6 +1451,7 @@ int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_power,union acpi_object *out_obj;acpi_handle handle;int result, ret = -EINVAL ; +struct acpi_device *adev;if (!dev)return -EINVAL ;
@@ -1464,11 +1465,27 @@ int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_power,return -ENODEV ; } + adev =ACPI_COMPANION (&dev->dev); +if (!adev) +return -EINVAL ; + +mutex_lock (&adev->power.aux_pwr_lock); + +/* Check if aux power already granted */ +if (adev->power.aux_power_limit) { +pci_info (dev,"D3cold Aux Power request already granted: %u mW\n" , + adev->power.aux_power_limit); +mutex_unlock (&adev->power.aux_pwr_lock); +return -EPERM ; + } + out_obj =acpi_evaluate_dsm_typed (handle, &pci_acpi_dsm_guid,4 ,DSM_PCI_D3COLD_AUX_POWER_LIMIT , &in_obj,ACPI_TYPE_INTEGER ); -if (!out_obj) +if (!out_obj) { +mutex_unlock (&adev->power.aux_pwr_lock);return -EINVAL ; + } result = out_obj->integer.value;if (retry_interval)
@@ -1478,14 +1495,17 @@ int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_power,case 0x0 :pci_dbg (dev,"D3cold Aux Power %u mW request denied\n" , requested_power); + adev->power.aux_power_limit =0 ;break ;case 0x1 :pci_info (dev,"D3cold Aux Power request granted: %u mW\n" , requested_power); + adev->power.aux_power_limit = requested_power; ret =0 ;break ;case 0x2 :pci_info (dev,"D3cold Aux Power: Main power won't be removed\n" ); + adev->power.aux_power_limit =0 ; ret = -EBUSY ;break ;default :
@@ -1500,9 +1520,12 @@ int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_power,pci_err (dev,"D3cold Aux Power: Reserved or unsupported response: 0x%x\n" , result); } + adev->power.aux_power_limit =0 ;break ; } +mutex_unlock (&adev->power.aux_pwr_lock); +ACPI_FREE (out_obj);return ret; }
include/acpi/acpi_bus.h +2 -0
@@ -294,6 +294,8 @@ struct acpi_device_power {struct acpi_device_power_flags flags;struct acpi_device_power_state states[ACPI_D_STATE_COUNT ];/* Power states (D0-D3Cold) */ u8 state_for_enumeration;/* Deepest power state for enumeration */ +u32 aux_power_limit;/* aux power limit granted by bios */ +struct mutex aux_pwr_lock;/* prevent concurrent aux power limit requests */ };struct acpi_dep_data {
Signature · 1 line
2.34.1
PATCH v3 3/11 PCI/ACPI: Add PERST# Assertion Delay _DSM method
In reply to Badal NilawarFrom: Anshuman Gupta <[email protected]>
Implement _DSM Method 0Bh as per PCI firmware specs section 4.6.11 Rev 3.3.
--- drivers/pci/pci-acpi.c | 57 ++++++++++++++++++++++++++++++++++++++++ include/linux/pci-acpi.h | 8 +++++- 2 files changed, 64 insertions(+), 1 deletion(-)
drivers/pci/pci-acpi.c +57 -0
@@ -1531,6 +1531,63 @@ int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_power, }EXPORT_SYMBOL_GPL (pci_acpi_request_d3cold_aux_power); +/** +* pci_acpi_add_perst_assertion_delay - Request PERST# delay via ACPI DSM +* @dev: PCI device instance +* @delay_us: Requested delay_us +* +* This function sends a request to the host BIOS via ACPI _DSM to grant the +* required PERST# delay for the specified PCI device. It evaluates the _DSM +* to request the PERST# delay and handles the response accordingly. +* +* Return: returns 0 on success and errno on failure. +*/ +int pci_acpi_add_perst_assertion_delay (struct pci_dev *dev,u32 delay_us) +{ +union acpi_object in_obj = { + .integer.type =ACPI_TYPE_INTEGER , + .integer.value = delay_us, + }; + +union acpi_object *out_obj; +acpi_handle handle; +int result, ret = -EINVAL ; + +if (!dev) +return -EINVAL ; + + handle =ACPI_HANDLE (&dev->dev); +if (!handle) +return -EINVAL ; + +if (!acpi_check_dsm (handle, &pci_acpi_dsm_guid,4 ,1 <<DSM_PCI_PERST_ASSERTION_DELAY )) { +pci_dbg (dev,"ACPI _DSM 0%Xh not supported\n" ,DSM_PCI_PERST_ASSERTION_DELAY ); +return -ENODEV ; + } + + out_obj =acpi_evaluate_dsm_typed (handle, &pci_acpi_dsm_guid,4 , +DSM_PCI_PERST_ASSERTION_DELAY , + &in_obj,ACPI_TYPE_INTEGER ); +if (!out_obj) +return -EINVAL ; + + result = out_obj->integer.value; + +if (result == delay_us) { +pci_info (dev,"PERST# Assertion Delay set to %u microseconds\n" , delay_us); + ret =0 ; + }else if (result ==0 ) { +pci_warn (dev,"PERST# Assertion Delay request failed, no previous valid request\n" ); + }else { +pci_warn (dev,"PERST# Assertion Delay request failed, Previous valid delay: %u microseconds\n" , + result); + } + +ACPI_FREE (out_obj); +return ret; +} +EXPORT_SYMBOL_GPL (pci_acpi_add_perst_assertion_delay); +static void pci_acpi_set_external_facing (struct pci_dev *dev) {u8 val;
include/linux/pci-acpi.h +7 -1
@@ -122,6 +122,7 @@ extern const guid_t pci_acpi_dsm_guid;#define DSM_PCI_POWER_ON_RESET_DELAY 0x08#define DSM_PCI_DEVICE_READINESS_DURATIONS 0x09#define DSM_PCI_D3COLD_AUX_POWER_LIMIT 0x0A +#define DSM_PCI_PERST_ASSERTION_DELAY 0x0B#ifdef CONFIG_PCIE_EDR void pci_acpi_add_edr_notifier (struct pci_dev *pdev);
@@ -135,7 +136,7 @@ int pci_acpi_set_companion_lookup_hook(struct acpi_device *(*func)(struct pci_devoid pci_acpi_clear_companion_lookup_hook (void );int pci_acpi_request_d3cold_aux_power (struct pci_dev *dev,u32 requested_power,u32 *retry_interval); - +int pci_acpi_add_perst_assertion_delay (struct pci_dev *dev,u32 delay_us);#else /* CONFIG_ACPI */ static inline void acpi_pci_add_bus (struct pci_bus *bus) { }static inline void acpi_pci_remove_bus (struct pci_bus *bus) { }
@@ -144,6 +145,11 @@ static int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_ {return -EOPNOTSUPP ; } + +static int pci_acpi_add_perst_assertion_delay (struct pci_dev *dev,u32 delay_us) +{ +return -EOPNOTSUPP ; +}#endif /* CONFIG_ACPI */ #endif /* _PCI_ACPI_H_ */
Signature · 1 line
2.34.1
PATCH v3 4/11 drm/xe/vrsr: Introduce flag has_vrsr
In reply to Badal NilawarIntroduce flag has_vrsr to determine if platform supports VRSR feature
--- drivers/gpu/drm/xe/xe_device_types.h | 2 ++ drivers/gpu/drm/xe/xe_pci.c | 3 +++ 2 files changed, 5 insertions(+)
drivers/gpu/drm/xe/xe_device_types.h +2 -0
@@ -334,6 +334,8 @@ struct xe_device { u8 has_sriov:1;/** @info.has_usm: Device has unified shared memory support */ u8 has_usm:1; +/** @info.has_vrsr: Has capability to enter into VRAM self refresh */ + u8 has_vrsr:1;/** @info.has_64bit_timestamp: Device supports 64-bit timestamps */ u8 has_64bit_timestamp:1;/** @info.is_dgfx: is discrete device */
drivers/gpu/drm/xe/xe_pci.c +3 -0
@@ -68,6 +68,7 @@ struct xe_device_desc { u8 has_llc:1; u8 has_pxp:1; u8 has_sriov:1; + u8 has_vrsr:1; u8 needs_scratch:1; u8 skip_guc_pc:1; u8 skip_mtcfg:1;
@@ -342,6 +343,7 @@ static const struct xe_device_desc bmg_desc = { .dma_mask_size = 46, .has_display = true, .has_fan_control = true, + .has_vrsr = true, .has_heci_cscfi = 1, .needs_scratch = true, };
@@ -589,6 +591,7 @@ static int xe_info_init_early(struct xe_device *xe, xe->info.has_llc = desc->has_llc; xe->info.has_pxp = desc->has_pxp; xe->info.has_sriov = desc->has_sriov; + xe->info.has_vrsr = desc->has_vrsr; xe->info.skip_guc_pc = desc->skip_guc_pc; xe->info.skip_mtcfg = desc->skip_mtcfg; xe->info.skip_pcode = desc->skip_pcode;
Signature · 1 line
2.34.1
PATCH v3 5/11 drm/xe/vrsr: Detect VRSR Capability
In reply to Badal NilawarFrom: Anshuman Gupta <[email protected]>
Detect VRAM Self Refresh(vrsr) Capability.
--- drivers/gpu/drm/xe/regs/xe_regs.h | 3 +++ drivers/gpu/drm/xe/xe_device_types.h | 4 ++++ drivers/gpu/drm/xe/xe_pm.c | 26 ++++++++++++++++++++++++++ 3 files changed, 33 insertions(+)
drivers/gpu/drm/xe/regs/xe_regs.h +3 -0
@@ -53,6 +53,9 @@#define MTL_MPE_FREQUENCY XE_REG(0x13802c)#define MTL_RPE_MASK REG_GENMASK(8, 0) +#define VRAM_SR_CAPABILITY XE_REG(0x138144) +#define VRAM_SR_SUPPORTED REG_BIT(0) +#define VF_CAP_REG XE_REG(0x1901f8, XE_REG_OPTION_VF)#define VF_CAP REG_BIT(0)
drivers/gpu/drm/xe/xe_device_types.h +4 -0
@@ -512,6 +512,9 @@ struct xe_device {/** @d3cold.allowed: Indicates if d3cold is a valid device state */ bool allowed; +/** @d3cold.vrsr_capable: Indicates if d3cold VRAM Self Refresh is supported */ +bool vrsr_capable; +/** * @d3cold.vram_threshold: *
@@ -522,6 +525,7 @@ struct xe_device {* Default threshold value is 300mb. */ u32 vram_threshold; +/** @d3cold.lock: protect vram_threshold */ struct mutex lock; } d3cold;
drivers/gpu/drm/xe/xe_pm.c +26 -0
@@ -13,13 +13,16 @@#include <drm/ttm/ttm_placement.h> #include "display/xe_display.h" +#include "regs/xe_regs.h" #include "xe_bo.h" #include "xe_bo_evict.h" #include "xe_device.h" +#include "xe_force_wake.h" #include "xe_ggtt.h" #include "xe_gt.h" #include "xe_guc.h" #include "xe_irq.h" +#include "xe_mmio.h" #include "xe_pcode.h" #include "xe_pxp.h" #include "xe_trace.h"
@@ -235,6 +238,28 @@ static bool xe_pm_pci_d3cold_capable(struct xe_device *xe)return true; } +static bool xe_pm_vrsr_capable (struct xe_device *xe) +{ +struct xe_mmio *mmio =xe_root_tile_mmio (xe); +unsigned int fw_ref; +struct xe_gt *gt; +u32 val; + + gt =xe_root_mmio_gt (xe); + +if (!xe->info.probe_display) +return false; + + fw_ref =xe_force_wake_get (gt_to_fw (gt),XE_FORCEWAKE_ALL ); +if (!fw_ref) +return false; + + val =xe_mmio_read32 (mmio,VRAM_SR_CAPABILITY ); +xe_force_wake_put (gt_to_fw (gt),XE_FORCEWAKE_ALL ); + +return val &VRAM_SR_SUPPORTED ; +} +static void xe_pm_runtime_init (struct xe_device *xe) {struct device *dev = xe->drm.dev;
@@ -349,6 +374,7 @@ int xe_pm_init(struct xe_device *xe) err =xe_pm_set_vram_threshold (xe, vram_threshold);if (err) goto err_unregister; + xe->d3cold.vrsr_capable =xe_pm_vrsr_capable (xe); }xe_pm_runtime_init (xe);
Signature · 1 line
2.34.1
PATCH v3 6/11 drm/xe/vrsr: Initialize VRSR feature
In reply to Badal NilawarAdd the API xe_pm_vrsr_enable to initialize the VRSR feature, requesting AUX power limit and PERST# assertion delay.
V2: Add retry mechanism while requesting AUX power limit
--- drivers/gpu/drm/xe/xe_device_types.h | 1 + drivers/gpu/drm/xe/xe_pcode_api.h | 7 ++ drivers/gpu/drm/xe/xe_pm.c | 105 ++++++++++++++++++++++++++- drivers/gpu/drm/xe/xe_pm.h | 1 + 4 files changed, 113 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_device_types.h +1 -0
@@ -7,6 +7,7 @@#define _XE_DEVICE_TYPES_H_#include <linux/pci.h> +#include <linux/pci-acpi.h> #include <drm/drm_device.h> #include <drm/drm_file.h>
drivers/gpu/drm/xe/xe_pcode_api.h +7 -0
@@ -43,6 +43,13 @@#define POWER_SETUP_I1_SHIFT 6/* 10.6 fixed point format */ #define POWER_SETUP_I1_DATA_MASK REG_GENMASK(15, 0) +#define PCODE_D3_VRAM_SELF_REFRESH 0x71 +#define PCODE_D3_VRSR_SC_DISABLE 0x0 +#define PCODE_D3_VRSR_SC_ENABLE 0x1 +#define PCODE_D3_VRSR_SC_AUX_PL_AND_PERST_DELAY 0x2 +#define POWER_D3_VRSR_PERST_MASK REG_GENMASK(31, 16) +#define POWER_D3_VRSR_AUX_PL_MASK REG_GENMASK(15, 0) +#define PCODE_FREQUENCY_CONFIG 0x6e/* Frequency Config Sub Commands (param1) */ #define PCODE_MBOX_FC_SC_READ_FUSED_P0 0x0
drivers/gpu/drm/xe/xe_pm.c +104 -1
129 lines not on this page · raw message
drivers/gpu/drm/xe/xe_pm.h +1 -0
@@ -35,4 +35,5 @@ bool xe_rpm_reclaim_safe(const struct xe_device *xe);struct task_struct *xe_pm_read_callback_task (struct xe_device *xe);int xe_pm_module_init (void ); +int xe_pm_vrsr_enable (struct xe_device *xe,bool enable);#endif
Signature · 1 line
2.34.1
kernel test robot
build botRe: [PATCH v3 06/11] drm/xe/vrsr: Initialize VRSR feature
kernel test robot noticed the following build warnings:
Hi Badal,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-xe/drm-xe-next]
[also build test WARNING on next-20250523]
[cannot apply to rafael-pm/linux-next rafael-pm/bleeding-edge pci/next pci/for-linus linus/master v6.15-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Badal-Nilawar/PCI-ACPI-Add-D3cold-Aux-Power-Limit_DSM-method/20250524-030125 base: https://gitlab.freedesktop.org/drm/xe/kernel.git drm-xe-next patch link: https://lore.kernel.org/r/20250523190155.2623462-7-badal.nilawar%40intel.com patch subject: [PATCH v3 06/11] drm/xe/vrsr: Initialize VRSR feature config: arm-randconfig-002-20250524 (https://download.01.org/0day-ci/archive/20250524/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250524/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/xe/xe_device_types.h:10:0,
from drivers/gpu/drm/xe/xe_bo_types.h:16,
from drivers/gpu/drm/xe/xe_bo.h:11,
from drivers/gpu/drm/xe/xe_query.c:17:
>> include/linux/pci-acpi.h:149:12: warning: 'pci_acpi_add_perst_assertion_delay' defined but not used [-Wunused-function]
static int pci_acpi_add_perst_assertion_delay(struct pci_dev *dev, u32 delay_us)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/pci-acpi.h:143:12: warning: 'pci_acpi_request_d3cold_aux_power' defined but not used [-Wunused-function] static int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_power,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/pci_acpi_add_perst_assertion_delay +149 include/linux/pci-acpi.h
ac1c8e35a3262d Kuppuswamy Sathyanarayanan 2020-03-23 134
59dc33252ee777 Rafael J. Wysocki 2021-08-24 135 int pci_acpi_set_companion_lookup_hook(struct acpi_device *(*func)(struct pci_dev *));
59dc33252ee777 Rafael J. Wysocki 2021-08-24 136 void pci_acpi_clear_companion_lookup_hook(void);
004b1d6651d930 Anshuman Gupta 2025-05-24 137 int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_power,
004b1d6651d930 Anshuman Gupta 2025-05-24 138 u32 *retry_interval);
57059451b12af0 Anshuman Gupta 2025-05-24 139 int pci_acpi_add_perst_assertion_delay(struct pci_dev *dev, u32 delay_us);
5090d4a6a1f150 Jiang Liu 2013-04-12 140 #else /* CONFIG_ACPI */
5090d4a6a1f150 Jiang Liu 2013-04-12 141 static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
5090d4a6a1f150 Jiang Liu 2013-04-12 142 static inline void acpi_pci_remove_bus(struct pci_bus *bus) { }
004b1d6651d930 Anshuman Gupta 2025-05-24 @143 static int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_power,
004b1d6651d930 Anshuman Gupta 2025-05-24 144 u32 *retry_interval)
004b1d6651d930 Anshuman Gupta 2025-05-24 145 {
004b1d6651d930 Anshuman Gupta 2025-05-24 146 return -EOPNOTSUPP;
004b1d6651d930 Anshuman Gupta 2025-05-24 147 }
57059451b12af0 Anshuman Gupta 2025-05-24 148
57059451b12af0 Anshuman Gupta 2025-05-24 @149 static int pci_acpi_add_perst_assertion_delay(struct pci_dev *dev, u32 delay_us)
57059451b12af0 Anshuman Gupta 2025-05-24 150 {
57059451b12af0 Anshuman Gupta 2025-05-24 151 return -EOPNOTSUPP;
57059451b12af0 Anshuman Gupta 2025-05-24 152 }
5090d4a6a1f150 Jiang Liu 2013-04-12 153 #endif /* CONFIG_ACPI */
^1da177e4c3f41 Linus Torvalds 2005-04-16 154 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v3 7/11 drm/xe/vrsr: Enable VRSR on default VGA boot device
In reply to Badal NilawarThe VRSR feature is to enhance the display screen refresh experience when the device exits from the D3Cold state. Therefore, apply the VRSR feature to the default VGA boot device and when a display is connected.
--- drivers/gpu/drm/xe/display/xe_display.c | 22 ++++++++++++++++++++++ drivers/gpu/drm/xe/display/xe_display.h | 2 ++ drivers/gpu/drm/xe/xe_pm.c | 5 +++++ 3 files changed, 29 insertions(+)
drivers/gpu/drm/xe/display/xe_display.c +22 -0
@@ -88,6 +88,28 @@ static void display_destroy(struct drm_device *dev, void *dummy)destroy_workqueue (xe->display.hotplug.dp_wq); } +bool xe_display_connected (struct xe_device *xe) +{ +struct drm_connector *list_connector; +struct drm_connector_list_iter iter; +bool ret = false; + +mutex_lock (&xe->drm.mode_config.mutex); +drm_connector_list_iter_begin (&xe->drm, &iter); + +drm_for_each_connector_iter (list_connector, &iter) { +if (list_connector->status == connector_status_connected) { + ret = true; +break ; + } + } + +drm_connector_list_iter_end (&iter); +mutex_unlock (&xe->drm.mode_config.mutex); + +return ret; +} +/** * xe_display_create - create display struct * @xe: XE device instance
drivers/gpu/drm/xe/display/xe_display.h +2 -0
@@ -39,6 +39,7 @@ void xe_display_pm_resume(struct xe_device *xe);void xe_display_pm_runtime_suspend (struct xe_device *xe);void xe_display_pm_runtime_suspend_late (struct xe_device *xe);void xe_display_pm_runtime_resume (struct xe_device *xe); +bool xe_display_connected (struct xe_device *xe);#else
@@ -71,5 +72,6 @@ static inline void xe_display_pm_runtime_suspend(struct xe_device *xe) {}static inline void xe_display_pm_runtime_suspend_late (struct xe_device *xe) {}static inline void xe_display_pm_runtime_resume (struct xe_device *xe) {} +static inline bool xe_display_connected (struct xe_device *xe) {}#endif /* CONFIG_DRM_XE_DISPLAY */ #endif /* _XE_DISPLAY_H_ */
drivers/gpu/drm/xe/xe_pm.c +5 -0
@@ -9,6 +9,7 @@#include <linux/fault-inject.h> #include <linux/pm_runtime.h> #include <linux/suspend.h> +#include <linux/vgaarb.h> #include <drm/drm_managed.h> #include <drm/ttm/ttm_placement.h>
@@ -310,6 +311,7 @@ static int pci_acpi_aux_power_setup(struct xe_device *xe)static void xe_pm_vrsr_init (struct xe_device *xe) { +struct pci_dev *pdev =to_pci_dev (xe->drm.dev);int ret;/* Check if platform support D3Cold VRSR */
@@ -319,6 +321,9 @@ static void xe_pm_vrsr_init(struct xe_device *xe)if (!xe_pm_vrsr_capable (xe))return ; +if (pdev !=vga_default_device () || !xe_display_connected (xe)) +return ; +/* * If the VRSR initialization fails, the device will proceed with the regular * D3Cold flow
Signature · 1 line
2.34.1
kernel test robot
build botRe: [PATCH v3 07/11] drm/xe/vrsr: Enable VRSR on default VGA boot device
kernel test robot noticed the following build warnings:
Hi Badal,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-xe/drm-xe-next]
[also build test WARNING on next-20250523]
[cannot apply to rafael-pm/linux-next rafael-pm/bleeding-edge pci/next pci/for-linus linus/master v6.15-rc7] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Badal-Nilawar/PCI-ACPI-Add-D3cold-Aux-Power-Limit_DSM-method/20250524-030125 base: https://gitlab.freedesktop.org/drm/xe/kernel.git drm-xe-next patch link: https://lore.kernel.org/r/20250523190155.2623462-8-badal.nilawar%40intel.com patch subject: [PATCH v3 07/11] drm/xe/vrsr: Enable VRSR on default VGA boot device config: s390-randconfig-001-20250524 (https://download.01.org/0day-ci/archive/20250524/[email protected]/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250524/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/xe/xe_irq.c:12:
>> drivers/gpu/drm/xe/display/xe_display.h:75:64: warning: non-void function does not return a value [-Wreturn-type]
75 | static inline bool xe_display_connected(struct xe_device *xe) {}
| ^ In file included from drivers/gpu/drm/xe/xe_irq.c:12:
In file included from drivers/gpu/drm/xe/display/xe_display.h:9:
In file included from drivers/gpu/drm/xe/xe_device.h:11:
In file included from drivers/gpu/drm/xe/xe_device_types.h:10:
include/linux/pci-acpi.h:143:12: warning: unused function 'pci_acpi_request_d3cold_aux_power' [-Wunused-function]
143 | static int pci_acpi_request_d3cold_aux_power(struct pci_dev *dev, u32 requested_power,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/pci-acpi.h:149:12: warning: unused function 'pci_acpi_add_perst_assertion_delay' [-Wunused-function]
149 | static int pci_acpi_add_perst_assertion_delay(struct pci_dev *dev, u32 delay_us)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
--
In file included from drivers/gpu/drm/xe/xe_pm.c:17:
>> drivers/gpu/drm/xe/display/xe_display.h:75:64: warning: non-void function does not return a value [-Wreturn-type]
75 | static inline bool xe_display_connected(struct xe_device *xe) {}
| ^1 warning generated.
vim +75 drivers/gpu/drm/xe/display/xe_display.h
74
> 75 static inline bool xe_display_connected(struct xe_device *xe) {}Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v3 8/11 drm/xe/vrsr: Refactor d3cold.allowed to a enum
In reply to Badal NilawarFrom: Anshuman Gupta <[email protected]>
Add xe_d3_state enum to add support for VRAM Self Refresh d3cold state.
--- drivers/gpu/drm/xe/display/xe_display.c | 6 +++--- drivers/gpu/drm/xe/xe_device_types.h | 5 +++-- drivers/gpu/drm/xe/xe_pci.c | 6 +++--- drivers/gpu/drm/xe/xe_pm.c | 16 ++++++++-------- drivers/gpu/drm/xe/xe_pm.h | 8 +++++++- 5 files changed, 24 insertions(+), 17 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +3 -3
@@ -433,7 +433,7 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)if (!xe->info.probe_display)return ; -if (xe->d3cold.allowed) { +if (xe->d3cold.target_state) {xe_display_enable_d3cold (xe);return ; }
@@ -459,7 +459,7 @@ void xe_display_pm_runtime_suspend_late(struct xe_device *xe)if (!xe->info.probe_display)return ; -if (xe->d3cold.allowed) +if (xe->d3cold.target_state)xe_display_pm_suspend_late (xe);/*
@@ -537,7 +537,7 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)if (!xe->info.probe_display)return ; -if (xe->d3cold.allowed) { +if (xe->d3cold.target_state) {xe_display_disable_d3cold (xe);return ; }
drivers/gpu/drm/xe/xe_device_types.h +3 -2
@@ -20,6 +20,7 @@#include "xe_memirq_types.h" #include "xe_oa_types.h" #include "xe_platform_types.h" +#include "xe_pm.h" #include "xe_pmu_types.h" #include "xe_pt_types.h" #include "xe_sriov_types.h"
@@ -510,8 +511,8 @@ struct xe_device {/** @d3cold.capable: Indicates if root port is d3cold capable */ bool capable; -/** @d3cold.allowed: Indicates if d3cold is a valid device state */ -bool allowed; +/** @d3cold.target_state: Indicates d3cold target state */ +enum xe_d3_state target_state;/** @d3cold.vrsr_capable: Indicates if d3cold VRAM Self Refresh is supported */ bool vrsr_capable;
drivers/gpu/drm/xe/xe_pci.c +3 -3
@@ -977,7 +977,7 @@ static int xe_pci_runtime_suspend(struct device *dev)pci_save_state (pdev); -if (xe->d3cold.allowed) { +if (xe->d3cold.target_state) {d3cold_toggle (pdev,D3COLD_ENABLE );pci_disable_device (pdev);pci_ignore_hotplug (pdev);
@@ -1002,7 +1002,7 @@ static int xe_pci_runtime_resume(struct device *dev)pci_restore_state (pdev); -if (xe->d3cold.allowed) { +if (xe->d3cold.target_state) { err =pci_enable_device (pdev);if (err)return err;
@@ -1018,7 +1018,7 @@ static int xe_pci_runtime_idle(struct device *dev)struct pci_dev *pdev =to_pci_dev (dev);struct xe_device *xe =pdev_to_xe_device (pdev); -xe_pm_d3cold_allowed_toggle (xe); +xe_pm_d3cold_target_state_toggle (xe);return 0 ; }
drivers/gpu/drm/xe/xe_pm.c +8 -8
@@ -606,7 +606,7 @@ int xe_pm_runtime_suspend(struct xe_device *xe)xe_display_pm_runtime_suspend (xe); -if (xe->d3cold.allowed) { +if (xe->d3cold.target_state) { err =xe_bo_evict_all (xe);if (err) goto out_resume;
@@ -653,7 +653,7 @@ int xe_pm_runtime_resume(struct xe_device *xe)xe_rpm_lockmap_acquire (xe); -if (xe->d3cold.allowed) { +if (xe->d3cold.target_state) { err =xe_pcode_ready (xe, true);if (err) goto out;
@@ -676,7 +676,7 @@ int xe_pm_runtime_resume(struct xe_device *xe)xe_display_pm_runtime_resume (xe); -if (xe->d3cold.allowed) { +if (xe->d3cold.target_state) { err =xe_bo_restore_late (xe);if (err) goto out;
@@ -918,13 +918,13 @@ int xe_pm_set_vram_threshold(struct xe_device *xe, u32 threshold) }/** -* xe_pm_d3cold_allowed_toggle - Check conditions to toggle d3cold.allowed +* xe_pm_d3cold_target_state_toggle - Check conditions to toggle target_state * @xe: xe device instance * * To be called during runtime_pm idle callback. * Check for all the D3Cold conditions ahead of runtime suspend. */ -void xe_pm_d3cold_allowed_toggle (struct xe_device *xe) +void xe_pm_d3cold_target_state_toggle (struct xe_device *xe) {struct ttm_resource_manager *man;u32 total_vram_used_mb =0 ;
@@ -932,7 +932,7 @@ void xe_pm_d3cold_allowed_toggle(struct xe_device *xe)int i;if (!xe->d3cold.capable) { - xe->d3cold.allowed = false; + xe->d3cold.target_state =XE_D3HOT ;return ; }
@@ -947,9 +947,9 @@ void xe_pm_d3cold_allowed_toggle(struct xe_device *xe)mutex_lock (&xe->d3cold.lock);if (total_vram_used_mb < xe->d3cold.vram_threshold) - xe->d3cold.allowed = true; + xe->d3cold.target_state =XE_D3COLD_OFF ;else - xe->d3cold.allowed = false; + xe->d3cold.target_state =XE_D3HOT ;mutex_unlock (&xe->d3cold.lock); }
drivers/gpu/drm/xe/xe_pm.h +7 -1
@@ -12,6 +12,12 @@struct xe_device ; +enum xe_d3_state { +XE_D3HOT =0 , +XE_D3COLD_VRSR , +XE_D3COLD_OFF , +}; +int xe_pm_suspend (struct xe_device *xe);int xe_pm_resume (struct xe_device *xe);
@@ -30,7 +36,7 @@ void xe_pm_runtime_get_noresume(struct xe_device *xe);bool xe_pm_runtime_resume_and_get (struct xe_device *xe);void xe_pm_assert_unbounded_bridge (struct xe_device *xe);int xe_pm_set_vram_threshold (struct xe_device *xe,u32 threshold); -void xe_pm_d3cold_allowed_toggle (struct xe_device *xe); +void xe_pm_d3cold_target_state_toggle (struct xe_device *xe);bool xe_rpm_reclaim_safe (const struct xe_device *xe);struct task_struct *xe_pm_read_callback_task (struct xe_device *xe);int xe_pm_module_init (void );
Signature · 1 line
2.34.1
PATCH v3 9/11 drm/xe/pm: D3Cold target state
In reply to Badal NilawarFrom: Anshuman Gupta <[email protected]>
Trade-off D3Cold target state based upon current vram usage. If vram usage is greater than vram_d3cold_threshold and GPU is VRSR capable target D3Cold state is D3Cold-VRSR otherwise target state is D3Cold-Off.
--- drivers/gpu/drm/xe/xe_pm.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/xe/xe_pm.c +14 -0
@@ -113,6 +113,14 @@ static void xe_rpm_lockmap_release(const struct xe_device *xe) &xe_pm_runtime_d3cold_map); } +static void xe_pm_suspend_prepare (struct xe_device *xe) +{ +if (pm_suspend_target_state ==PM_SUSPEND_TO_IDLE ) +xe_pm_d3cold_target_state_toggle (xe); +else + xe->d3cold.target_state =XE_D3COLD_OFF ; +} +/** * xe_pm_suspend - Helper for System suspend, i.e. S0->S3 / S0->S2idle * @xe: xe device instance
@@ -128,6 +136,8 @@ int xe_pm_suspend(struct xe_device *xe)drm_dbg (&xe->drm,"Suspending device\n" );trace_xe_pm_suspend (xe,__builtin_return_address (0 )); +xe_pm_suspend_prepare (xe); + err =xe_pxp_pm_suspend (xe->pxp);if (err) goto err;
@@ -948,10 +958,14 @@ void xe_pm_d3cold_target_state_toggle(struct xe_device *xe)if (total_vram_used_mb < xe->d3cold.vram_threshold) xe->d3cold.target_state =XE_D3COLD_OFF ; +else if (xe->d3cold.vrsr_capable) + xe->d3cold.target_state =XE_D3COLD_VRSR ;else xe->d3cold.target_state =XE_D3HOT ;mutex_unlock (&xe->d3cold.lock); + +drm_dbg (&xe->drm,"Xe D3cold target state %d\n" , xe->d3cold.target_state); }/**
Signature · 1 line
2.34.1
PATCH v3 10/11 drm/xe/vrsr: Enable VRSR
In reply to Badal NilawarFrom: Anshuman Gupta <[email protected]>
Enabling VRSR in runtime suspend and also in System wide suspend. Also fix couple of typo in xe_pm.c.
--- drivers/gpu/drm/xe/xe_pci.c | 4 ++-- drivers/gpu/drm/xe/xe_pm.c | 46 +++++++++++++++++++++++++++---------- 2 files changed, 36 insertions(+), 14 deletions(-)
drivers/gpu/drm/xe/xe_pci.c +2 -2
@@ -926,7 +926,7 @@ static int xe_pci_suspend(struct device *dev)/* * Enabling D3Cold is needed for S2Idle/S0ix. -* It is save to allow here since xe_pm_suspend has evicted +* It is safe to allow here since xe_pm_suspend has evicted * the local memory and the direct complete optimization is disabled. */ d3cold_toggle (pdev,D3COLD_ENABLE );
@@ -943,7 +943,7 @@ static int xe_pci_resume(struct device *dev)struct pci_dev *pdev =to_pci_dev (dev);int err; -/* Give back the D3Cold decision to the runtime P M*/ +/* Give back the D3Cold decision to the runtime PM */ d3cold_toggle (pdev,D3COLD_DISABLE ); err =pci_set_power_state (pdev,PCI_D0 );
drivers/gpu/drm/xe/xe_pm.c +34 -12
95 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v3 11/11 drm/xe/vrsr: Introduce a debugfs node named vrsr_capable
In reply to Badal NilawarAdd a debugfs node named vrsr_capable to check if the device supports VRSR.
--- drivers/gpu/drm/xe/xe_debugfs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/gpu/drm/xe/xe_debugfs.c +20 -0
@@ -226,6 +226,23 @@ static const struct file_operations atomic_svm_timeslice_ms_fops = { .write = atomic_svm_timeslice_ms_set, }; +static ssize_t vrsr_capable_show (struct file *f,char __user *ubuf, +size_t size,loff_t *pos) +{ +struct xe_device *xe =file_inode (f)->i_private; +char buf[32 ]; +int len =0 ; + + len =scnprintf (buf,sizeof (buf),"%s\n" , xe->d3cold.vrsr_capable ?"true" :"false" ); + +return simple_read_from_buffer (ubuf, size, pos, buf, len); +} + +static const struct file_operations vrsr_capable_fops = { + .owner =THIS_MODULE , + .read = vrsr_capable_show, +}; +void xe_debugfs_register (struct xe_device *xe) {struct ttm_device *bdev = &xe->ttm;
@@ -249,6 +266,9 @@ void xe_debugfs_register(struct xe_device *xe)debugfs_create_file ("atomic_svm_timeslice_ms" ,0600 , root, xe, &atomic_svm_timeslice_ms_fops); +debugfs_create_file ("vrsr_capable" ,0400 , root, xe, + &vrsr_capable_fops); +for (mem_type =XE_PL_VRAM0 ; mem_type <=XE_PL_VRAM1 ; ++mem_type) { man =ttm_manager_type (bdev, mem_type);
Signature · 1 line
2.34.1
Patchwork
CI✗ CI.Patch_applied: failure for VRAM Self Refresh (rev3)
In reply to Badal Nilawar== Series Details ==
== Series Details ==
Series: VRAM Self Refresh (rev3)
URL : https://patchwork.freedesktop.org/series/145342/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 5ed61f4a36b3 drm-tip: 2025y-05m-23d-13h-19m-23s UTC integration manifest === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/display/xe_display.c:88
error: drivers/gpu/drm/xe/display/xe_display.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: PCI/ACPI: Add D3cold Aux Power Limit_DSM method
Applying: PCI/ACPI: Per root port allow one Aux power limit request
Applying: PCI/ACPI: Add PERST# Assertion Delay _DSM method
Applying: drm/xe/vrsr: Introduce flag has_vrsr
Applying: drm/xe/vrsr: Detect VRSR Capability
Applying: drm/xe/vrsr: Initialize VRSR feature
Applying: drm/xe/vrsr: Enable VRSR on default VGA boot device
Patch failed at 0007 drm/xe/vrsr: Enable VRSR on default VGA boot device When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".