-
Notifications
You must be signed in to change notification settings - Fork 99
Memory
Memory is a resource and is represented in this design by a class called MemBuffer. Due to the intrinsic complexity of managing all the various ways memory can be allocated a user space class had to be created to encapsulate it. There is physically contiguous memory, and there is virtually contiguous memory, which is called discontiguous memory in this design. Then there are various alignments which can be specified. Discontiguous memory can be allocated specifying an offset into the 1st page of its allocated area. It can also be specified by stating which alignment one desires, or nothing can be specified and the OS returns heap memory which is has available.
MemBuffer resources are used to describe the user data associated with any particular command. It does not represent the meta data memory associated with a command. Meta data is contiguous, but it must be handled in a different manner than the contiguous memory backing an ACQ/ASQ/IOCQ/IOSQ. The memory backing an IOCQ/IOSQ can be contiguous, but there are admin commands which must specify, as user data, the memory to which backs those resources. So even in IOCQ/IOSQ cases we can consider the physically contiguous memory as user data. There are no commands needed to create ACQ/ASQ resources, however the framework still requires C++ objects in user space to represent them. There simply won't be any associated command to create them like for IOQ resources.
MemBuffer resources can be created with test or group lifetimes and so are also supported by the gRsrcMngr.
Some general rules of thumb to follow for tnvme is that any memory allocated in user space, by tnvme, is considered discontiguous. All discontiguous memory will have a PRP list associated with describing it. All memory allocated by the kernel, dnvme, is considered contiguous. All contiguous memory will not have a PRP list to describe it, rather it requires a PRP pointer to describe the entire buffer because it is physically contiguous and no discontinuities will be found when a DUT traverses through it.