On 07.10.2013 16:05, Erik Faye-Lund wrote:
On Mon, Oct 7, 2013 at 2:52 PM, Terje Bergström tbergstrom@nvidia.com wrote:
AND 0xff is necessary, because the same registers are mirrored in multiple contexts. AND removes the offset coming from context, and leaves just the plain register offset.
The offsets in the commands don't have enough bits to reach over to the next context. The contexts are repeated at multiples of 0x4000, and 0xFFF is the largest encodable offset. So I don't really thing the AND is needed for *that* purpose.
Well, that was embarrassing. Of course that is true. You can access all registers via MMIO or with SETCLASS to correct context. But that was still the reason I used when I wrote that 0xff, so it's bogus.
Real fix is to do what Thierry already did: limit the bitmap to max register number we're interested in, and have a if() to fail fast if register number falls outside that range.
Even better, get IOMMU up and running.
Terje