Commit 9855e584 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: trust init table registers are safe

Apparently the original reason for checking this was there were known
register accesses that caused hangs on some chipsets.  This was more
than likely because of incorrect parsing of previous opcodes, and I
hardly think aborting a script half way through is going to be any
better (in fact, we have had bug reports where this has been the cause
of s/r failures among other things).

This patch (which has been in Fedora 12 for a long time now) removes
all checking for known register ranges, and just leaves the check to
ensure the access is within the mapped aperture to avoid an oops.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 0a90dc51
...@@ -310,63 +310,22 @@ valid_reg(struct nvbios *bios, uint32_t reg) ...@@ -310,63 +310,22 @@ valid_reg(struct nvbios *bios, uint32_t reg)
struct drm_device *dev = bios->dev; struct drm_device *dev = bios->dev;
/* C51 has misaligned regs on purpose. Marvellous */ /* C51 has misaligned regs on purpose. Marvellous */
if (reg & 0x2 || (reg & 0x1 && dev_priv->VBIOS.pub.chip_version != 0x51)) { if (reg & 0x2 ||
NV_ERROR(dev, "========== misaligned reg 0x%08X ==========\n", (reg & 0x1 && dev_priv->VBIOS.pub.chip_version != 0x51))
reg); NV_ERROR(dev, "======= misaligned reg 0x%08X =======\n", reg);
return 0;
} /* warn on C51 regs that haven't been verified accessible in tracing */
/*
* Warn on C51 regs that have not been verified accessible in
* mmiotracing
*/
if (reg & 0x1 && dev_priv->VBIOS.pub.chip_version == 0x51 && if (reg & 0x1 && dev_priv->VBIOS.pub.chip_version == 0x51 &&
reg != 0x130d && reg != 0x1311 && reg != 0x60081d) reg != 0x130d && reg != 0x1311 && reg != 0x60081d)
NV_WARN(dev, "=== C51 misaligned reg 0x%08X not verified ===\n", NV_WARN(dev, "=== C51 misaligned reg 0x%08X not verified ===\n",
reg); reg);
/* Trust the init scripts on G80 */ if (reg >= (8*1024*1024)) {
if (dev_priv->card_type >= NV_50) NV_ERROR(dev, "=== reg 0x%08x out of mapped bounds ===\n", reg);
return 1; return 0;
#define WITHIN(x, y, z) ((x >= y) && (x < y + z))
if (WITHIN(reg, NV_PMC_OFFSET, NV_PMC_SIZE))
return 1;
if (WITHIN(reg, NV_PBUS_OFFSET, NV_PBUS_SIZE))
return 1;
if (WITHIN(reg, NV_PFIFO_OFFSET, NV_PFIFO_SIZE))
return 1;
if (dev_priv->VBIOS.pub.chip_version >= 0x30 &&
(WITHIN(reg, 0x4000, 0x600) || reg == 0x00004600))
return 1;
if (dev_priv->VBIOS.pub.chip_version >= 0x40 &&
WITHIN(reg, 0xc000, 0x48))
return 1;
if (dev_priv->VBIOS.pub.chip_version >= 0x17 && reg == 0x0000d204)
return 1;
if (dev_priv->VBIOS.pub.chip_version >= 0x40) {
if (reg == 0x00011014 || reg == 0x00020328)
return 1;
if (WITHIN(reg, 0x88000, NV_PBUS_SIZE)) /* new PBUS */
return 1;
} }
if (WITHIN(reg, NV_PFB_OFFSET, NV_PFB_SIZE))
return 1;
if (WITHIN(reg, NV_PEXTDEV_OFFSET, NV_PEXTDEV_SIZE))
return 1;
if (WITHIN(reg, NV_PCRTC0_OFFSET, NV_PCRTC0_SIZE * 2))
return 1;
if (WITHIN(reg, NV_PRAMDAC0_OFFSET, NV_PRAMDAC0_SIZE * 2))
return 1;
if (dev_priv->VBIOS.pub.chip_version >= 0x17 && reg == 0x0070fff0)
return 1;
if (dev_priv->VBIOS.pub.chip_version == 0x51 &&
WITHIN(reg, NV_PRAMIN_OFFSET, NV_PRAMIN_SIZE))
return 1;
#undef WITHIN
NV_ERROR(dev, "========== unknown reg 0x%08X ==========\n", reg); return 1;
return 0;
} }
static bool static bool
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment