mirror of
https://github.com/NVIDIA/open-gpu-kernel-modules.git
synced 2026-02-21 23:43:59 +00:00
525.53
This commit is contained in:
@@ -110,8 +110,6 @@ typedef struct
|
||||
// Attempt acquire even if it potentially violates the locking order
|
||||
// But do not block in a way that could cause a deadlock
|
||||
#define GPU_LOCK_FLAGS_SAFE_LOCK_UPGRADE NVBIT(2)
|
||||
// Old name alias
|
||||
#define GPUS_LOCK_FLAGS_COND_ACQUIRE GPU_LOCK_FLAGS_COND_ACQUIRE
|
||||
|
||||
//
|
||||
// RM Lock Related Functions
|
||||
@@ -189,17 +187,9 @@ void rmIntrMaskLockRelease(OBJGPU *pGpu, NvU64 oldIrql);
|
||||
#define rmInitLockMetering()
|
||||
#define rmDestroyLockMetering()
|
||||
|
||||
//
|
||||
// RM API lock definitions are handled by the rmapi module. Providing legacy
|
||||
// rmApiLockXxx interface for temporary compatibility. CORERM-1370
|
||||
//
|
||||
#include "rmapi/rmapi.h"
|
||||
|
||||
#define API_LOCK_FLAGS_NONE RMAPI_LOCK_FLAGS_NONE
|
||||
#define API_LOCK_FLAGS_COND_ACQUIRE RMAPI_LOCK_FLAGS_COND_ACQUIRE
|
||||
|
||||
#define rmApiLockAcquire(flags, module) (rmapiLockAcquire(flags, module))
|
||||
static NV_INLINE NV_STATUS rmApiLockRelease(void) {rmapiLockRelease(); return NV_OK;}
|
||||
#define rmApiLockIsOwner() (rmapiLockIsOwner())
|
||||
|
||||
#endif // LOCKS_H
|
||||
|
||||
@@ -33,14 +33,19 @@
|
||||
/*!
|
||||
* @brief Obtain relative CE index.
|
||||
*
|
||||
* @param localEngType NV2080_ENGINE_TYPE_ for this CE, or partition-local engine type.
|
||||
* @param rmEngineType RM_ENGINE_TYPE_ for this CE, or partition-local engine type.
|
||||
* @param ceIdx CE index in 0..GPU_MAX_CES-1
|
||||
*
|
||||
* @return NV_OK if the conversion is successful.
|
||||
*/
|
||||
static NV_INLINE
|
||||
NV_STATUS ceIndexFromType(OBJGPU *pGpu, NvHandle hClient, NvU32 localEngType, NvU32 *ceIdx)
|
||||
NV_STATUS ceIndexFromType(OBJGPU *pGpu, NvHandle hClient, RM_ENGINE_TYPE rmEngineType, NvU32 *ceIdx)
|
||||
{
|
||||
NV_STATUS status = NV_OK;
|
||||
RM_ENGINE_TYPE localRmEngType = rmEngineType;
|
||||
|
||||
*ceIdx = GPU_MAX_CES;
|
||||
|
||||
//
|
||||
// If MIG is enabled, client passes a logical engineId w.r.t its own partition
|
||||
// we need to convert this logical Id to a physical engine Id as we use it
|
||||
@@ -51,29 +56,24 @@ NV_STATUS ceIndexFromType(OBJGPU *pGpu, NvHandle hClient, NvU32 localEngType, Nv
|
||||
KernelMIGManager *pKernelMIGManager = GPU_GET_KERNEL_MIG_MANAGER(pGpu);
|
||||
MIG_INSTANCE_REF ref;
|
||||
|
||||
NV_CHECK_OK_OR_RETURN(
|
||||
LEVEL_ERROR,
|
||||
kmigmgrGetInstanceRefFromClient(pGpu, pKernelMIGManager,
|
||||
hClient, &ref));
|
||||
status = kmigmgrGetInstanceRefFromClient(pGpu, pKernelMIGManager, hClient, &ref);
|
||||
|
||||
NV_CHECK_OK_OR_RETURN(
|
||||
LEVEL_ERROR,
|
||||
kmigmgrGetLocalToGlobalEngineType(pGpu, pKernelMIGManager, ref,
|
||||
localEngType,
|
||||
ceIdx));
|
||||
}
|
||||
else
|
||||
{
|
||||
*ceIdx = localEngType;
|
||||
if (status != NV_OK)
|
||||
return status;
|
||||
|
||||
status = kmigmgrGetLocalToGlobalEngineType(pGpu, pKernelMIGManager, ref, rmEngineType, &localRmEngType);
|
||||
|
||||
if (status != NV_OK)
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!NV2080_ENGINE_TYPE_IS_COPY(*ceIdx))
|
||||
if (!RM_ENGINE_TYPE_IS_COPY(localRmEngType))
|
||||
{
|
||||
return NV_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
*ceIdx = NV2080_ENGINE_TYPE_COPY_IDX(*ceIdx);
|
||||
return NV_OK;
|
||||
*ceIdx = RM_ENGINE_TYPE_COPY_IDX(localRmEngType);
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif // KERNEL_CE_PRIVATE_H
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
* Defines display type enums that can be used in the KernelDisplay object.
|
||||
*
|
||||
******************************************************************************/
|
||||
#define NV_PDISP_CHN_NUM_ANY 0x7F
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -39,6 +40,7 @@ typedef enum
|
||||
dispChnClass_Ovly,
|
||||
dispChnClass_Winim,
|
||||
dispChnClass_Win,
|
||||
dispChnClass_Any,
|
||||
dispChnClass_Supported
|
||||
} DISPCHNCLASS;
|
||||
|
||||
@@ -49,4 +51,18 @@ enum DISPLAY_ICC_BW_CLIENT
|
||||
NUM_DISPLAY_ICC_BW_CLIENTS
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
dispMemoryTarget_physNVM,
|
||||
dispMemoryTarget_physPCI,
|
||||
dispMemoryTarget_physPCICoherent
|
||||
} DISPMEMORYTARGET;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
NvU64 addr;
|
||||
DISPMEMORYTARGET memTarget;
|
||||
NvBool valid;
|
||||
} VGAADDRDESC;
|
||||
|
||||
#endif // #ifndef KERN_DISP_TYPE_H
|
||||
|
||||
243
src/nvidia/inc/kernel/gpu/external_device/dac_p2060.h
Normal file
243
src/nvidia/inc/kernel/gpu/external_device/dac_p2060.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef DAC_P2060_H
|
||||
#define DAC_P2060_H
|
||||
|
||||
/* ------------------------ Includes --------------------------------------- */
|
||||
#include "gpu/external_device/external_device.h" // DACEXTERNALDEVICE
|
||||
#include "gpu/external_device/gsync.h" // GSYNCVIDEOMODE, GSYNCSYNCPOLARITY
|
||||
#include "gpu/disp/kern_disp_max.h"
|
||||
|
||||
/* ------------------------ Macros & Defines ------------------------------- */
|
||||
|
||||
// Display synchronization interface. (Framelock, Genlock, Swapready, etc)
|
||||
#define NV_P2060_MAX_ASSOCIATED_GPUS 4
|
||||
#define NV_P2060_MAX_IFACES_PER_GSYNC 4
|
||||
#define NV_P2060_MAX_GPUS_PER_IFACE 1
|
||||
#define NV_P2060_MAX_HEADS_PER_GPU 4
|
||||
#define NV_P2060_MAX_MOSAIC_SLAVES 3
|
||||
#define NV_P2060_MAX_MOSAIC_GROUPS 2
|
||||
|
||||
#define NV_P2060_IFACE_ONE 0
|
||||
#define NV_P2060_IFACE_TWO 1
|
||||
#define NV_P2060_IFACE_THREE 2
|
||||
#define NV_P2060_IFACE_FOUR 3
|
||||
|
||||
#define NV_P2060_SYNC_SKEW_MAX_UNITS_FULL_SUPPORT 65535 // For FPGA with Rev >= 3. Refer Bug 1058215
|
||||
#define NV_P2060_SYNC_SKEW_MAX_UNITS_LIMITED_SUPPORT 1 // For FPGA with Rev < 3.
|
||||
#define NV_P2060_SYNC_SKEW_RESOLUTION 977
|
||||
#define NV_P2060_START_DELAY_MAX_UNITS 65535
|
||||
#define NV_P2060_START_DELAY_RESOLUTION 7800
|
||||
#define NV_P2060_SYNC_INTERVAL_MAX_UNITS 7
|
||||
|
||||
#define NV_P2060_WATCHDOG_COUNT_DOWN_VALUE 60 // 1 minute, assuming watchdog time interval is 1 second.
|
||||
#define NV_P2060_FRAME_COUNT_TIMER_INTERVAL 5000000000LL // 5 sec
|
||||
|
||||
#define NV_P2060_MAX_GPU_FRAME_COUNT 65535
|
||||
#define NV_P2060_MAX_GSYNC_FRAME_COUNT 16777215 // 2^24.Gsync frame count is a 24 bit register
|
||||
/* ------------------------ Types definitions ------------------------------ */
|
||||
|
||||
typedef struct EXTDEV_I2C_HANDLES
|
||||
{
|
||||
//Internal handles per GPU
|
||||
|
||||
NvHandle hClient;
|
||||
NvHandle hDevice;
|
||||
NvHandle hSubdevice;
|
||||
NvHandle hSubscription;
|
||||
NvU32 gpuId;
|
||||
} EXTDEV_I2C_HANDLES;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
NvU8 lossRegStatus;
|
||||
NvU8 gainRegStatus;
|
||||
NvU8 miscRegStatus;
|
||||
DACEXTERNALDEVICE *pExtDevice;
|
||||
}EXTDEV_INTR_DATA;
|
||||
|
||||
// note: NV_P2060_MAX_ASSOCIATED_GPUS = NV_P2060_MAX_IFACES_PER_GSYNC * NV_P2060_MAX_GPUS_PER_IFACE
|
||||
|
||||
struct DACP2060EXTERNALDEVICE
|
||||
{
|
||||
//Must be at top of struct
|
||||
DACEXTERNALDEVICE ExternalDevice;
|
||||
|
||||
// Stuff for supporting the DisplaySync interface
|
||||
NvU32 AssociatedCRTCs; // bit mask of crtcs ids associated.
|
||||
GSYNCVIDEOMODE VideoMode;
|
||||
GSYNCSYNCPOLARITY SyncPolarity;
|
||||
NvU32 SyncStartDelay;
|
||||
NvU32 SyncSkew;
|
||||
NvU32 NSync;
|
||||
NvU32 HouseSignal;
|
||||
NvU32 UseHouseSync;
|
||||
NvU32 Master;
|
||||
NvU32 Slaves;
|
||||
NvU32 EmitTestSignal;
|
||||
NvU32 InterlaceMode;
|
||||
NvU32 RefreshRate; // desired frame rate (units of .01Hz)
|
||||
NvU32 DebugMask;
|
||||
NvU32 gpuAttachMask;
|
||||
NvU32 id;
|
||||
NvU32 watchdogCountDownValue;
|
||||
NvBool isNonFramelockInterruptEnabled;
|
||||
NvU32 interruptEnabledInterface;
|
||||
NvU32 tSwapRdyHi; /* Value of SWAP_LOCKOUT_START in accordance to the
|
||||
* time in microseconds for which swap Rdy
|
||||
* lines will remain high.(Provided via a regkey)
|
||||
*/
|
||||
NvU32 tSwapRdyHiLsrMinTime; /* Value of LSR_MIN_TIME in accordance to the time (in us)
|
||||
* swap ready line will remain high.(Provided via a regkey)
|
||||
*/
|
||||
|
||||
struct {
|
||||
NvU32 currentFrameCount; // gpu frame count register value for current user query
|
||||
NvU32 previousFrameCount; // gpu frame count register value for previous user query
|
||||
NvU32 totalFrameCount; // equals to cached gsync frame count = gpu frame count + difference.
|
||||
NvU32 numberOfRollbacks; // Max value of N where (Gsync Frame Count > N * Gpu frame count)
|
||||
NvU32 frameTime; // Time to render one frame.
|
||||
NvU64 lastFrameCounterQueryTime;
|
||||
NvS32 initialDifference; // Difference between Gsync frame count and (numberOfRollbacks * Gpu framecount)
|
||||
NvU32 iface;
|
||||
NvU32 head;
|
||||
NvU32 vActive; // Vertical Resolution for which system is framelocked.
|
||||
NvBool bReCheck; // Enabled to verify initialDifference 1 sec after initialization.
|
||||
NvBool enableFrmCmpMatchIntSlave; // Enable the frmCmpMatchInt for slave, if this bit is set.
|
||||
NvBool isFrmCmpMatchIntMasterEnabled; // To enable frmCmpMatchInt for master when gsync framecount exceeds (2^24 - 1000)
|
||||
} FrameCountData;
|
||||
|
||||
struct {
|
||||
NvU32 Status1;
|
||||
NvU64 lastSyncCheckTime;
|
||||
NvU64 lastStereoToggleTime;
|
||||
} Snapshot[NV_P2060_MAX_IFACES_PER_GSYNC];
|
||||
|
||||
// These arrays refer to the state of heads with respect to their sync
|
||||
// source, and their usage can be kind of confusing. This table
|
||||
// describes how they should be set/used:
|
||||
//
|
||||
// Head[i] --> Is Head[i] the frame lock master, or a slave
|
||||
// SyncSrc --> Where is the sync timing actually coming from (the
|
||||
// master head or a house sync signal)
|
||||
|
||||
//
|
||||
// Head[i] SyncSrc PM[i] PS[i] PSLS[i]
|
||||
// -----------------------------------------+---------------------
|
||||
// Master Head[i] 1 0 0
|
||||
// Master House 1 1 0
|
||||
// Slave Head[!i] 0 0 1
|
||||
// Slave House 0 1 0
|
||||
// Slave External 0 1 0
|
||||
// Neither X 0 0 0
|
||||
//
|
||||
// (the last row represents the case where the head has not been
|
||||
// requested to lock).
|
||||
|
||||
struct {
|
||||
struct {
|
||||
NvU32 Master [OBJ_MAX_HEADS];
|
||||
NvU32 Slaved [OBJ_MAX_HEADS];
|
||||
NvU32 LocalSlave[OBJ_MAX_HEADS];
|
||||
} Sync;
|
||||
|
||||
struct {
|
||||
NvU32 gpuId;
|
||||
NvBool connected;
|
||||
} GpuInfo;
|
||||
|
||||
struct {
|
||||
NvU32 OrigLsrMinTime[OBJ_MAX_HEADS];
|
||||
NvBool saved;
|
||||
} DsiFliplock;
|
||||
|
||||
struct {
|
||||
NvU32 direction;
|
||||
NvU32 mode;
|
||||
NvBool saved;
|
||||
} RasterSyncGpio;
|
||||
|
||||
NvBool SwapReadyRequested;
|
||||
NvBool skipSwapBarrierWar;
|
||||
|
||||
NvU32 lastEventNotified;
|
||||
NvU32 gainedSync; // Set when we gain sync after enabling framelock.
|
||||
|
||||
} Iface[NV_P2060_MAX_IFACES_PER_GSYNC];
|
||||
|
||||
EXTDEV_I2C_HANDLES i2cHandles[NV_P2060_MAX_IFACES_PER_GSYNC];
|
||||
|
||||
struct {
|
||||
NvU32 gpuTimingSource;
|
||||
NvU32 gpuTimingSlaves[NV_P2060_MAX_MOSAIC_SLAVES];
|
||||
NvU32 slaveGpuCount;
|
||||
NvBool enabledMosaic;
|
||||
} MosaicGroup[NV_P2060_MAX_MOSAIC_GROUPS];
|
||||
};
|
||||
|
||||
PDACEXTERNALDEVICE extdevConstruct_P2060 (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
NvBool gsyncAttachExternalDevice_P2060 (OBJGPU *, PDACEXTERNALDEVICE*);
|
||||
void extdevDestroy_P2060 (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
NvBool extdevGetDevice_P2060 (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
NvBool extdevInit_P2060 (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
void extdevDestroy_P2060 (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
void extdevService_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU8, NvU8, NvU8, NvBool);
|
||||
NV_STATUS extdevWatchdog_P2060 (OBJGPU *, OBJTMR *, PDACEXTERNALDEVICE); // OBJTMR routine signature (TIMERPROC).
|
||||
NvBool extdevSaveI2cHandles_P2060 (OBJGPU *, DACEXTERNALDEVICE *);
|
||||
NV_STATUS gsyncFindGpuHandleLocation (DACEXTERNALDEVICE *, NvU32 , NvU32 *);
|
||||
|
||||
// P2060 hal ifaces
|
||||
|
||||
NvBool gsyncGpuCanBeMaster_P2060 (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
NV_STATUS gsyncGetSyncPolarity_P2060 (OBJGPU *, PDACEXTERNALDEVICE, GSYNCSYNCPOLARITY *);
|
||||
NV_STATUS gsyncSetSyncPolarity_P2060 (OBJGPU *, PDACEXTERNALDEVICE, GSYNCSYNCPOLARITY);
|
||||
NV_STATUS gsyncGetVideoMode_P2060 (OBJGPU *, PDACEXTERNALDEVICE, GSYNCVIDEOMODE *);
|
||||
NV_STATUS gsyncSetVideoMode_P2060 (OBJGPU *, PDACEXTERNALDEVICE, GSYNCVIDEOMODE);
|
||||
NV_STATUS gsyncGetNSync_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32 *);
|
||||
NV_STATUS gsyncSetNSync_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32);
|
||||
NV_STATUS gsyncGetSyncSkew_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32 *);
|
||||
NV_STATUS gsyncSetSyncSkew_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32);
|
||||
NV_STATUS gsyncGetUseHouse_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32 *);
|
||||
NV_STATUS gsyncSetUseHouse_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32);
|
||||
NV_STATUS gsyncGetSyncStartDelay_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32 *);
|
||||
NV_STATUS gsyncSetSyncStartDelay_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32);
|
||||
NV_STATUS gsyncRefSignal_P2060 (OBJGPU *, PDACEXTERNALDEVICE, REFTYPE, GSYNCSYNCSIGNAL, NvBool bRate, NvU32 *);
|
||||
NV_STATUS gsyncRefMaster_P2060 (OBJGPU *, PDACEXTERNALDEVICE, REFTYPE, NvU32 *DisplayMask, NvU32 *Refresh, NvBool retainMaster, NvBool skipSwapBarrierWar);
|
||||
NV_STATUS gsyncRefSlaves_P2060 (OBJGPU *, PDACEXTERNALDEVICE, REFTYPE, NvU32 *DisplayMask_s, NvU32 *Refresh);
|
||||
NV_STATUS gsyncGetCplStatus_P2060 (OBJGPU *, PDACEXTERNALDEVICE, GSYNCSTATUS, NvU32 *);
|
||||
NV_STATUS gsyncGetEmitTestSignal_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32 *);
|
||||
NV_STATUS gsyncSetEmitTestSignal_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32);
|
||||
NV_STATUS gsyncGetInterlaceMode_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32 *);
|
||||
NV_STATUS gsyncSetInterlaceMode_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32);
|
||||
NV_STATUS gsyncRefSwapBarrier_P2060 (OBJGPU *, PDACEXTERNALDEVICE, REFTYPE, NvBool *);
|
||||
NV_STATUS gsyncGetWatchdog_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32 *);
|
||||
NV_STATUS gsyncSetWatchdog_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32);
|
||||
NV_STATUS gsyncGetRevision_P2060 (OBJGPU *, PDACEXTERNALDEVICE, GSYNCCAPSPARAMS *);
|
||||
NV_STATUS gsyncOptimizeTimingParameters_P2060(OBJGPU *, GSYNCTIMINGPARAMS *);
|
||||
NV_STATUS gsyncGetStereoLockMode_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32 *);
|
||||
NV_STATUS gsyncSetStereoLockMode_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32);
|
||||
NV_STATUS gsyncSetMosaic_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NV30F1_CTRL_GSYNC_SET_LOCAL_SYNC_PARAMS *);
|
||||
NV_STATUS gsyncConfigFlashGsync_P2060 (OBJGPU *, PDACEXTERNALDEVICE, NvU32);
|
||||
|
||||
#endif
|
||||
35
src/nvidia/inc/kernel/gpu/external_device/dac_p2061.h
Normal file
35
src/nvidia/inc/kernel/gpu/external_device/dac_p2061.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef DAC_P2061_H
|
||||
#define DAC_P2061_H
|
||||
|
||||
/* ------------------------ Macros & Defines ------------------------------- */
|
||||
// P2061 uses P2060's object.
|
||||
|
||||
// P2061 hal ifaces
|
||||
NV_STATUS gsyncGetHouseSyncMode_P2061 (OBJGPU *, PDACEXTERNALDEVICE, NvU8*);
|
||||
NV_STATUS gsyncSetHouseSyncMode_P2061 (OBJGPU *, PDACEXTERNALDEVICE, NvU8);
|
||||
NV_STATUS gsyncGetCplStatus_P2061 (OBJGPU *, PDACEXTERNALDEVICE, GSYNCSTATUS, NvU32 *);
|
||||
|
||||
#endif // DAC_P2061_H
|
||||
132
src/nvidia/inc/kernel/gpu/external_device/external_device.h
Normal file
132
src/nvidia/inc/kernel/gpu/external_device/external_device.h
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef EXTDEV_H_
|
||||
#define EXTDEV_H_
|
||||
|
||||
/* ------------------------ Includes --------------------------------------- */
|
||||
#include "Nvcm.h"
|
||||
#include "sweng/dispsw.h"
|
||||
|
||||
/* ------------------------ Types definitions ------------------------------ */
|
||||
typedef struct DACEXTERNALDEVICE DACEXTERNALDEVICE, *PDACEXTERNALDEVICE;
|
||||
typedef struct DACEXTERNALDEVICEIFACE DACEXTERNALDEVICEIFACE, *PDACEXTERNALDEVICEIFACE;
|
||||
typedef struct DACP2060EXTERNALDEVICE DACP2060EXTERNALDEVICE, *PDACP2060EXTERNALDEVICE;
|
||||
|
||||
typedef enum _DAC_EXTERNAL_DEVICES
|
||||
{
|
||||
DAC_EXTERNAL_DEVICE_NONE = 0,
|
||||
DAC_EXTERNAL_DEVICE_P2060 = 0x2060, // NV30F1_CTRL_GSYNC_GET_CAPS_BOARD_ID_P2060
|
||||
DAC_EXTERNAL_DEVICE_P2061 = 0x2061, // NV30F1_CTRL_GSYNC_GET_CAPS_BOARD_ID_P2060
|
||||
} DAC_EXTERNAL_DEVICES;
|
||||
|
||||
typedef enum _DAC_EXTERNAL_DEVICE_FPGA_REVS
|
||||
{
|
||||
DAC_EXTERNAL_DEVICE_REV_0,
|
||||
DAC_EXTERNAL_DEVICE_REV_1,
|
||||
DAC_EXTERNAL_DEVICE_REV_2,
|
||||
DAC_EXTERNAL_DEVICE_REV_3,
|
||||
DAC_EXTERNAL_DEVICE_REV_4,
|
||||
DAC_EXTERNAL_DEVICE_REV_5,
|
||||
DAC_EXTERNAL_DEVICE_REV_6,
|
||||
DAC_EXTERNAL_DEVICE_REV_7,
|
||||
DAC_EXTERNAL_DEVICE_REV_MAX,
|
||||
DAC_EXTERNAL_DEVICE_REV_NONE,
|
||||
} DAC_EXTERNAL_DEVICE_REVS;
|
||||
|
||||
typedef enum _DAC_EXTDEV_ACTIONS
|
||||
{
|
||||
GET,
|
||||
SET,
|
||||
} DAC_EXTDEV_ACTIONS;
|
||||
|
||||
//
|
||||
// Not super-sure how "ExternalDevice" fits in with the model vs. say an
|
||||
// external display encoder (tv, digital, DAC, etc). But perhaps those would
|
||||
// instantiate one of these guys to become the "CommandChannel". As in an
|
||||
// external display encoder would "know about" its associated ExternalDevice
|
||||
// and use it to communicate... later... for now ExternalDevice is the base
|
||||
// class for the extension boards.
|
||||
//
|
||||
|
||||
struct DACEXTERNALDEVICEIFACE
|
||||
{
|
||||
NvBool (*GetDevice) (OBJGPU *, PDACEXTERNALDEVICE); // = 0 ( Pure virtual )
|
||||
NvBool (*Init) (OBJGPU *, PDACEXTERNALDEVICE); // = 0 ( Pure virtual )
|
||||
void (*Destroy) (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
NvBool (*Attach) (OBJGPU *, PDACEXTERNALDEVICE *);
|
||||
NvBool (*Validate) (OBJGPU *, PDACEXTERNALDEVICE); // check if the config is valid
|
||||
|
||||
void (*SetMode) (OBJGPU *, PDACEXTERNALDEVICE, NvU32);
|
||||
|
||||
NvBool (*SetupVblankService)(OBJGPU *, PDACEXTERNALDEVICE, NvU32, NvBool);
|
||||
void (*Service) (OBJGPU *, PDACEXTERNALDEVICE, NvU8, NvU8, NvU8, NvBool);
|
||||
NV_STATUS (*Watchdog) (OBJGPU *, struct OBJTMR *, PDACEXTERNALDEVICE); // OBJTMR routine signature (TIMERPROC).
|
||||
NvBool (*setI2cHandles)(OBJGPU *, DACEXTERNALDEVICE *);
|
||||
};
|
||||
|
||||
struct DACEXTERNALDEVICE
|
||||
{
|
||||
DACEXTERNALDEVICEIFACE *pI;
|
||||
|
||||
NvU32 ReferenceCount;
|
||||
|
||||
NvU8 I2CAddr;
|
||||
NvU32 I2CPort;
|
||||
NvU32 MaxGpus;
|
||||
|
||||
NvU8 revId;
|
||||
DAC_EXTERNAL_DEVICES deviceId;
|
||||
DAC_EXTERNAL_DEVICE_REVS deviceRev; //device revision, also known as firmware major version
|
||||
NvU8 deviceExRev; //device extended revision, also known as firmware minor version
|
||||
|
||||
struct {
|
||||
NvBool Scheduled;
|
||||
NvU32 TimeOut;
|
||||
} WatchdogControl;
|
||||
};
|
||||
|
||||
typedef PDACEXTERNALDEVICE (*pfextdevConstruct) (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
|
||||
/* ------------------------ Macros & Defines ------------------------------- */
|
||||
#define NV_P2060_MIN_REV 0x2
|
||||
|
||||
void extdevGetBoundHeadsAndDisplayIds(OBJGPU *, NvU32 *);
|
||||
PDACEXTERNALDEVICE extdevConstruct_Base (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
void extdevDestroy_Base (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
NvBool extdevValidate_Default (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
void extdevInvalidate_Default(OBJGPU *, PDACEXTERNALDEVICE);
|
||||
|
||||
NV_STATUS i2c_extdeviceHelper(OBJGPU *, DACEXTERNALDEVICE *, NvU32, NvU8, NvU8 *,NvBool);
|
||||
NV_STATUS writeregu008_extdevice(OBJGPU *, PDACEXTERNALDEVICE, NvU8, NvU8);
|
||||
NV_STATUS writeregu008_extdeviceTargeted(OBJGPU *, PDACEXTERNALDEVICE, NvU8, NvU8);
|
||||
NV_STATUS readregu008_extdevice(OBJGPU *, PDACEXTERNALDEVICE, NvU8, NvU8*);
|
||||
NV_STATUS readregu008_extdeviceTargeted(OBJGPU *, PDACEXTERNALDEVICE, NvU8, NvU8*);
|
||||
|
||||
void extdevDestroy (OBJGPU *);
|
||||
NV_STATUS extdevScheduleWatchdog(OBJGPU *, PDACEXTERNALDEVICE);
|
||||
NV_STATUS extdevCancelWatchdog (OBJGPU *, PDACEXTERNALDEVICE);
|
||||
NV_STATUS extdevServiceWatchdog (OBJGPU *, struct OBJTMR *, void *); // OBJTMR routine signature (TIMERPROC).
|
||||
void extdevGsyncService(OBJGPU *, NvU8, NvU8, NvU8, NvBool);
|
||||
|
||||
#endif
|
||||
3
src/nvidia/inc/kernel/gpu/external_device/gsync.h
Normal file
3
src/nvidia/inc/kernel/gpu/external_device/gsync.h
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
#include "g_gsync_nvoc.h"
|
||||
|
||||
3
src/nvidia/inc/kernel/gpu/external_device/gsync_api.h
Normal file
3
src/nvidia/inc/kernel/gpu/external_device/gsync_api.h
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
#include "g_gsync_api_nvoc.h"
|
||||
|
||||
107
src/nvidia/inc/kernel/gpu/gpu_acpi_data.h
Normal file
107
src/nvidia/inc/kernel/gpu/gpu_acpi_data.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2022 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.
|
||||
*/
|
||||
|
||||
#ifndef _GPU_ACPI_DATA_H_
|
||||
#define _GPU_ACPI_DATA_H_
|
||||
|
||||
#include "ctrl/ctrl0073/ctrl0073system.h"
|
||||
|
||||
#include "nvctassert.h"
|
||||
#include "acpigenfuncs.h"
|
||||
#include "nvstatus.h"
|
||||
#include "gpu/gpu_halspec.h"
|
||||
|
||||
#define MAX_DSM_SUPPORTED_FUNCS_RTN_LEN 8 // # bytes to store supported functions
|
||||
|
||||
typedef struct {
|
||||
// supported function status and cache
|
||||
NvU32 suppFuncStatus;
|
||||
NvU8 suppFuncs[MAX_DSM_SUPPORTED_FUNCS_RTN_LEN];
|
||||
NvU32 suppFuncsLen;
|
||||
NvBool bArg3isInteger;
|
||||
// callback status and cache
|
||||
NvU32 callbackStatus;
|
||||
NvU32 callback;
|
||||
} ACPI_DSM_CACHE;
|
||||
|
||||
typedef struct {
|
||||
|
||||
ACPI_DSM_CACHE dsm[ACPI_DSM_FUNCTION_COUNT];
|
||||
ACPI_DSM_FUNCTION dispStatusHotplugFunc;
|
||||
ACPI_DSM_FUNCTION dispStatusConfigFunc;
|
||||
ACPI_DSM_FUNCTION perfPostPowerStateFunc;
|
||||
ACPI_DSM_FUNCTION stereo3dStateActiveFunc;
|
||||
NvU32 dsmPlatCapsCache[ACPI_DSM_FUNCTION_COUNT];
|
||||
NvU32 MDTLFeatureSupport;
|
||||
|
||||
// cache of generic func/subfunction remappings.
|
||||
ACPI_DSM_FUNCTION dsmCurrentFunc[NV_ACPI_GENERIC_FUNC_COUNT];
|
||||
NvU32 dsmCurrentSubFunc[NV_ACPI_GENERIC_FUNC_COUNT];
|
||||
NvU32 dsmCurrentFuncSupport;
|
||||
|
||||
} ACPI_DATA;
|
||||
|
||||
typedef struct DOD_METHOD_DATA
|
||||
{
|
||||
NV_STATUS status;
|
||||
NvU32 acpiIdListLen;
|
||||
NvU32 acpiIdList[NV0073_CTRL_SYSTEM_ACPI_ID_MAP_MAX_DISPLAYS];
|
||||
} DOD_METHOD_DATA;
|
||||
|
||||
typedef struct JT_METHOD_DATA
|
||||
{
|
||||
NV_STATUS status;
|
||||
NvU16 jtRevId;
|
||||
NvU32 jtCaps;
|
||||
} JT_METHOD_DATA;
|
||||
|
||||
typedef struct MUX_METHOD_DATA_ELEMENT
|
||||
{
|
||||
NvU32 acpiId;
|
||||
NvU32 mode;
|
||||
NV_STATUS status;
|
||||
} MUX_METHOD_DATA_ELEMENT;
|
||||
|
||||
typedef struct MUX_METHOD_DATA
|
||||
{
|
||||
NvU32 tableLen;
|
||||
MUX_METHOD_DATA_ELEMENT acpiIdMuxModeTable[NV0073_CTRL_SYSTEM_ACPI_ID_MAP_MAX_DISPLAYS];
|
||||
MUX_METHOD_DATA_ELEMENT acpiIdMuxPartTable[NV0073_CTRL_SYSTEM_ACPI_ID_MAP_MAX_DISPLAYS];
|
||||
} MUX_METHOD_DATA;
|
||||
|
||||
typedef struct CAPS_METHOD_DATA
|
||||
{
|
||||
NV_STATUS status;
|
||||
NvU32 optimusCaps;
|
||||
} CAPS_METHOD_DATA;
|
||||
|
||||
typedef struct ACPI_METHOD_DATA
|
||||
{
|
||||
NvBool bValid;
|
||||
DOD_METHOD_DATA dodMethodData;
|
||||
JT_METHOD_DATA jtMethodData;
|
||||
MUX_METHOD_DATA muxMethodData;
|
||||
CAPS_METHOD_DATA capsMethodData;
|
||||
} ACPI_METHOD_DATA;
|
||||
|
||||
#endif // _GPU_ACPI_DATA_H_
|
||||
@@ -94,7 +94,7 @@
|
||||
GPU_CHILD_SINGLE_INST( OBJHSHUBMANAGER, GPU_GET_HSHUBMANAGER, 1, NV_FALSE, NV_FALSE, pHshMgr )
|
||||
#endif
|
||||
#if GPU_CHILD_MODULE(HSHUB)
|
||||
GPU_CHILD_MULTI_INST ( OBJHSHUB, GPU_GET_HSHUB, GPU_MAX_HSHUBS, NV_FALSE, NV_FALSE, pHshub )
|
||||
GPU_CHILD_MULTI_INST ( Hshub, GPU_GET_HSHUB, GPU_MAX_HSHUBS, NV_FALSE, NV_FALSE, pHshub )
|
||||
#endif
|
||||
#if GPU_CHILD_MODULE(SEQ)
|
||||
GPU_CHILD_SINGLE_INST( OBJSEQ, GPU_GET_SEQ, 1, NV_FALSE, NV_TRUE, pSeq )
|
||||
@@ -157,7 +157,7 @@
|
||||
GPU_CHILD_SINGLE_INST( ClockManager, GPU_GET_CLK_MGR, 1, NV_FALSE, NV_FALSE, pClk )
|
||||
#endif
|
||||
#if GPU_CHILD_MODULE(FAN)
|
||||
GPU_CHILD_SINGLE_INST( OBJFAN, GPU_GET_FAN, 1, NV_FALSE, NV_FALSE, pFan )
|
||||
GPU_CHILD_SINGLE_INST( Fan, GPU_GET_FAN, 1, NV_FALSE, NV_FALSE, pFan )
|
||||
#endif
|
||||
#if GPU_CHILD_MODULE(PERF)
|
||||
GPU_CHILD_SINGLE_INST( Perf, GPU_GET_PERF, 1, NV_FALSE, NV_FALSE, pPerf )
|
||||
@@ -187,7 +187,7 @@
|
||||
GPU_CHILD_SINGLE_INST( OBJVOLT, GPU_GET_VOLT, 1, NV_FALSE, NV_FALSE, pVolt )
|
||||
#endif
|
||||
#if GPU_CHILD_MODULE(I2C)
|
||||
GPU_CHILD_SINGLE_INST( OBJI2C, GPU_GET_I2C, 1, NV_FALSE, NV_TRUE, pI2c )
|
||||
GPU_CHILD_SINGLE_INST( I2c, GPU_GET_I2C, 1, NV_FALSE, NV_TRUE, pI2c )
|
||||
#endif
|
||||
#if GPU_CHILD_MODULE(SPI)
|
||||
GPU_CHILD_SINGLE_INST( Spi, GPU_GET_SPI, 1, NV_FALSE, NV_TRUE, pSpi )
|
||||
|
||||
@@ -48,7 +48,7 @@ typedef enum
|
||||
SOC_DEV_MAPPING_DPAUX1, // Update NV_MAX_SOC_DPAUX_NUM_DEVICES if adding new DPAUX mappings
|
||||
SOC_DEV_MAPPING_HDACODEC,
|
||||
SOC_DEV_MAPPING_MIPICAL,
|
||||
SOC_DEV_MAPPING_MAX // Keep this as last entry
|
||||
SOC_DEV_MAPPING_MAX
|
||||
} SOC_DEV_MAPPING;
|
||||
|
||||
#define GPU_MAX_DEVICE_MAPPINGS (60)
|
||||
|
||||
137
src/nvidia/inc/kernel/gpu/gpu_engine_type.h
Normal file
137
src/nvidia/inc/kernel/gpu/gpu_engine_type.h
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2021-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef _GPU_ENGINE_TYPE_H_
|
||||
#define _GPU_ENGINE_TYPE_H_
|
||||
|
||||
#include "class/cl2080.h"
|
||||
#include "nvrangetypes.h"
|
||||
#include "utils/nvbitvector.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RM_ENGINE_TYPE_NULL = (0x00000000),
|
||||
RM_ENGINE_TYPE_GR0 = (0x00000001),
|
||||
RM_ENGINE_TYPE_GR1 = (0x00000002),
|
||||
RM_ENGINE_TYPE_GR2 = (0x00000003),
|
||||
RM_ENGINE_TYPE_GR3 = (0x00000004),
|
||||
RM_ENGINE_TYPE_GR4 = (0x00000005),
|
||||
RM_ENGINE_TYPE_GR5 = (0x00000006),
|
||||
RM_ENGINE_TYPE_GR6 = (0x00000007),
|
||||
RM_ENGINE_TYPE_GR7 = (0x00000008),
|
||||
RM_ENGINE_TYPE_COPY0 = (0x00000009),
|
||||
RM_ENGINE_TYPE_COPY1 = (0x0000000a),
|
||||
RM_ENGINE_TYPE_COPY2 = (0x0000000b),
|
||||
RM_ENGINE_TYPE_COPY3 = (0x0000000c),
|
||||
RM_ENGINE_TYPE_COPY4 = (0x0000000d),
|
||||
RM_ENGINE_TYPE_COPY5 = (0x0000000e),
|
||||
RM_ENGINE_TYPE_COPY6 = (0x0000000f),
|
||||
RM_ENGINE_TYPE_COPY7 = (0x00000010),
|
||||
RM_ENGINE_TYPE_COPY8 = (0x00000011),
|
||||
RM_ENGINE_TYPE_COPY9 = (0x00000012),
|
||||
RM_ENGINE_TYPE_NVDEC0 = (0x0000001d),
|
||||
RM_ENGINE_TYPE_NVDEC1 = (0x0000001e),
|
||||
RM_ENGINE_TYPE_NVDEC2 = (0x0000001f),
|
||||
RM_ENGINE_TYPE_NVDEC3 = (0x00000020),
|
||||
RM_ENGINE_TYPE_NVDEC4 = (0x00000021),
|
||||
RM_ENGINE_TYPE_NVDEC5 = (0x00000022),
|
||||
RM_ENGINE_TYPE_NVDEC6 = (0x00000023),
|
||||
RM_ENGINE_TYPE_NVDEC7 = (0x00000024),
|
||||
RM_ENGINE_TYPE_NVENC0 = (0x00000025),
|
||||
RM_ENGINE_TYPE_NVENC1 = (0x00000026),
|
||||
RM_ENGINE_TYPE_NVENC2 = (0x00000027),
|
||||
RM_ENGINE_TYPE_VP = (0x00000028),
|
||||
RM_ENGINE_TYPE_ME = (0x00000029),
|
||||
RM_ENGINE_TYPE_PPP = (0x0000002a),
|
||||
RM_ENGINE_TYPE_MPEG = (0x0000002b),
|
||||
RM_ENGINE_TYPE_SW = (0x0000002c),
|
||||
RM_ENGINE_TYPE_TSEC = (0x0000002d),
|
||||
RM_ENGINE_TYPE_VIC = (0x0000002e),
|
||||
RM_ENGINE_TYPE_MP = (0x0000002f),
|
||||
RM_ENGINE_TYPE_SEC2 = (0x00000030),
|
||||
RM_ENGINE_TYPE_HOST = (0x00000031),
|
||||
RM_ENGINE_TYPE_DPU = (0x00000032),
|
||||
RM_ENGINE_TYPE_PMU = (0x00000033),
|
||||
RM_ENGINE_TYPE_FBFLCN = (0x00000034),
|
||||
RM_ENGINE_TYPE_NVJPEG0 = (0x00000035),
|
||||
RM_ENGINE_TYPE_NVJPEG1 = (0x00000036),
|
||||
RM_ENGINE_TYPE_NVJPEG2 = (0x00000037),
|
||||
RM_ENGINE_TYPE_NVJPEG3 = (0x00000038),
|
||||
RM_ENGINE_TYPE_NVJPEG4 = (0x00000039),
|
||||
RM_ENGINE_TYPE_NVJPEG5 = (0x0000003a),
|
||||
RM_ENGINE_TYPE_NVJPEG6 = (0x0000003b),
|
||||
RM_ENGINE_TYPE_NVJPEG7 = (0x0000003c),
|
||||
RM_ENGINE_TYPE_OFA = (0x0000003d),
|
||||
RM_ENGINE_TYPE_LAST = (0x0000003e),
|
||||
} RM_ENGINE_TYPE;
|
||||
|
||||
//
|
||||
// The duplicates in the RM_ENGINE_TYPE. Using define instead of putting them
|
||||
// in the enum to make sure that each item in the enum has a unique number.
|
||||
//
|
||||
#define RM_ENGINE_TYPE_GRAPHICS RM_ENGINE_TYPE_GR0
|
||||
#define RM_ENGINE_TYPE_BSP RM_ENGINE_TYPE_NVDEC0
|
||||
#define RM_ENGINE_TYPE_MSENC RM_ENGINE_TYPE_NVENC0
|
||||
#define RM_ENGINE_TYPE_CIPHER RM_ENGINE_TYPE_TSEC
|
||||
#define RM_ENGINE_TYPE_NVJPG RM_ENGINE_TYPE_NVJPEG0
|
||||
|
||||
#define RM_ENGINE_TYPE_COPY_SIZE 10
|
||||
#define RM_ENGINE_TYPE_NVENC_SIZE 3
|
||||
#define RM_ENGINE_TYPE_NVJPEG_SIZE 8
|
||||
#define RM_ENGINE_TYPE_NVDEC_SIZE 8
|
||||
#define RM_ENGINE_TYPE_GR_SIZE 8
|
||||
|
||||
// Indexed engines
|
||||
#define RM_ENGINE_TYPE_COPY(i) (RM_ENGINE_TYPE_COPY0+(i))
|
||||
#define RM_ENGINE_TYPE_IS_COPY(i) (((i) >= RM_ENGINE_TYPE_COPY0) && ((i) < RM_ENGINE_TYPE_COPY(RM_ENGINE_TYPE_COPY_SIZE)))
|
||||
#define RM_ENGINE_TYPE_COPY_IDX(i) ((i) - RM_ENGINE_TYPE_COPY0)
|
||||
|
||||
#define RM_ENGINE_TYPE_NVENC(i) (RM_ENGINE_TYPE_NVENC0+(i))
|
||||
#define RM_ENGINE_TYPE_IS_NVENC(i) (((i) >= RM_ENGINE_TYPE_NVENC0) && ((i) < RM_ENGINE_TYPE_NVENC(RM_ENGINE_TYPE_NVENC_SIZE)))
|
||||
#define RM_ENGINE_TYPE_NVENC_IDX(i) ((i) - RM_ENGINE_TYPE_NVENC0)
|
||||
|
||||
#define RM_ENGINE_TYPE_NVDEC(i) (RM_ENGINE_TYPE_NVDEC0+(i))
|
||||
#define RM_ENGINE_TYPE_IS_NVDEC(i) (((i) >= RM_ENGINE_TYPE_NVDEC0) && ((i) < RM_ENGINE_TYPE_NVDEC(RM_ENGINE_TYPE_NVDEC_SIZE)))
|
||||
#define RM_ENGINE_TYPE_NVDEC_IDX(i) ((i) - RM_ENGINE_TYPE_NVDEC0)
|
||||
|
||||
#define RM_ENGINE_TYPE_NVJPEG(i) (RM_ENGINE_TYPE_NVJPEG0+(i))
|
||||
#define RM_ENGINE_TYPE_IS_NVJPEG(i) (((i) >= RM_ENGINE_TYPE_NVJPEG0) && ((i) < RM_ENGINE_TYPE_NVJPEG(RM_ENGINE_TYPE_NVJPEG_SIZE)))
|
||||
#define RM_ENGINE_TYPE_NVJPEG_IDX(i) ((i) - RM_ENGINE_TYPE_NVJPEG0)
|
||||
|
||||
#define RM_ENGINE_TYPE_GR(i) (RM_ENGINE_TYPE_GR0 + (i))
|
||||
#define RM_ENGINE_TYPE_IS_GR(i) (((i) >= RM_ENGINE_TYPE_GR0) && ((i) < RM_ENGINE_TYPE_GR(RM_ENGINE_TYPE_GR_SIZE)))
|
||||
#define RM_ENGINE_TYPE_GR_IDX(i) ((i) - RM_ENGINE_TYPE_GR0)
|
||||
|
||||
#define RM_ENGINE_TYPE_IS_VALID(i) (((i) > (RM_ENGINE_TYPE_NULL)) && ((i) < (RM_ENGINE_TYPE_LAST)))
|
||||
|
||||
// Engine Range defines
|
||||
#define RM_ENGINE_RANGE_GR() rangeMake(RM_ENGINE_TYPE_GR(0), RM_ENGINE_TYPE_GR(RM_ENGINE_TYPE_GR_SIZE - 1))
|
||||
#define RM_ENGINE_RANGE_COPY() rangeMake(RM_ENGINE_TYPE_COPY(0), RM_ENGINE_TYPE_COPY(RM_ENGINE_TYPE_COPY_SIZE - 1))
|
||||
#define RM_ENGINE_RANGE_NVDEC() rangeMake(RM_ENGINE_TYPE_NVDEC(0), RM_ENGINE_TYPE_NVDEC(RM_ENGINE_TYPE_NVDEC_SIZE - 1))
|
||||
#define RM_ENGINE_RANGE_NVENC() rangeMake(RM_ENGINE_TYPE_NVENC(0), RM_ENGINE_TYPE_NVENC(RM_ENGINE_TYPE_NVENC_SIZE - 1))
|
||||
#define RM_ENGINE_RANGE_NVJPEG() rangeMake(RM_ENGINE_TYPE_NVJPEG(0), RM_ENGINE_TYPE_NVJPEG(RM_ENGINE_TYPE_NVJPEG_SIZE - 1))
|
||||
|
||||
// Bit Vectors
|
||||
MAKE_BITVECTOR(ENGTYPE_BIT_VECTOR, RM_ENGINE_TYPE_LAST);
|
||||
|
||||
#endif //_GPU_ENGINE_TYPE_H_
|
||||
60
src/nvidia/inc/kernel/gpu/gpu_fabric_probe.h
Normal file
60
src/nvidia/inc/kernel/gpu/gpu_fabric_probe.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef GPU_FABRIC_PROBE_H
|
||||
#define GPU_FABRIC_PROBE_H
|
||||
|
||||
|
||||
#include "nvlink_inband_msg.h"
|
||||
|
||||
#define GPU_FABRIC_PROBE_SEC_TO_NS 1000000000ULL
|
||||
|
||||
#define GPU_FABRIC_PROBE_DEFAULT_DELAY 5 // 5 seconds
|
||||
|
||||
#define GPU_FABRIC_PROBE_DEFAULT_PROBE_SLOWDOWN_THRESHOLD 10
|
||||
|
||||
typedef struct GPU_FABRIC_PROBE_INFO GPU_FABRIC_PROBE_INFO;
|
||||
|
||||
NV_STATUS gpuFabricProbeStart(OBJGPU *pGpu,
|
||||
GPU_FABRIC_PROBE_INFO **ppGpuFabricProbeInfo);
|
||||
void gpuFabricProbeStop(GPU_FABRIC_PROBE_INFO *pGpuFabricProbeInfo);
|
||||
|
||||
void gpuFabricProbeSuspend(GPU_FABRIC_PROBE_INFO *pGpuFabricProbeInfo);
|
||||
NV_STATUS gpuFabricProbeResume(GPU_FABRIC_PROBE_INFO *pGpuFabricProbeInfo);
|
||||
|
||||
NV_STATUS gpuFabricProbeGetGpuFabricHandle(GPU_FABRIC_PROBE_INFO *pInfo, NvU64 *pHandle);
|
||||
NV_STATUS gpuFabricProbeGetGfId(GPU_FABRIC_PROBE_INFO *pInfo, NvU32 *pGfId);
|
||||
NV_STATUS gpuFabricProbeGetfmCaps(GPU_FABRIC_PROBE_INFO *pInfo, NvU64 *pFmCaps);
|
||||
NV_STATUS gpuFabricProbeGetClusterUuid(GPU_FABRIC_PROBE_INFO *pInfo, NvUuid *pClusterUuid);
|
||||
NV_STATUS gpuFabricProbeGetFabricPartitionId(GPU_FABRIC_PROBE_INFO *pInfo, NvU16 *pFabricPartitionId);
|
||||
NV_STATUS gpuFabricProbeGetGpaAddress(GPU_FABRIC_PROBE_INFO *pInfo, NvU64 *pGpaAddress);
|
||||
NV_STATUS gpuFabricProbeGetGpaAddressRange(GPU_FABRIC_PROBE_INFO *pInfo, NvU64 *pGpaAddressRange);
|
||||
NV_STATUS gpuFabricProbeGetFlaAddress(GPU_FABRIC_PROBE_INFO *pInfo, NvU64 *pFlaAddress);
|
||||
NV_STATUS gpuFabricProbeGetFlaAddressRange(GPU_FABRIC_PROBE_INFO *pInfo, NvU64 *pFlaAddressRange);
|
||||
NV_STATUS gpuFabricProbeGetNumProbeReqs(GPU_FABRIC_PROBE_INFO *pInfo, NvU64 *numProbes);
|
||||
|
||||
NvBool gpuFabricProbeIsReceived(GPU_FABRIC_PROBE_INFO *pGpuFabricProbeInfo);
|
||||
NvBool gpuFabricProbeIsSuccess(GPU_FABRIC_PROBE_INFO *pGpuFabricProbeInfo);
|
||||
NV_STATUS gpuFabricProbeGetFmStatus(GPU_FABRIC_PROBE_INFO *pGpuFabricProbeInfo);
|
||||
NvBool gpuFabricProbeIsSupported(OBJGPU *pGpu);
|
||||
#endif // GPU_FABRIC_PROBE_H
|
||||
50
src/nvidia/inc/kernel/gpu/gpu_shared_data_map.h
Normal file
50
src/nvidia/inc/kernel/gpu/gpu_shared_data_map.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2022 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.
|
||||
*/
|
||||
|
||||
#ifndef GPU_SHARED_DATA_MAP_H
|
||||
#define GPU_SHARED_DATA_MAP_H
|
||||
|
||||
#include "core/core.h"
|
||||
#include "gpu/mem_mgr/mem_desc.h"
|
||||
#include "class/cl00de.h"
|
||||
|
||||
// ****************************************************************************
|
||||
// Type definitions
|
||||
// ****************************************************************************
|
||||
|
||||
typedef struct GpuSharedDataMap {
|
||||
MEMORY_DESCRIPTOR *pMemDesc;
|
||||
NvP64 pMapBuffer;
|
||||
NvP64 pMapBufferPriv;
|
||||
NvU32 processId;
|
||||
|
||||
NV00DE_SHARED_DATA data;
|
||||
} GpuSharedDataMap;
|
||||
|
||||
// Start data write, returns data struct to write into
|
||||
NV00DE_SHARED_DATA * gpushareddataWriteStart(OBJGPU *pGpu);
|
||||
// Finish data write, pushes data cached by above into mapped data
|
||||
void gpushareddataWriteFinish(OBJGPU *pGpu);
|
||||
|
||||
#endif /* GPU_SHARED_DATA_MAP_H */
|
||||
|
||||
3
src/nvidia/inc/kernel/gpu/gpu_user_shared_data.h
Normal file
3
src/nvidia/inc/kernel/gpu/gpu_user_shared_data.h
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
#include "g_gpu_user_shared_data_nvoc.h"
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2022 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.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_GRAPHICS_CONTEXT_BUFFERS_H
|
||||
#define KERNEL_GRAPHICS_CONTEXT_BUFFERS_H
|
||||
|
||||
#include "utils/nv_enum.h"
|
||||
|
||||
/*
|
||||
* Global buffer types. These are shared between contexts
|
||||
* each PF/VF context normally. A GraphicsContext may have
|
||||
* a private allocation for security (VPR) or when
|
||||
* graphics preemption is enabled.
|
||||
*
|
||||
* Not all buffer types are supported on every GPU.
|
||||
*/
|
||||
#define GR_GLOBALCTX_BUFFER_DEF(x) \
|
||||
NV_ENUM_ENTRY(x, GR_GLOBALCTX_BUFFER_BUNDLE_CB, 0x00000000) \
|
||||
NV_ENUM_ENTRY(x, GR_GLOBALCTX_BUFFER_PAGEPOOL, 0x00000001) \
|
||||
NV_ENUM_ENTRY(x, GR_GLOBALCTX_BUFFER_ATTRIBUTE_CB, 0x00000002) \
|
||||
NV_ENUM_ENTRY(x, GR_GLOBALCTX_BUFFER_RTV_CB, 0x00000003) \
|
||||
NV_ENUM_ENTRY(x, GR_GLOBALCTX_BUFFER_GFXP_POOL, 0x00000004) \
|
||||
NV_ENUM_ENTRY(x, GR_GLOBALCTX_BUFFER_GFXP_CTRL_BLK, 0x00000005) \
|
||||
NV_ENUM_ENTRY(x, GR_GLOBALCTX_BUFFER_FECS_EVENT, 0x00000006) \
|
||||
NV_ENUM_ENTRY(x, GR_GLOBALCTX_BUFFER_PRIV_ACCESS_MAP, 0x00000007) \
|
||||
NV_ENUM_ENTRY(x, GR_GLOBALCTX_BUFFER_UNRESTRICTED_PRIV_ACCESS_MAP, 0x00000008) \
|
||||
NV_ENUM_ENTRY(x, GR_GLOBAL_BUFFER_GLOBAL_PRIV_ACCESS_MAP, 0x00000009)
|
||||
|
||||
NV_ENUM_DEF(GR_GLOBALCTX_BUFFER, GR_GLOBALCTX_BUFFER_DEF)
|
||||
#define GR_GLOBALCTX_BUFFER_COUNT NV_ENUM_SIZE(GR_GLOBALCTX_BUFFER)
|
||||
|
||||
|
||||
#define GR_CTX_BUFFER_DEF(x) \
|
||||
NV_ENUM_ENTRY(x, GR_CTX_BUFFER_MAIN, 0x00000000) \
|
||||
NV_ENUM_ENTRY(x, GR_CTX_BUFFER_ZCULL, 0x00000001) \
|
||||
NV_ENUM_ENTRY(x, GR_CTX_BUFFER_PM, 0x00000002) \
|
||||
NV_ENUM_ENTRY(x, GR_CTX_BUFFER_PREEMPT, 0x00000003) \
|
||||
NV_ENUM_ENTRY(x, GR_CTX_BUFFER_SPILL, 0x00000004) \
|
||||
NV_ENUM_ENTRY(x, GR_CTX_BUFFER_BETA_CB, 0x00000005) \
|
||||
NV_ENUM_ENTRY(x, GR_CTX_BUFFER_PAGEPOOL, 0x00000006) \
|
||||
NV_ENUM_ENTRY(x, GR_CTX_BUFFER_RTV_CB, 0x00000007) \
|
||||
NV_ENUM_ENTRY(x, GR_CTX_BUFFER_PATCH, 0x00000008)
|
||||
|
||||
NV_ENUM_DEF(GR_CTX_BUFFER, GR_CTX_BUFFER_DEF)
|
||||
|
||||
#endif // KERNEL_GRAPHICS_CONTEXT_BUFFERS_H
|
||||
57
src/nvidia/inc/kernel/gpu/gr/kernel_sm_debugger_exception.h
Normal file
57
src/nvidia/inc/kernel/gpu/gr/kernel_sm_debugger_exception.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2022 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.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_SM_DEBUGGER_EXCEPTION_H
|
||||
#define KERNEL_SM_DEBUGGER_EXCEPTION_H
|
||||
|
||||
#include "utils/nv_enum.h"
|
||||
#include "nvctassert.h"
|
||||
#include "nvmisc.h"
|
||||
|
||||
#include "ctrl/ctrl83de.h"
|
||||
|
||||
#define SMDBG_EXCEPTION_TYPE_DEF(x) \
|
||||
NV_ENUM_ENTRY(x, SMDBG_EXCEPTION_TYPE_FATAL, 0) \
|
||||
NV_ENUM_ENTRY(x, SMDBG_EXCEPTION_TYPE_TRAP, 1) \
|
||||
NV_ENUM_ENTRY(x, SMDBG_EXCEPTION_TYPE_SINGLE_STEP, 2) \
|
||||
NV_ENUM_ENTRY(x, SMDBG_EXCEPTION_TYPE_INT, 3) \
|
||||
NV_ENUM_ENTRY(x, SMDBG_EXCEPTION_TYPE_CILP, 4) \
|
||||
NV_ENUM_ENTRY(x, SMDBG_EXCEPTION_TYPE_PREEMPTION_STARTED, 5)
|
||||
|
||||
NV_ENUM_DEF(SMDBG_EXCEPTION_TYPE, SMDBG_EXCEPTION_TYPE_DEF);
|
||||
ct_assert(NV_ENUM_IS_CONTIGUOUS(SMDBG_EXCEPTION_TYPE));
|
||||
|
||||
ct_assert(NVBIT32(SMDBG_EXCEPTION_TYPE_FATAL) ==
|
||||
NV83DE_CTRL_DEBUG_SET_EXCEPTION_MASK_FATAL);
|
||||
ct_assert(NVBIT32(SMDBG_EXCEPTION_TYPE_TRAP) ==
|
||||
NV83DE_CTRL_DEBUG_SET_EXCEPTION_MASK_TRAP);
|
||||
ct_assert(NVBIT32(SMDBG_EXCEPTION_TYPE_SINGLE_STEP) ==
|
||||
NV83DE_CTRL_DEBUG_SET_EXCEPTION_MASK_SINGLE_STEP);
|
||||
ct_assert(NVBIT32(SMDBG_EXCEPTION_TYPE_INT) ==
|
||||
NV83DE_CTRL_DEBUG_SET_EXCEPTION_MASK_INT);
|
||||
ct_assert(NVBIT32(SMDBG_EXCEPTION_TYPE_CILP) ==
|
||||
NV83DE_CTRL_DEBUG_SET_EXCEPTION_MASK_CILP);
|
||||
ct_assert(NVBIT32(SMDBG_EXCEPTION_TYPE_PREEMPTION_STARTED) ==
|
||||
NV83DE_CTRL_DEBUG_SET_EXCEPTION_MASK_PREEMPTION_STARTED);
|
||||
|
||||
#endif // KERNEL_SM_DEBUGGER_EXCEPTION_H
|
||||
@@ -50,6 +50,7 @@ typedef struct
|
||||
{
|
||||
MESSAGE_QUEUE_INIT_ARGUMENTS messageQueueInitArguments;
|
||||
GSP_SR_INIT_ARGUMENTS srInitArguments;
|
||||
NvU32 gpuInstance;
|
||||
} GSP_ARGUMENTS_CACHED;
|
||||
|
||||
#endif // GSP_INIT_ARGS_H
|
||||
|
||||
@@ -35,11 +35,12 @@
|
||||
#include "ctrl/ctrl2080/ctrl2080bios.h"
|
||||
#include "ctrl/ctrl2080/ctrl2080fb.h"
|
||||
#include "ctrl/ctrl2080/ctrl2080gpu.h"
|
||||
#include "ctrl/ctrla083.h"
|
||||
|
||||
#include "gpu/gpu.h" // COMPUTE_BRANDING_TYPE
|
||||
#include "gpu/gpu_acpi_data.h" // ACPI_METHOD_DATA
|
||||
#include "vgpu/rpc_headers.h" // MAX_GPC_COUNT
|
||||
#include "platform/chipset/chipset.h" // BUSINFO
|
||||
#include "gpu/nvbitmask.h" // NVGPU_ENGINE_CAPS_MASK_ARRAY_MAX
|
||||
|
||||
typedef struct GspSMInfo_t
|
||||
{
|
||||
@@ -69,7 +70,7 @@ typedef struct GspStaticConfigInfo_t
|
||||
NV0080_CTRL_GPU_GET_SRIOV_CAPS_PARAMS sriovCaps;
|
||||
NvU32 sriovMaxGfid;
|
||||
|
||||
NvU64 engineCaps;
|
||||
NvU32 engineCaps[NVGPU_ENGINE_CAPS_MASK_ARRAY_MAX];
|
||||
|
||||
GspSMInfo SM_info;
|
||||
|
||||
@@ -96,6 +97,7 @@ typedef struct GspStaticConfigInfo_t
|
||||
NvBool bGeforceSmb;
|
||||
NvBool bIsTitan;
|
||||
NvBool bIsTesla;
|
||||
NvBool bIsMobile;
|
||||
|
||||
NvU64 bar1PdeBase;
|
||||
NvU64 bar2PdeBase;
|
||||
@@ -110,8 +112,8 @@ typedef struct GspStaticConfigInfo_t
|
||||
|
||||
NvBool bClRootportNeedsNosnoopWAR;
|
||||
|
||||
NVA083_CTRL_VIRTUAL_DISPLAY_GET_NUM_HEADS_PARAMS displaylessMaxHeads;
|
||||
NVA083_CTRL_VIRTUAL_DISPLAY_GET_MAX_RESOLUTION_PARAMS displaylessMaxResolution;
|
||||
VIRTUAL_DISPLAY_GET_NUM_HEADS_PARAMS displaylessMaxHeads;
|
||||
VIRTUAL_DISPLAY_GET_MAX_RESOLUTION_PARAMS displaylessMaxResolution;
|
||||
NvU64 displaylessMaxPixels;
|
||||
|
||||
// Client handle for internal RMAPI control.
|
||||
@@ -142,7 +144,15 @@ typedef struct GspSystemInfo
|
||||
NvU8 oorArch;
|
||||
NvU64 clPdbProperties;
|
||||
NvU32 Chipset;
|
||||
NvBool bGpuBehindBridge;
|
||||
NvBool bUpstreamL0sUnsupported;
|
||||
NvBool bUpstreamL1Unsupported;
|
||||
NvBool bUpstreamL1PorSupported;
|
||||
NvBool bUpstreamL1PorMobileOnly;
|
||||
NvU8 upstreamAddressValid;
|
||||
BUSINFO FHBBusInfo;
|
||||
BUSINFO chipsetIDInfo;
|
||||
ACPI_METHOD_DATA acpiMethodData;
|
||||
} GspSystemInfo;
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
@@ -44,99 +44,96 @@
|
||||
#define MC_ENGINE_IDX_VIDEO 5
|
||||
#define MC_ENGINE_IDX_MD 6
|
||||
#define MC_ENGINE_IDX_BUS 7
|
||||
// UNUSED
|
||||
#define MC_ENGINE_IDX_PMGR 9
|
||||
#define MC_ENGINE_IDX_VP2 10
|
||||
#define MC_ENGINE_IDX_CIPHER 11
|
||||
#define MC_ENGINE_IDX_BIF 12
|
||||
#define MC_ENGINE_IDX_PPP 13
|
||||
#define MC_ENGINE_IDX_PRIVRING 14
|
||||
#define MC_ENGINE_IDX_PMU 15
|
||||
#define MC_ENGINE_IDX_CE0 16
|
||||
#define MC_ENGINE_IDX_CE1 17
|
||||
#define MC_ENGINE_IDX_CE2 18
|
||||
#define MC_ENGINE_IDX_CE3 19
|
||||
#define MC_ENGINE_IDX_CE4 20
|
||||
#define MC_ENGINE_IDX_CE5 21
|
||||
#define MC_ENGINE_IDX_CE6 22
|
||||
#define MC_ENGINE_IDX_CE7 23
|
||||
#define MC_ENGINE_IDX_CE8 24
|
||||
#define MC_ENGINE_IDX_CE9 25
|
||||
#define MC_ENGINE_IDX_VIC 26
|
||||
#define MC_ENGINE_IDX_ISOHUB 27
|
||||
#define MC_ENGINE_IDX_VGPU 28
|
||||
#define MC_ENGINE_IDX_MSENC 29
|
||||
#define MC_ENGINE_IDX_MSENC1 30
|
||||
#define MC_ENGINE_IDX_MSENC2 31
|
||||
#define MC_ENGINE_IDX_C2C 32
|
||||
// UNUSED
|
||||
#define MC_ENGINE_IDX_LTC 34
|
||||
#define MC_ENGINE_IDX_FBHUB 35
|
||||
#define MC_ENGINE_IDX_HDACODEC 36
|
||||
#define MC_ENGINE_IDX_GMMU 37
|
||||
#define MC_ENGINE_IDX_SEC2 38
|
||||
#define MC_ENGINE_IDX_FSP 39
|
||||
#define MC_ENGINE_IDX_NVLINK 40
|
||||
#define MC_ENGINE_IDX_GSP 41
|
||||
#define MC_ENGINE_IDX_NVJPG 42
|
||||
#define MC_ENGINE_IDX_PMGR 8
|
||||
#define MC_ENGINE_IDX_VP2 9
|
||||
#define MC_ENGINE_IDX_CIPHER 10
|
||||
#define MC_ENGINE_IDX_BIF 11
|
||||
#define MC_ENGINE_IDX_PPP 12
|
||||
#define MC_ENGINE_IDX_PRIVRING 13
|
||||
#define MC_ENGINE_IDX_PMU 14
|
||||
#define MC_ENGINE_IDX_CE0 15
|
||||
#define MC_ENGINE_IDX_CE1 16
|
||||
#define MC_ENGINE_IDX_CE2 17
|
||||
#define MC_ENGINE_IDX_CE3 18
|
||||
#define MC_ENGINE_IDX_CE4 19
|
||||
#define MC_ENGINE_IDX_CE5 20
|
||||
#define MC_ENGINE_IDX_CE6 21
|
||||
#define MC_ENGINE_IDX_CE7 22
|
||||
#define MC_ENGINE_IDX_CE8 23
|
||||
#define MC_ENGINE_IDX_CE9 24
|
||||
#define MC_ENGINE_IDX_VIC 35
|
||||
#define MC_ENGINE_IDX_ISOHUB 36
|
||||
#define MC_ENGINE_IDX_VGPU 37
|
||||
#define MC_ENGINE_IDX_MSENC 38
|
||||
#define MC_ENGINE_IDX_MSENC1 39
|
||||
#define MC_ENGINE_IDX_MSENC2 40
|
||||
#define MC_ENGINE_IDX_C2C 41
|
||||
#define MC_ENGINE_IDX_LTC 42
|
||||
#define MC_ENGINE_IDX_FBHUB 43
|
||||
#define MC_ENGINE_IDX_HDACODEC 44
|
||||
#define MC_ENGINE_IDX_GMMU 45
|
||||
#define MC_ENGINE_IDX_SEC2 46
|
||||
#define MC_ENGINE_IDX_FSP 47
|
||||
#define MC_ENGINE_IDX_NVLINK 48
|
||||
#define MC_ENGINE_IDX_GSP 49
|
||||
#define MC_ENGINE_IDX_NVJPG 50
|
||||
#define MC_ENGINE_IDX_NVJPEG MC_ENGINE_IDX_NVJPG
|
||||
#define MC_ENGINE_IDX_NVJPEG0 MC_ENGINE_IDX_NVJPEG
|
||||
#define MC_ENGINE_IDX_NVJPEG1 43
|
||||
#define MC_ENGINE_IDX_NVJPEG2 44
|
||||
#define MC_ENGINE_IDX_NVJPEG3 45
|
||||
#define MC_ENGINE_IDX_NVJPEG4 46
|
||||
#define MC_ENGINE_IDX_NVJPEG5 47
|
||||
#define MC_ENGINE_IDX_NVJPEG6 48
|
||||
#define MC_ENGINE_IDX_NVJPEG7 49
|
||||
|
||||
#define MC_ENGINE_IDX_REPLAYABLE_FAULT 50
|
||||
#define MC_ENGINE_IDX_ACCESS_CNTR 51
|
||||
#define MC_ENGINE_IDX_NON_REPLAYABLE_FAULT 52
|
||||
#define MC_ENGINE_IDX_REPLAYABLE_FAULT_ERROR 53
|
||||
#define MC_ENGINE_IDX_NON_REPLAYABLE_FAULT_ERROR 54
|
||||
#define MC_ENGINE_IDX_INFO_FAULT 55
|
||||
#define MC_ENGINE_IDX_BSP 56
|
||||
#define MC_ENGINE_IDX_NVJPEG1 51
|
||||
#define MC_ENGINE_IDX_NVJPEG2 52
|
||||
#define MC_ENGINE_IDX_NVJPEG3 53
|
||||
#define MC_ENGINE_IDX_NVJPEG4 54
|
||||
#define MC_ENGINE_IDX_NVJPEG5 55
|
||||
#define MC_ENGINE_IDX_NVJPEG6 56
|
||||
#define MC_ENGINE_IDX_NVJPEG7 57
|
||||
#define MC_ENGINE_IDX_REPLAYABLE_FAULT 58
|
||||
#define MC_ENGINE_IDX_ACCESS_CNTR 59
|
||||
#define MC_ENGINE_IDX_NON_REPLAYABLE_FAULT 60
|
||||
#define MC_ENGINE_IDX_REPLAYABLE_FAULT_ERROR 61
|
||||
#define MC_ENGINE_IDX_NON_REPLAYABLE_FAULT_ERROR 62
|
||||
#define MC_ENGINE_IDX_INFO_FAULT 63
|
||||
#define MC_ENGINE_IDX_BSP 64
|
||||
#define MC_ENGINE_IDX_NVDEC MC_ENGINE_IDX_BSP
|
||||
#define MC_ENGINE_IDX_NVDEC0 MC_ENGINE_IDX_NVDEC
|
||||
#define MC_ENGINE_IDX_NVDEC1 57
|
||||
#define MC_ENGINE_IDX_NVDEC2 58
|
||||
#define MC_ENGINE_IDX_NVDEC3 59
|
||||
#define MC_ENGINE_IDX_NVDEC4 60
|
||||
#define MC_ENGINE_IDX_NVDEC5 61
|
||||
#define MC_ENGINE_IDX_NVDEC6 62
|
||||
#define MC_ENGINE_IDX_NVDEC7 63
|
||||
#define MC_ENGINE_IDX_CPU_DOORBELL 64
|
||||
#define MC_ENGINE_IDX_PRIV_DOORBELL 65
|
||||
#define MC_ENGINE_IDX_MMU_ECC_ERROR 66
|
||||
#define MC_ENGINE_IDX_BLG 67
|
||||
#define MC_ENGINE_IDX_PERFMON 68
|
||||
#define MC_ENGINE_IDX_BUF_RESET 69
|
||||
#define MC_ENGINE_IDX_XBAR 70
|
||||
#define MC_ENGINE_IDX_ZPW 71
|
||||
#define MC_ENGINE_IDX_OFA0 72
|
||||
#define MC_ENGINE_IDX_TEGRA 73
|
||||
#define MC_ENGINE_IDX_GR 74
|
||||
#define MC_ENGINE_IDX_NVDEC1 65
|
||||
#define MC_ENGINE_IDX_NVDEC2 66
|
||||
#define MC_ENGINE_IDX_NVDEC3 67
|
||||
#define MC_ENGINE_IDX_NVDEC4 68
|
||||
#define MC_ENGINE_IDX_NVDEC5 69
|
||||
#define MC_ENGINE_IDX_NVDEC6 70
|
||||
#define MC_ENGINE_IDX_NVDEC7 71
|
||||
#define MC_ENGINE_IDX_CPU_DOORBELL 72
|
||||
#define MC_ENGINE_IDX_PRIV_DOORBELL 73
|
||||
#define MC_ENGINE_IDX_MMU_ECC_ERROR 74
|
||||
#define MC_ENGINE_IDX_BLG 75
|
||||
#define MC_ENGINE_IDX_PERFMON 76
|
||||
#define MC_ENGINE_IDX_BUF_RESET 77
|
||||
#define MC_ENGINE_IDX_XBAR 78
|
||||
#define MC_ENGINE_IDX_ZPW 79
|
||||
#define MC_ENGINE_IDX_OFA0 80
|
||||
#define MC_ENGINE_IDX_TEGRA 81
|
||||
#define MC_ENGINE_IDX_GR 82
|
||||
#define MC_ENGINE_IDX_GR0 MC_ENGINE_IDX_GR
|
||||
#define MC_ENGINE_IDX_GR1 75
|
||||
#define MC_ENGINE_IDX_GR2 76
|
||||
#define MC_ENGINE_IDX_GR3 77
|
||||
#define MC_ENGINE_IDX_GR4 78
|
||||
#define MC_ENGINE_IDX_GR5 79
|
||||
#define MC_ENGINE_IDX_GR6 80
|
||||
#define MC_ENGINE_IDX_GR7 81
|
||||
#define MC_ENGINE_IDX_ESCHED 82
|
||||
#define MC_ENGINE_IDX_GR1 83
|
||||
#define MC_ENGINE_IDX_GR2 84
|
||||
#define MC_ENGINE_IDX_GR3 85
|
||||
#define MC_ENGINE_IDX_GR4 86
|
||||
#define MC_ENGINE_IDX_GR5 87
|
||||
#define MC_ENGINE_IDX_GR6 88
|
||||
#define MC_ENGINE_IDX_GR7 89
|
||||
#define MC_ENGINE_IDX_ESCHED 90
|
||||
#define MC_ENGINE_IDX_ESCHED__SIZE 64
|
||||
#define MC_ENGINE_IDX_GR_FECS_LOG 146
|
||||
#define MC_ENGINE_IDX_GR_FECS_LOG 154
|
||||
#define MC_ENGINE_IDX_GR0_FECS_LOG MC_ENGINE_IDX_GR_FECS_LOG
|
||||
#define MC_ENGINE_IDX_GR1_FECS_LOG 147
|
||||
#define MC_ENGINE_IDX_GR2_FECS_LOG 148
|
||||
#define MC_ENGINE_IDX_GR3_FECS_LOG 149
|
||||
#define MC_ENGINE_IDX_GR4_FECS_LOG 150
|
||||
#define MC_ENGINE_IDX_GR5_FECS_LOG 151
|
||||
#define MC_ENGINE_IDX_GR6_FECS_LOG 152
|
||||
#define MC_ENGINE_IDX_GR7_FECS_LOG 153
|
||||
#define MC_ENGINE_IDX_TMR_SWRL 154
|
||||
#define MC_ENGINE_IDX_MAX 155 // This must be kept as the max bit if
|
||||
#define MC_ENGINE_IDX_GR1_FECS_LOG 155
|
||||
#define MC_ENGINE_IDX_GR2_FECS_LOG 156
|
||||
#define MC_ENGINE_IDX_GR3_FECS_LOG 157
|
||||
#define MC_ENGINE_IDX_GR4_FECS_LOG 158
|
||||
#define MC_ENGINE_IDX_GR5_FECS_LOG 159
|
||||
#define MC_ENGINE_IDX_GR6_FECS_LOG 160
|
||||
#define MC_ENGINE_IDX_GR7_FECS_LOG 161
|
||||
#define MC_ENGINE_IDX_TMR_SWRL 162
|
||||
#define MC_ENGINE_IDX_MAX 163 // This must be kept as the max bit if
|
||||
// we need to add more engines
|
||||
#define MC_ENGINE_IDX_INVALID 0xFFFFFFFF
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
#include "g_intrable_nvoc.h"
|
||||
|
||||
3
src/nvidia/inc/kernel/gpu/mem_mgr/mem_mapper.h
Normal file
3
src/nvidia/inc/kernel/gpu/mem_mgr/mem_mapper.h
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
#include "g_mem_mapper_nvoc.h"
|
||||
|
||||
@@ -156,11 +156,20 @@ typedef struct _RANGELISTTYPE
|
||||
struct _RANGELISTTYPE *pNext;
|
||||
} RANGELISTTYPE, *PRANGELISTTYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MEMORY_PROTECTION_UNPROTECTED = 0,
|
||||
MEMORY_PROTECTION_PROTECTED = 1
|
||||
} MEMORY_PROTECTION;
|
||||
|
||||
/*!
|
||||
* @brief Callbacks to UVM for eviction
|
||||
*/
|
||||
typedef NV_STATUS (*pmaEvictPagesCb_t)(void *ctxPtr, NvU32 pageSize, NvU64 *pPages, NvU32 count, NvU64 physBegin, NvU64 physEnd);
|
||||
typedef NV_STATUS (*pmaEvictRangeCb_t)(void *ctxPtr, NvU64 physBegin, NvU64 physEnd);
|
||||
typedef NV_STATUS (*pmaEvictPagesCb_t)(void *ctxPtr, NvU32 pageSize, NvU64 *pPages,
|
||||
NvU32 count, NvU64 physBegin, NvU64 physEnd,
|
||||
MEMORY_PROTECTION prot);
|
||||
typedef NV_STATUS (*pmaEvictRangeCb_t)(void *ctxPtr, NvU64 physBegin, NvU64 physEnd,
|
||||
MEMORY_PROTECTION prot);
|
||||
|
||||
/*!
|
||||
* @brief Pluggable data structure management. Currently we have regmap and address tree.
|
||||
|
||||
@@ -42,10 +42,11 @@ void pmaRegionPrint(PMA *pPma, PMA_REGION_DESCRIPTOR *pRegion, void *pMap);
|
||||
NvBool pmaStateCheck(PMA *pPma);
|
||||
|
||||
// Temporary putting these here. TODO refactor them in the next CL.
|
||||
NV_STATUS _pmaEvictContiguous(PMA *pPma, void *pMap, NvU64 evictStart, NvU64 evictEnd);
|
||||
NV_STATUS _pmaEvictContiguous(PMA *pPma, void *pMap, NvU64 evictStart, NvU64 evictEnd,
|
||||
MEMORY_PROTECTION prot);
|
||||
NV_STATUS _pmaEvictPages(PMA *pPma, void *pMap, NvU64 *evictPages, NvU64 evictPageCount,
|
||||
NvU64 *allocPages, NvU64 allocPageCount, NvU32 pageSize, NvU64 physBegin,
|
||||
NvU64 physEnd);
|
||||
NvU64 *allocPages, NvU64 allocPageCount, NvU32 pageSize,
|
||||
NvU64 physBegin, NvU64 physEnd, MEMORY_PROTECTION prot);
|
||||
void _pmaClearScrubBit(PMA *pPma, SCRUB_NODE *pPmaScrubList, NvU64 count);
|
||||
NV_STATUS _pmaCheckScrubbedPages(PMA *pPma, NvU64 chunkSize, NvU64 *pPages, NvU32 pageCount);
|
||||
NV_STATUS _pmaPredictOutOfMemory(PMA *pPma, NvLength allocationCount, NvU32 pageSize,
|
||||
|
||||
@@ -53,6 +53,7 @@ typedef struct EVENTNOTIFICATION EVENTNOTIFICATION;
|
||||
#define RM_PAGE_MASK 0x0FFF
|
||||
#define RM_PAGE_SHIFT 12
|
||||
#define RM_PAGE_SHIFT_64K 16
|
||||
#define RM_PAGE_SHIFT_128K 17
|
||||
|
||||
// Huge page size is 2 MB
|
||||
#define RM_PAGE_SHIFT_HUGE 21
|
||||
|
||||
39
src/nvidia/inc/kernel/gpu/nvbitmask.h
Normal file
39
src/nvidia/inc/kernel/gpu/nvbitmask.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2021-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef _NVBITMASK_H_
|
||||
#define _NVBITMASK_H_
|
||||
|
||||
#include "kernel/gpu/gpu_engine_type.h"
|
||||
|
||||
//
|
||||
// Engine Type capability mask bit-array helper MACROS to support on growing number of engine types
|
||||
// The caps is defined as
|
||||
// NvU32 caps[NVGPU_ENGINE_CAPS_MASK_ARRAY_MAX]
|
||||
//
|
||||
#define NVGPU_ENGINE_CAPS_MASK_BITS 32
|
||||
#define NVGPU_ENGINE_CAPS_MASK_ARRAY_MAX ((RM_ENGINE_TYPE_LAST-1)/NVGPU_ENGINE_CAPS_MASK_BITS + 1)
|
||||
#define NVGPU_GET_ENGINE_CAPS_MASK(caps, id) (caps[(id)/NVGPU_ENGINE_CAPS_MASK_BITS] & NVBIT((id) % NVGPU_ENGINE_CAPS_MASK_BITS))
|
||||
#define NVGPU_SET_ENGINE_CAPS_MASK(caps, id) (caps[(id)/NVGPU_ENGINE_CAPS_MASK_BITS] |= NVBIT((id) % NVGPU_ENGINE_CAPS_MASK_BITS))
|
||||
|
||||
#endif //_NVBITMASK_H_
|
||||
35
src/nvidia/inc/kernel/gpu/nvlink/common_nvlink.h
Normal file
35
src/nvidia/inc/kernel/gpu/nvlink/common_nvlink.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2020-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_NVLINK_H
|
||||
#define COMMON_NVLINK_H
|
||||
|
||||
#include "core/core.h"
|
||||
#include "kernel/gpu/nvlink/kernel_nvlink.h"
|
||||
#include "kernel/gpu/nvlink/kernel_ioctrl.h"
|
||||
|
||||
#include "ctrl/ctrl2080/ctrl2080nvlink.h" // rmcontrol params
|
||||
|
||||
NV_STATUS nvlinkCtrlCmdBusGetNvlinkCaps(OBJGPU *pGpu, NV2080_CTRL_CMD_NVLINK_GET_NVLINK_CAPS_PARAMS *pParams);
|
||||
|
||||
#endif // COMMON_NVLINK_H
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2021-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_PERF_1HZ_H
|
||||
#define KERNEL_PERF_1HZ_H
|
||||
|
||||
/* ------------------------ Includes --------------------------------------- */
|
||||
#include "gpu/gpu_resource.h"
|
||||
#include "objtmr.h"
|
||||
|
||||
/* ------------------------ Macros ----------------------------------------- */
|
||||
/* ------------------------ Datatypes -------------------------------------- */
|
||||
/*!
|
||||
* This structure represents data for managing 1HZ Callback timer
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*!
|
||||
* NV_TRUE if 1Hz callback is in progress
|
||||
*/
|
||||
NvBool b1HzTimerCallback;
|
||||
|
||||
/*!
|
||||
* TRUE if AllowMaxPerf and not in Hibernate/Standby
|
||||
*/
|
||||
NvBool bEnableTimerUpdates;
|
||||
} KERNEL_PERF_1HZ;
|
||||
|
||||
/* -------------------- Function Prototypes -------------------------------- */
|
||||
/*!
|
||||
* @brief Handle 1Hz timer callback from SW interrupts
|
||||
*
|
||||
* @param[in] pGpu OBJGPU pointer
|
||||
* @param[in] pTmr OBJTMR pointer
|
||||
* @param[in] *ptr timer callback ID
|
||||
*
|
||||
* @returns Always return NV_OK
|
||||
*
|
||||
*/
|
||||
NV_STATUS kperfTimerProc(OBJGPU *pGpu, OBJTMR *pTmr, void *ptr);
|
||||
|
||||
/*!
|
||||
* Since the function tmrCancelCallback() needs a distinct value for POBJECT,
|
||||
* we can not just use any value in the POBJECT field if we intend to use
|
||||
* tmrCancelCallback() function. For scheduling Kernel Perf related callbacks we
|
||||
* will use the unique value for the Kernel Perf by using the address of the function
|
||||
* that will be called when timer elapses.
|
||||
*/
|
||||
#define TMR_POBJECT_KERNEL_PERF_1HZ ((void *)(kperfTimerProc))
|
||||
|
||||
#endif // KERNEL_PERF_1HZ_H
|
||||
@@ -27,5 +27,9 @@
|
||||
|
||||
RMCTRL_EXPORT(NV2080_CTRL_CMD_INTERNAL_CCU_UNMAP,
|
||||
RMCTRL_FLAGS(KERNEL_PRIVILEGED, ROUTE_TO_PHYSICAL, INTERNAL))
|
||||
NV_STATUS subdeviceCtrlCmdCcuUnmap(Subdevice *pSubdevice);
|
||||
NV_STATUS subdeviceCtrlCmdCcuUnmap(Subdevice *pSubdevice, NV2080_CTRL_INTERNAL_CCU_UNMAP_INFO_PARAMS *pParams);
|
||||
|
||||
RMCTRL_EXPORT(NV2080_CTRL_CMD_INTERNAL_CCU_SET_STREAM_STATE,
|
||||
RMCTRL_FLAGS(KERNEL_PRIVILEGED, ROUTE_TO_PHYSICAL, INTERNAL))
|
||||
NV_STATUS subdeviceCtrlCmdCcuSetStreamState(Subdevice *pSubdevice, NV2080_CTRL_INTERNAL_CCU_STREAM_STATE_PARAMS *pParams);
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "mem_mgr/vaspace.h"
|
||||
#include "mem_mgr/pool_alloc.h"
|
||||
#include "gpu/mem_mgr/virt_mem_allocator_common.h"
|
||||
#include "kernel/gpu/gpu_engine_type.h"
|
||||
|
||||
// state of context buffer pools
|
||||
struct CTX_BUF_POOL_INFO
|
||||
@@ -77,7 +78,7 @@ void ctxBufPoolRelease(CTX_BUF_POOL_INFO *pCtxBufPool);
|
||||
void ctxBufPoolDestroy(CTX_BUF_POOL_INFO **ppCtxBufPool);
|
||||
NvBool ctxBufPoolIsSupported(OBJGPU *pGpu);
|
||||
NV_STATUS ctxBufPoolGetSizeAndPageSize(CTX_BUF_POOL_INFO *pCtxBufPool, OBJGPU *pGpu, NvU64 alignment, RM_ATTR_PAGE_SIZE attr, NvBool bContig, NvU64 *pSize, NvU32 *pPageSize);
|
||||
NV_STATUS ctxBufPoolGetGlobalPool(OBJGPU *pGpu, CTX_BUF_ID bufId, NvU32 engineType, CTX_BUF_POOL_INFO **ppCtxBufPool);
|
||||
NV_STATUS ctxBufPoolGetGlobalPool(OBJGPU *pGpu, CTX_BUF_ID bufId, RM_ENGINE_TYPE rmEngineType, CTX_BUF_POOL_INFO **ppCtxBufPool);
|
||||
NvBool ctxBufPoolIsScrubSkipped(CTX_BUF_POOL_INFO *pCtxBufPool);
|
||||
void ctxBufPoolSetScrubSkip(CTX_BUF_POOL_INFO *pCtxBufPool, NvBool bSkipScrub);
|
||||
#endif // _CTX_BUF_POOL_H_
|
||||
|
||||
45
src/nvidia/inc/kernel/mem_mgr/mem_list.h
Normal file
45
src/nvidia/inc/kernel/mem_mgr/mem_list.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2021 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_mem_list_nvoc.h"
|
||||
|
||||
#ifndef _MEMORY_LIST_H_
|
||||
#define _MEMORY_LIST_H_
|
||||
|
||||
#include "mem_mgr/mem.h"
|
||||
|
||||
/*!
|
||||
* These classes are used by the vGPU support to create memory objects for memory
|
||||
* assigned to a guest VM.
|
||||
*/
|
||||
NVOC_PREFIX(memlist) class MemoryList : Memory
|
||||
{
|
||||
public:
|
||||
NV_STATUS memlistConstruct(MemoryList *pMemoryList, CALL_CONTEXT *pCallContext,
|
||||
RS_RES_ALLOC_PARAMS_INTERNAL *pParams) :
|
||||
Memory(pCallContext, pParams);
|
||||
|
||||
virtual NvBool memlistCanCopy(MemoryList *pMemoryList);
|
||||
};
|
||||
|
||||
#endif
|
||||
3
src/nvidia/inc/kernel/mem_mgr/mem_multicast_fabric.h
Normal file
3
src/nvidia/inc/kernel/mem_mgr/mem_multicast_fabric.h
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
#include "g_mem_multicast_fabric_nvoc.h"
|
||||
|
||||
@@ -31,10 +31,75 @@
|
||||
#include "containers/map.h"
|
||||
#include "mem_mgr/vaspace.h"
|
||||
|
||||
#define FOR_EACH_IN_VADDR_LIST(pVaList, pVAS, vaddr) \
|
||||
{ \
|
||||
VA_LIST_MAPIter it; \
|
||||
(pVAS) = NULL; \
|
||||
(vaddr) = 0; \
|
||||
if ((pVaList)->type == VA_LIST_SIMPLE) \
|
||||
{ \
|
||||
(pVAS) = (pVaList)->impl.simple.entries[0].pVas; \
|
||||
(vaddr) = (pVaList)->impl.simple.entries[0].vAddr; \
|
||||
if ((pVAS) == NULL) \
|
||||
{ \
|
||||
(pVAS) = (pVaList)->impl.simple.entries[1].pVas; \
|
||||
(vaddr) = (pVaList)->impl.simple.entries[1].vAddr; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
it = mapIterAll(&(pVaList)->impl.map); \
|
||||
if (mapIterNext(&it)) \
|
||||
{ \
|
||||
if (mapIterNext(&it)) \
|
||||
{ \
|
||||
VA_INFO *pInfo = (VA_INFO *)it.pValue; \
|
||||
if (pInfo != NULL) \
|
||||
{ \
|
||||
(vaddr) = pInfo->vAddr; \
|
||||
(pVAS) = ((OBJVASPACE *) NvP64_VALUE(mapKey(&(pVaList)->impl.map, pInfo))); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
while ((pVAS) != NULL) \
|
||||
{
|
||||
|
||||
#define FOR_EACH_IN_VADDR_LIST_END(pVaList, pVAS, vaddr) \
|
||||
if ((pVaList)->type == VA_LIST_SIMPLE) \
|
||||
{ \
|
||||
if ((((pVAS) != (pVaList)->impl.simple.entries[1].pVas))) \
|
||||
{ \
|
||||
(pVAS) = (pVaList)->impl.simple.entries[1].pVas; \
|
||||
(vaddr) = (pVaList)->impl.simple.entries[1].vAddr; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(pVAS) = NULL; \
|
||||
(vaddr) = 0; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(pVAS) = NULL; \
|
||||
(vaddr) = 0; \
|
||||
if (mapIterNext(&it)) \
|
||||
{ \
|
||||
VA_INFO *pInfo = (VA_INFO *)it.pValue; \
|
||||
if (pInfo != NULL) \
|
||||
{ \
|
||||
(vaddr) = pInfo->vAddr; \
|
||||
(pVAS) = ((OBJVASPACE *) NvP64_VALUE(mapKey(&(pVaList)->impl.map, pInfo))); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/*!
|
||||
* Map info
|
||||
*/
|
||||
typedef struct
|
||||
typedef struct VADDR_LIST_INFO
|
||||
{
|
||||
/*!
|
||||
* Indicate whether caller should release the VA.
|
||||
@@ -42,12 +107,12 @@ typedef struct
|
||||
* Use vaListSetManaged() to change the value.
|
||||
*/
|
||||
NvBool bRelease;
|
||||
}VADDR_LIST_INFO;
|
||||
} VADDR_LIST_INFO;
|
||||
|
||||
/*!
|
||||
* Virtual memory info
|
||||
*/
|
||||
typedef struct
|
||||
typedef struct VA_INFO
|
||||
{
|
||||
/*! virtual address */
|
||||
NvU64 vAddr;
|
||||
@@ -58,31 +123,82 @@ typedef struct
|
||||
* Key 0 (pVAS == NULL) is used to store this info
|
||||
*/
|
||||
VADDR_LIST_INFO *pVaListInfo;
|
||||
}VA_INFO;
|
||||
} VA_INFO;
|
||||
|
||||
/*!
|
||||
* Dictionary that tracks active virtual memory mappings.
|
||||
* Indexed by the vaspace object pointer.
|
||||
*/
|
||||
MAKE_MAP(VA_LIST, VA_INFO);
|
||||
MAKE_MAP(VA_LIST_MAP, VA_INFO);
|
||||
|
||||
typedef enum VA_LIST_TYPE
|
||||
{
|
||||
VA_LIST_SIMPLE = 0,
|
||||
VA_LIST_DICT = 1
|
||||
} VA_LIST_TYPE;
|
||||
|
||||
/*!
|
||||
* Data structure tracking virtual addresses assigned to virtual address spaces
|
||||
* Structured to hold mappings for up to two VAS without heap allocation, and
|
||||
* arbitrary mappings beyond that point using a dictionary. Once more than two
|
||||
* mappings are added, the list will remain a dictionary until it is destroyed.
|
||||
*/
|
||||
typedef struct VA_LIST
|
||||
{
|
||||
VA_LIST_TYPE type;
|
||||
union VA_LIST_IMPL
|
||||
{
|
||||
// Simple list of up to 2 VAS
|
||||
struct VA_LIST_SIMPLE
|
||||
{
|
||||
VADDR_LIST_INFO common;
|
||||
struct VA_LIST_INLINE
|
||||
{
|
||||
OBJVASPACE *pVas;
|
||||
NvU64 vAddr;
|
||||
NvU64 refCnt;
|
||||
} entries[2];
|
||||
} simple;
|
||||
|
||||
// Dictionay mapping more than two VAS
|
||||
VA_LIST_MAP map;
|
||||
} impl;
|
||||
} VA_LIST;
|
||||
|
||||
/*! Init the tracker object */
|
||||
NV_STATUS vaListInit(VA_LIST *);
|
||||
|
||||
/*! remove all mappings */
|
||||
void vaListClear(VA_LIST *);
|
||||
|
||||
/*! Init the tracker object */
|
||||
void vaListDestroy(VA_LIST *);
|
||||
|
||||
/*!
|
||||
* Set VA lifecycle property.
|
||||
* TRUE means caller should free the VA. e.g RM managed mappings
|
||||
* FALSE means caller shouldn't free the VA. e.g UVM or KMD managed mappings.
|
||||
*/
|
||||
NV_STATUS vaListSetManaged(VA_LIST *, NvBool bManaged);
|
||||
|
||||
NvBool vaListGetManaged(VA_LIST *);
|
||||
|
||||
/*! Add a vas mapping to the tracker */
|
||||
NV_STATUS vaListAddVa(VA_LIST *, OBJVASPACE *, NvU64 vaddr);
|
||||
|
||||
/*! Remove a vas mapping to the tracker */
|
||||
NV_STATUS vaListRemoveVa(VA_LIST *, OBJVASPACE *);
|
||||
|
||||
/*! Get the vas mapping */
|
||||
NV_STATUS vaListFindVa(VA_LIST *, OBJVASPACE *, NvU64 *vaddr);
|
||||
|
||||
/*! Get the vas refCount */
|
||||
NV_STATUS vaListGetRefCount(VA_LIST *, OBJVASPACE *, NvU64 *refCount);
|
||||
|
||||
/*! Set the vas refCount */
|
||||
NV_STATUS vaListSetRefCount(VA_LIST *, OBJVASPACE *, NvU64 refCount);
|
||||
|
||||
/*! Get the number of mappings */
|
||||
NvU32 vaListMapCount(VA_LIST *);
|
||||
|
||||
#endif // VADDR_LIST_H
|
||||
|
||||
@@ -52,6 +52,7 @@ OSSimEscapeWrite stubOsSimEscapeWrite;
|
||||
OSSimEscapeWriteBuffer stubOsSimEscapeWriteBuffer;
|
||||
OSSimEscapeRead stubOsSimEscapeRead;
|
||||
OSSimEscapeReadBuffer stubOsSimEscapeReadBuffer;
|
||||
OSSetSurfaceName stubOsSetSurfaceName;
|
||||
OSCallACPI_MXMX stubOsCallACPI_MXMX;
|
||||
OSCallACPI_DSM stubOsCallACPI_DSM;
|
||||
OSCallACPI_DDC stubOsCallACPI_DDC;
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
#include "core/core.h"
|
||||
#include "rmconfig.h"
|
||||
|
||||
#include "platform/nbsi/nbsi_read.h"
|
||||
NV_STATUS getAcpiDsmObjectData(OBJGPU *, NvU8**, NvU32 *, ACPI_DSM_FUNCTION, NBSI_GLOB_TYPE, NBSI_VALIDATE);
|
||||
|
||||
NV_STATUS testIfDsmFuncSupported(OBJGPU *, ACPI_DSM_FUNCTION);
|
||||
NV_STATUS testIfDsmSubFunctionEnabled(OBJGPU *, ACPI_DSM_FUNCTION, NvU32);
|
||||
NV_STATUS remapDsmFunctionAndSubFunction(OBJGPU *, ACPI_DSM_FUNCTION *, NvU32 *);
|
||||
|
||||
104
src/nvidia/inc/kernel/platform/nbsi/nbsi_read.h
Normal file
104
src/nvidia/inc/kernel/platform/nbsi/nbsi_read.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef NBSI_READ_H
|
||||
#define NBSI_READ_H
|
||||
|
||||
#include "platform/nbsi/nbsi_table.h"
|
||||
|
||||
typedef enum _NBSI_VALIDATE
|
||||
{
|
||||
NBSI_VALIDATE_ALL = 0, // do CRC and all normal tests
|
||||
NBSI_VALIDATE_IGNORE_CRC // normal tests, skip CRC
|
||||
} NBSI_VALIDATE;
|
||||
|
||||
typedef struct OBJGPU OBJGPU;
|
||||
|
||||
NvU16 fnv1Hash16(const NvU8 * data, NvU32 dataLen);
|
||||
NvU16 fnv1Hash16Unicode(const NvU16 * data, NvU32 dataLen);
|
||||
NvU32 fnv32buf(const void *buf, NvU32 len, NvU32 hval, NvU32 prevPartHashLen);
|
||||
NvU32 fnv32bufUnicode(const void *buf, NvU32 len, NvU32 hval, NvU32 prevPartHashLen);
|
||||
void fnv1Hash20Array(const NvU8 *, NvU32, NvU32 * , NvU8);
|
||||
void fnv1Hash20ArrayUnicode(const NvU16 *, NvU32, NvU32 * , NvU8);
|
||||
NvU64 fnv1Hash64(const NvU8 * data, NvU32 dataLen);
|
||||
NvU32 getNbsiValue (OBJGPU *, NvU32, NvU16, NvU8, NvU32*, NvU8*, NvU32*, NvU32*);
|
||||
NV_STATUS initNbsiTable(OBJGPU *);
|
||||
void freeNbsiTable(OBJGPU *);
|
||||
NV_STATUS nbsiReadRegistryDword(OBJGPU *, const char *, NvU32 *);
|
||||
NV_STATUS nbsiReadRegistryString(OBJGPU *, const char *, NvU8 *, NvU32 *);
|
||||
NV_STATUS getNbsiObjByType(OBJGPU *, NvU16, NBSI_SOURCE_LOC *, NvU8 *, NvU32, NvU8 *, NvU32*, NvU32*, NvU32*, ACPI_DSM_FUNCTION, NBSI_VALIDATE);
|
||||
void initNbsiObject(NBSI_OBJ *pNbsiObj);
|
||||
NBSI_OBJ *getNbsiObject(void);
|
||||
|
||||
|
||||
/*
|
||||
* 32 bit magic FNV-0 and FNV-1 prime
|
||||
*/
|
||||
#define FNV_32_PRIME 0x01000193 // is 16777619.
|
||||
#define MASK_20 0xfffff
|
||||
#define MASK_16 0xffff
|
||||
#define FNV1_32_INIT 0x811C9DC5 // is 2166136261.
|
||||
|
||||
// State (undefined, open, bad or not present) of the nbsiTable
|
||||
#define NBSI_TABLE_UNDEFINED 0 // nbsi table initialization not called so
|
||||
// nbsiTableptr unallocated
|
||||
#define NBSI_TABLE_INIT 1 // nbsi table being opened not yet ready
|
||||
#define NBSI_TABLE_OPEN 2 // nbsi table ready for business
|
||||
#define NBSI_TABLE_BAD 3 // nbsi table structure bad
|
||||
#define NBSI_TABLE_NOTPRESENT 4 // nbsi table is not present
|
||||
|
||||
#define NBSI_TABLE_FMT_UNKNOWN 0xff // Unknown format for NBSI table
|
||||
|
||||
#define NBSI_REVISION_ID 0x00000101
|
||||
#define NVHG_NBSI_REVISION_ID 0x00000101
|
||||
|
||||
#define NBSI_FUNC_PLATCAPS 0x00000001 // Platform NBSI capabilities
|
||||
#define NBSI_FUNC_PLATPOLICY 0x00000002 // Query/Set Platform Policy
|
||||
#define NBSI_FUNC_DISPLAYSTATUS 0x00000003 // Query the Display Hot-Key
|
||||
#define NBSI_FUNC_MDTL 0x00000004 //
|
||||
#define NBSI_FUNC_CALLBACKS 0x00000005 // Get Callbacks
|
||||
#define NBSI_FUNC_GETOBJBYTYPE 0x00000006 // Get an Object by Type
|
||||
#define NBSI_FUNC_GETALLOBJS 0x00000007 // Get Driver Object
|
||||
|
||||
// Return values for NBSI_FUNC_SUPPORT call.
|
||||
#define NBSI_FUNC_PLATCAPS_SUPPORTED NVBIT(1) // Platform NBSI capabilities
|
||||
#define NBSI_FUNC_PLATPOLICY_SUPPORTED NVBIT(2) // Query/Set Platform Policy
|
||||
#define NBSI_FUNC_DISPLAYSTATUS_SUPPORTED NVBIT(3) // Query the Display Hot-Key
|
||||
#define NBSI_FUNC_MDTL_SUPPORTED NVBIT(4) //
|
||||
#define NBSI_FUNC_CALLBACKS_SUPPORTED NVBIT(5) // Get Callbacks
|
||||
#define NBSI_FUNC_GETOBJBYTYPE_SUPPORTED NVBIT(6) // Get an Object by Type
|
||||
#define NBSI_FUNC_GETALLOBJS_SUPPORTED NVBIT(7) // Get Driver Object
|
||||
|
||||
#define NBSI_READ_SIZE (4*1024) // 4K as per spec
|
||||
#define NBSI_INIT_TABLE_ALLOC_SIZE NBSI_READ_SIZE // must be larger than
|
||||
// NBSI_READ_SIZE
|
||||
|
||||
#define NBPB_FUNC_SUPPORT 0x00000000 // Function is supported?
|
||||
#define NBPB_FUNC_GETOBJBYTYPE 0x00000010 // Fetch any specific Object by Type
|
||||
#define NBPB_FUNC_GETALLOBJS 0x00000011 // Fetch all Objects
|
||||
#define NBPB_FUNC_GETTHERMALBUDGET 0x00000020 // Get the current thermal budget
|
||||
#define NBPB_FUNC_GETPSS 0x00000021 // Get the PSS table
|
||||
#define NBPB_FUNC_SETPPC 0x00000022 // Set p-State Cap
|
||||
#define NBPB_FUNC_GETPPC 0x00000023 // Get the last p-State cap set with _FUNC_SETPPC
|
||||
|
||||
#endif // NBSI_READ_H
|
||||
375
src/nvidia/inc/kernel/platform/nbsi/nbsi_table.h
Normal file
375
src/nvidia/inc/kernel/platform/nbsi/nbsi_table.h
Normal file
@@ -0,0 +1,375 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef NBSITBL_H
|
||||
#define NBSITBL_H
|
||||
|
||||
#include "ctrl/ctrl0000/ctrl0000system.h" // NV0000_SYSTEM_MAX_APPROVAL_COOKIE_STRING_LENGTH
|
||||
#include "ctrl/ctrl2080/ctrl2080bios.h" // NV2080_CTRL_BIOS_NBSI_NUM_MODULES
|
||||
#include "core/core.h"
|
||||
#include "platform/pci_exp_table.h"
|
||||
|
||||
// Maximum number of NBSI OS strings (including generic)
|
||||
#define MAX_NBSI_OS 3
|
||||
#define MAX_NBSI_OS_STR_LEN 10
|
||||
|
||||
#define NBSI_SOURCE_LOC NvU16
|
||||
|
||||
typedef enum _NBSI_TBL_SOURCES // keep in sync with nvapi.spec
|
||||
{
|
||||
NBSI_TBL_SOURCE_BEST_FIT = 0,
|
||||
NBSI_TBL_SOURCE_REGISTRY = 1,
|
||||
NBSI_TBL_SOURCE_VBIOS = 2,
|
||||
NBSI_TBL_SOURCE_SBIOS = 8,
|
||||
NBSI_TBL_SOURCE_ACPI = 0x10,
|
||||
NBSI_TBL_SOURCE_UEFI = 0x20
|
||||
} NBSI_TBL_SOURCES, * PNBSI_TBL_SOURCES;
|
||||
#define NBSI_TBL_SOURCE_MAX 6 // number of NBSI_TBL_SOURCES entries (not including BEST FIT)
|
||||
|
||||
#define NBSI_TBL_SOURCE_ALL (NBSI_TBL_SOURCE_REGISTRY | \
|
||||
NBSI_TBL_SOURCE_VBIOS | \
|
||||
NBSI_TBL_SOURCE_SBIOS | \
|
||||
NBSI_TBL_SOURCE_ACPI | \
|
||||
NBSI_TBL_SOURCE_UEFI)
|
||||
#define NBSI_TBL_SOURCE_NONE 0
|
||||
|
||||
typedef enum _NBSI_ACPI_METHOD
|
||||
{
|
||||
NBSI_TBL_SOURCE_ACPI_UNKNOWN,
|
||||
NBSI_TBL_SOURCE_ACPI_BY_OBJ_TYPE,
|
||||
NBSI_TBL_SOURCE_ACPI_BY_ALL_OBJ,
|
||||
NBSI_TBL_SOURCE_ACPI_BOTH_METHODS
|
||||
} NBSI_ACPI_METHOD, *PNBSI_ACPI_METHOD;
|
||||
|
||||
typedef struct _NBSI_CACHE_ENTRY_OBJ {
|
||||
NvU16 globType;
|
||||
NBSI_SOURCE_LOC globSource;
|
||||
NvU8 globIndex;
|
||||
NBSI_SOURCE_LOC altGlobSource;
|
||||
NvU8 altGlobIndex;
|
||||
NvU8 * pObj;
|
||||
} NBSI_CACHE_ENTRY_OBJ, *PNBSI_CACHE_ENTRY_OBJ;
|
||||
|
||||
typedef struct _NBSI_CACHE_OBJ {
|
||||
// Number of entries we've found and cached.
|
||||
NvU8 tblCacheNumEntries;
|
||||
// Maximum entries we might have.
|
||||
NvU8 tblCacheMaxNumEntries;
|
||||
// Pointers to cache entries
|
||||
PNBSI_CACHE_ENTRY_OBJ pCacheEntry[1];
|
||||
} NBSI_CACHE_OBJ, *PNBSI_CACHE_OBJ;
|
||||
|
||||
//
|
||||
// The following two structs (DRVR_VER0 and DRVR_VER) attempt to handle
|
||||
// the driver version.
|
||||
// Driver revision example: 7.15.11.7782
|
||||
// The format is: a.bb.1c.dddd
|
||||
// where a represents the OS (7 for Vista/Vista64)
|
||||
// bb represents the DX version (15 for DX10)
|
||||
// the 1 in 1c is specified by MS
|
||||
// c.dddd is the NV-specific driver version.
|
||||
// old version of this structure had byte to hold minRev but the new
|
||||
// version uses 20 bits.
|
||||
//
|
||||
typedef struct _DRVR_VER0
|
||||
{
|
||||
NvU8 majVer : 8;
|
||||
NvU8 minVer : 8;
|
||||
NvU8 majRev : 8;
|
||||
NvU8 minRev : 8;
|
||||
} DRVR_VER0, * PDRVR_VER0;
|
||||
|
||||
typedef struct _DRVR_VER
|
||||
{
|
||||
NvU32 Rev : 20;
|
||||
NvU32 DX : 8;
|
||||
NvU32 OS : 4;
|
||||
} DRVR_VER, * PDRVR_VER;
|
||||
|
||||
typedef struct _NBSI_OBJ {
|
||||
// Setting for current maximum OS strings in use.
|
||||
NvU8 curMaxNbsiOSes;
|
||||
|
||||
// Default hash strings for OS strings (done once so to speed up the system)
|
||||
NvU32 nbsiOSstrHash[MAX_NBSI_OS];
|
||||
|
||||
// Default string for a blank path hash (done once so to speed up the system)
|
||||
NvU16 nbsiBlankPathHash;
|
||||
|
||||
// Contains the OS strings.
|
||||
NvU8 nbsiOSstr[MAX_NBSI_OS][MAX_NBSI_OS_STR_LEN+1];
|
||||
NvU32 nbsiOSstrLen[MAX_NBSI_OS];
|
||||
|
||||
// Currently available locations of NBSI directory
|
||||
NBSI_SOURCE_LOC availDirLoc[NV_MAX_DEVICES];
|
||||
|
||||
// nbsi driver object save.
|
||||
NvU8 * nbsiDrvrTable[NV_MAX_DEVICES];
|
||||
|
||||
// pointer to array of pointers (cache of tables)
|
||||
PNBSI_CACHE_OBJ pTblCache[NV_MAX_DEVICES];
|
||||
|
||||
// pointer to override tables
|
||||
NvU8 * regOverrideList[NV_MAX_DEVICES];
|
||||
|
||||
// Current Driver version for best fit check.
|
||||
DRVR_VER DriverVer;
|
||||
|
||||
} NBSI_OBJ, *PNBSI_OBJ;
|
||||
|
||||
|
||||
#ifndef VARIABLE_SIZE_ARRAY
|
||||
#define VARIABLE_SIZE_ARRAY 1 // The size of this array may vary.
|
||||
#endif
|
||||
|
||||
// For offsets which are present but not defined (an error case) have
|
||||
// a predefined undefined link. This allows me to build a table which
|
||||
// has all 12 module types defined, but valid links on only the ones I'm
|
||||
// using... And I can fail the search if asked to search one that's not
|
||||
// defined.
|
||||
#define NBSI_UNDEFINED_OFFSET 0xffffffff
|
||||
|
||||
typedef enum _NBSI_ELEMENT_TYPES
|
||||
{
|
||||
NBSI_BYTE = 0,
|
||||
NBSI_WORD,
|
||||
NBSI_DWORD,
|
||||
NBSI_QWORD,
|
||||
NBSI_BYTE_ARRAY,
|
||||
NBSI_BYTE_ARRAY_EXTENDED,
|
||||
numNBSI_TYPES
|
||||
} NBSI_ELEMENT_TYPES;
|
||||
|
||||
// size of element header in bytes. 24 bits.
|
||||
#define NBSI_ELEMENT_HDRSIZ 3
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NBSI_ELEMENT
|
||||
{
|
||||
struct ELEMENT_HDR_PARTA
|
||||
{
|
||||
NvU8 type: 4;
|
||||
NvU8 lsnValueID: 4;
|
||||
} hdrPartA;
|
||||
struct ELEMENT_HDR_PARTB
|
||||
{
|
||||
NvU16 mswValueID;
|
||||
} hdrPartB;
|
||||
union ELEMENT_DATA
|
||||
{
|
||||
NvU8 dataByte;
|
||||
NvU16 dataWord;
|
||||
NvU32 dataDWord;
|
||||
NvU64 dataQWord;
|
||||
struct
|
||||
{
|
||||
NvU8 size;
|
||||
NvU8 data[VARIABLE_SIZE_ARRAY];
|
||||
} ba;
|
||||
struct
|
||||
{
|
||||
NvU16 size;
|
||||
NvU8 data[VARIABLE_SIZE_ARRAY];
|
||||
} bax;
|
||||
} data;
|
||||
} NBSI_ELEMENT, *PNBSI_ELEMENT;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NBSI_ELEMENTS
|
||||
{
|
||||
NvU32 numElements;
|
||||
NBSI_ELEMENT elements[VARIABLE_SIZE_ARRAY];
|
||||
} NBSI_ELEMENTS, *PNBSI_ELEMENTS;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NBSI_SCOPE
|
||||
{
|
||||
NvU16 pathID;
|
||||
NvU32 offset; // Relative Offset from this member i.e. &ulOffset
|
||||
} NBSI_SCOPE, *PNBSI_SCOPE;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NBSI_SCOPES
|
||||
{
|
||||
NvU32 numPaths;
|
||||
NBSI_SCOPE paths[VARIABLE_SIZE_ARRAY];
|
||||
} NBSI_SCOPES, *PNBSI_SCOPES;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NBSI_MODULE
|
||||
{
|
||||
NvU16 moduleID;
|
||||
NvU32 offset; // Relative Offset from this member i.e. &ulOffset
|
||||
} NBSI_MODULE, *PNBSI_MODULE;
|
||||
#pragma pack()
|
||||
|
||||
// Maximum understood dir version
|
||||
#define MAXNBSIDIRVER 1
|
||||
|
||||
#define NBSIDIRHDRSTRING (NvU32) (('N'<<24)+('B'<<16)+('S'<<8)+'I')
|
||||
#define MXMHDRSTRING (NvU32) (('_'<<24)+('M'<<16)+('X'<<8)+'M')
|
||||
|
||||
// A directory of globs
|
||||
#pragma pack(1)
|
||||
typedef union _NBSI_DIRECTORY
|
||||
{
|
||||
struct OLD_FORMAT // Original version for Beta
|
||||
{
|
||||
NvU8 numGlobs; // number of globs
|
||||
NvU8 dirVer; // dirVer
|
||||
NvU16 globType[1]; // NBSI_GLOB_TYPE (placeholder)
|
||||
} od;
|
||||
struct NEW_FORMAT // Shipping version
|
||||
{
|
||||
NvU32 nbsiHeaderString; // header string NBSIDIRHDRSTRING
|
||||
NvU32 size; // size of entire directory
|
||||
NvU8 numGlobs; // number of globs
|
||||
NvU8 dirVer; // dirVer
|
||||
NvU16 globType[1]; // NBSI_GLOB_TYPE (placeholder
|
||||
} d;
|
||||
} NBSI_DIRECTORY, *PNBSI_DIRECTORY;
|
||||
#pragma pack()
|
||||
|
||||
#define nbsiobjtype(ch1,ch2) (NvU16) ((ch1<<8) + ch2)
|
||||
typedef enum _NBSI_GLOB_TYPES
|
||||
{
|
||||
NBSI_RSRVD_GLOB = 0, // Reserved Glob type
|
||||
NBSI_DRIVER = nbsiobjtype('D','R'), // Driver Object
|
||||
NBSI_VBIOS = nbsiobjtype('V','B'), // VBIOS Object
|
||||
NBSI_HDCP = nbsiobjtype('H','K'), // HDCP Keys
|
||||
NBSI_INFOROM = nbsiobjtype('I','R'), // InfoROM object
|
||||
NBSI_HDD = nbsiobjtype('H','D'), // Storage Driver
|
||||
NBSI_NONVOLATILE = nbsiobjtype('N','V'), // CMOS settings
|
||||
NBSI_PLAT_INFO = nbsiobjtype('P','I'), // PlatformInfo Object
|
||||
NBSI_PLAT_INFO_WAR = nbsiobjtype('I','P'), // PlatformInfo WAR Bug 986051
|
||||
NBSI_VALKEY = nbsiobjtype('V','K'), // Validation key
|
||||
NBSI_TEGRA_INFO = nbsiobjtype('T','G'), // Tegra Info object
|
||||
NBSI_TEGRA_DCB = nbsiobjtype('T','D'), // Tegra DCB object
|
||||
NBSI_TEGRA_PANEL = nbsiobjtype('T','P'), // Tegra TPB object
|
||||
NBSI_TEGRA_DSI = nbsiobjtype('T','S'), // Tegra DSI information
|
||||
NBSI_SYS_INFO = nbsiobjtype('G','D'), // System Info object
|
||||
NBSI_TEGRA_TMDS = nbsiobjtype('T','T'), // Tegra TMDS configuration block
|
||||
NBSI_OPTIMUS_PLAT = nbsiobjtype('O','P'), // Optimus Platform key
|
||||
} NBSI_GLOB_TYPE, * PNBSI_GLOB_TYPE;
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NBSI_UID0
|
||||
{
|
||||
NvU16 svid; // Sub-system Vendor ID
|
||||
NvU16 ssid; // Sub-system Device ID
|
||||
struct {
|
||||
NvU16 vid; // Chip Vendor ID (NVIDIA)
|
||||
NvU16 did; // Chip Device ID
|
||||
NvU8 revId; // Chip RevID
|
||||
} Chip;
|
||||
DRVR_VER0 Driver; // Target Driver Version
|
||||
struct { // Target BIOS Version
|
||||
NvU8 minVer : 8;
|
||||
NvU8 majVer : 8;
|
||||
} VBIOS;
|
||||
struct { // Platform Firmware Version
|
||||
NvU8 minVer : 4;
|
||||
NvU8 majVer : 4;
|
||||
} Platform;
|
||||
} NBSI_UID0, *PNBSI_UID0;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NBSI_UID
|
||||
{
|
||||
NvU16 svid; // Sub-system Vendor ID
|
||||
NvU16 ssid; // Sub-system Device ID
|
||||
struct {
|
||||
NvU16 vid; // Chip Vendor ID (NVIDIA)
|
||||
NvU16 did; // Chip Device ID
|
||||
NvU8 revId; // Chip RevID
|
||||
} Chip;
|
||||
DRVR_VER Driver; // Target Driver Version
|
||||
struct { // Target BIOS Version
|
||||
NvU8 minVer : 8;
|
||||
NvU8 majVer : 8;
|
||||
} VBIOS;
|
||||
struct { // Platform Firmware Version
|
||||
NvU8 minVer : 4;
|
||||
NvU8 majVer : 4;
|
||||
} Platform;
|
||||
} NBSI_UID, *PNBSI_UID;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _DSM_GEN_OBJ_HDR
|
||||
{
|
||||
NvU64 sig; // Common hash signature
|
||||
NvU16 globType; // NBSI_GLOB_TYPE (i.e. NBSI_HDCP, NBSI_VALKEY etc.)
|
||||
NvU32 size; // Entire size in bytes object, including header and object data.
|
||||
NvU16 majMinVer; // Version of Generic Object in Maj:Min format
|
||||
} DSM_GEN_OBJ_HDR, *PDSM_GEN_OBJ_HDR;
|
||||
#pragma pack()
|
||||
#define DSM_GEN_HDR_SIZE (sizeof(DSM_GEN_OBJ_HDR))
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NBSI_GEN_OBJ
|
||||
{
|
||||
DSM_GEN_OBJ_HDR objHdr;
|
||||
// actual packed object data
|
||||
NvU8 objData[VARIABLE_SIZE_ARRAY];
|
||||
} NBSI_GEN_OBJ, *PNBSI_GEN_OBJ;
|
||||
#pragma pack()
|
||||
#define NBSI_GEN_HDR_SIZE (sizeof(NBSI_GEN_OBJ)-VARIABLE_SIZE_ARRAY)
|
||||
|
||||
#define NBSI_MAX_TABLE_SIZE (256*1024) // define some maximum size
|
||||
#define NBSI_MIN_GEN_OBJ_SIZE NBSI_GEN_HDR_SIZE
|
||||
|
||||
#define NBSI_DRIVERVER_0100 0x0100
|
||||
#pragma pack(1)
|
||||
typedef struct _NBSI_DRIVER_OBJ0
|
||||
{
|
||||
DSM_GEN_OBJ_HDR objHdr; // object header. globType = NBSI_GLOB_TYPE ('DR')
|
||||
NBSI_UID0 uid; // Platform UID
|
||||
NvU32 numModules;
|
||||
// num_modules may vary... this is placeholder
|
||||
NBSI_MODULE modules[NV2080_CTRL_BIOS_NBSI_NUM_MODULES];
|
||||
// actual packed object data
|
||||
NvU8 objData[VARIABLE_SIZE_ARRAY];
|
||||
} NBSI_DRIVER_OBJ0, *PNBSI_DRIVER_OBJ0;
|
||||
#pragma pack()
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _NBSI_DRIVER_OBJ
|
||||
{
|
||||
DSM_GEN_OBJ_HDR objHdr; // object header. globType = NBSI_GLOB_TYPE ('DR')
|
||||
NBSI_UID uid; // Platform UID
|
||||
NvU32 numModules;
|
||||
// num_modules may vary... this is placeholder
|
||||
NBSI_MODULE modules[NV2080_CTRL_BIOS_NBSI_NUM_MODULES];
|
||||
// actual packed object data
|
||||
NvU8 objData[VARIABLE_SIZE_ARRAY];
|
||||
} NBSI_DRIVER_OBJ, *PNBSI_DRIVER_OBJ;
|
||||
#pragma pack()
|
||||
|
||||
#endif // NBSITBL_H
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
#include "g_platform_request_handler_nvoc.h"
|
||||
|
||||
281
src/nvidia/inc/kernel/platform/platform_request_handler_utils.h
Normal file
281
src/nvidia/inc/kernel/platform/platform_request_handler_utils.h
Normal file
@@ -0,0 +1,281 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2011-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef _PLATFORM_REQUEST_HANDLER_UTILS_H_
|
||||
#define _PLATFORM_REQUEST_HANDLER_UTILS_H_
|
||||
|
||||
//_PCONTROL
|
||||
//_PCONTROL response from driver to SBIOS
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RES 3:0
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RES_CHANGE_EVENT (0)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RES_VPSTATE_INFO (1)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RES_VPSTATE_SET (2)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RES_VPSTATE_UPDATE (3)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RESERVED 7:4
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RESERVED_BITS (0)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_LAST_VPSTATE_LIMIT 15:8
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_INDEX_PSTATE 15:8
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_SLOW_EXT_VPSTATE 23:16
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_FAST_VPSTATE 31:24
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_MAPPING_VPSTATE 31:24
|
||||
|
||||
//_PCONTROL request from SBIOS to driver
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_REQ 3:0
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_REQ_NO_ACTION (0)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_REQ_VPSTATE_INFO (1)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_REQ_VPSTATE_SET (2)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_REQ_VPSTATE_UPDATE (3)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RESERVED1 7:4
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RESERVED1_BITS (0)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_INDEX_PSTATE 15:8
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_MAX_VPSTATE_LEVEL 15:8
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RESERVED2 30:16
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_RESERVED2_BITS (0)
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_BIT_31 31:31
|
||||
#define NV_PB_PFM_REQ_HNDLR_PCTRL_BIT_31_ZERO (0)
|
||||
|
||||
|
||||
/*
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_PSHAREDATA
|
||||
*
|
||||
* This structure represents a block of PSHARE data from SBIOS
|
||||
*
|
||||
* status
|
||||
* settings per spec
|
||||
* ulVersion
|
||||
* (Major(16 bits):Minor(16 bits), current v1.0)
|
||||
* Little endian format 0x00, 0x00, 0x01, 0x00
|
||||
* tGpu
|
||||
* GPU temperature (not provided by system)
|
||||
*
|
||||
* ctgp
|
||||
* Configurable TGP limit
|
||||
*/
|
||||
typedef struct NV0000_CTRL_PFM_REQ_HNDLR_PSHAREDATA {
|
||||
// Header to sensor structure
|
||||
NvU32 status;
|
||||
NvU32 ulVersion;
|
||||
|
||||
NvU32 tGpu;
|
||||
NvU32 ctgp;
|
||||
} NV0000_CTRL_PFM_REQ_HNDLR_PSHAREDATA, *PNV0000_CTRL_PFM_REQ_HNDLR_PSHAREDATA;
|
||||
|
||||
/*
|
||||
* Begin defines for access to ACPI calls, these
|
||||
* are used in the RM, so we'd like to get them
|
||||
* in, even though the CTRL call is not ready.
|
||||
* NV0000_CTRL_CMD_CALL_PFM_REQ_HNDLR_ACPI
|
||||
*
|
||||
* This command is used to send ACPI commands for PlatformRequestHandler compliant SBIOS
|
||||
* to the RM to be executed by system BIOS. Results of those SBIOS
|
||||
* command are returned through this interface.
|
||||
*
|
||||
* cmd
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_TYPE
|
||||
* Gets system configuration Information.
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_SUPPORT
|
||||
* Gets bit mask of supported functions
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_PCONTROL
|
||||
* Sets GPU power control features.
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_PSHARESTATUS
|
||||
* Gets System PShare Status
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_GETPPL
|
||||
* Execute ACPI GETPPL command.
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_SETPPL
|
||||
* Execute ACPI SETPPL command.
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_PSHAREPARAMS
|
||||
* Get sensor information and capabilities.
|
||||
* input
|
||||
* Used for single DWORD (32 bit) values as input to
|
||||
* the requested ACPI call.
|
||||
*
|
||||
*/
|
||||
typedef struct _NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CTRL
|
||||
{
|
||||
NvU32 cmd;
|
||||
NvU32 input;
|
||||
} NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CTRL;
|
||||
|
||||
/*
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_OUTPUT
|
||||
*
|
||||
* This structure represents the output from a single ACPI call.
|
||||
*
|
||||
* result
|
||||
* The ACPI return code for the operation attempted.
|
||||
* pBuffer
|
||||
* This field returns a pointer the buffer of data requested.
|
||||
* bufferSz
|
||||
* This field returns the size of returned data in above pBuffer.
|
||||
*/
|
||||
typedef struct _NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_OUTPUT
|
||||
{
|
||||
NvU32 result[2];
|
||||
NvU8 *pBuffer;
|
||||
NvU16 bufferSz;
|
||||
} NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_OUTPUT;
|
||||
|
||||
|
||||
/*
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_PARAMS
|
||||
*
|
||||
* This structure represents a parameter block of data to describe an
|
||||
* ACPI request, and return it's output.
|
||||
*
|
||||
* ctrl
|
||||
* The ACPI request for the operation attempted.
|
||||
* output
|
||||
* Output structure from the executed ACPI command.
|
||||
*/
|
||||
typedef struct _NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_PARAMS
|
||||
{
|
||||
NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CTRL ctrl;
|
||||
NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_OUTPUT output;
|
||||
} NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_PARAMS;
|
||||
|
||||
/*
|
||||
* NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_PARAMS_EX
|
||||
*
|
||||
* Used for PPL and TRL calls, which have up to three input DWORDs and three
|
||||
* output DWORDs.
|
||||
*/
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_PARAMS_EX_MAX_SZ (3)
|
||||
|
||||
typedef struct _NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_PARAMS_EX
|
||||
{
|
||||
NvU32 pfmreqhndlrFunc;
|
||||
NvU16 inSize;
|
||||
NvU16 outSize;
|
||||
NvU32 input[NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_PARAMS_EX_MAX_SZ];
|
||||
NvU32 output[NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_PARAMS_EX_MAX_SZ];
|
||||
} NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_PARAMS_EX;
|
||||
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_TYPE 8:0
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_SUPPORT (GPS_FUNC_SUPPORT)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_PCONTROL (GPS_FUNC_PCONTROL)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_PSHARESTATUS (GPS_FUNC_PSHARESTATUS)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_GETPPL (GPS_FUNC_GETPPL)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_SETPPL (GPS_FUNC_SETPPL)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_GETTRL (GPS_FUNC_GETTRL)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_SETTRL (GPS_FUNC_SETTRL)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_GETPPM (GPS_FUNC_GETPPM)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_SETPPM (GPS_FUNC_SETPPM)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_CALL_ACPI_CMD_PSHAREPARAMS (GPS_FUNC_PSHAREPARAMS)
|
||||
|
||||
// PFM_REQ_HNDLR_SUPPORT output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_SUPPORTED_SUPPORT_AVAIL 0:0
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_SUPPORTED_PCONTROL_AVAIL 28:28
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_SUPPORTED_PSHARESTATUS_AVAIL 32:32
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_SUPPORTED_GETPPL_AVAIL 36:36
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_SUPPORTED_SETPPL_AVAIL 37:37
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_SUPPORTED_GETTRL_AVAIL 38:38
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_SUPPORTED_SETTRL_AVAIL 39:39
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_SUPPORTED_GETPPM_AVAIL 40:40
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_SUPPORTED_SETPPM_AVAIL 41:41
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_SUPPORTED_PSHAREPARAMS_AVAIL 42:42
|
||||
|
||||
// PFM_REQ_HNDLR_PCONTROL
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_REQ_TYPE 3:0
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_REQ_TYPE_EVENT_RESP (0x00) // input only
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_REQ_TYPE_EVENT_DONE (0x00) // output only
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_REQ_TYPE_VPSTATE_INFO (0x01) // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_REQ_TYPE_NEW_VP_STATE (0x02) // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_REQ_TYPE_UPDATE_VP_STATE (0x03) // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_VPSTATE_LIMIT 15:8 // input request type 0, 2, or 3; output request type 2
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_PSTATE_IDX 15:8 // input request type 1; output request type 1
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_SLOWEST_VPSTATE 23:16 // input only
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_FASTEST_VPSTATE 31:24 // input request type 0, 2, or 3
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PCONTROL_VPSTATE_MAPPING 31:24 // input request type 1
|
||||
|
||||
// PFM_REQ_HNDLR_PSHARESTATUS
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_UPDATE_LIMIT 0:0 // output only
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_UPDATE_LIMIT_NOT_PENDING (0)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_UPDATE_LIMIT_PENDING (1)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_DO_NOT_USE 19:1
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_PLAT_USER_CONFIG_TGP_MODE_SUPPORT 20:20 // output only
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_PLAT_USER_CONFIG_TGP_MODE_SUPPORT_DISABLE (0)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_PLAT_USER_CONFIG_TGP_MODE_SUPPORT_ENABLE (1)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_EDPPEAK_LIMIT_UPDATE 21:21 // output only
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_EDPPEAK_LIMIT_UPDATE_FALSE (0)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_EDPPEAK_LIMIT_UPDATE_TRUE (1)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_USER_CONFIG_TGP_MODE 22:22 // output only
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_USER_CONFIG_TGP_MODE_DISABLE (0)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARESTATUS_USER_CONFIG_TGP_MODE_ENABLE (1)
|
||||
|
||||
|
||||
// Shared by GETPPL, SETPPL
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPL_ARGS_COUNT (3)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPL_ARGS_VERSION_IDX (0)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPL_ARG0_VERSION_MINOR 15:0 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPL_ARG0_VERSION_MAJOR 31:16 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPL_ARG0_VERSION_MAJOR_V1 (1) // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPL_ARGS_LIMIT1_IDX (1) // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPL_ARGS_LIMIT2_IDX (2) // input & output
|
||||
|
||||
// Shared by GETTRL, SETTRL
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_TRL_ARGS_COUNT (2)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_TRL_ARGS_VERSION_IDX (0)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_TRL_ARG0_VERSION_MINOR 15:0 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_TRL_ARG0_VERSION_MAJOR 31:16 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_TRL_ARG0_VERSION_MAJOR_V1 (1) // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_TRL_ARGS_FREQ_MHZ_IDX (1) // input & output
|
||||
|
||||
// Shared by GETPPM, SETPPM
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPM_ARGS_COUNT (2)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPM_ARGS_VERSION_IDX (0)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPM_ARG0_VERSION_MINOR 15:0 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPM_ARG0_VERSION_MAJOR 31:16 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPM_ARG0_VERSION_MAJOR_V1 (1) // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPM_ARGS_IDX (1) // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPM_ARGS_INDEX 7:0 // output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PPM_ARGS_AVAILABLE_MASK 15:8 // output
|
||||
|
||||
//
|
||||
// PFM_REQ_HNDLR_PSHARE_PARAMS
|
||||
// status bits
|
||||
//
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_QUERY_TYPE 3:0 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_QUERY_TYPE_CURRENT_INFO (0x00)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_QUERY_TYPE_SUPPORTED_FIELDS (0x01)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_QUERY_TYPE_CURRENT_LIMITS (0x02)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_TGPU 8:8 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_TGPU_FALSE (0)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_TGPU_TRUE (1)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_DO_NOT_USE 14:9 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_CTGP 15:15 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_CTGP_FALSE (0)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_CTGP_TRUE (1)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_PPMD 16:16 // input & output
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_PPMD_FALSE (0)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_PSHARE_PARAMS_STATUS_PPMD_TRUE (1)
|
||||
|
||||
//
|
||||
// A mapping from ACPI DSM and SW support dsm version.
|
||||
// The SW might emulate 1x based on other parameters
|
||||
//
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_ACPI_REVISION_SW_1X (0x00000100)
|
||||
#define NV0000_CTRL_PFM_REQ_HNDLR_ACPI_REVISION_SW_2X (0x00000200)
|
||||
|
||||
|
||||
#endif // _PLATFORM_REQUEST_HANDLER_UTILS_H_
|
||||
|
||||
@@ -34,6 +34,18 @@
|
||||
struct NVOC_EXPORTED_METHOD_DEF;
|
||||
typedef RS_RES_CONTROL_PARAMS_INTERNAL RmCtrlParams;
|
||||
|
||||
// RMCTRL_API_COPPY_FLAGS is used to specify control api copy behavior.
|
||||
#define RMCTRL_API_COPY_FLAGS_NONE 0x00000000
|
||||
|
||||
// skip memory copy in api copy in
|
||||
#define RMCTRL_API_COPY_FLAGS_SKIP_COPYIN NVBIT(0)
|
||||
|
||||
// set control cache on api copy out
|
||||
#define RMCTRL_API_COPY_FLAGS_SET_CONTROL_CACHE NVBIT(1)
|
||||
|
||||
// skip copy out even for controls with RMCTRL_FLAGS_COPYOUT_ON_ERROR
|
||||
#define RMCTRL_API_COPY_FLAGS_FORCE_SKIP_COPYOUT_ON_ERROR NVBIT(2)
|
||||
|
||||
//
|
||||
// RmCtrlExecuteCookie
|
||||
//
|
||||
@@ -49,6 +61,9 @@ struct RS_CONTROL_COOKIE
|
||||
// Rmctrl Flags
|
||||
NvU32 ctrlFlags;
|
||||
|
||||
// API Copy Flags
|
||||
NvU32 apiCopyFlags;
|
||||
|
||||
// Required Access Rights for this command
|
||||
const RS_ACCESS_MASK rightsRequired;
|
||||
|
||||
@@ -248,6 +263,33 @@ NV_STATUS embeddedParamCopyOut(RMAPI_PARAM_COPY *pParamCopy, RmCtrlParams *pRmC
|
||||
// ??
|
||||
#define RMCTRL_FLAGS_ALLOW_WITHOUT_SYSMEM_ACCESS 0x000010000
|
||||
|
||||
//
|
||||
// This flag specifies that the control can be run by an admin privileged
|
||||
// client running in a full SRIOV, vGPU-GSP-ENABLED hypervisor environment.
|
||||
// Overrides regular privilege level flags.
|
||||
//
|
||||
#define RMCTRL_FLAGS_CPU_PLUGIN_FOR_VGPU_GSP 0x000020000
|
||||
|
||||
//
|
||||
// This flag specifies that the control can be run by an admin privileged
|
||||
// client running in a full SRIOV, vGPU-GSP-DISABLED hypervisor environment.
|
||||
// Overrides regular privilege level flags.
|
||||
//
|
||||
#define RMCTRL_FLAGS_CPU_PLUGIN_FOR_SRIOV 0x000040000
|
||||
|
||||
//
|
||||
// This flag specifies that the control can be run by an admin privileged
|
||||
// client running in a non-SRIOV or SRIOV-Heavy hypervisor environment.
|
||||
// Overrides regular privilege level flags.
|
||||
//
|
||||
#define RMCTRL_FLAGS_CPU_PLUGIN_FOR_LEGACY 0x000080000
|
||||
|
||||
//
|
||||
// This flag specifies that the control can be run by an unprivileged
|
||||
// client running in GSP-RM when SRIOV and vGPU-GSP are ENABLED.
|
||||
// Overrides regular privilege level flags.
|
||||
//
|
||||
#define RMCTRL_FLAGS_GSP_PLUGIN_FOR_VGPU_GSP 0x000100000
|
||||
|
||||
//
|
||||
// 'ACCESS_RIGHTS' Attribute
|
||||
|
||||
@@ -56,7 +56,6 @@ void Nv04VidHeapControl (NVOS32_PARAMETERS*);
|
||||
void Nv04IdleChannels (NVOS30_PARAMETERS*);
|
||||
void Nv04MapMemory (NVOS33_PARAMETERS*);
|
||||
void Nv04UnmapMemory (NVOS34_PARAMETERS*);
|
||||
void Nv04UpdateContextDma (NVOS37_PARAMETERS*);
|
||||
void Nv04I2CAccess (NVOS_I2C_ACCESS_PARAMS*);
|
||||
void Nv04AllocContextDma (NVOS39_PARAMETERS*);
|
||||
void Nv04BindContextDma (NVOS49_PARAMETERS*);
|
||||
@@ -77,7 +76,6 @@ void Nv04VidHeapControlUser (NVOS32_PARAMETERS*);
|
||||
void Nv04IdleChannelsUser (NVOS30_PARAMETERS*);
|
||||
void Nv04MapMemoryUser (NVOS33_PARAMETERS*);
|
||||
void Nv04UnmapMemoryUser (NVOS34_PARAMETERS*);
|
||||
void Nv04UpdateContextDmaUser (NVOS37_PARAMETERS*);
|
||||
void Nv04I2CAccessUser (NVOS_I2C_ACCESS_PARAMS*);
|
||||
void Nv04AllocContextDmaUser (NVOS39_PARAMETERS*);
|
||||
void Nv04BindContextDmaUser (NVOS49_PARAMETERS*);
|
||||
@@ -98,7 +96,6 @@ void Nv04VidHeapControlKernel (NVOS32_PARAMETERS*);
|
||||
void Nv04IdleChannelsKernel (NVOS30_PARAMETERS*);
|
||||
void Nv04MapMemoryKernel (NVOS33_PARAMETERS*);
|
||||
void Nv04UnmapMemoryKernel (NVOS34_PARAMETERS*);
|
||||
void Nv04UpdateContextDmaKernel (NVOS37_PARAMETERS*);
|
||||
void Nv04I2CAccessKernel (NVOS_I2C_ACCESS_PARAMS*);
|
||||
void Nv04AllocContextDmaKernel (NVOS39_PARAMETERS*);
|
||||
void Nv04BindContextDmaKernel (NVOS49_PARAMETERS*);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2020 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "os/os.h"
|
||||
#include "rmapi/resource.h"
|
||||
|
||||
struct P2PApi;
|
||||
typedef struct VirtualMemory VirtualMemory;
|
||||
typedef struct Memory Memory;
|
||||
|
||||
@@ -59,7 +58,7 @@ struct _def_client_dma_mapping_info
|
||||
NvU64 FbApertureLen[NV_MAX_SUBDEVICES]; // GPU aperture mapped lengths
|
||||
MEMORY_DESCRIPTOR *pMemDesc; // Subregion to be mapped
|
||||
NvU32 Flags;
|
||||
struct P2PApi *pP2PInfo;
|
||||
NvBool bP2P;
|
||||
NvU32 gpuMask;
|
||||
ADDRESS_TRANSLATION addressTranslation;
|
||||
MEMORY_DESCRIPTOR *pBar1P2PVirtMemDesc; // The peer GPU mapped BAR1 region
|
||||
|
||||
@@ -262,16 +262,21 @@ NV_STATUS RmConfigSetEx (NvHandle, NvHandle, NvU32, NvP64, NvU32, NvBool);
|
||||
|
||||
/**
|
||||
* Control cache API.
|
||||
* Every function except rmapiControlCacheInit and rmapiControlCacheFree is thread safe.
|
||||
*/
|
||||
void rmapiControlCacheInit(void);
|
||||
NvBool rmapiControlIsCacheable(NvU32 flags, NvBool isGSPClient);
|
||||
void* rmapiControlCacheGet(NvHandle hClient, NvHandle hObject, NvU32 cmd);
|
||||
NV_STATUS rmapiControlCacheInit(void);
|
||||
NvBool rmapiControlIsCacheable(NvU32 flags, NvU32 accessRight, NvBool bAllowInternal);
|
||||
NvBool rmapiCmdIsCacheable(NvU32 cmd, NvBool bAllowInternal);
|
||||
NV_STATUS rmapiControlCacheGet(NvHandle hClient, NvHandle hObject, NvU32 cmd,
|
||||
void* params, NvU32 paramsSize);
|
||||
NV_STATUS rmapiControlCacheSet(NvHandle hClient, NvHandle hObject, NvU32 cmd,
|
||||
void* params, NvU32 paramsSize);
|
||||
const void* params, NvU32 paramsSize);
|
||||
NV_STATUS rmapiControlCacheSetGpuInstForObject(NvHandle hClient, NvHandle hObject, NvU32 gpuInst);
|
||||
void rmapiControlCacheFreeAllCacheForGpu(NvU32 gpuInst);
|
||||
void rmapiControlCacheSetMode(NvU32 mode);
|
||||
NvU32 rmapiControlCacheGetMode(void);
|
||||
void rmapiControlCacheFree(void);
|
||||
void rmapiControlCacheFreeClient(NvHandle hClient);
|
||||
void rmapiControlCacheFreeObject(NvHandle hClient, NvHandle hObject);
|
||||
void rmapiControlCacheFreeClientEntry(NvHandle hClient);
|
||||
void rmapiControlCacheFreeObjectEntry(NvHandle hClient, NvHandle hObject);
|
||||
|
||||
typedef struct _RM_API_CONTEXT {
|
||||
NvU32 gpuMask;
|
||||
@@ -362,7 +367,7 @@ rmapiInitLockInfo
|
||||
#define RM_LOCK_MODULES_TMR RM_LOCK_MODULE_VAL(0x000800, 0x04)
|
||||
|
||||
#define RM_LOCK_MODULES_I2C RM_LOCK_MODULE_VAL(0x001000, 0x00)
|
||||
#define RM_LOCK_MODULES_GPS RM_LOCK_MODULE_VAL(0x001000, 0x01)
|
||||
#define RM_LOCK_MODULES_PFM_REQ_HNDLR RM_LOCK_MODULE_VAL(0x001000, 0x01)
|
||||
#define RM_LOCK_MODULES_SEC2 RM_LOCK_MODULE_VAL(0x001000, 0x02)
|
||||
#define RM_LOCK_MODULES_THERM RM_LOCK_MODULE_VAL(0x001000, 0x03)
|
||||
#define RM_LOCK_MODULES_INFOROM RM_LOCK_MODULE_VAL(0x001000, 0x04)
|
||||
|
||||
@@ -55,4 +55,9 @@ rmapiutilFreeClientAndDeviceHandles
|
||||
//
|
||||
NvBool rmapiutilIsExternalClassIdInternalOnly(NvU32 externalClassId);
|
||||
|
||||
//
|
||||
// Return the flags and access right associated with this RM control command
|
||||
//
|
||||
NV_STATUS rmapiutilGetControlInfo(NvU32 cmd, NvU32 *pFlags, NvU32 *pAccessRight);
|
||||
|
||||
#endif /* RMAPI_UTILS_H */
|
||||
|
||||
98
src/nvidia/inc/kernel/virtualization/common_vgpu_mgr.h
Normal file
98
src/nvidia/inc/kernel/virtualization/common_vgpu_mgr.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 1993-2022 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.
|
||||
*/
|
||||
|
||||
#ifndef __common_vgpu_mgr_h__
|
||||
#define __common_vgpu_mgr_h__
|
||||
|
||||
#include "gpu/gpu.h"
|
||||
#include "gpu/fifo/kernel_fifo.h"
|
||||
#include "ctrl/ctrla081.h"
|
||||
|
||||
#include "containers/list.h"
|
||||
|
||||
#define MAX_VGPU_TYPES_PER_PGPU NVA081_MAX_VGPU_TYPES_PER_PGPU
|
||||
#define VGPU_CONFIG_PARAMS_MAX_LENGTH 1024
|
||||
#define VGPU_STRING_BUFFER_SIZE NVA081_VGPU_STRING_BUFFER_SIZE
|
||||
#define VGPU_UUID_SIZE NVA081_VM_UUID_SIZE
|
||||
#define VGPU_MAX_GFID 64
|
||||
#define VGPU_SIGNATURE_SIZE NVA081_VGPU_SIGNATURE_SIZE
|
||||
#define MAX_VGPU_DEVICES_PER_PGPU NVA081_MAX_VGPU_PER_PGPU
|
||||
|
||||
/* This structure represents the vGPU type's attributes */
|
||||
typedef struct
|
||||
{
|
||||
NvU32 vgpuTypeId;
|
||||
NvU8 vgpuName[VGPU_STRING_BUFFER_SIZE];
|
||||
NvU8 vgpuClass[VGPU_STRING_BUFFER_SIZE];
|
||||
NvU8 license[NV_GRID_LICENSE_INFO_MAX_LENGTH];
|
||||
NvU8 licensedProductName[NV_GRID_LICENSE_INFO_MAX_LENGTH];
|
||||
NvU32 maxInstance;
|
||||
NvU32 numHeads;
|
||||
NvU32 maxResolutionX;
|
||||
NvU32 maxResolutionY;
|
||||
NvU32 maxPixels;
|
||||
NvU32 frlConfig;
|
||||
NvU32 cudaEnabled;
|
||||
NvU32 eccSupported;
|
||||
NvU32 gpuInstanceSize;
|
||||
NvU32 multiVgpuSupported;
|
||||
NvU64 vdevId NV_ALIGN_BYTES(8);
|
||||
NvU64 pdevId NV_ALIGN_BYTES(8);
|
||||
NvU64 profileSize NV_ALIGN_BYTES(8);
|
||||
NvU64 fbLength NV_ALIGN_BYTES(8);
|
||||
NvU64 gspHeapSize NV_ALIGN_BYTES(8);
|
||||
NvU64 fbReservation NV_ALIGN_BYTES(8);
|
||||
NvU64 mappableVideoSize NV_ALIGN_BYTES(8);
|
||||
NvU32 encoderCapacity;
|
||||
NvU64 bar1Length NV_ALIGN_BYTES(8);
|
||||
NvU32 frlEnable;
|
||||
NvU32 gpuDirectSupported;
|
||||
NvU32 nvlinkP2PSupported;
|
||||
NvU8 vgpuExtraParams[VGPU_CONFIG_PARAMS_MAX_LENGTH];
|
||||
NvU8 vgpuSignature[VGPU_SIGNATURE_SIZE];
|
||||
} VGPU_TYPE;
|
||||
|
||||
MAKE_LIST(VGPU_TYPE_LIST, VGPU_TYPE);
|
||||
|
||||
void
|
||||
vgpuMgrFillVgpuType(NVA081_CTRL_VGPU_INFO *pVgpuInfo, VGPU_TYPE *pVgpuTypeNode);
|
||||
|
||||
NV_STATUS
|
||||
vgpuMgrReserveSystemChannelIDs(OBJGPU *pGpu,
|
||||
VGPU_TYPE *vgpuTypeInfo,
|
||||
NvU32 gfid,
|
||||
NvU32 *pChidOffset,
|
||||
NvHandle hClient,
|
||||
NvU32 numChannels,
|
||||
NvU32 engineFifoListNumEntries,
|
||||
FIFO_ENGINE_LIST *engineFifoList);
|
||||
|
||||
void
|
||||
vgpuMgrFreeSystemChannelIDs(OBJGPU *pGpu,
|
||||
NvU32 gfid,
|
||||
NvU32 *pChidOffset,
|
||||
NvHandle hClient,
|
||||
NvU32 engineFifoListNumEntries,
|
||||
FIFO_ENGINE_LIST *engineFifoList);
|
||||
|
||||
#endif // __common_vgpu_mgr_h__
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
#include "g_kernel_hostvgpudeviceapi_nvoc.h"
|
||||
|
||||
3
src/nvidia/inc/kernel/virtualization/kernel_vgpu_mgr.h
Normal file
3
src/nvidia/inc/kernel/virtualization/kernel_vgpu_mgr.h
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
#include "g_kernel_vgpu_mgr_nvoc.h"
|
||||
|
||||
3
src/nvidia/inc/kernel/virtualization/vgpuconfigapi.h
Normal file
3
src/nvidia/inc/kernel/virtualization/vgpuconfigapi.h
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
#include "g_vgpuconfigapi_nvoc.h"
|
||||
|
||||
Reference in New Issue
Block a user