From fc3112d4bde9f4ff4ccf7b8754de61217178ed6c Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Mon, 18 May 2020 13:48:08 -0700 Subject: [PATCH] misc: Fixed HSAIL_X86 compilation errors HSAIL_X86 fail to compile. This patch enables compilation. Issue-on: https://gem5.atlassian.net/browse/GEM5-556 Change-Id: I663e529622ed90254eaf8be01e23991ed8271b5b Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29293 Reviewed-by: Bobby R. Bruce Maintainer: Bobby R. Bruce Tested-by: kokoro --- src/SConscript | 4 ++-- src/arch/hsail/gen.py | 2 +- src/dev/hsa/HSADevice.py | 2 +- src/dev/hsa/HSADriver.py | 2 +- src/dev/hsa/hsa_device.cc | 3 +-- src/dev/hsa/hsa_driver.cc | 30 +++-------------------------- src/dev/hsa/hsa_packet_processor.cc | 9 +++------ 7 files changed, 12 insertions(+), 40 deletions(-) diff --git a/src/SConscript b/src/SConscript index 134e2a598..1de8a2d75 100644 --- a/src/SConscript +++ b/src/SConscript @@ -624,7 +624,7 @@ def makeTheISA(source, target, env): isas = [ src.get_contents().decode('utf-8') for src in source ] target_isa = env['TARGET_ISA'] def define(isa): - return isa.upper() + '_ISA' + return str(isa.upper()) + '_ISA' def namespace(isa): return isa[0].upper() + isa[1:].lower() + 'ISA' @@ -669,7 +669,7 @@ def makeTheGPUISA(source, target, env): isas = [ src.get_contents() for src in source ] target_gpu_isa = env['TARGET_GPU_ISA'] def define(isa): - return isa.upper() + '_ISA' + return str(isa.upper()) + '_ISA' def namespace(isa): return isa[0].upper() + isa[1:].lower() + 'ISA' diff --git a/src/arch/hsail/gen.py b/src/arch/hsail/gen.py index 8dcc92c7b..56404248b 100755 --- a/src/arch/hsail/gen.py +++ b/src/arch/hsail/gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python # Copyright (c) 2015 Advanced Micro Devices, Inc. # All rights reserved. # diff --git a/src/dev/hsa/HSADevice.py b/src/dev/hsa/HSADevice.py index 125d6eef1..50e3c6dbf 100644 --- a/src/dev/hsa/HSADevice.py +++ b/src/dev/hsa/HSADevice.py @@ -35,7 +35,7 @@ from m5.SimObject import SimObject from m5.params import * from m5.proxy import * -from Device import DmaDevice +from m5.objects.Device import DmaDevice class HSADevice(DmaDevice): type = 'HSADevice' diff --git a/src/dev/hsa/HSADriver.py b/src/dev/hsa/HSADriver.py index ed742fa49..3df22a00d 100644 --- a/src/dev/hsa/HSADriver.py +++ b/src/dev/hsa/HSADriver.py @@ -35,7 +35,7 @@ from m5.SimObject import SimObject from m5.params import * from m5.proxy import * -from Process import EmulatedDriver +from m5.objects.Process import EmulatedDriver class HSADriver(EmulatedDriver): type = 'HSADriver' diff --git a/src/dev/hsa/hsa_device.cc b/src/dev/hsa/hsa_device.cc index 01b7a41eb..78ec8e8b4 100644 --- a/src/dev/hsa/hsa_device.cc +++ b/src/dev/hsa/hsa_device.cc @@ -102,9 +102,8 @@ HSADevice::translateOrDie(Addr vaddr, Addr &paddr) * grab context zero. */ auto process = sys->getThreadContext(0)->getProcessPtr(); - auto mem_state = process->getMemState(); - if (!mem_state->translate(vaddr, paddr)) { + if (!process->pTable->translate(vaddr, paddr)) { fatal("failed translation: vaddr 0x%x\n", vaddr); } } diff --git a/src/dev/hsa/hsa_driver.cc b/src/dev/hsa/hsa_driver.cc index 5f3015917..3f5c8eb0a 100644 --- a/src/dev/hsa/hsa_driver.cc +++ b/src/dev/hsa/hsa_driver.cc @@ -74,7 +74,7 @@ HSADriver::mmap(ThreadContext *tc, Addr start, uint64_t length, int prot, "offset: 0x%x)\n", start, length, offset); auto process = tc->getProcessPtr(); - auto mem_state = process->getMemState(); + auto mem_state = process->memState; // Extend global mmap region if necessary. if (start == 0) { @@ -87,32 +87,8 @@ HSADriver::mmap(ThreadContext *tc, Addr start, uint64_t length, int prot, * Now map this virtual address to our PIO doorbell interface * in the page tables (non-cacheable). */ - mem_state->map(start, device->hsaPacketProc().pioAddr, length, false); + process->pTable->map(start, device->hsaPacketProc().pioAddr, + length, false); DPRINTF(HSADriver, "amdkfd doorbell mapped to %xp\n", start); return start; } - -/** - * Forward relevant parameters to packet processor; queueID - * is used to link doorbell. The queueIDs are not re-used - * in current implementation, and we allocate only one page - * (4096 bytes) for doorbells, so check if this queue ID can - * be mapped into that page. - */ -void -HSADriver::allocateQueue(const SETranslatingPortProxy &mem_proxy, Addr ioc_buf) -{ - TypedBufferArg args(ioc_buf); - args.copyIn(mem_proxy); - - if (VOID_PTR_ADD32(0, queueId) >= (void*)0x1000) { - fatal("%s: Exceeded maximum number of HSA queues allowed\n", name()); - } - - args->queue_id = queueId++; - auto &hsa_pp = device->hsaPacketProc(); - hsa_pp.setDeviceQueueDesc(args->read_pointer_address, - args->ring_base_address, args->queue_id, - args->ring_size); - args.copyOut(mem_proxy); -} diff --git a/src/dev/hsa/hsa_packet_processor.cc b/src/dev/hsa/hsa_packet_processor.cc index 76da30e29..bd050163b 100644 --- a/src/dev/hsa/hsa_packet_processor.cc +++ b/src/dev/hsa/hsa_packet_processor.cc @@ -127,7 +127,7 @@ HSAPacketProcessor::write(Packet *pkt) "%s: write of size %d to reg-offset %d (0x%x)\n", __FUNCTION__, pkt->getSize(), daddr, daddr); - uint32_t doorbell_reg = pkt->get(); + uint32_t doorbell_reg = pkt->getLE(); DPRINTF(HSAPacketProcessor, "%s: write data 0x%x to offset %d (0x%x)\n", @@ -152,9 +152,8 @@ HSAPacketProcessor::translateOrDie(Addr vaddr, Addr &paddr) // new extensions, it will likely be wrong to just arbitrarily grab context // zero. auto process = sys->getThreadContext(0)->getProcessPtr(); - auto mem_state = process->getMemState(); - if (!mem_state->translate(vaddr, paddr)) + if (!process->pTable->translate(vaddr, paddr)) fatal("failed translation: vaddr 0x%x\n", vaddr); } @@ -395,9 +394,7 @@ HSAPacketProcessor::processPkt(void* pkt, uint32_t rl_idx, Addr host_pkt_addr) * not support atomic operations. */ auto tc = sys->getThreadContext(0); - auto process = tc->getProcessPtr(); - auto mem_state = process->getMemState(); - auto &virt_proxy = mem_state->getVirtProxy(); + auto &virt_proxy = tc->getVirtProxy(); TypedBufferArg prev_signal(signal_addr); prev_signal.copyIn(virt_proxy); -- 2.30.2