dev-hsa: Fix size of HSA Queue
In the HSAQueueDescriptor ptr function, we mod the index by numElts, but numElts was previously just set to size, which was the raw size of the queue. This lead to indexing past the queue. We fix this by dividing by the size by the AQL packet size to get the actual number of elements the queue can hold. We also add an assert for indexing into the queue, as there is a scenario where the queue reports a larger size than it actually is. Change-Id: Ie5e699379f303255305c279e58a34dc783df86a0 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42423 Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com> Reviewed-by: Matthew Poremba <matthew.poremba@amd.com> Maintainer: Matt Sinclair <mattdsinclair@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Matt Sinclair
parent
47a278c0ad
commit
8f577e6e23
@@ -85,7 +85,7 @@ class HSAQueueDescriptor
|
||||
uint64_t hri_ptr, uint32_t size)
|
||||
: basePointer(base_ptr), doorbellPointer(db_ptr),
|
||||
writeIndex(0), readIndex(0),
|
||||
numElts(size), hostReadIndexPtr(hri_ptr),
|
||||
numElts(size / AQL_PACKET_SIZE), hostReadIndexPtr(hri_ptr),
|
||||
stalledOnDmaBufAvailability(false),
|
||||
dmaInProgress(false)
|
||||
{ }
|
||||
@@ -98,6 +98,13 @@ class HSAQueueDescriptor
|
||||
|
||||
uint64_t ptr(uint64_t ix)
|
||||
{
|
||||
/**
|
||||
* Sometimes queues report that their size is 512k, which would
|
||||
* indicate numElts of 0x2000. However, they only have 256k
|
||||
* mapped which means any index over 0x1000 will fail an
|
||||
* address translation.
|
||||
*/
|
||||
assert(ix % numElts < 0x1000);
|
||||
return basePointer +
|
||||
((ix % numElts) * objSize());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user