1 /*
2 * Copyright (C) 2018-2021 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #include "shared/source/gmm_helper/windows/gmm_memory_base.h"
9
10 #include "shared/source/gmm_helper/client_context/gmm_client_context.h"
11 #include "shared/source/helpers/debug_helpers.h"
12 #include "shared/source/os_interface/windows/windows_defs.h"
13
14 namespace NEO {
GmmMemoryBase(GmmClientContext * gmmClientContext)15 GmmMemoryBase::GmmMemoryBase(GmmClientContext *gmmClientContext) : clientContext(*gmmClientContext->getHandle()) {
16 }
17
configureDevice(GMM_ESCAPE_HANDLE hAdapter,GMM_ESCAPE_HANDLE hDevice,GMM_ESCAPE_FUNC_TYPE pfnEscape,GMM_GFX_SIZE_T svmSize,BOOLEAN bdwL3Coherency,uintptr_t & minAddress,bool obtainMinAddress)18 bool GmmMemoryBase::configureDevice(GMM_ESCAPE_HANDLE hAdapter,
19 GMM_ESCAPE_HANDLE hDevice,
20 GMM_ESCAPE_FUNC_TYPE pfnEscape,
21 GMM_GFX_SIZE_T svmSize,
22 BOOLEAN bdwL3Coherency,
23 uintptr_t &minAddress,
24 bool obtainMinAddress) {
25 minAddress = windowsMinAddress;
26 auto retVal = configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, svmSize, bdwL3Coherency);
27 if (obtainMinAddress) {
28 minAddress = getInternalGpuVaRangeLimit();
29 }
30 return retVal;
31 }
getInternalGpuVaRangeLimit()32 uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
33 return static_cast<uintptr_t>(clientContext.GetInternalGpuVaRangeLimit());
34 }
35
setDeviceInfo(GMM_DEVICE_INFO * deviceInfo)36 bool GmmMemoryBase::setDeviceInfo(GMM_DEVICE_INFO *deviceInfo) {
37 auto status = clientContext.GmmSetDeviceInfo(deviceInfo);
38 DEBUG_BREAK_IF(status != GMM_SUCCESS);
39 return GMM_SUCCESS == status;
40 }
41 }; // namespace NEO
42