gem5-dev@gem5.org

The gem5 Developer List

View all threads

[XS] Change in gem5/gem5[develop]: dev-amdgpu: Default MMIO reads when previously written

MP
Matthew Poremba (Gerrit)
Fri, Apr 28, 2023 12:48 AM

Matthew Poremba has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/70039?usp=email )

(

1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
)Change subject: dev-amdgpu: Default MMIO reads when previously written
......................................................................

dev-amdgpu: Default MMIO reads when previously written

If an MMIO was previously written and the driver reads it, we should
return the value that was previously read. This overwrites the MMIO
trace value which is the last resort fallback for finding an MMIO value.
This is needed to initialize newer GPU devices in gem5.

Change-Id: Ida2435290b706288e88518b5d920691cdb6dcc09
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70039
Maintainer: Matt Sinclair mattdsinclair@gmail.com
Reviewed-by: Matt Sinclair mattdsinclair@gmail.com
Tested-by: kokoro noreply+kokoro@google.com

M src/dev/amdgpu/amdgpu_device.cc
1 file changed, 7 insertions(+), 0 deletions(-)

Approvals:
Matt Sinclair: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass

diff --git a/src/dev/amdgpu/amdgpu_device.cc
b/src/dev/amdgpu/amdgpu_device.cc
index 3605882..7e6304a 100644
--- a/src/dev/amdgpu/amdgpu_device.cc
+++ b/src/dev/amdgpu/amdgpu_device.cc
@@ -248,6 +248,13 @@
DPRINTF(AMDGPUDevice, "Read MMIO %#lx\n", offset);
mmioReader.readFromTrace(pkt, MMIO_BAR, offset);

  • if (regs.find(pkt->getAddr()) != regs.end()) {
  •    uint64_t value = regs[pkt->getAddr()];
    
  •    DPRINTF(AMDGPUDevice, "Reading what kernel wrote before: %#x\n",
    
  •            value);
    
  •    pkt->setUintX(value, ByteOrder::little);
    
  • }
  • switch (aperture) {
      case NBIO_BASE:
        switch (aperture_offset) {
    

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/70039?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings

Gerrit-MessageType: merged
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ida2435290b706288e88518b5d920691cdb6dcc09
Gerrit-Change-Number: 70039
Gerrit-PatchSet: 3
Gerrit-Owner: Matthew Poremba matthew.poremba@amd.com
Gerrit-Reviewer: Matt Sinclair mattdsinclair@gmail.com
Gerrit-Reviewer: Matthew Poremba matthew.poremba@amd.com
Gerrit-Reviewer: kokoro noreply+kokoro@google.com

Matthew Poremba has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/70039?usp=email ) ( 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: dev-amdgpu: Default MMIO reads when previously written ...................................................................... dev-amdgpu: Default MMIO reads when previously written If an MMIO was previously written and the driver reads it, we should return the value that was previously read. This overwrites the MMIO trace value which is the last resort fallback for finding an MMIO value. This is needed to initialize newer GPU devices in gem5. Change-Id: Ida2435290b706288e88518b5d920691cdb6dcc09 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70039 Maintainer: Matt Sinclair <mattdsinclair@gmail.com> Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> --- M src/dev/amdgpu/amdgpu_device.cc 1 file changed, 7 insertions(+), 0 deletions(-) Approvals: Matt Sinclair: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/dev/amdgpu/amdgpu_device.cc b/src/dev/amdgpu/amdgpu_device.cc index 3605882..7e6304a 100644 --- a/src/dev/amdgpu/amdgpu_device.cc +++ b/src/dev/amdgpu/amdgpu_device.cc @@ -248,6 +248,13 @@ DPRINTF(AMDGPUDevice, "Read MMIO %#lx\n", offset); mmioReader.readFromTrace(pkt, MMIO_BAR, offset); + if (regs.find(pkt->getAddr()) != regs.end()) { + uint64_t value = regs[pkt->getAddr()]; + DPRINTF(AMDGPUDevice, "Reading what kernel wrote before: %#x\n", + value); + pkt->setUintX(value, ByteOrder::little); + } + switch (aperture) { case NBIO_BASE: switch (aperture_offset) { -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/70039?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-MessageType: merged Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: Ida2435290b706288e88518b5d920691cdb6dcc09 Gerrit-Change-Number: 70039 Gerrit-PatchSet: 3 Gerrit-Owner: Matthew Poremba <matthew.poremba@amd.com> Gerrit-Reviewer: Matt Sinclair <mattdsinclair@gmail.com> Gerrit-Reviewer: Matthew Poremba <matthew.poremba@amd.com> Gerrit-Reviewer: kokoro <noreply+kokoro@google.com>