2018-05-05 21:30:37 +02:00
|
|
|
/*
|
2019-12-23 14:28:33 +01:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-09-18 09:11:08 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
2018-05-05 21:30:37 +02:00
|
|
|
|
2020-02-23 18:46:50 +01:00
|
|
|
#include "gmm_helper/windows/gmm_memory_base.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2020-02-23 18:46:50 +01:00
|
|
|
#include "helpers/debug_helpers.h"
|
|
|
|
|
#include "os_interface/windows/windows_defs.h"
|
2018-05-05 21:30:37 +02:00
|
|
|
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "gmm_client_context.h"
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2020-01-24 15:03:28 +01:00
|
|
|
GmmMemoryBase::GmmMemoryBase(GmmClientContext *gmmClientContext) : clientContext(*gmmClientContext->getHandle()) {
|
2018-07-03 10:00:12 +02:00
|
|
|
}
|
2018-05-05 21:30:37 +02:00
|
|
|
bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
|
|
|
|
GMM_ESCAPE_HANDLE hDevice,
|
|
|
|
|
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
|
|
|
|
GMM_GFX_SIZE_T SvmSize,
|
2018-08-23 11:29:39 +02:00
|
|
|
BOOLEAN BDWL3Coherency) {
|
2020-01-24 15:03:28 +01:00
|
|
|
return clientContext.ConfigureDeviceAddressSpace(
|
2018-05-05 21:30:37 +02:00
|
|
|
{hAdapter},
|
|
|
|
|
{hDevice},
|
|
|
|
|
{pfnEscape},
|
|
|
|
|
SvmSize,
|
2018-08-23 11:29:39 +02:00
|
|
|
0,
|
|
|
|
|
0,
|
2018-05-05 21:30:37 +02:00
|
|
|
BDWL3Coherency,
|
2018-08-23 11:29:39 +02:00
|
|
|
0,
|
|
|
|
|
0) != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GmmMemoryBase::configureDevice(GMM_ESCAPE_HANDLE hAdapter,
|
|
|
|
|
GMM_ESCAPE_HANDLE hDevice,
|
|
|
|
|
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
|
|
|
|
GMM_GFX_SIZE_T SvmSize,
|
|
|
|
|
BOOLEAN BDWL3Coherency,
|
2019-12-23 14:28:33 +01:00
|
|
|
uintptr_t &minAddress,
|
|
|
|
|
bool obtainMinAddress) {
|
2018-08-23 11:29:39 +02:00
|
|
|
minAddress = windowsMinAddress;
|
2019-12-23 14:28:33 +01:00
|
|
|
auto retVal = configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, SvmSize, BDWL3Coherency);
|
|
|
|
|
if (obtainMinAddress) {
|
|
|
|
|
minAddress = getInternalGpuVaRangeLimit();
|
|
|
|
|
}
|
|
|
|
|
return retVal;
|
|
|
|
|
}
|
|
|
|
|
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
2020-01-24 15:03:28 +01:00
|
|
|
return static_cast<uintptr_t>(clientContext.GetInternalGpuVaRangeLimit());
|
2019-12-23 14:28:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GmmMemoryBase::setDeviceInfo(GMM_DEVICE_INFO *deviceInfo) {
|
2020-01-24 15:03:28 +01:00
|
|
|
auto status = clientContext.GmmSetDeviceInfo(deviceInfo);
|
2019-12-23 14:28:33 +01:00
|
|
|
DEBUG_BREAK_IF(status != GMM_SUCCESS);
|
|
|
|
|
return GMM_SUCCESS == status;
|
2018-05-05 21:30:37 +02:00
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
}; // namespace NEO
|