Delete TypeSelector helper
Change-Id: Iff5fe62d31fa7b07658cfcf81ebd2c12d47e2b3b Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
parent
2f7158e035
commit
130a7ac8b8
|
@ -35,16 +35,6 @@ inline void setAddress(CmdServicesMemTraceMemoryCompare &cmd, uint64_t address)
|
|||
cmd.addressHigh = static_cast<uint32_t>(address >> 32);
|
||||
}
|
||||
|
||||
template <typename TypeTrue, typename TypeFalse, bool is32Bits>
|
||||
struct TypeSelector {
|
||||
typedef TypeTrue type;
|
||||
};
|
||||
|
||||
template <typename TypeTrue, typename TypeFalse>
|
||||
struct TypeSelector<TypeTrue, TypeFalse, false> {
|
||||
typedef TypeFalse type;
|
||||
};
|
||||
|
||||
union IAPageTableEntry {
|
||||
struct
|
||||
{
|
||||
|
@ -264,11 +254,11 @@ struct AubPageTableHelper64 : public AubPageTableHelper<Traits>, PageTableTraits
|
|||
};
|
||||
|
||||
template <typename TraitsIn>
|
||||
struct AubDump : public TypeSelector<AubPageTableHelper32<TraitsIn>, AubPageTableHelper64<TraitsIn>, TraitsIn::addressingBits == 32>::type {
|
||||
typedef TraitsIn Traits;
|
||||
typedef typename TypeSelector<uint32_t, uint64_t, Traits::addressingBits == 32>::type AddressType;
|
||||
typedef typename TypeSelector<AubPageTableHelper32<Traits>, AubPageTableHelper64<Traits>, Traits::addressingBits == 32>::type BaseHelper;
|
||||
typedef typename Traits::Stream Stream;
|
||||
struct AubDump : public std::conditional<TraitsIn::addressingBits == 32, AubPageTableHelper32<TraitsIn>, AubPageTableHelper64<TraitsIn>>::type {
|
||||
using Traits = TraitsIn;
|
||||
using AddressType = typename std::conditional<Traits::addressingBits == 32, uint32_t, uint64_t>::type;
|
||||
using BaseHelper = typename std::conditional<Traits::addressingBits == 32, AubPageTableHelper32<Traits>, AubPageTableHelper64<Traits>>::type;
|
||||
using Stream = typename Traits::Stream;
|
||||
|
||||
typedef union _MiContextDescriptorReg_ {
|
||||
struct {
|
||||
|
|
|
@ -92,7 +92,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
|
|||
uint32_t aubDeviceId;
|
||||
bool standalone;
|
||||
|
||||
std::unique_ptr<TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type> ppgtt;
|
||||
std::unique_ptr<std::conditional<is64bit, PML4, PDPE>::type> ppgtt;
|
||||
std::unique_ptr<PDPE> ggtt;
|
||||
// remap CPU VA -> GGTT VA
|
||||
AddressMapper *gttRemap;
|
||||
|
|
|
@ -42,7 +42,7 @@ AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const Hardware
|
|||
auto physicalAddressAllocator = aubCenter->getPhysicalAddressAllocator();
|
||||
UNRECOVERABLE_IF(nullptr == physicalAddressAllocator);
|
||||
|
||||
ppgtt = std::make_unique<TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type>(physicalAddressAllocator);
|
||||
ppgtt = std::make_unique<std::conditional<is64bit, PML4, PDPE>::type>(physicalAddressAllocator);
|
||||
ggtt = std::make_unique<PDPE>(physicalAddressAllocator);
|
||||
|
||||
gttRemap = aubCenter->getAddressMapper();
|
||||
|
|
|
@ -80,7 +80,7 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
|
|||
bool streamInitialized = false;
|
||||
|
||||
std::unique_ptr<PhysicalAddressAllocator> physicalAddressAllocator;
|
||||
std::unique_ptr<TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type> ppgtt;
|
||||
std::unique_ptr<std::conditional<is64bit, PML4, PDPE>::type> ppgtt;
|
||||
std::unique_ptr<PDPE> ggtt;
|
||||
// remap CPU VA -> GGTT VA
|
||||
AddressMapper gttRemap;
|
||||
|
|
|
@ -28,7 +28,7 @@ TbxCommandStreamReceiverHw<GfxFamily>::TbxCommandStreamReceiverHw(const Hardware
|
|||
|
||||
physicalAddressAllocator.reset(this->createPhysicalAddressAllocator());
|
||||
|
||||
ppgtt = std::make_unique<TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type>(physicalAddressAllocator.get());
|
||||
ppgtt = std::make_unique<std::conditional<is64bit, PML4, PDPE>::type>(physicalAddressAllocator.get());
|
||||
ggtt = std::make_unique<PDPE>(physicalAddressAllocator.get());
|
||||
|
||||
for (auto &engineInfo : engineInfoTable) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
#include "runtime/gen_common/aub_mapper_base.h"
|
||||
#include "runtime/memory_manager/memory_constants.h"
|
||||
|
||||
namespace OCLRT {
|
||||
struct CNLFamily;
|
||||
|
@ -15,7 +16,7 @@ template <>
|
|||
struct AUBFamilyMapper<CNLFamily> {
|
||||
enum { device = AubMemDump::DeviceValues::Cnl };
|
||||
|
||||
typedef AubMemDump::Traits<device, GfxAddressBits::value> AubTraits;
|
||||
using AubTraits = AubMemDump::Traits<device, MemoryConstants::GfxAddressBits>;
|
||||
|
||||
static const AubMemDump::LrcaHelper *csTraits[EngineType::NUM_ENGINES];
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
#include "runtime/gen_common/aub_mapper_base.h"
|
||||
#include "runtime/memory_manager/memory_constants.h"
|
||||
|
||||
namespace OCLRT {
|
||||
struct BDWFamily;
|
||||
|
@ -15,7 +16,7 @@ template <>
|
|||
struct AUBFamilyMapper<BDWFamily> {
|
||||
enum { device = AubMemDump::DeviceValues::Bdw };
|
||||
|
||||
typedef AubMemDump::Traits<device, GfxAddressBits::value> AubTraits;
|
||||
using AubTraits = AubMemDump::Traits<device, MemoryConstants::GfxAddressBits>;
|
||||
|
||||
static const AubMemDump::LrcaHelper *csTraits[EngineType::NUM_ENGINES];
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
#include "runtime/gen_common/aub_mapper_base.h"
|
||||
#include "runtime/memory_manager/memory_constants.h"
|
||||
|
||||
namespace OCLRT {
|
||||
struct SKLFamily;
|
||||
|
@ -15,7 +16,7 @@ template <>
|
|||
struct AUBFamilyMapper<SKLFamily> {
|
||||
enum { device = AubMemDump::DeviceValues::Skl };
|
||||
|
||||
typedef AubMemDump::Traits<device, GfxAddressBits::value> AubTraits;
|
||||
using AubTraits = AubMemDump::Traits<device, MemoryConstants::GfxAddressBits>;
|
||||
|
||||
static const AubMemDump::LrcaHelper *csTraits[EngineType::NUM_ENGINES];
|
||||
|
||||
|
|
|
@ -1,29 +1,13 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/aub_mem_dump/aub_mem_dump.h"
|
||||
#include "runtime/helpers/completion_stamp.h"
|
||||
#include "runtime/helpers/selectors.h"
|
||||
#include <vector>
|
||||
|
||||
namespace OCLRT {
|
||||
|
@ -34,4 +18,5 @@ struct AUBFamilyMapper {
|
|||
|
||||
using MMIOPair = std::pair<uint32_t, uint32_t>;
|
||||
using MMIOList = std::vector<MMIOPair>;
|
||||
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -65,7 +65,6 @@ set(RUNTIME_SRCS_HELPERS_BASE
|
|||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/queue_helpers.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/queue_helpers.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sampler_helpers.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/selectors.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/stdio.h
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
template <typename TypeTrue, typename TypeFalse, bool expression>
|
||||
struct TypeSelector {
|
||||
typedef TypeTrue type;
|
||||
};
|
||||
|
||||
template <typename TypeTrue, typename TypeFalse>
|
||||
struct TypeSelector<TypeTrue, TypeFalse, false> {
|
||||
typedef TypeFalse type;
|
||||
};
|
||||
|
||||
template <int valueTrue, int valueFalse, bool expression>
|
||||
struct IntSelector {
|
||||
enum {
|
||||
value = expression ? valueTrue : valueFalse
|
||||
};
|
||||
};
|
||||
|
||||
typedef IntSelector<32, 48, sizeof(void *) == sizeof(char[4])> GfxAddressBits;
|
|
@ -10,6 +10,9 @@
|
|||
#include <cstddef>
|
||||
#include <limits>
|
||||
|
||||
constexpr bool is32bit = (sizeof(void *) == 4);
|
||||
constexpr bool is64bit = (sizeof(void *) == 8);
|
||||
|
||||
namespace MemoryConstants {
|
||||
static const uint64_t zoneHigh = ~(uint64_t)0xFFFFFFFF;
|
||||
static const uint64_t kiloByte = 1024;
|
||||
|
@ -33,7 +36,5 @@ static const uint64_t max32BitAddress = ((1ULL << 32) - 1);
|
|||
static const uint64_t max48BitAddress = ((1ULL << 48) - 1);
|
||||
static const uintptr_t page4kEntryMask = std::numeric_limits<uintptr_t>::max() & ~MemoryConstants::pageMask;
|
||||
static const uintptr_t page64kEntryMask = std::numeric_limits<uintptr_t>::max() & ~MemoryConstants::page64kMask;
|
||||
static const int GfxAddressBits = is64bit ? 48 : 32;
|
||||
} // namespace MemoryConstants
|
||||
|
||||
const bool is32bit = (sizeof(void *) == 4) ? true : false;
|
||||
const bool is64bit = (sizeof(void *) == 8) ? true : false;
|
||||
|
|
|
@ -1589,8 +1589,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
|
|||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
|
||||
PhysicalAddressAllocator allocator;
|
||||
struct PpgttMock : TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type {
|
||||
PpgttMock(PhysicalAddressAllocator *allocator) : TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type(allocator) {}
|
||||
struct PpgttMock : std::conditional<is64bit, PML4, PDPE>::type {
|
||||
PpgttMock(PhysicalAddressAllocator *allocator) : std::conditional<is64bit, PML4, PDPE>::type(allocator) {}
|
||||
|
||||
void pageWalk(uintptr_t vm, size_t size, size_t offset, uint64_t entryBits, PageWalker &pageWalker, uint32_t memoryBank) override {
|
||||
receivedSize = size;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/selectors.h"
|
||||
#include "runtime/memory_manager/address_mapper.h"
|
||||
#include "test.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "runtime/aub_mem_dump/page_table_entry_bits.h"
|
||||
#include "runtime/helpers/ptr_math.h"
|
||||
#include "runtime/helpers/selectors.h"
|
||||
#include "runtime/memory_manager/memory_banks.h"
|
||||
#include "runtime/memory_manager/page_table.h"
|
||||
#include "runtime/memory_manager/page_table.inl"
|
||||
|
@ -75,10 +74,10 @@ class MockPDPE : public MockPageTable<MockPDE, 2, 2> {
|
|||
}
|
||||
};
|
||||
|
||||
class PPGTTPageTable : public TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type {
|
||||
class PPGTTPageTable : public std::conditional<is64bit, PML4, PDPE>::type {
|
||||
public:
|
||||
const size_t ppgttEntries = IntSelector<512u, 4u, sizeof(void *) == 8>::value;
|
||||
PPGTTPageTable(PhysicalAddressAllocator *allocator) : TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type(allocator) {
|
||||
const size_t ppgttEntries = is64bit ? 512u : 4u;
|
||||
PPGTTPageTable(PhysicalAddressAllocator *allocator) : std::conditional<is64bit, PML4, PDPE>::type(allocator) {
|
||||
EXPECT_EQ(ppgttEntries, entries.size());
|
||||
}
|
||||
bool isEmpty() {
|
||||
|
@ -105,7 +104,7 @@ class GGTTPageTable : public PDPE {
|
|||
class PageTableFixture {
|
||||
protected:
|
||||
const size_t pageSize = 1 << 12;
|
||||
const uintptr_t refAddr = (uintptr_t(1) << IntSelector<46, 31, is64Bit>::value);
|
||||
const uintptr_t refAddr = uintptr_t(1) << (is64Bit ? 46 : 31);
|
||||
MockPhysicalAddressAllocator allocator;
|
||||
uint64_t startAddress = 0x1000;
|
||||
|
||||
|
@ -248,8 +247,8 @@ TEST_F(PageTableTests48, givenBigGpuAddressWhenPageWalkIsCalledThenPageTablesAre
|
|||
}
|
||||
|
||||
TEST_F(PageTableTests48, givenZeroEntryBitsWhenPageWalkIsCalledThenPageTableEntryHasPresentBitSet) {
|
||||
std::unique_ptr<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>
|
||||
pageTable(std::make_unique<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(&allocator));
|
||||
std::unique_ptr<std::conditional<is64bit, MockPML4, MockPDPE>::type>
|
||||
pageTable(std::make_unique<std::conditional<is64bit, MockPML4, MockPDPE>::type>(&allocator));
|
||||
|
||||
uintptr_t gpuVa = 0x1000;
|
||||
|
||||
|
@ -266,12 +265,12 @@ TEST_F(PageTableTests48, givenZeroEntryBitsWhenPageWalkIsCalledThenPageTableEntr
|
|||
EXPECT_EQ(size, walked);
|
||||
ASSERT_NE(nullptr, pageTable->entries[0]);
|
||||
|
||||
PageTableEntryChecker::testEntry<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | 0x1));
|
||||
PageTableEntryChecker::testEntry<std::conditional<is64bit, MockPML4, MockPDPE>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | 0x1));
|
||||
}
|
||||
|
||||
TEST_F(PageTableTests48, givenZeroEntryBitsWhenMapIsCalledThenPageTableEntryHasPresentBitSet) {
|
||||
std::unique_ptr<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>
|
||||
pageTable(std::make_unique<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(&allocator));
|
||||
std::unique_ptr<std::conditional<is64bit, MockPML4, MockPDPE>::type>
|
||||
pageTable(std::make_unique<std::conditional<is64bit, MockPML4, MockPDPE>::type>(&allocator));
|
||||
uintptr_t gpuVa = 0x1000;
|
||||
size_t size = pageSize;
|
||||
auto address = allocator.mainAllocator.load();
|
||||
|
@ -279,12 +278,12 @@ TEST_F(PageTableTests48, givenZeroEntryBitsWhenMapIsCalledThenPageTableEntryHasP
|
|||
pageTable->map(gpuVa, size, 0, MemoryBanks::MainBank);
|
||||
ASSERT_NE(nullptr, pageTable->entries[0]);
|
||||
|
||||
PageTableEntryChecker::testEntry<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | 0x1));
|
||||
PageTableEntryChecker::testEntry<std::conditional<is64bit, MockPML4, MockPDPE>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | 0x1));
|
||||
}
|
||||
|
||||
TEST_F(PageTableTests48, givenEntryBitsWhenPageWalkIsCalledThenEntryBitsArePassedToPageWalker) {
|
||||
std::unique_ptr<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>
|
||||
pageTable(std::make_unique<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(&allocator));
|
||||
std::unique_ptr<std::conditional<is64bit, MockPML4, MockPDPE>::type>
|
||||
pageTable(std::make_unique<std::conditional<is64bit, MockPML4, MockPDPE>::type>(&allocator));
|
||||
|
||||
uintptr_t gpuVa = 0x1000;
|
||||
size_t size = pageSize;
|
||||
|
@ -303,8 +302,8 @@ TEST_F(PageTableTests48, givenEntryBitsWhenPageWalkIsCalledThenEntryBitsArePasse
|
|||
}
|
||||
|
||||
TEST_F(PageTableTests48, givenTwoPageWalksWhenSecondWalkHasDifferentEntryBitsThenEntryIsUpdated) {
|
||||
std::unique_ptr<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>
|
||||
pageTable(std::make_unique<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(&allocator));
|
||||
std::unique_ptr<std::conditional<is64bit, MockPML4, MockPDPE>::type>
|
||||
pageTable(std::make_unique<std::conditional<is64bit, MockPML4, MockPDPE>::type>(&allocator));
|
||||
|
||||
uintptr_t gpuVa = 0x1000;
|
||||
size_t size = pageSize;
|
||||
|
@ -328,8 +327,8 @@ TEST_F(PageTableTests48, givenTwoPageWalksWhenSecondWalkHasDifferentEntryBitsThe
|
|||
}
|
||||
|
||||
TEST_F(PageTableTests48, givenTwoPageWalksWhenSecondWalkHasNonValidEntryBitsThenEntryIsNotUpdated) {
|
||||
std::unique_ptr<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>
|
||||
pageTable(std::make_unique<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(&allocator));
|
||||
std::unique_ptr<std::conditional<is64bit, MockPML4, MockPDPE>::type>
|
||||
pageTable(std::make_unique<std::conditional<is64bit, MockPML4, MockPDPE>::type>(&allocator));
|
||||
|
||||
uintptr_t gpuVa = 0x1000;
|
||||
size_t size = pageSize;
|
||||
|
@ -357,8 +356,8 @@ TEST_F(PageTableTests48, givenTwoPageWalksWhenSecondWalkHasNonValidEntryBitsThen
|
|||
}
|
||||
|
||||
TEST_F(PageTableTests48, givenTwoMapsWhenSecondMapHasDifferentEntryBitsThenEntryIsUpdated) {
|
||||
std::unique_ptr<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>
|
||||
pageTable(std::make_unique<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(&allocator));
|
||||
std::unique_ptr<std::conditional<is64bit, MockPML4, MockPDPE>::type>
|
||||
pageTable(std::make_unique<std::conditional<is64bit, MockPML4, MockPDPE>::type>(&allocator));
|
||||
uintptr_t gpuVa = 0x1000;
|
||||
size_t size = pageSize;
|
||||
uint64_t ppgttBits = 0xabc;
|
||||
|
@ -366,16 +365,16 @@ TEST_F(PageTableTests48, givenTwoMapsWhenSecondMapHasDifferentEntryBitsThenEntry
|
|||
|
||||
pageTable->map(gpuVa, size, ppgttBits, 0);
|
||||
ASSERT_NE(nullptr, pageTable->entries[0]);
|
||||
PageTableEntryChecker::testEntry<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | ppgttBits | 0x1));
|
||||
PageTableEntryChecker::testEntry<std::conditional<is64bit, MockPML4, MockPDPE>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | ppgttBits | 0x1));
|
||||
|
||||
ppgttBits = 0x345;
|
||||
pageTable->map(gpuVa, size, ppgttBits, 0);
|
||||
PageTableEntryChecker::testEntry<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | ppgttBits | 0x1));
|
||||
PageTableEntryChecker::testEntry<std::conditional<is64bit, MockPML4, MockPDPE>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | ppgttBits | 0x1));
|
||||
}
|
||||
|
||||
TEST_F(PageTableTests48, givenTwoMapsWhenSecondMapHasNonValidEntryBitsThenEntryIsNotUpdated) {
|
||||
std::unique_ptr<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>
|
||||
pageTable(std::make_unique<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(&allocator));
|
||||
std::unique_ptr<std::conditional<is64bit, MockPML4, MockPDPE>::type>
|
||||
pageTable(std::make_unique<std::conditional<is64bit, MockPML4, MockPDPE>::type>(&allocator));
|
||||
uintptr_t gpuVa = 0x1000;
|
||||
size_t size = pageSize;
|
||||
uint64_t ppgttBits = 0xabc;
|
||||
|
@ -384,12 +383,12 @@ TEST_F(PageTableTests48, givenTwoMapsWhenSecondMapHasNonValidEntryBitsThenEntryI
|
|||
pageTable->map(gpuVa, size, ppgttBits, 0);
|
||||
ASSERT_NE(nullptr, pageTable->entries[0]);
|
||||
|
||||
PageTableEntryChecker::testEntry<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | ppgttBits | 0x1));
|
||||
PageTableEntryChecker::testEntry<std::conditional<is64bit, MockPML4, MockPDPE>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | ppgttBits | 0x1));
|
||||
|
||||
uint64_t nonValidPpgttBits = PageTableEntry::nonValidBits;
|
||||
pageTable->map(gpuVa, size, nonValidPpgttBits, 0);
|
||||
|
||||
PageTableEntryChecker::testEntry<TypeSelector<MockPML4, MockPDPE, sizeof(void *) == 8>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | ppgttBits | 0x1));
|
||||
PageTableEntryChecker::testEntry<std::conditional<is64bit, MockPML4, MockPDPE>::type>(pageTable.get(), 1, static_cast<uintptr_t>(address | ppgttBits | 0x1));
|
||||
}
|
||||
|
||||
TEST_F(PageTableTests48, givenPageTableWhenMappingTheSameAddressMultipleTimesThenNumberOfPagesReservedInAllocatorMatchPagesMapped) {
|
||||
|
|
Loading…
Reference in New Issue