Scratch registers are used by the Linux DRM driver to store sequence numbers related to fencing. Without them, Xorg starts but quickly hangs.
Signed-off-by: Chad Jablonski <[email protected]> --- hw/display/ati.c | 19 +++++++++++++++++++ hw/display/ati_int.h | 1 + hw/display/ati_regs.h | 6 ++++++ 3 files changed, 26 insertions(+) diff --git a/hw/display/ati.c b/hw/display/ati.c index 0c550599cc..86e5c16946 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -629,6 +629,14 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size) case CP_IB_BUFSZ: val = s->regs.cp_ib_bufsz; break; + case SCRATCH_REG0: + case SCRATCH_REG1: + case SCRATCH_REG2: + case SCRATCH_REG3: + case SCRATCH_REG4: + case SCRATCH_REG5: + val = s->regs.scratch_reg[(addr - SCRATCH_REG0) / sizeof(uint32_t)]; + break; default: break; } @@ -1197,6 +1205,17 @@ void ati_mm_write(void *opaque, hwaddr addr, } break; } + case SCRATCH_REG0: + case SCRATCH_REG1: + case SCRATCH_REG2: + case SCRATCH_REG3: + case SCRATCH_REG4: + case SCRATCH_REG5: + { + int reg_idx = (addr - SCRATCH_REG0) / sizeof(uint32_t); + s->regs.scratch_reg[reg_idx] = data; + break; + } default: break; } diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h index df08b6ae01..daa45a2009 100644 --- a/hw/display/ati_int.h +++ b/hw/display/ati_int.h @@ -131,6 +131,7 @@ typedef struct ATIVGARegs { uint32_t cp_rb_wptr; uint32_t cp_ib_base; uint32_t cp_ib_bufsz; + uint32_t scratch_reg[6]; } ATIVGARegs; typedef struct ATIHostDataState { diff --git a/hw/display/ati_regs.h b/hw/display/ati_regs.h index e8e1b90374..54d63cf26b 100644 --- a/hw/display/ati_regs.h +++ b/hw/display/ati_regs.h @@ -222,6 +222,12 @@ #define CLR_CMP_MASK 0x15cc #define DP_SRC_FRGD_CLR 0x15d8 #define DP_SRC_BKGD_CLR 0x15dc +#define SCRATCH_REG0 0x15e0 +#define SCRATCH_REG1 0x15e4 +#define SCRATCH_REG2 0x15e8 +#define SCRATCH_REG3 0x15ec +#define SCRATCH_REG4 0x15f0 +#define SCRATCH_REG5 0x15f4 #define DST_BRES_ERR 0x1628 #define DST_BRES_INC 0x162c #define DST_BRES_DEC 0x1630 -- 2.54.0
