sync with OpenBSD -current
This commit is contained in:
parent
b5dda3c267
commit
c78abe7784
59 changed files with 509 additions and 656 deletions
|
@ -1487,9 +1487,11 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
|
|||
#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
|
||||
bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);
|
||||
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
|
||||
void amdgpu_choose_low_power_state(struct amdgpu_device *adev);
|
||||
#else
|
||||
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
|
||||
static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false; }
|
||||
static inline void amdgpu_choose_low_power_state(struct amdgpu_device *adev) { }
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_DRM_AMD_DC)
|
||||
|
|
|
@ -1519,6 +1519,7 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
|
|||
if (adev->asic_type < CHIP_RAVEN)
|
||||
return false;
|
||||
|
||||
#ifdef __linux__
|
||||
/*
|
||||
* If ACPI_FADT_LOW_POWER_S0 is not set in the FADT, it is generally
|
||||
* risky to do any special firmware-related preparations for entering
|
||||
|
@ -1531,6 +1532,7 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
|
|||
"To use suspend-to-idle change the sleep mode in BIOS setup.\n");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !IS_ENABLED(CONFIG_AMD_PMC)
|
||||
dev_err_once(adev->dev,
|
||||
|
@ -1541,4 +1543,19 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
|
|||
#endif /* CONFIG_AMD_PMC */
|
||||
}
|
||||
|
||||
/**
|
||||
* amdgpu_choose_low_power_state
|
||||
*
|
||||
* @adev: amdgpu_device_pointer
|
||||
*
|
||||
* Choose the target low power state for the GPU
|
||||
*/
|
||||
void amdgpu_choose_low_power_state(struct amdgpu_device *adev)
|
||||
{
|
||||
if (amdgpu_acpi_is_s0ix_active(adev))
|
||||
adev->in_s0ix = true;
|
||||
else if (amdgpu_acpi_is_s3_active(adev))
|
||||
adev->in_s3 = true;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SUSPEND */
|
||||
|
|
|
@ -4221,13 +4221,15 @@ int amdgpu_device_prepare(struct drm_device *dev)
|
|||
struct amdgpu_device *adev = drm_to_adev(dev);
|
||||
int i, r;
|
||||
|
||||
amdgpu_choose_low_power_state(adev);
|
||||
|
||||
if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
|
||||
return 0;
|
||||
|
||||
/* Evict the majority of BOs before starting suspend sequence */
|
||||
r = amdgpu_device_evict_resources(adev);
|
||||
if (r)
|
||||
return r;
|
||||
goto unprepare;
|
||||
|
||||
flush_delayed_work(&adev->gfx.gfx_off_delay_work);
|
||||
|
||||
|
@ -4238,10 +4240,15 @@ int amdgpu_device_prepare(struct drm_device *dev)
|
|||
continue;
|
||||
r = adev->ip_blocks[i].version->funcs->prepare_suspend((void *)adev);
|
||||
if (r)
|
||||
return r;
|
||||
goto unprepare;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
unprepare:
|
||||
adev->in_s0ix = adev->in_s3 = false;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2383,8 +2383,6 @@ static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
|
||||
static int amdgpu_pmops_prepare(struct device *dev)
|
||||
{
|
||||
struct drm_device *drm_dev = dev_get_drvdata(dev);
|
||||
|
@ -2477,6 +2475,8 @@ static int amdgpu_pmops_freeze(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
|
||||
static int amdgpu_pmops_thaw(struct device *dev)
|
||||
{
|
||||
struct drm_device *drm_dev = dev_get_drvdata(dev);
|
||||
|
@ -2491,6 +2491,8 @@ static int amdgpu_pmops_poweroff(struct device *dev)
|
|||
return amdgpu_device_suspend(drm_dev, true);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int amdgpu_pmops_restore(struct device *dev)
|
||||
{
|
||||
struct drm_device *drm_dev = dev_get_drvdata(dev);
|
||||
|
@ -2498,6 +2500,8 @@ static int amdgpu_pmops_restore(struct device *dev)
|
|||
return amdgpu_device_resume(drm_dev, true);
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
|
||||
static int amdgpu_runtime_idle_check_display(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
|
@ -3496,6 +3500,8 @@ amdgpu_attachhook(struct device *self)
|
|||
struct drm_gem_object *obj;
|
||||
struct amdgpu_bo *rbo;
|
||||
|
||||
dev_set_drvdata(self, dev);
|
||||
|
||||
r = amdgpu_driver_load_kms(adev, adev->flags);
|
||||
if (r)
|
||||
goto out;
|
||||
|
@ -3671,15 +3677,23 @@ amdgpu_activate(struct device *self, int act)
|
|||
switch (act) {
|
||||
case DVACT_QUIESCE:
|
||||
rv = config_activate_children(self, act);
|
||||
amdgpu_device_prepare(dev);
|
||||
amdgpu_device_suspend(dev, true);
|
||||
amdgpu_pmops_prepare(self);
|
||||
if (acpi_softc && acpi_softc->sc_state == ACPI_STATE_S4)
|
||||
amdgpu_pmops_freeze(self);
|
||||
else
|
||||
amdgpu_pmops_suspend(self);
|
||||
break;
|
||||
case DVACT_SUSPEND:
|
||||
if (!acpi_softc || acpi_softc->sc_state != ACPI_STATE_S4)
|
||||
amdgpu_pmops_suspend_noirq(self);
|
||||
break;
|
||||
case DVACT_RESUME:
|
||||
break;
|
||||
case DVACT_WAKEUP:
|
||||
amdgpu_device_resume(dev, true);
|
||||
if (acpi_softc && acpi_softc->sc_state == ACPI_STATE_S4)
|
||||
amdgpu_pmops_restore(self);
|
||||
else
|
||||
amdgpu_pmops_resume(self);
|
||||
rv = config_activate_children(self, act);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1550,10 +1550,16 @@ drm_activate(struct device *self, int act)
|
|||
switch (act) {
|
||||
case DVACT_QUIESCE:
|
||||
#ifdef CONFIG_ACPI
|
||||
if (acpi_softc && acpi_softc->sc_state == ACPI_STATE_S3)
|
||||
pm_suspend_target_state = PM_SUSPEND_MEM;
|
||||
else
|
||||
pm_suspend_target_state = PM_SUSPEND_TO_IDLE;
|
||||
if (acpi_softc) {
|
||||
switch (acpi_softc->sc_state) {
|
||||
case ACPI_STATE_S0:
|
||||
pm_suspend_target_state = PM_SUSPEND_TO_IDLE;
|
||||
break;
|
||||
case ACPI_STATE_S3:
|
||||
pm_suspend_target_state = PM_SUSPEND_MEM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
pm_suspend_target_state = PM_SUSPEND_TO_IDLE;
|
||||
#endif
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#if NACPI > 0
|
||||
#define CONFIG_ACPI 1
|
||||
#define CONFIG_ACPI_SLEEP 1
|
||||
#define CONFIG_AMD_PMC 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: pci.h,v 1.16 2024/01/16 23:38:13 jsg Exp $ */
|
||||
/* $OpenBSD: pci.h,v 1.17 2024/08/16 10:46:46 kettenis Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2015 Mark Kettenis
|
||||
*
|
||||
|
@ -524,4 +524,10 @@ pci_match_id(const struct pci_device_id *ids, struct pci_dev *pdev)
|
|||
#define PCI_CLASS_ACCELERATOR_PROCESSING \
|
||||
(PCI_CLASS_ACCELERATOR << 8)
|
||||
|
||||
static inline int
|
||||
pci_device_is_present(struct pci_dev *pdev)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* _LINUX_PCI_H_ */
|
||||
|
|
|
@ -80,4 +80,10 @@ pm_runtime_get_if_active(struct device *dev, bool x)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int
|
||||
pm_runtime_suspended(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue