535.86.05

This commit is contained in:
Bernhard Stoeckner
2023-07-18 15:54:53 +02:00
parent 22a077c4fe
commit 337e28efda
264 changed files with 67251 additions and 107479 deletions

View File

@@ -24,13 +24,19 @@
#ifndef _CE_UTILS_SIZES_H
#define _CE_UTILS_SIZES_H
#define NUM_COPY_BLOCKS 4096
#define CHANNEL_HOST_SEMAPHORE_SIZE 4
#define CHANNEL_ENGINE_SEMAPHORE_SIZE 4
#define GPFIFO_SIZE NV906F_GP_ENTRY__SIZE * NUM_COPY_BLOCKS
#define CHANNEL_NOTIFIER_SIZE (sizeof(NvNotification) * \
NV_CHANNELGPFIFO_NOTIFICATION_TYPE__SIZE_1)
#define CE_MAX_BYTES_PER_LINE 0xffffffffULL
#define CE_NUM_COPY_BLOCKS 4096
#define CE_CHANNEL_SEMAPHORE_SIZE 8
#define CE_GPFIFO_SIZE NV906F_GP_ENTRY__SIZE * CE_NUM_COPY_BLOCKS
#define CE_CHANNEL_NOTIFIER_SIZE (sizeof(NvNotification) * \
NV_CHANNELGPFIFO_NOTIFICATION_TYPE__SIZE_1)
#define CE_METHOD_SIZE_PER_BLOCK 0x64
#define FAST_SCRUBBER_METHOD_SIZE_PER_BLOCK 0x78
// number of bytes per sec2 method-stream (including host methods)
#define SEC2_METHOD_SIZE_PER_BLOCK 0x94
#define SEC2_AUTH_TAG_BUF_SEMAPHORE_SIZE 4
#endif // _CE_UTILS_SIZES_H

View File

@@ -49,6 +49,8 @@
#include "class/clc86f.h" // HOPPER_CHANNEL_GPFIFO_A
#include "gpu/conf_compute/ccsl.h"
#include "nvctassert.h"
#include "vgpu/vgpu_guest_pma_scrubber.h"
@@ -137,13 +139,21 @@ NvU32 channelReadChannelMemdesc(OBJCHANNEL *pChannel, NvU32 offset);
// Needed for pushbuffer management
NV_STATUS channelWaitForFreeEntry(OBJCHANNEL *pChannel, NvU32 *pPutIndex);
NV_STATUS channelFillGpFifo(OBJCHANNEL *pChannel, NvU32 putIndex, NvU32 methodsLength);
NvU32 channelFillPb(OBJCHANNEL *pChannel, NvU32 putIndex, NvBool bPipelined,
NvBool bInsertFinishPayload, CHANNEL_PB_INFO *pChannelPbInfo);
NvU32 channelFillCePb(OBJCHANNEL *pChannel, NvU32 putIndex, NvBool bPipelined,
NvBool bInsertFinishPayload, CHANNEL_PB_INFO *pChannelPbInfo);
NvU32 channelFillPbFastScrub(OBJCHANNEL *pChannel, NvU32 putIndex, NvBool bPipelined,
NvBool bInsertFinishPayload, CHANNEL_PB_INFO *pChannelPbInfo);
NV_STATUS channelFillSec2Pb(OBJCHANNEL *pChannel, NvU32 putIndex, NvBool bInsertFinishPayload,
CHANNEL_PB_INFO *pChannelPbInfo, CCSL_CONTEXT *pCcslCtx,
MEMORY_DESCRIPTOR *pScrubMemDesc, MEMORY_DESCRIPTOR *pSemaMemDesc,
NvU64 scrubMthdAuthTagBufGpuVA, NvU32 scrubAuthTagBufIndex,
NvU64 semaMthdAuthTagBufGpuVA, NvU32 semaAuthTagBufIndex, NvU32* methodLength);
// Needed for work tracking
NV_STATUS channelWaitForFinishPayload(OBJCHANNEL *pChannel, NvU64 targetPayload);
NvU64 channelGetFinishPayload(OBJCHANNEL *pChannel);
void channelServiceScrubberInterrupts(OBJCHANNEL *pChannel);
#endif // _CHANNEL_UTILS_H_

View File

@@ -36,6 +36,7 @@
#include "vgpu/vgpu_guest_pma_scrubber.h"
#if !defined(SRT_BUILD)
#include "gpu/mem_mgr/ce_utils.h"
#include "gpu/mem_mgr/sec2_utils.h"
#endif
struct OBJGPU;
@@ -88,7 +89,13 @@ typedef struct OBJMEMSCRUB {
#if !defined(SRT_BUILD)
// Scrubber uses ceUtils to manage CE channel
CeUtils *pCeUtils;
#endif
// Scrubber uses sec2Utils to manage SEC2 channel
Sec2Utils *pSec2Utils;
#endif // !defined(SRT_BUILD)
// Engine used for scrubbing
NvU32 engineType;
struct OBJGPU *pGpu;
VGPU_GUEST_PMA_SCRUB_BUFFER_RING vgpuScrubBuffRing;
NvBool bVgpuScrubberEnabled;

View File

@@ -0,0 +1,112 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "g_sec2_utils_nvoc.h"
#ifndef SEC2_UTILS_H
#define SEC2_UTILS_H
#include "gpu/gpu_resource.h" // GpuResource
#include "kernel/gpu/mem_mgr/channel_utils.h"
#include "kernel/gpu/conf_compute/ccsl_context.h"
#define SEC2_AUTH_TAG_BUF_SIZE_BYTES (16)
#define SHA_256_HASH_SIZE_BYTES (32)
typedef struct
{
MEMORY_DESCRIPTOR *pMemDesc;
NvU64 offset;
NvU64 length;
NvU64 submittedWorkId;
} SEC2UTILS_MEMSET_PARAMS;
typedef struct
{
NvHandle hPhysMem;
NvHandle hVirtMem;
NvHandle hVASpace;
NvU64 gpuVA;
NvU64 size;
MEMORY_DESCRIPTOR *pMemDesc;
} SEC2UTILS_BUFFER_INFO;
NVOC_PREFIX(sec2utils) class Sec2Utils : Object
{
public:
NV_STATUS sec2utilsConstruct(Sec2Utils *psec2utils, OBJGPU *pGpu, KERNEL_MIG_GPU_INSTANCE *pKernelMIGGPUInstance);
void sec2utilsDestruct(Sec2Utils *psec2utils);
NV_STATUS sec2utilsMemset(Sec2Utils *psec2utils, SEC2UTILS_MEMSET_PARAMS *pParams);
NvU64 sec2utilsUpdateProgress(Sec2Utils *psec2utils);
void sec2utilsServiceInterrupts(Sec2Utils *psec2utils);
//
// Internal states
//
NvHandle hClient;
NvHandle hDevice;
NvHandle hSubdevice;
OBJCHANNEL *pChannel;
OBJGPU *pGpu;
NvU32 sec2Class;
NvU64 lastSubmittedPayload;
NvU64 lastCompletedPayload;
CCSL_CONTEXT *pCcslCtx;
//
// 4K page consisting of 128 auth tag buffers.
// One buffer is used per sec2 method stream.
// RM scrubber can submit multiple scrub method streams per sec2 operation.
//
SEC2UTILS_BUFFER_INFO scrubMthdAuthTagBuf;
//
// 4K page consisting of 128 auth tag buffers.
// One buffer is used per scrubber operation (not per sec2 scrub method stream).
// One scrub op corresponds to one call to sec2UtilsMemSet
//
SEC2UTILS_BUFFER_INFO semaMthdAuthTagBuf;
//
// Updated by RM to point to current auth tag buffer index (0-127)
// so its incremented for every scrub method stream.
//
NvU32 authTagPutIndex;
//
// Updated by SEC2 engine to point to last used/ last "seen" auth tag buffer index.
// This is updated based on completion of every scrub method stream.
//
NvU32 authTagGetIndex;
};
#endif // SEC2_UTILS_H