Guard against common cases where vega10 does not

need to be reset.

Specifically, check if the card is already in BACO. If so, exit. If the card shows no signs of life, exit because we likely can't do anything. If the card shows signs of life, do a BACO reset.
This commit is contained in:
Adam Madsen
2020-11-01 23:29:53 -06:00
parent eb42a21118
commit 7faae1b95a
4 changed files with 43 additions and 15 deletions

View File

@@ -23,6 +23,8 @@
#include <linux/types.h>
#include <linux/delay.h>
#include "soc15_common.h"
#include "vega10_inc.h"
#include "common_baco.h"
#include "common.h"
@@ -120,3 +122,17 @@ bool soc15_baco_program_registers(struct amd_fake_dev *adev,
return true;
}
int smu9_baco_get_state(struct amd_fake_dev *adev, enum BACO_STATE *state)
{
uint32_t reg;
reg = RREG32_SOC15(NBIF, 0, mmBACO_CNTL);
if (reg & BACO_CNTL__BACO_MODE_MASK)
/* gfx has already entered BACO state */
*state = BACO_STATE_IN;
else
*state = BACO_STATE_OUT;
return 0;
}

View File

@@ -55,6 +55,14 @@ struct soc15_baco_cmd_entry
uint32_t val;
};
/* from hwmgr.h */
enum BACO_STATE
{
BACO_STATE_OUT = 0,
BACO_STATE_IN,
};
/* end from hwmgr.h */
struct amd_fake_dev;
extern bool baco_program_registers(struct amd_fake_dev *adev,
@@ -63,4 +71,6 @@ extern bool baco_program_registers(struct amd_fake_dev *adev,
extern bool soc15_baco_program_registers(struct amd_fake_dev *adev,
const struct soc15_baco_cmd_entry *entry,
const u32 array_size);
extern int smu9_baco_get_state(struct amd_fake_dev *adev, enum BACO_STATE *state);
#endif