WO2015061970A1 - Method and device for accessing internal memory - Google Patents

Method and device for accessing internal memory Download PDF

Info

Publication number
WO2015061970A1
WO2015061970A1 PCT/CN2013/086167 CN2013086167W WO2015061970A1 WO 2015061970 A1 WO2015061970 A1 WO 2015061970A1 CN 2013086167 W CN2013086167 W CN 2013086167W WO 2015061970 A1 WO2015061970 A1 WO 2015061970A1
Authority
WO
WIPO (PCT)
Prior art keywords
physical memory
memory address
data
address information
physical
Prior art date
Application number
PCT/CN2013/086167
Other languages
French (fr)
Chinese (zh)
Inventor
姚传群
王俊杰
彭伟林
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201380004536.4A priority Critical patent/CN104169891B/en
Priority to PCT/CN2013/086167 priority patent/WO2015061970A1/en
Publication of WO2015061970A1 publication Critical patent/WO2015061970A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources

Definitions

  • the present invention relates to the field of computers, and in particular, to a method and device for accessing a memory. Background technique
  • the physical memory of the computer system there is not only system memory for storing the computer operating system, but also dedicated functional memory for storing data when the computer implements a specific function.
  • the dedicated functional memory and the system memory are distributed without isolation.
  • the memory for example, in the central processing unit (CPU), the Field-Programmable Gate Array (FPGA) implements the packet forwarding system, the physical memory A memory is allocated for forwarding memory (dedicated functional memory) for storing message queues (Queues), data buffers (Buffers), message pointers, forwarding memory, and system memory without isolation in physical memory. And the FPGA realizes the interaction of the data cache location through the message queue, and then obtains the corresponding data through the obtained message queue content.
  • FPGA Field-Programmable Gate Array
  • Embodiments of the present invention provide a method and device for accessing a memory, which effectively improves the security of the system memory.
  • a method of accessing memory including
  • the data access request includes a physical memory address of the data that the first device requests to access; the first memory area is a dedicated physical memory area corresponding to the first device;
  • the first memory area is accessed.
  • the method before the acquiring, by the first device, the data access request for accessing the first memory area, the method further includes:
  • the I/O virtualization controller device includes at least one physical memory address information a physical memory address information base, wherein each physical memory address information corresponds to a different memory area; correspondingly, the physical memory address of the data requested by the first device is queried I/0 virtualization control Physical memory address information in the device, including:
  • the physical memory address information database is obtained by the first device, and the physical memory address information corresponding to the memory area corresponding to the first device is obtained.
  • the physical memory address information corresponding to the first memory area in the I/O virtualization controller device is not limited.
  • the method also includes
  • the data access request is discarded in the physical memory address information in the I/O virtualization controller device.
  • the method further includes
  • the second aspect provides a device for accessing a memory, including,
  • An acquiring unit configured to acquire a data access request that the first device requests to access the first memory area, where the data access request includes a physical memory address of the data that the first device requests to access; the first memory area is a dedicated physical memory area i corresponding to a device;
  • a query unit configured to query physical memory address information in the I/O virtualization controller device according to a physical memory address of the data requested by the first device acquired by the acquiring unit, where the physical memory address information includes a physical memory address corresponding to a physical memory address of the first memory area;
  • an access unit configured to access the first memory area if the physical unit address of the data requested by the first device to be accessed by the query unit is in the physical memory address information in the I/O virtualization controller device.
  • the device further includes
  • mapping unit configured to map a physical memory address of the first memory area to the I/O virtualization controller before the obtaining unit acquires a data access request of the first device requesting access to the first memory area Forming, by the device, the physical memory address information
  • the mapping unit is further configured to map a physical memory address of the first memory area to the first device.
  • the I/O virtualization controller device includes at least one physical memory address information a physical memory address information base, where each physical memory address information corresponds to a different memory area; correspondingly, the query unit is specifically used,
  • the physical memory address information database is obtained by the first device, and the physical memory address information corresponding to the memory area corresponding to the first device is obtained.
  • the physical memory address information corresponding to the first memory area in the I/O virtualization controller device is not limited.
  • a discarding unit configured to: if the query unit determines that a physical memory address of data requested by the first device is not in physical memory address information in the I/O virtualization controller device, the data access request is throw away.
  • the device further includes
  • a recording unit configured to: if the query unit determines that the physical memory address of the data requested by the first device is not in the physical memory address information in the I/O virtualization controller device, the abnormal information is recorded.
  • a processor configured to acquire a data access request of the first device requesting access to the first memory area, where the data access request includes a physical memory address of data requested by the first device; the first memory area is a dedicated physical memory area corresponding to a device;
  • An I/O virtualization controller device for requesting access to data according to the first device
  • the physical memory address is queried for the physical memory address information in the I/O virtualization controller device; wherein the physical memory address information includes a physical memory address corresponding to the physical memory address of the first memory region;
  • a first device configured to: if the I/O virtualization controller device determines that a physical memory address of the data requested by the first device is in the physical memory address information in the I/O virtualization controller device, The first memory area.
  • the processor is specifically configured to: before the acquiring, by the first device, a data access request for accessing the first memory area, A physical memory address of a memory area is mapped to the
  • the processor is further configured to map a physical memory address of the first memory area to the first device.
  • the I/O virtualization controller device includes at least one physical memory address information a physical memory address information base, wherein each physical memory address information corresponds to a different memory area; correspondingly, the I/O virtualization controller device is further used,
  • the physical memory address information database is obtained by the first device, and the physical memory address information corresponding to the memory area corresponding to the first device is obtained.
  • the physical memory address information corresponding to the first memory area in the I/O virtualization controller device is not limited.
  • the I/O virtualization The controller device is also used.
  • the I/O virtualization controller device is further configured to:
  • a physical machine including: a device for accessing a memory and a physical memory, where the device for accessing the memory includes a first device and an I/O virtualization controller device;
  • the device for accessing the memory is used,
  • the I/O virtualization controller device Querying physical memory address information in the I/O virtualization controller device according to the physical memory address of the data requested by the first device; wherein the physical memory address information includes a physical memory address of the first memory region Corresponding physical memory address;
  • the first memory area is accessed.
  • the device for accessing a memory is further configured to: before the acquiring, by the first device, a data access request for accessing the first memory area, The physical memory address of the first memory area is mapped to the I/O virtualization controller device to form the physical memory address information; the device for accessing the memory is further configured to: physics of the first memory area The memory address is mapped into the first device.
  • the I/O virtualization controller device includes at least one physical memory address information a physical memory address information base, wherein each physical memory address information corresponds to a different memory area; correspondingly, The device for accessing the memory is specifically used,
  • the physical memory address information corresponding to the first memory area in the I/O virtualization controller device is not limited.
  • the data access request is discarded in the physical memory address information in the I/O virtualization controller device.
  • a method and device for accessing a memory provided by an embodiment of the present invention, by acquiring a data access request of a first device requesting access to a first memory area, where the data access request includes a physicality of data requested by the first device a memory address; the first memory area is a dedicated physical memory area corresponding to the first device; and the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device;
  • the physical memory address information includes the physical memory address of the data accessed by the first standby request in the physical memory address information in the I/O virtualization controller device, and then accesses the first memory region. Effectively improve the security of system memory.
  • FIG. 1 is a schematic flowchart of a method for accessing a memory according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of an internal structure of a physical memory according to an embodiment of the present invention
  • Schematic diagram of a message pointer and a message queue
  • FIG. 3 is a schematic diagram of a scenario of a C P U and an F P G A packet forwarding system according to an embodiment of the present disclosure
  • FIG. 4 is a schematic flow chart of another method for accessing a memory according to an embodiment of the present invention.
  • FIG. 5 is a schematic flow chart of still another method for accessing a memory according to an embodiment of the present disclosure
  • FIG. 6 is a schematic diagram of a scenario in which a plurality of devices access a memory according to an embodiment of the present invention
  • FIG. 7 is a schematic flowchart of another method for accessing a memory according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of an apparatus for accessing a memory device according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of another apparatus for accessing a memory according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic structural diagram of another apparatus for accessing a memory according to an embodiment of the present invention.
  • FIG. 1 is a schematic structural diagram of a device of a physical machine according to an embodiment of the present invention
  • FIG. 1B is a schematic structural diagram of another device of a physical machine according to an embodiment of the present invention.
  • Embodiment 1 of the present invention provides a method for accessing a memory.
  • the method may include:
  • the first device And obtaining, by the first device, a data access request for accessing the first memory area, where the data access request includes a physical memory address of the data that the first device requests to access; the first memory area is the first The dedicated physical memory area corresponding to the device; wherein, the first device is a device that implements a specific function by accessing the physical memory of the computer, for example, in the CPU of the X 8 6 system and the FPGA packet forwarding system, the first device is an FPGA; or The first device may be a peripheral of the virtual machine in the virtualization platform; the present invention does not specifically limit the type of the first device;
  • the first memory area is a dedicated physical memory area in which the first device allocated in the physical memory implements the corresponding function.
  • the first memory area is included in the physical memory, and the first memory area includes at least a data cache. a message queue and a message pointer; wherein, the data cache is used to store data accessed by the first device in implementing the corresponding function, and the data may be stored in the data cache in the form of a data packet;
  • the message queue may be a circular queue, and the message queue includes data information arranged in a queue form, and each data information is used to store related information of corresponding data in the data cache, for example, may include a location where the data is stored in the data cache.
  • the physical memory address and the data feature for example, the data feature may include the type, the size, the length, and the like of the data.
  • the specific content of the data feature included in the data information may be set as needed, and the present invention is not specifically limited;
  • the depth of the message queue refers to the capacity that the message queue can use to store data information.
  • Each message queue can be a depth-determined and limited circular queue, and the depth of the message queue can be smaller than the capacity of the data cache;
  • the data information corresponding to each data stored in the data cache may be stored in the message queue, and some of the data information will wait for the message queue to have a free location.
  • the message pointer is used to indicate the location of the data information in the message queue.
  • the message pointer is divided into a head pointer and a tail pointer.
  • the head pointer can be used to indicate the last non-idle position in the message queue
  • the tail pointer can be used to indicate the number in the message queue.
  • the message pointer When it is necessary to store data information in the message queue, firstly, according to the message pointer, it is judged whether the message queue is full. If it is full, it waits for the empty position; if it is not full, the data information to be stored is stored in the tail pointer of the message pointer. Indicates the first idle location, and then updates the message pointer to the tail pointer of the message pointer + 1 , that is, keeps the tail pointer of the message pointer indicating the first idle position in the message queue;
  • the message queue (message queue depth - 1) position does not store the data information is empty, can use the judgment of the tail pointer position of the message pointer + 1 is equal to the head pointer Position judgment, if it is equal, it determines that the message queue is full, if not equal, it determines that the message queue is not full; of course, because the message queue is a circular queue, when the tail pointer points to the (message queue depth - 1) position, then the tail Pointer + 1 returns to position 0, so the pointer position + 1 in all embodiments of the present invention is generally defined as (pointer position + 1) % message queue depth, where % is a remainder operator; it should be noted that the present invention
  • the method for indicating the message queue and the method for determining whether the message queue is full are used as an example to describe the indication relationship between the message pointer and the position of the message queue. Of course, the method for indicating the message queue to the message queue and determining whether the message
  • the location 0 in the message queue stores data information 1
  • the location 1 stores data information 2
  • the location 2 stores data information 3
  • the remaining message queue locations are empty.
  • the head pointer of the message pointer indicates the position 0 of the message queue
  • the tail pointer indicates the position 3 of the message queue; when the data information 4 is stored in the message queue, the message is first determined.
  • the queue is not full, so Store the data information 4 in the message queue position 3 indicated by the tail pointer, and update the tail pointer of the message queue + 1 to the message queue position 4; when reading the data information from the queue, read the message queue position indicated by the head pointer 0 stores the data information 1, and updates the head pointer of the message pointer + 1 to the message queue position 1;
  • the data cache stores N data (stored in the form of data packets), which are respectively recorded as data packet 1, packet 2 packet N;
  • Bay 1 J corresponding to N data information, respectively recorded as data information 1, data information 2 data information N, each data information corresponds to a data packet, each data information may contain data corresponding to the data information The physical memory address and data characteristics of the location where the packet is stored in the data cache;
  • S-1 where S is far greater than N, storing data information from the message queue position 0, the message queue storing data information 1, data information 2 data information N, the corresponding head pointer in the message pointer indicating the message queue position 0, and the tail pointer indicates the message queue position N;
  • the location of the message queue can be recorded as message queue position 0, message queue position 1 message queue position Y-1, where Y is less than N, from the message queue location 0 starts to store data information, the message queue stores data information 1, data information 2 data information Y-1, then, data information Y data information N will wait for the message queue to have an idle location to be generated and stored; corresponding message pointer
  • the head pointer indicates that the message queue location is 0, and the tail pointer indicates the message queue location Y1.
  • the data access request may be generated by the first device, where the first device reads the data packet in the first memory area and the first device stores the data packet in the first memory area as an example to describe a data access request generation process.
  • the first device reads the data packet in the first memory area
  • the first device acquires the physical memory address of the data message in the message pointer in real time, and assumes that the current device acquires the physical memory address of the data information 2, and the first device generates a data access request for accessing a message queue, the data access request including a physical memory address of the data information 2;
  • the first device obtains the data information 2 from the message queue according to the physical memory address of the data information 2, obtains the physical memory address of the data packet 2 according to the data information 2, and the first device generates a data access request for accessing the data cache, the data access The request contains the physical memory address of packet 2.
  • the first device stores the data packet to the first memory area.
  • the first device when the first device needs to save the data X to the first memory area, the first device applies to the first memory area for the data cache required to store the data packet X, and obtains the physical memory allocated to the data packet X in the data cache.
  • the first device generates a data access request according to a memory allocation to the physical memory address of the data packet X in the data cache, and the data access request includes a physical memory address allocated by the memory to the data packet X in the data cache.
  • the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device; wherein, the physical memory address;
  • the method may further include:
  • the physical memory address of the first memory area includes a data cache, a message queue, and a physical memory address of the message pointer.
  • the physical memory address information is formed by mapping the physical memory address of the first memory area to the I/O virtualization controller device, and the physical memory address information may be in a table form in the I/O virtualization controller device. Existence, see Table 1, may also exist in other forms, and the form of physical memory address information does not affect the result of the present invention, and the present invention does not limit this; Table 1
  • the I/O virtualization controller device includes a physical memory address information database composed of at least one physical memory address information, where each physical memory address information corresponds to a different memory region;
  • multiple memory areas are allocated in physical memory.
  • different devices can correspond to the same memory area; by mapping the physical memory address of each memory area to I /O Virtualization controller device forms physical memory information, and the I/O virtualization controller device includes a physical memory information database composed of multiple physical memory information, where each physical memory address information corresponds to a different one. Memory area, different devices can correspond to the same physical memory address information;
  • the physical memory address information in the physical memory address information database corresponds to a plurality of memory regions, respectively, and the physical memory address information library may exist in the form of a table in the I/O virtualization controller device, see Table 2, of course.
  • the physical memory address information database may also exist in other forms in the I/O virtualization controller device.
  • the form of the physical memory address information database does not affect the result of the present invention, and the present invention does not limit this;
  • multiple devices can correspond to the same memory area, and I/O is virtual.
  • multiple devices may correspond to the same physical memory address information.
  • the physical memory address information of the first device shown in Table 2 may be the physical memory address of the Nth device. The same information;
  • the physical memory address information of the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device, which may include
  • the physical memory address of the data requested by the first device is determined to be in the physical memory address information in the I/O virtualization controller device, accessing the first memory area i or .
  • the first device sends the request to access the first
  • the data access request in the memory area can correctly access the first memory area, and does not accidentally step on the system memory, that is, it does not affect the security of the system memory.
  • the method may further include
  • the data access request is discarded.
  • the method may further include:
  • the abnormal information is recorded.
  • the method for accessing the memory provided by the embodiment of the present invention, by acquiring the data access request of the first device requesting access to the first memory area, where the data access request includes the physical memory address of the data requested by the first device
  • the first memory The area is a dedicated physical memory area corresponding to the first device; the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device; wherein the physical memory address information Having the physical memory address of the data accessed by the first memory area in the physical memory address information in the I/O virtualization controller device, accessing the first memory area; effectively improving system memory safety.
  • Embodiment 2 Embodiment 2
  • the second embodiment of the present invention provides a method for accessing a memory.
  • the CPU cooperates with the FPGA in the FPGA packet forwarding system to store data in the memory as an example, and the method for accessing the memory shown in FIG. 1 is described in detail.
  • the specific process of accessing the memory method can be completed by the physical machine where the physical memory is located;
  • the interaction data between the FPGA and the physical memory includes the FPGA storing data and reading data to the physical memory, and the embodiment of the present invention only uses the FPGA as the first
  • the device stores data in physical memory as an example to describe the method of accessing memory.
  • the method for accessing memory by other devices is similar to the method for accessing memory by FPGA, and will not be described here.
  • the method can include:
  • a dedicated physical memory area corresponding to the CPU and the FPGA is allocated in the physical memory, that is, the first memory area is defined as forwarding memory;
  • the CPU and the FPGA packet forwarding system require 1 kilobit (KiloByte, referred to as KB) physical memory for packet forwarding.
  • 1 KB of physical memory is allocated as forwarding memory, and the starting physical memory address is 2001H.
  • the physical memory address of the forwarding memory is 2001 H ⁇ 2400H;
  • a continuous physical memory area is allocated in the physical memory as an example of forwarding memory, and which part of the physical memory is allocated as The forwarding memory is not specifically limited in the present invention.
  • the physical memory address of the forwarding memory is mapped to a Direct Memory Access Remapping (DMA Remapping) structure to form physical memory address information; and the physical memory address of the forwarding memory is mapped to the FPGA;
  • DMA Remapping Direct Memory Access Remapping
  • the DMA Remapping is to cooperate with the I/O virtualization controller device in the X86 system.
  • the method for accessing the memory is only described by using the X86 as an example.
  • the embodiment of the present invention Without limitation, it is only necessary to ensure that the I/O virtualization controller device is matched with the system used by the method of the present invention; any method for accessing memory through the I/O virtualization controller device belongs to the protection scope of the present invention; for example;
  • the physical memory address 2001H ⁇ 2400H of the forwarding memory is mapped into the DMA Remapping structure, and the physical memory address information formed is as shown in Table 3;
  • a CPU with an FPGA packet forwarding system requires a message queue of depth 10.
  • a message queue with a base address of 2001H and a depth of 10 is defined; then, the position in the message queue can be recorded as message queue position 0, message queue position 1, message queue position 2, message queue position 9 ;
  • the device that reads the data packet from the physical memory can obtain the physical memory address of the message queue storing the data information according to the message queue position indicated by the header pointer in the message pointer and the reference address of the message queue;
  • the area in the forwarding memory except the message queue and the message pointer is the data buffer area.
  • the FPGA receives a packet X with a size of 1 byte (Byte, abbreviated as B), the packet X needs to be forwarded out. First, the packet X needs to be stored in the forwarding memory.
  • the storage request is initiated, and the physical memory with a length of 1 B is used to store the data packet X. Assume that the physical memory address of the physical memory with a length of 1 B is 2300H.
  • step 404 After the physical memory for storing the data packet X is obtained in step 404, a data access request needs to be generated, and the data packet X is requested to be stored in the physical entity obtained in step 404;
  • the data access request for accessing the forwarding memory is obtained, and the data access request includes the physical memory address obtained in step 404, that is, the application for storing the data packet X in the physical memory with the physical memory address of 2300H.
  • step 406 Query the physical memory address information of the DMA Remapping structure according to the physical memory address included in the data access request, and check whether the physical memory address included in the data access request is in the physical memory address information of the DMA Remapping structure; if yes, execute step 407. If not, proceed to step 409;
  • a data access request is obtained, where the data access request includes the physical memory address of the physical memory acquired in step 404, that is, 2300H;
  • the physical memory address 2300H included in the data access request queries the physical memory address information shown in Table 3, and detects whether the physical memory address 2300H included in the obtained data access request is in the physical memory address information of the DMA Remapping structure;
  • the physical memory address contained in the physical memory address information shown in Table 3 is 2001H - 2400H, and the physical memory address contained in the obtained data access request is 2300H. After detection, the physical content included in the acquired data access request can be determined.
  • the memory address 2300H is in the physical memory address information of the DMA Remapping structure;
  • the data access request obtained in step 405 includes the physical memory address of the physical memory obtained in step 404, that is, 2600H, and then according to the acquired data.
  • the physical memory address 2600H included in the access request is used to query the physical memory address information shown in Table 3, and it is detected whether the physical memory address 2600H included in the obtained data access request is in the physical memory address information of the DMA Remapping structure;
  • the physical memory address contained in the physical memory address information shown in Table 3 is 2001H - 2400H, and the physical memory address contained in the obtained data access request is 2600H. After detection, the physical content included in the acquired data access request can be determined.
  • the memory address 2600H is not in the physical memory address information of the DMA Remapping structure.
  • step 406 determines, according to the physical memory address information of the physical memory address 2300H included in the obtained data access request, the physical memory address information of the physical memory address 2300H included in the acquired data access request in the DMA Remapping structure.
  • the packet X is stored in the physical memory where the physical memory address is 2300H.
  • the data characteristics of the data packet can include data size, data type, data length, etc.
  • the data feature is not specifically limited in the present invention.
  • the generated message information is stored in the message queue.
  • the message queue is not full as an example.
  • the message queue is generally selected to forward the first idle position in the message queue in the memory, that is, the position indicated by the tail pointer in the message pointer; of course, other idle locations in the message queue may also be selected to store the idle location to store the data packet. Physical memory address and data characteristics, the specific location is not limited;
  • the position indicated by the tail pointer in the message pointer is updated, so that the position indicated by the tail pointer in the message pointer is + 1;
  • the data location of the data packet X that is, the physical memory address 2 3 0 0 H and the data characteristics of the data packet X, generates data information. X; storing the data information X in the first idle position of the message queue in the forwarding memory, that is, the position indicated by the tail pointer in the message pointer;
  • the tail pointer of the message pointer indicates that the first idle location in the message queue is the message queue location 4, then the data information is stored in the location;
  • the process of generating the data information X it is possible to include the wrong physical memory address in the data information X, that is, the physical memory address contained in the data information X is not the location where the data packet X is actually saved; Any kind of error can be detected and corrected by the method of accessing the memory according to the present invention during the process of the first device accessing the physical memory to read the data packet.
  • querying Table 3 in step 060 can determine that the physical memory address contained in the data access request is not in the physical memory address information of the DMA Rema pping structure, so The data packet X can be stored in the physical memory address where the physical memory address is 2600H, and the data access request is discarded.
  • step 404 is performed to obtain the physical memory address of the physical memory used to store the data packet X;
  • the error access information is recorded, so that the device accessing the memory can locate the access problem, thereby improving the maintainability of the system;
  • the embodiment only uses the request for storing the data packet X in the physical memory as a data access request as an example.
  • the physical memory is stored. Any request that includes a physical memory address in the data process can be used as a data access request, which is not limited by the present invention and is within the scope of the present invention.
  • the method for accessing the memory obtains a data access request for requesting access to the forwarding memory, where the data access request includes a physical memory address requesting to store the data packet X; and the physical memory address of the data packet X is stored according to the request.
  • Querying the physical memory address information in the DMA Remapping structure if it is determined that the physical memory address of the request packet X is in the physical memory address information in the DMA Remapping structure, accessing the forwarding memory; detecting whether the physical memory address of the request packet X is stored In the allocated dedicated physical memory area, prevent the physical memory address of the request X from storing the packet X. If it is not in the allocated dedicated physical memory area, the error of storing the packet X in the system memory affects the security of the system memory; Improve the security of system memory.
  • a third embodiment of the present invention provides a method for accessing a memory.
  • the method for accessing a memory shown in FIG. 1 is described in detail by taking a data packet from a physical memory as an example.
  • the specific process of accessing the memory may be performed by physical memory.
  • the physical machine where it is located is completed.
  • the method described in 403 is similar, and this embodiment will not be described herein again; in this embodiment, it is assumed that: the physical address in the first memory area is 2001H ⁇ 2400H; the message queue depth is 10, and the reference address is 2001H; The physical address of the location where the packet X is stored is 2300H; the data information X corresponding to the packet X is stored in the message queue position 4 of the message queue, and the head pointer of the message pointer indicates the position 4 of the message queue; Background, detailing a detailed process of a method of reading a packet X from physical memory, see FIG. 5, the method may include:
  • the real-time acquisition of the last non-empty message queue position indicated by the head pointer in the message pointer in the first memory area is the message queue position 4, and the physical structure of the message queue storing the data information X can be obtained according to the reference address 2001H of the message queue.
  • the memory address is 2005H.
  • the data information X stored at the location is obtained at the location indicated by the physical memory address 2005H in the physical memory.
  • step 503 Obtain, according to the data information X obtained in step 502, a physical memory address of a data cache in which the data packet is stored;
  • the location where the packet X is stored that is, the location of the physical memory address 2300H in the physical memory is obtained;
  • the physical memory address contained in the generated data information X is not the actual location of the saved data packet X, but the location of the system memory is 2701 H.
  • the location where the data packet X is stored is the location of the physical memory address 2701 H in the physical memory.
  • the data access request for accessing the first memory area is obtained, and the data access request includes the physical memory address 2701H acquired in step 503, that is, the data stored in the location indicated by the physical memory address 2701 H in the physical memory is requested to be read.
  • step 505. Query the physical memory address information of the DMA Remapping structure according to the physical memory address included in the data access request, and check whether the physical memory address included in the data access request is in the physical memory address information of the DMA Remapping structure; if yes, execute step 506. If not, proceed to step 507;
  • the physical memory address contained in the physical memory address information shown in Table 3 is 2001H - 2400H, and the physical memory address contained in the obtained data access request is 2300H. After detection, the physical content included in the acquired data access request can be determined.
  • the memory address 2300H is in the physical memory address information of the DMA Remapping structure, step 506 is performed;
  • the physical memory address information included in the obtained data access request is detected in the physical memory of the DMA Rema pp i ng structure. Address information;
  • the physical memory address contained in the physical memory address information shown in Table 3 is 2001H - 2400H, and the physical memory address included in the obtained data access request is 2701H. After detection, the physical content included in the acquired data access request can be determined. If the memory address 2701 H is not in the physical memory address information of the DMA Remapping structure, step 507 is performed.
  • step 503 determines, according to the physical memory address 2300H included in the obtained data access request, the physical memory address information shown in Table 3, and determines that the physical memory address 2300H included in the data access request is in the physical memory address information of the DMA Remapping structure. Then reading the data packet X stored in the physical memory location corresponding to the physical memory address 2300H included in the data access request;
  • the position indicated by the head pointer in the message pointer is updated such that the position indicated by the head pointer in the message pointer + 1 , that is, the head pointer in the update message pointer indicates the message queue position 5.
  • step 505 if it is determined in step 505 that the physical memory address included in the data access request is not in the physical memory address information of the DMA Remapping structure, the access to the memory cannot be performed, and the data access request is discarded;
  • step 501 is re-executed to obtain the location indicated by the head pointer in the message pointer.
  • the error access information is recorded, so that the device accessing the memory can locate the access problem, thereby improving the maintainability of the system.
  • the embodiment only uses the request for accessing the data packet X in the physical memory address as a data access request as an example.
  • the physical memory is used. Any request for a physical memory address in the process of reading data may be used as a data access request, which is not limited by the present invention and is within the scope of the present invention.
  • a method for accessing a memory by accessing a memory request requesting access to a forwarding memory wherein the data access request includes a physical memory address of the data requested to be read; a physical memory address of the data read according to the request Querying the physical memory address information in the DMA Remapping structure; if it is determined that the physical memory address of the data requested to be read is in the physical memory address information in the DMA Remapping structure, accessing the forwarding memory; detecting the physical memory address of the data read by the request Whether it is in the dedicated physical memory area allocated, preventing the physical memory stored in the read data packet When the memory address is not in the allocated dedicated physical memory area, the system memory packet is read and received, which affects the security of the system memory and effectively improves the security of the system memory.
  • a fourth embodiment of the present invention provides a method for accessing a memory.
  • the method for accessing memory in FIG. 1 is described in detail by taking N devices simultaneously accessing memory in an X86 system. Referring to FIG. 6, in the X86 system, there is a N. Devices access memory, respectively, as devices
  • Device 2 Device 3 Device N This embodiment describes the device 1, device 2, device 3 device N access memory method
  • the method may include:
  • device 1, device 2, device 3 device N are respectively allocated memory area i or 1, memory area i or 2, memory area i or 3 memory area i or N; of course, multiple devices can correspond to the same A memory area, so, in the memory area 1, memory area 2, memory area 3 memory area N can have the same memory area, this embodiment is memory area i or 1, memory area i or 2, memory area i Or 3, ... the memory area N is all different for an example.
  • N physical memory address is divided into another 'J mapping to DMA Remapping structure, forming N physical memory address information, recorded as physical memory address information 1, physical memory address information 2, physical memory address information 3 physical memory address information N;
  • the device, the memory area, and the physical memory address information correspond to each other; physical memory address information 1, physical memory address information 2, physical memory address information 3, ... physical memory address information N constitutes a physical memory address in the DMA Remapping structure database.
  • the data access request includes a physical memory address of data requested by the first device to access;
  • the data access request sent by the device N to access the memory area N is obtained, where the access request includes the physical memory address of the data that the device N requests to access.
  • step 705. Query the physical memory address information obtained by the step 704 according to the physical memory address of the data requested by the first device, and check whether the physical memory address of the data requested by the first device is in the physical memory corresponding to the first device in the DMA Remapping structure. In the address information; if yes, step 706 is performed; if not, step 707 is performed;
  • the physical memory address information N is queried, and the physical memory address of the data requested by the device N is determined to be in the DMA.
  • Access data requested to be accessed in the first memory area is accessed.
  • the step 705 determines that the physical memory address of the data requested by the device N is in the physical memory address information N corresponding to the device N in the DMA Remapping structure, the data requested in the memory region N is accessed.
  • the maintainability of the system can be improved.
  • the method for accessing the memory provided by the embodiment of the present invention, when a plurality of devices access the memory, requesting the first device to access the data access request of the first memory area, where the data access request includes the first
  • the physical of the data that the device is requesting access to The memory address is obtained by querying the physical memory address information base according to the physical memory address of the data requested by the first device, and acquiring the physical memory address information corresponding to the first memory area; and querying the I/O according to the physical memory address of the data requested by the first device.
  • the physical memory address information corresponding to the first memory area in the virtualization controller device if it is determined that the physical memory address of the data requested by the first device is in the physical memory address information in the I/O virtualization controller device, access The first memory area; effectively improves the security of the system memory.
  • the fifth embodiment of the present invention provides a device for accessing a memory 80.
  • the device 80 may include:
  • the obtaining unit 8 01 is configured to obtain a data access request that the first device requests to access the first memory area, where the data access request includes a physical memory address of the data that the first device requests to access; the first memory area a dedicated physical memory area i corresponding to the first device;
  • the first device is a device that implements a specific function by accessing a physical memory of the computer.
  • the first device is a CPU or an FPGA; or the first device may be a virtualized virtual platform. Peripheral of the machine; the present invention does not specifically limit the type of the first device;
  • the first memory area is a dedicated physical memory area in which the first device allocated in the physical memory implements the corresponding function.
  • the first memory area is included in the physical memory, and the first memory area includes at least the data cache and the message. a queue and a message pointer; wherein, the data cache is used to store data accessed by the first device in implementing the corresponding function, and the data may be stored in the data cache in the form of a data packet;
  • the message queue may be a circular queue, and the message queue includes data information arranged in a queue form, and each data information is used to store related information of corresponding data in the data cache, for example, may include a location where the data is stored in the data cache.
  • the physical memory address and data characteristics, for example, the data feature may include the type, size, length, etc. of the data, and the specific content of the data feature included in the data information may be as needed.
  • the depth of the message queue refers to the capacity that the message queue can use to store data information.
  • Each message queue can be a depth-determined and limited circular queue, and the depth of the message queue can be smaller than the capacity of the data cache;
  • the data information corresponding to each data stored in the data cache may store a part of the data information in the message queue, and some of the data information will wait for the message queue to have a free location. Regenerated and stored;
  • the message pointer is used to indicate the location of the data information in the message queue.
  • the message pointer is divided into a head pointer and a tail pointer.
  • the head pointer can be used to indicate the last non-idle position in the message queue
  • the tail pointer can be used to indicate the number in the message queue.
  • An idle location so that the location of the data in the message queue and the free location can be clearly indicated by the indication of the message pointer; when the first device reads the data information from the message queue, it can be based on the reference address of the message queue. Adding the actual physical memory address where the data information is stored by adding the message queue position indicated by the message pointer head pointer;
  • the data cache stores N data (stored in the form of data packets), which are respectively recorded as packet 1 and packet 2 packet N.
  • Bay 1 J corresponding to N data information, respectively recorded as data information 1, data information 2 data information N, each data information corresponds to a data packet, each data information may contain data corresponding to the data information The physical memory address and data characteristics of the location where the packet is stored in the data cache;
  • the message queue has a depth of Y and the message queue is empty.
  • the location of the message queue can be recorded as message queue position 0, message queue position 1 message queue.
  • Position Y-l where ⁇ is less than ⁇ , data information is stored from message queue position 0, data message 1 is stored in message queue, data information 2 data information Y-1, then data information ⁇ data information ⁇ will wait for message
  • the queue has an idle location that is regenerated and stored; the head pointer in the corresponding message pointer indicates the message queue location 0, and the tail pointer indicates the message queue location Y-l.
  • the data access request may be generated by the first device, where the first device reads the data packet in the first memory area and the first device stores the data packet in the first memory area as an example to describe a data access request generation process.
  • the first device reads the data packet in the first memory area
  • the first device acquires the physical memory address of the data message in the message pointer in real time, and assumes that the first device acquires the physical memory address of the data information 2, and the first device generates a data access request for accessing the message queue, where the data access request includes The physical memory address of data information 2;
  • the first device obtains the data information 2 from the message queue according to the physical memory address of the data information 2, obtains the physical memory address of the data packet 2 according to the data information 2, and the first device generates a data access request for accessing the data cache, the data access The request contains the physical memory address of packet 2.
  • the first device stores the data packet to the first memory area.
  • the first device when the first device needs to save the data X to the first memory area, the first device applies to the first memory area for the data cache required to store the data packet X, and obtains the physical memory allocated to the data packet X in the data cache.
  • the first device generates a data access request according to a memory allocation to the physical memory address of the data packet X in the data cache, and the data access request includes a physical memory address allocated by the memory to the data packet X in the data cache.
  • the query unit 802 is configured to query physical memory address information in the I/O virtualization controller device according to the physical memory address of the data requested by the first device acquired by the acquiring unit 810; wherein, the physical The memory address information is further included with the first one.
  • the device may further include
  • the mapping unit 804 is configured to map the physical memory address of the first memory area to the I/O virtualization controller device before the acquiring unit 801 acquires the data access request of the first device requesting access to the first memory area Forming physical memory address information; wherein, the physical memory address of the first memory area includes a physical memory address of the data cache, the message queue, and the message pointer.
  • the mapping unit 804 is further configured to map the physical memory address of the first memory area to the first device.
  • the physical memory address information is formed by mapping the physical memory address of the first memory area to the I/O virtualization controller device, and the physical memory address information may be in a table form in the I/O virtualization controller device. Existence, see Table 1, may also exist in other forms, and the form of physical memory address information does not affect the result of the present invention, and the present invention does not limit this;
  • the I/O virtualization controller device includes a physical memory address information database composed of at least one physical memory address information, where each physical memory address information corresponds to a different memory region;
  • multiple memory areas are allocated in physical memory.
  • different devices can correspond to the same memory area; by mapping the physical memory address of each memory area to I /O Virtualization controller device forms physical memory information, and the I/O virtualization controller device includes a physical memory information database composed of multiple physical memory information, where each physical memory address information corresponds to a different one. Memory area, different devices can correspond to the same physical memory address information;
  • the physical memory address information in the physical memory address information database corresponds to a plurality of memory regions, respectively, and the physical memory address information library may exist in the form of a table in the I/O virtualization controller device, see Table 2, of course.
  • the physical memory address information database may also exist in other forms in the I/O virtualization controller device.
  • the form of the physical memory address information database does not affect the result of the present invention, and the present invention does not limit this;
  • the query unit 802 can be specifically used to:
  • the memory address information base acquires physical memory address information corresponding to the memory area corresponding to the first device;
  • the physical memory address information corresponding to the first memory area in the I/O virtualization controller device
  • the access unit 803 is configured to: if the query unit 802 determines that the physical memory address of the data requested by the first device is in the physical memory address information in the I/O virtualization controller device, accessing the first memory Area
  • the first device sends the request to access the first
  • the data access request in the memory area can correctly access the first memory area, and does not accidentally step on the system memory, that is, it does not affect the security of the system memory.
  • the device 80 may further include
  • the discarding unit 805 is configured to: if the query unit 802 determines that the physical memory address of the data requested by the first device is not in the physical memory address information in the I/O virtualization controller device, the data is Access request is discarded.
  • the device 80 may further include
  • the recording unit 806 is configured to: if the query unit 802 determines that the physical memory address of the data requested by the first device is not in the physical memory address information in the I/O virtualization controller device, the abnormal information is recorded.
  • the device 80 for accessing the memory acquires a data access request of the first memory area by requesting the first device, where the data access request includes the physical memory of the data requested by the first device.
  • the first memory area is a dedicated physical memory area corresponding to the first device; and the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device;
  • the physical memory address information includes a physical memory address of the data accessed by the first memory in the I/O virtualization controller device In the memory address information, the first memory area is accessed; the security of the system memory is effectively improved.
  • the sixth embodiment of the present invention provides a device 100 for accessing a memory.
  • the device 100 may include:
  • the processor 1001, the I/O virtualization controller device 1002, the first device 1003, and at least one communication bus 1004 are configured to implement connection and mutual communication between the devices.
  • the processor 1001 may be a central processing unit (English: Central processing unit, referred to as CPU);
  • the processor 1001 is configured to obtain a data access request that the first device 1003 requests to access the first memory area, where the data access request includes a physical memory address of the data that the first device requests to access;
  • the memory area is a dedicated physical memory area corresponding to the first device;
  • the first device is a device that implements a specific function by accessing a physical memory of the computer.
  • the first device is a CPU or an FPGA; or the first device may be in a virtualization platform.
  • the peripheral device of the virtual machine; the present invention does not specifically limit the type of the first device;
  • the first memory area is a dedicated physical memory area in which the first device allocated in the physical memory implements the corresponding function.
  • the first memory area is included in the physical memory, and the first memory area includes at least the data cache and the message. a queue and a message pointer; wherein, the data cache is used to store data accessed by the first device in implementing the corresponding function, and the data may be stored in the data cache in the form of a data packet;
  • the message queue may be a circular queue, and the message queue includes data information arranged in a queue form, and each data information is used to store related information of corresponding data in the data cache, for example, may include a location where the data is stored in the data cache.
  • the physical memory address and the data feature, for example, the data feature may include the type, the size, the length, and the like of the data.
  • the specific content of the data feature included in the data information may be set as needed, and the present invention is not specifically limited;
  • the depth of the message queue refers to the capacity that the message queue can use to store data information.
  • Each message queue can be a depth-determined and limited circular queue, and the depth of the message queue can be smaller than the capacity of the data cache;
  • the data information corresponding to each data stored in the data cache may store a part of the data information in the message queue, and some of the data information will wait for the message queue to have a free location. Regenerated and stored;
  • the message pointer is used to indicate the location of the data information in the message queue.
  • the message pointer is divided into a head pointer and a tail pointer.
  • the head pointer can be used to indicate the last non-idle position in the message queue
  • the tail pointer can be used to indicate the number in the message queue.
  • An idle location so that the location of the data in the message queue and the free location can be clearly indicated by the indication of the message pointer; when the first device reads the data information from the message queue, it can be based on the reference address of the message queue. Adding the actual physical memory address where the data information is stored by adding the message queue position indicated by the message pointer head pointer;
  • the data cache stores N data (stored in the form of data packets), which are respectively recorded as packet 1 and packet 2 packet N.
  • Bay 1 J corresponding to N data information, respectively recorded as data information 1, data information 2 data information N, each data information corresponds to a data packet, each data information may contain data corresponding to the data information The physical memory address and data characteristics of the location where the packet is stored in the data cache;
  • the message queue has a depth of Y and the message queue is empty.
  • the location of the message queue can be recorded as message queue position 0, message queue position 1 message queue position Y - 1 , where Y is less than N, from the message queue location 0 starts to store data information,
  • the message queue stores data information 1 and data information 2 data information Y-1.
  • the data information Y data information N will wait for the message queue to have an idle location to be regenerated and stored; the head pointer in the corresponding message pointer indicates the message queue position. 0 , and the tail pointer indicates the message queue position Y- l.
  • the data access request may be generated by the first device, where the first device reads the data packet in the first memory area and the first device stores the data packet in the first memory area as an example to describe a data access request generation process.
  • the first device reads the data packet in the first memory area
  • the first device acquires the physical memory address of the data message in the message pointer in real time, and assumes that the current device acquires the physical memory address of the data information 2, and the first device generates a data access request for accessing the message queue, where the data access request includes The physical memory address of data information 2;
  • the first device obtains the data information 2 from the message queue according to the physical memory address of the data information 2, obtains the physical memory address of the data packet 2 according to the data information 2, and the first device generates a data access request for accessing the data cache, the data access The request contains the physical memory address of packet 2.
  • the first device stores the data packet to the first memory area.
  • the first device when the first device needs to save the data X to the first memory area, the first device applies to the first memory area for the data cache required to store the data packet X, and obtains the physical memory allocated to the data packet X in the data cache.
  • the first device generates a data access request according to a memory allocation to the physical memory address of the data packet X in the data cache, and the data access request includes a physical memory address allocated by the memory to the data packet X in the data cache.
  • the I/O virtualization controller device 1 002 is configured to query physical memory address information in the I/O virtualization controller device 1 002 according to a physical memory address of the data requested by the first device 1 003;
  • the physical memory address information is included in the first step, and the processor 1 001 may be specifically configured to: before the acquiring, by the first device, a data access request for accessing the first memory area, the first Memory area Mapping a physical memory address of the domain into the I/O virtualization controller device to form the physical memory address information;
  • the physical memory address of the first memory area includes a data cache, a message queue, and a physical memory address of the message pointer.
  • the processor 1001 is further configured to: map a physical memory address of the first memory area to the first device.
  • the physical memory address information is formed by mapping the physical memory address of the first memory area to the I/O virtualization controller device, and the physical memory address information may be in a table form in the I/O virtualization controller device. Existence, see Table 1, may also exist in other forms, and the form of physical memory address information does not affect the result of the present invention, and the present invention does not limit this;
  • the I/O virtualization controller device includes a physical memory address information database composed of at least one physical memory address information, where each physical memory address information corresponds to a different memory region;
  • multiple memory areas are allocated in physical memory.
  • different devices can correspond to the same memory area; by mapping the physical memory address of each memory area to I /O Virtualization controller device forms physical memory information, and the I/O virtualization controller device includes a physical memory information database composed of multiple physical memory information, where each physical memory address information corresponds to a different one. Memory area, different devices can correspond to the same physical memory address information;
  • the physical memory address information in the physical memory address information database corresponds to a plurality of memory regions, respectively, and the physical memory address information library may exist in the form of a table in the I/O virtualization controller device, see Table 2, of course.
  • the physical memory address information database may also exist in other forms in the I/O virtualization controller device.
  • the form of the physical memory address information database does not affect the result of the present invention, and the present invention does not limit this;
  • the I/O virtualization controller device 1002 is further configured to: query the physical memory address information database according to the data access request of the first device 1003 to access the first memory area, and obtain the corresponding Memory area corresponding Physical memory address information;
  • the physical memory address information corresponding to the first memory area in the I/O virtualization controller device 1002 is queried according to the physical memory address of the data requested by the first device 1003.
  • the first device 1003 is configured to: if the I/O virtualization controller device 1002 determines the physical memory address information of the physical memory address of the data requested by the first device 1003 in the I/O virtualization controller device 1002 Accessing the first memory area; exemplarily, if the physical memory address of the data requested by the first device included in the data access request is in the physical memory address information in the I/O virtualization controller device,
  • the data access request sent by the first device to access the first memory area can correctly access the first memory area, and the system memory is not accidentally stepped on, that is, the system memory security is not affected.
  • the I/O virtualization controller device 1002 is further configured to: if it is determined that the physical memory address of the data requested by the first device 1003 is not in the physical state of the I/O virtualization controller device 1002 In the memory address information, the data access request is discarded.
  • the I/O virtualization controller device 1002 is further configured to: if it is determined that the physical memory address of the data requested by the first device 1003 is not in the physical of the I/O virtualization controller device In the memory address information, the abnormal information is recorded.
  • the device 100 for accessing the memory acquires a data access request of the first memory area by requesting the first device, where the data access request includes the physical memory of the data requested by the first device.
  • the first memory area is a dedicated physical memory area corresponding to the first device; and the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device;
  • the physical memory address information includes a physical memory address of the data accessed by the first memory in the physical memory address information in the I/O virtualization controller device, and the first memory area is accessed. Effectively improved the system Memory security.
  • the seventh embodiment of the present invention provides a physical machine 110.
  • the physical machine 110 may include:
  • the device 80 or 90 for accessing the memory according to any of the above embodiments;
  • the physical memory 1101 may include read only memory and random access memory for storing data of the device 80 or 90 accessing the memory; a portion of the physical memory 1101 may also include non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the device for accessing the memory includes a first device and an I/O virtualization controller device;
  • the device 80 or 90 that accesses the memory can be used,
  • the I/O virtualization controller device Querying physical memory address information in the I/O virtualization controller device according to the physical memory address of the data requested by the first device; wherein the physical memory address information includes a physical memory address of the first memory region Corresponding physical memory address;
  • the device 80 or 90 for accessing the memory may be further configured to: map the physical memory address of the first memory area to the location before the acquiring the first device requests the data access request of the first memory area In the I/O virtualization controller device, the physical memory address information is formed;
  • the I/O virtualization controller device includes a physical memory address information library composed of at least one physical memory address information, where each physical memory location The address information respectively corresponds to a different memory area; correspondingly, the device 80 or 90 for accessing the memory is specifically used,
  • the device 80 or 90 that accesses the memory can also be used.
  • the data access request is discarded in the physical memory address information in the I/O virtualization controller device.
  • the physical machine 1 1 0 provided by the embodiment of the present invention obtains a data access request of the first memory area by requesting the first device, where the data access request includes the physical memory of the data requested by the first device.
  • the first memory area is a dedicated physical memory area corresponding to the first device; and the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device;
  • the physical memory address information includes a physical memory address corresponding to a physical memory address of the first memory area; if it is determined that the physical memory address of the data requested by the first device is in the I/O virtualization controller In the physical memory address information in the device, accessing the first memory area effectively improves the security of the system memory.
  • the disclosed system, apparatus, and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical or otherwise.
  • the units described as separate components may or may not be physically separated, and the components displayed as the units may or may not be physical units, and may be located in one place or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the embodiment of the present embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • the above-described integrated unit implemented in the form of a software functional unit can be stored in a computer readable storage medium.
  • the software functional unit described above is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform portions of the steps of the various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read only memory (R ea dO nly Memo ry, abbreviated as), a random access memory (Ra ndom A ccess Memo ry, RAM for short), a magnetic disk or an optical disk, and the like.

Abstract

The embodiment of the present invention discloses a method and device for accessing internal memory, relating to the field of computing, and effectively increases the security of internal memory. Said method comprises: a data access request from a first device requesting access to a first memory area is obtained, said data access request comprising the physical memory address of the data the first device requests to access, said first memory area being the dedicated physical memory area corresponding to the first device; on the basis of the physical memory address of the data the first device requests to access, the physical memory address information of an I/O virtualisation controller device is queried, said physical memory address information comprising the physical memory address corresponding to the physical memory address of the first memory area; and, if it is determined that the physical memory address of the data the first device requests to access is within the physical memory address information of the I/O virtualisation controller device, then the first memory area is accessed.

Description

一种访问内存的方法及设备 技术领域  Method and device for accessing memory
本发明涉及计算机领域, 尤其涉及一种访问内存的方法及设备。 背景技术  The present invention relates to the field of computers, and in particular, to a method and device for accessing a memory. Background technique
在计算机系统的物理内存中, 既有用于存放计算机操作系统的 系统内存, 也有用于存放计算机实现特定功能时存储数据的专用功 能性内存, 专用功能性内存与系统内存是无隔离的分布在物理内存 中的, 例如, 在中央处理器 ( Central Processing Unit, 简称 CPU ) 酉己合现场可编程门阵歹' J ( Field-Programmable Gate Array, 简称 FPGA ) 实现数据包的转发系统中, 从物理内存中分配出一片 内存用 来作为转发内存 (专用功能性内存), 用来存储消息队列 ( Queue)、 数据緩存 ( Buffer )、 消息指针, 转发内存及系统内存无隔离的分布 在物理内存中, CPU和 FPGA通过消息队列实现数据緩存位置的交互, 然后通过获取的消息队列内容获取对应的数据。  In the physical memory of the computer system, there is not only system memory for storing the computer operating system, but also dedicated functional memory for storing data when the computer implements a specific function. The dedicated functional memory and the system memory are distributed without isolation. In the memory, for example, in the central processing unit (CPU), the Field-Programmable Gate Array (FPGA) implements the packet forwarding system, the physical memory A memory is allocated for forwarding memory (dedicated functional memory) for storing message queues (Queues), data buffers (Buffers), message pointers, forwarding memory, and system memory without isolation in physical memory. And the FPGA realizes the interaction of the data cache location through the message queue, and then obtains the corresponding data through the obtained message queue content.
发明人发现现有技术至少存在以下缺陷: 由于专用功能性内存 和系统内存之间没有任何的隔离和保护, 一旦访问专用功能性内存 的地址发生错误, 就有可能踩到系统内存, 容易造成系统复位或者 挂死引起事故; 随着计算机系统的应用越来越广泛, 计算机所能实 现的功能也将越来越多, 对物理内存的访问量也会大幅提高, 这样 则增大了系统内存被误踩的可能性, 降低了系统内存的安全性。 发明内容  The inventors have found that the prior art has at least the following drawbacks: Since there is no isolation and protection between the dedicated functional memory and the system memory, once the address of the dedicated functional memory is accessed, it is possible to step on the system memory, which is easy to cause the system. Reset or hang to cause an accident; With the increasing use of computer systems, the functions that computers can implement will also increase, and the amount of access to physical memory will be greatly increased, thus increasing the system memory. The possibility of accidental stepping reduces the security of the system memory. Summary of the invention
本发明的实施例提供一种访问内存的方法及设备, 有效提高系 统内存的安全性。  Embodiments of the present invention provide a method and device for accessing a memory, which effectively improves the security of the system memory.
为达到上述目的, 本发明的实施例釆用如下技术方案:  In order to achieve the above object, embodiments of the present invention use the following technical solutions:
第一方面, 提供一种访问内存的方法, 包括,  In a first aspect, a method of accessing memory is provided, including
获取第一设备请求访问第一内存区域的数据访问请求, 其中, 所述数据访问请求包含所述第一设备请求访问的数据的物理内存地 址; 所述第一内存区域为第一设备对应的专用物理内存区域; Obtaining a data access request of the first device requesting access to the first memory area, where The data access request includes a physical memory address of the data that the first device requests to access; the first memory area is a dedicated physical memory area corresponding to the first device;
根据所述第一设备请求访问的数据的物理内存地址查询输入 / 输出 I / O 虚拟化控制器设备中的物理内存地址信息; 其中, 所述物 理内存地址信息包含与所述第一内存区域的物理内存地址对应的物 理内存地址;  Querying physical memory address information in the input/output I/O virtualization controller device according to the physical memory address of the data requested by the first device; wherein the physical memory address information includes the first memory region The physical memory address corresponding to the physical memory address;
若确定所述第一设备请求访问的数据的物理内存地址在所述 If the physical memory address of the data requested by the first device is determined to be
I / O虚拟化控制器设备中的物理内存地址信息中,则访问所述第一内 存区域。 In the physical memory address information in the I/O virtualization controller device, the first memory area is accessed.
结合第一方面, 在第一方面的第一种可能的实现方式中, 在所 述获取第一设备请求访问第一内存区域的数据访问请求之前, 所述 方法还包括,  With reference to the first aspect, in a first possible implementation manner of the first aspect, before the acquiring, by the first device, the data access request for accessing the first memory area, the method further includes:
将所述第一内存区域的物理内存地址映射至所述 I / O 虚拟化控 制器设备中, 形成所述物理内存地址信息;  Mapping a physical memory address of the first memory area to the I/O virtualization controller device to form the physical memory address information;
将所述第一内存区域的物理内存地址映射至所述第一设备中。 结合第一方面或第一方面的第一种可能的实现方式, 在第一方 面的第二种可能的实现方式中, 所述 I / O 虚拟化控制器设备中包含 由至少一个物理内存地址信息组成的物理内存地址信息库, 其中, 每一个物理内存地址信息分别对应一个不同的内存区域; 相应的, 所述根据所述第一设备请求访问的数据的物理内存地址查询 I / 0 虚 拟化控制器设备中的物理内存地址信息, 包括:  Mapping a physical memory address of the first memory area to the first device. With reference to the first aspect or the first possible implementation manner of the first aspect, in the second possible implementation manner of the first aspect, the I/O virtualization controller device includes at least one physical memory address information a physical memory address information base, wherein each physical memory address information corresponds to a different memory area; correspondingly, the physical memory address of the data requested by the first device is queried I/0 virtualization control Physical memory address information in the device, including:
根据所述第一设备请求访问第一内存区域的数据访问请求查询 物理内存地址信息库, 获取所述第一设备对应的内存区域对应的物 理内存地址信息;  And the physical memory address information database is obtained by the first device, and the physical memory address information corresponding to the memory area corresponding to the first device is obtained.
根据所述第一设备请求访问的数据的物理内存地址查询所述 Querying according to a physical memory address of the data requested by the first device to access
I / O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址 信息。 The physical memory address information corresponding to the first memory area in the I/O virtualization controller device.
结合第一方面或第一方面的第一种可能的实现方式或第一方面 的第二种可能的实现方式, 在第一方面的第三种可能的实现方式中, 所述方法还包括, In conjunction with the first aspect or the first possible implementation of the first aspect or the second possible implementation of the first aspect, in a third possible implementation of the first aspect, The method also includes
若确定所述第一设备请求访问的数据的物理内存地址不在所述 If it is determined that the physical memory address of the data requested by the first device is not in the
I / O虚拟化控制器设备中的物理内存地址信息中,将所述数据访问请 求丟弃。 The data access request is discarded in the physical memory address information in the I/O virtualization controller device.
结合第一方面的第三种可能的实现方式, 在第一方面的第四种 可能的实现方式中, 所述方法还包括,  In conjunction with the third possible implementation of the first aspect, in a fourth possible implementation manner of the first aspect, the method further includes
若确定所述第一设备请求访问的数据的物理内存地址不在所述 If it is determined that the physical memory address of the data requested by the first device is not in the
I / O虚拟化控制器设备中的物理内存地址信息中, 记录异常信息。 第二方面, 提供一种访问内存的设备, 包括, In the physical memory address information in the I/O virtualization controller device, abnormal information is recorded. The second aspect provides a device for accessing a memory, including,
获取单元, 用于获取第一设备请求访问第一内存区域的数据访 问请求, 其中, 所述数据访问请求包含所述第一设备请求访问的数 据的物理内存地址; 所述第一内存区域为第一设备对应的专用物理 内存区 i或;  An acquiring unit, configured to acquire a data access request that the first device requests to access the first memory area, where the data access request includes a physical memory address of the data that the first device requests to access; the first memory area is a dedicated physical memory area i corresponding to a device;
查询单元, 用于根据所述获取单元获取的所述第一设备请求访 问的数据的物理内存地址查询 I / O 虚拟化控制器设备中的物理内存 地址信息; 其中, 所述物理内存地址信息包含与所述第一内存区域 的物理内存地址对应的物理内存地址;  a query unit, configured to query physical memory address information in the I/O virtualization controller device according to a physical memory address of the data requested by the first device acquired by the acquiring unit, where the physical memory address information includes a physical memory address corresponding to a physical memory address of the first memory area;
访问单元, 用于若查询单元确定所述第一设备请求访问的数据 的物理内存地址在所述 I / O 虚拟化控制器设备中的物理内存地址信 息中, 则访问所述第一内存区域。  And an access unit, configured to access the first memory area if the physical unit address of the data requested by the first device to be accessed by the query unit is in the physical memory address information in the I/O virtualization controller device.
结合第二方面, 在第二方面的第一种可能的实现方式中, 所述 设备还包括,  With reference to the second aspect, in a first possible implementation manner of the second aspect, the device further includes
映射单元, 用于在所述获取单元获取所述第一设备请求访问第 一内存区域的数据访问请求之前, 将所述第一内存区域的物理内存 地址映射至所述 I / O 虚拟化控制器设备中, 形成所述物理内存地址 信息;  a mapping unit, configured to map a physical memory address of the first memory area to the I/O virtualization controller before the obtaining unit acquires a data access request of the first device requesting access to the first memory area Forming, by the device, the physical memory address information;
所述映射单元还用于, 将所述第一内存区域的物理内存地址映 射至所述第一设备中。 结合第二方面或第二方面的第一种可能的实现方式, 在第二方 面的第二种可能的实现方式中, 所述 I / O 虚拟化控制器设备中包含 由至少一个物理内存地址信息组成的物理内存地址信息库, 其中, 每一个物理内存地址信息分别对应一个不同的内存区域; 相应的, 所述查询单元具体用于, The mapping unit is further configured to map a physical memory address of the first memory area to the first device. With reference to the second aspect, or the first possible implementation manner of the second aspect, in the second possible implementation manner of the second aspect, the I/O virtualization controller device includes at least one physical memory address information a physical memory address information base, where each physical memory address information corresponds to a different memory area; correspondingly, the query unit is specifically used,
根据所述第一设备请求访问第一内存区域的数据访问请求查询 物理内存地址信息库, 获取所述第一设备对应的内存区域对应的物 理内存地址信息;  And the physical memory address information database is obtained by the first device, and the physical memory address information corresponding to the memory area corresponding to the first device is obtained.
根据所述第一设备请求访问的数据的物理内存地址查询所述 Querying according to a physical memory address of the data requested by the first device to access
I / O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址 信息。 The physical memory address information corresponding to the first memory area in the I/O virtualization controller device.
结合第二方面或第二方面的第一种可能的实现方式或第二方面 的第二种可能的实现方式, 在第二方面的第三种可能的实现方式中, 所述设备还包括,  With reference to the second aspect, or the first possible implementation manner of the second aspect, or the second possible implementation manner of the second aspect, in a third possible implementation manner of the second aspect,
丟弃单元, 用于若所述查询单元确定所述第一设备请求访问的 数据的物理内存地址不在所述 I / O 虚拟化控制器设备中的物理内存 地址信息中, 将所述数据访问请求丟弃。  a discarding unit, configured to: if the query unit determines that a physical memory address of data requested by the first device is not in physical memory address information in the I/O virtualization controller device, the data access request is throw away.
结合第二方面的第三种可能的实现方式, 在第二方面的第四种 可能的实现方式中, 所述设备还包括,  In conjunction with the third possible implementation of the second aspect, in a fourth possible implementation of the second aspect, the device further includes
记录单元, 用于若所述查询单元确定所述第一设备请求访问的 数据的物理内存地址不在所述 I / O 虚拟化控制器设备中的物理内存 地址信息中, 记录异常信息。 第三方面, 提供一种访问内存的设备, 包括,  And a recording unit, configured to: if the query unit determines that the physical memory address of the data requested by the first device is not in the physical memory address information in the I/O virtualization controller device, the abnormal information is recorded. The third aspect provides a device for accessing a memory, including,
处理器, 用于获取第一设备请求访问第一内存区域的数据访问 请求, 其中, 所述数据访问请求包含所述第一设备请求访问的数据 的物理内存地址; 所述第一内存区域为第一设备对应的专用物理内 存区域;  a processor, configured to acquire a data access request of the first device requesting access to the first memory area, where the data access request includes a physical memory address of data requested by the first device; the first memory area is a dedicated physical memory area corresponding to a device;
I / O虚拟化控制器设备,用于根据所述第一设备请求访问的数据 的物理内存地址查询所述 I/O 虚拟化控制器设备中的物理内存地址 信息; 其中, 所述物理内存地址信息包含与所述第一内存区域的物 理内存地址对应的物理内存地址; An I/O virtualization controller device for requesting access to data according to the first device The physical memory address is queried for the physical memory address information in the I/O virtualization controller device; wherein the physical memory address information includes a physical memory address corresponding to the physical memory address of the first memory region;
第一设备, 用于若 I/O 虚拟化控制器设备确定所述第一设备请 求访问的数据的物理内存地址在所述 I/O 虚拟化控制器设备中的物 理内存地址信息中, 则访问所述第一内存区域。  a first device, configured to: if the I/O virtualization controller device determines that a physical memory address of the data requested by the first device is in the physical memory address information in the I/O virtualization controller device, The first memory area.
结合第三方面, 在第三方面的第一种可能的实现方式中, 所述 处理器具体用于, 在所述获取第一设备请求访问第一内存区域的数 据访问请求之前, 将所述第一内存区域的物理内存地址映射至所述 With reference to the third aspect, in a first possible implementation manner of the third aspect, the processor is specifically configured to: before the acquiring, by the first device, a data access request for accessing the first memory area, A physical memory address of a memory area is mapped to the
I/O虚拟化控制器设备中, 形成所述物理内存地址信息; Forming the physical memory address information in the I/O virtualization controller device;
所述处理器具体还用于, 将所述第一内存区域的物理内存地址 映射至所述第一设备中。  The processor is further configured to map a physical memory address of the first memory area to the first device.
结合第三方面或第三方面的第一种可能的实现方式, 在第三方 面的第二种可能的实现方式中, 所述 I/O 虚拟化控制器设备中包含 由至少一个物理内存地址信息组成的物理内存地址信息库, 其中, 每一个物理内存地址信息分别对应一个不同的内存区域; 相应的, 所述 I/O虚拟化控制器设备还用于,  With reference to the third aspect, or the first possible implementation manner of the third aspect, in a second possible implementation manner of the third aspect, the I/O virtualization controller device includes at least one physical memory address information a physical memory address information base, wherein each physical memory address information corresponds to a different memory area; correspondingly, the I/O virtualization controller device is further used,
根据所述第一设备请求访问第一内存区域的数据访问请求查询 物理内存地址信息库, 获取所述第一设备对应的内存区域对应的物 理内存地址信息;  And the physical memory address information database is obtained by the first device, and the physical memory address information corresponding to the memory area corresponding to the first device is obtained.
根据所述第一设备请求访问的数据的物理内存地址查询所述 Querying according to a physical memory address of the data requested by the first device to access
I/O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址 信息。 The physical memory address information corresponding to the first memory area in the I/O virtualization controller device.
结合第三方面或第三方面的第一种可能的实现方式或第三方面 的第二种可能的实现方式, 在第三方面的第三种可能的实现方式中, 所述 I/O虚拟化控制器设备还用于,  With reference to the third aspect, or the first possible implementation manner of the third aspect, or the second possible implementation manner of the third aspect, in a third possible implementation manner of the third aspect, the I/O virtualization The controller device is also used,
若确定所述第一设备请求访问的数据的物理内存地址不在所述 If it is determined that the physical memory address of the data requested by the first device is not in the
I/O虚拟化控制器设备中的物理内存地址信息中,将所述数据访问请 求丟弃。 结合第三方面的第三种可能的实现方式, 在第三方面的第四种 可能的实现方式中, 所述 I / O虚拟化控制器设备还用于, The data access request is discarded in the physical memory address information in the I/O virtualization controller device. In conjunction with the third possible implementation of the third aspect, in a fourth possible implementation manner of the third aspect, the I/O virtualization controller device is further configured to:
若确定所述第一设备请求访问的数据的物理内存地址不在所述 If it is determined that the physical memory address of the data requested by the first device is not in the
I / O虚拟化控制器设备中的物理内存地址信息中, 记录异常信息。 第四方面, 提供一种物理机, 包括, 访问内存的设备以及物理 内存, 其中, 所述访问内存的设备包含第一设备以及 I / O 虚拟化控 制器设备; In the physical memory address information in the I/O virtualization controller device, abnormal information is recorded. In a fourth aspect, a physical machine is provided, including: a device for accessing a memory and a physical memory, where the device for accessing the memory includes a first device and an I/O virtualization controller device;
所述访问内存的设备用于,  The device for accessing the memory is used,
获取第一设备请求访问第一内存区域的数据访问请求, 其中, 所述数据访问请求包含所述第一设备请求访问的数据的物理内存地 址; 所述第一内存区域为第一设备对应的专用物理内存区域;  Obtaining a data access request that the first device requests access to the first memory area, where the data access request includes a physical memory address of the data that the first device requests to access; the first memory area is dedicated to the first device Physical memory area;
根据所述第一设备请求访问的数据的物理内存地址查询 I / O 虚 拟化控制器设备中的物理内存地址信息; 其中, 所述物理内存地址 信息包含与所述第一内存区域的物理内存地址对应的物理内存地 址;  Querying physical memory address information in the I/O virtualization controller device according to the physical memory address of the data requested by the first device; wherein the physical memory address information includes a physical memory address of the first memory region Corresponding physical memory address;
若确定所述第一设备请求访问的数据的物理内存地址在所述 If the physical memory address of the data requested by the first device is determined to be
I / O虚拟化控制器设备中的物理内存地址信息中,则访问所述第一内 存区域。 In the physical memory address information in the I/O virtualization controller device, the first memory area is accessed.
结合第四方面, 在第四方面的第一种可能的实现方式中, 所述 访问内存的设备还用于, 在所述获取第一设备请求访问第一内存区 域的数据访问请求之前, 将所述第一内存区域的物理内存地址映射 至所述 I / O虚拟化控制器设备中, 形成所述物理内存地址信息; 所述访问内存的设备还用于, 将所述第一内存区域的物理内存 地址映射至所述第一设备中。  With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect, the device for accessing a memory is further configured to: before the acquiring, by the first device, a data access request for accessing the first memory area, The physical memory address of the first memory area is mapped to the I/O virtualization controller device to form the physical memory address information; the device for accessing the memory is further configured to: physics of the first memory area The memory address is mapped into the first device.
结合第四方面或第四方面的第一种可能的实现方式, 在第四方 面的第二种可能的实现方式中, 所述 I / O 虚拟化控制器设备中包含 由至少一个物理内存地址信息组成的物理内存地址信息库, 其中, 每一个物理内存地址信息分别对应一个不同的内存区域; 相应的, 所述访问内存的设备具体用于, With reference to the fourth aspect, or the first possible implementation manner of the fourth aspect, in a second possible implementation manner of the fourth aspect, the I/O virtualization controller device includes at least one physical memory address information a physical memory address information base, wherein each physical memory address information corresponds to a different memory area; correspondingly, The device for accessing the memory is specifically used,
根据所述第一设备请求访问第一内存区域的数据访问请求查询 物理内存地址信息库, 获取所述第一设备对应的内存区域的物理内 存地址信息;  Obtaining physical memory address information of the memory area corresponding to the first device, by querying the physical memory address information database by requesting the data access request of the first device to access the first memory area;
根据所述第一设备请求访问的数据的物理内存地址查询所述 Querying according to a physical memory address of the data requested by the first device to access
I / O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址 信息。 The physical memory address information corresponding to the first memory area in the I/O virtualization controller device.
结合第四方面或第四方面的第一种可能的实现方式或第四方面 的第二种可能的实现方式, 在第四方面的第三种可能的实现方式中, 所述访问内存的设备还用于,  With reference to the fourth aspect, or the first possible implementation manner of the fourth aspect, or the second possible implementation manner of the fourth aspect, in a third possible implementation manner of the fourth aspect, Used for
若确定所述第一设备请求访问的数据的物理内存地址不在所述 If it is determined that the physical memory address of the data requested by the first device is not in the
I / O虚拟化控制器设备中的物理内存地址信息中,将所述数据访问请 求丟弃。 The data access request is discarded in the physical memory address information in the I/O virtualization controller device.
本发明实施例提供的一种访问内存的方法及设备, 通过获取第 一设备请求访问第一内存区域的数据访问请求, 其中, 所述数据访 问请求包含所述第一设备请求访问的数据的物理内存地址; 所述第 一内存区域为第一设备对应的专用物理内存区域; 根据所述第一设 备请求访问的数据的物理内存地址查询 I / O 虚拟化控制器设备中的 物理内存地址信息; 其中, 所述物理内存地址信息包含与所述第一 备请求访问的数据的物理内存地址在所述 I / O 虚拟化控制器设备中 的物理内存地址信息中, 则访问所述第一内存区域; 有效的提高了 系统内存的安全性。 附图说明  A method and device for accessing a memory provided by an embodiment of the present invention, by acquiring a data access request of a first device requesting access to a first memory area, where the data access request includes a physicality of data requested by the first device a memory address; the first memory area is a dedicated physical memory area corresponding to the first device; and the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device; The physical memory address information includes the physical memory address of the data accessed by the first standby request in the physical memory address information in the I/O virtualization controller device, and then accesses the first memory region. Effectively improve the security of system memory. DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下 面将对实施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明的一些实施例, 对于 本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以 根据这些附图获得其他的附图。 In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is some embodiments of the present invention, and it can be used by those skilled in the art without creative efforts. Other figures are obtained from these figures.
图 1为本发明实施例提供的一种访问内存的方法的流程示意图; 图 2 A为本发明实施例提供的一种物理内存的内部结构示意图; 图 2 B为本发明实施例提供的一种消息指针与消息队列的场景示 意图;  FIG. 1 is a schematic flowchart of a method for accessing a memory according to an embodiment of the present invention; FIG. 2 is a schematic diagram of an internal structure of a physical memory according to an embodiment of the present invention; Schematic diagram of a message pointer and a message queue;
图 3为本发明实施例提供的一种 C P U配合 F P G A数据包转发系统 的场景示意图;  FIG. 3 is a schematic diagram of a scenario of a C P U and an F P G A packet forwarding system according to an embodiment of the present disclosure;
图 4 为本发明实施例提供的另一种访问内存的方法的流程示意 图;  4 is a schematic flow chart of another method for accessing a memory according to an embodiment of the present invention;
图 5 为本发明实施例提供的再一种访问内存的方法的流程示意 图;  FIG. 5 is a schematic flow chart of still another method for accessing a memory according to an embodiment of the present disclosure;
图 6为本发明实施例多个设备访问内存时的场景示意图; 图 7 为本发明实施例提供的又一种访问内存的方法的流程示意 图;  FIG. 6 is a schematic diagram of a scenario in which a plurality of devices access a memory according to an embodiment of the present invention; FIG. 7 is a schematic flowchart of another method for accessing a memory according to an embodiment of the present invention;
图 8 为本发明实施例提供的一种访问内存的设备的装置结构示 意图;  FIG. 8 is a schematic structural diagram of an apparatus for accessing a memory device according to an embodiment of the present invention; FIG.
图 9 为本发明实施例提供的另一种访问内存的设备的装置结构 示意图;  FIG. 9 is a schematic structural diagram of another apparatus for accessing a memory according to an embodiment of the present disclosure;
图 1 0为本发明实施例提供的再一种访问内存的设备的装置结构 示意图;  FIG. 10 is a schematic structural diagram of another apparatus for accessing a memory according to an embodiment of the present invention;
图 1 1 A为本发明实施例提供的一种物理机的装置结构示意图; 图 1 1 B为本发明实施例提供的另一种物理机的装置结构示意图。 具体实施方式  FIG. 1 is a schematic structural diagram of a device of a physical machine according to an embodiment of the present invention; FIG. 1B is a schematic structural diagram of another device of a physical machine according to an embodiment of the present invention. detailed description
下面将结合本发明实施例中的附图, 对本发明实施例中的技术 方案进行清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明 一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本 领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他 实施例, 都属于本发明保护的范围。 实施例一 The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without departing from the inventive scope are the scope of the present invention. Embodiment 1
本发明实施例一提供一种访问内存的方法, 参见图 1 , 该方法可 以包括:  Embodiment 1 of the present invention provides a method for accessing a memory. Referring to FIG. 1, the method may include:
1 0 1、 获取第一设备请求访问第一内存区域的数据访问请求, 其 中, 所述数据访问请求包含所述第一设备请求访问的数据的物理内 存地址; 所述第一内存区域为第一设备对应的专用物理内存区域; 其中, 第一设备为通过访问计算机的物理内存实现特定功能的 设备, 例如, 在 X 8 6 系统的 C P U配合 F P G A数据包转发系统中, 第一 设备为 F P G A ; 或者, 第一设备可以为虚拟化平台中虚拟机的外设; 本发明对第一设备的类型不进行具体限定;  And obtaining, by the first device, a data access request for accessing the first memory area, where the data access request includes a physical memory address of the data that the first device requests to access; the first memory area is the first The dedicated physical memory area corresponding to the device; wherein, the first device is a device that implements a specific function by accessing the physical memory of the computer, for example, in the CPU of the X 8 6 system and the FPGA packet forwarding system, the first device is an FPGA; or The first device may be a peripheral of the virtual machine in the virtualization platform; the present invention does not specifically limit the type of the first device;
第一内存区域是在物理内存中分配的第一设备实现对应功能的 专用物理内存区域, 例如, 参见图 2 A , 第一内存区域包含于物理内 存中, 第一内存区域至少包含有数据緩存、 消息队列及消息指针; 其中, 数据緩存用于储存第一设备实现对应功能过程中访问的 数据, 该数据可以以数据包的形式存储在数据緩存中;  The first memory area is a dedicated physical memory area in which the first device allocated in the physical memory implements the corresponding function. For example, referring to FIG. 2A, the first memory area is included in the physical memory, and the first memory area includes at least a data cache. a message queue and a message pointer; wherein, the data cache is used to store data accessed by the first device in implementing the corresponding function, and the data may be stored in the data cache in the form of a data packet;
消息队列可以是循环队列, 消息队列中包含以队列形式排列的 数据信息, 每个数据信息分别用于存储数据緩存中对应的数据的相 关信息, 例如, 可以包含数据在数据緩存中存放的位置的物理内存 地址和数据特征, 例如, 数据特征可以包含数据的类型、 大小、 长 度等, 对于数据信息中包含的数据特征的具体内容, 可以根据需要 进行设置, 本发明不进行具体限定;  The message queue may be a circular queue, and the message queue includes data information arranged in a queue form, and each data information is used to store related information of corresponding data in the data cache, for example, may include a location where the data is stored in the data cache. The physical memory address and the data feature, for example, the data feature may include the type, the size, the length, and the like of the data. The specific content of the data feature included in the data information may be set as needed, and the present invention is not specifically limited;
消息队列的深度是指消息队列可以用来存储数据信息的容量, 每一个消息队列可以是一个深度确定并且有限的循环队列, 且消息 队列的深度可以小于数据緩存的容量;  The depth of the message queue refers to the capacity that the message queue can use to store data information. Each message queue can be a depth-determined and limited circular queue, and the depth of the message queue can be smaller than the capacity of the data cache;
需要说明的是, 当消息队列的深度小于数据緩存的容量时, 数 据緩存中存储的每个数据对应的数据信息可能一部分数据信息存储 于消息队列中, 一部分数据信息将等待消息队列有空闲位置时再生 成并存储; 消息指针用于指示消息队列中数据信息的位置, 消息指针分为 头指针和尾指针, 例如, 可以用头指针来指示消息队列中最后一个 非空闲位置, 可以用尾指针来指示消息队列中第一个空闲位置, 这 样, 通过消息指针的指示, 可以明确得出消息队列中存放数据的位 置和空闲的位置; 当第一设备从消息队列中读取数据信息时, 可以 根据消息队列的基准地址加上消息指针头指针指示的消息队列位置 获取到数据信息存放的实际物理内存地址; It should be noted that when the depth of the message queue is smaller than the capacity of the data cache, the data information corresponding to each data stored in the data cache may be stored in the message queue, and some of the data information will wait for the message queue to have a free location. Regenerate and store; The message pointer is used to indicate the location of the data information in the message queue. The message pointer is divided into a head pointer and a tail pointer. For example, the head pointer can be used to indicate the last non-idle position in the message queue, and the tail pointer can be used to indicate the number in the message queue. An idle location, so that the location of the data in the message queue and the free location can be clearly indicated by the indication of the message pointer; when the first device reads the data information from the message queue, it can be based on the reference address of the message queue. Adding the actual physical memory address where the data information is stored by adding the message queue position indicated by the message pointer head pointer;
当需要往消息队列中存入数据信息时, 首先根据消息指针判断 消息队列是否已满, 若已满, 则等待空位置; 若未满, 则将需要存 放的数据信息存入消息指针的尾指针指示的第一个空闲位置, 再更 新消息指针将消息指针的尾指针 + 1 , 即保持让消息指针的尾指针指 示在消息队列中第一个空闲位置;  When it is necessary to store data information in the message queue, firstly, according to the message pointer, it is judged whether the message queue is full. If it is full, it waits for the empty position; if it is not full, the data information to be stored is stored in the tail pointer of the message pointer. Indicates the first idle location, and then updates the message pointer to the tail pointer of the message pointer + 1 , that is, keeps the tail pointer of the message pointer indicating the first idle position in the message queue;
其中, 根据消息指针判断消息队列是否已满, 一般令消息队列 的第 (消息队列深度 - 1 ) 个位置不存放数据信息为空, 可以釆用判 断消息指针的尾指针位置 + 1 是否等于头指针位置判断, 若等于, 则 判断消息队列已满, 若不等于, 则判断消息队列未满; 当然, 由于 消息队列为循环队列, 当尾指针指向 (消息队列深度 - 1 ) 位置时, 再将尾指针 + 1 回到位置 0 , 故本发明所有实施例中的指针位置 + 1 ― 般定义为 (指针位置 + 1 ) %消息队列深度, 其中%为取余运算符号; 需要说明的是, 本发明只是以上述消息指针对消息队列的指示 方法以及判断消息队列是否已满的方法为例来说明消息指针与消息 队列的位置的指示关系, 当然, 消息指针对消息队列的指示方法以 及判断消息队列是否已满的方法还可以釆用其他方法, 不会影响本 发明的结果, 本发明对此不进行具体限定;  Wherein, according to the message pointer to determine whether the message queue is full, generally the message queue (message queue depth - 1) position does not store the data information is empty, can use the judgment of the tail pointer position of the message pointer + 1 is equal to the head pointer Position judgment, if it is equal, it determines that the message queue is full, if not equal, it determines that the message queue is not full; of course, because the message queue is a circular queue, when the tail pointer points to the (message queue depth - 1) position, then the tail Pointer + 1 returns to position 0, so the pointer position + 1 in all embodiments of the present invention is generally defined as (pointer position + 1) % message queue depth, where % is a remainder operator; it should be noted that the present invention The method for indicating the message queue and the method for determining whether the message queue is full are used as an example to describe the indication relationship between the message pointer and the position of the message queue. Of course, the method for indicating the message queue to the message queue and determining whether the message queue is The full method can also use other methods without affecting the results of the present invention. The present invention does not specifically defined;
例如, 在图 2 B所示的深度为 1 0 的消息队列, 该消息队列中位 置 0存放数据信息 1、 位置 1存放数据信息 2、 位置 2存放数据信息 3 , 其余消息队列位置均为空, 那么此时, 参见图 2 B , 消息指针的头 指针指示在该消息队列的位置 0 ,尾指针指示在该消息队列的位置 3; 当在该消息队列中存入数据信息 4 时, 首先判定消息队列未满, 故 将数据信息 4存入尾指针指示的消息队列位置 3 ,并更新消息队列的 尾指针 + 1 指示到消息队列位置 4; 当从该队列读取数据信息时, 读 取头指针指示的消息队列位置 0存放的数据信息 1,并将消息指针的 头指针更新 + 1指示到消息队列位置 1; For example, in the message queue of depth 10 shown in FIG. 2B, the location 0 in the message queue stores data information 1, the location 1 stores data information 2, the location 2 stores data information 3, and the remaining message queue locations are empty. Then, at this time, referring to FIG. 2B, the head pointer of the message pointer indicates the position 0 of the message queue, and the tail pointer indicates the position 3 of the message queue; when the data information 4 is stored in the message queue, the message is first determined. The queue is not full, so Store the data information 4 in the message queue position 3 indicated by the tail pointer, and update the tail pointer of the message queue + 1 to the message queue position 4; when reading the data information from the queue, read the message queue position indicated by the head pointer 0 stores the data information 1, and updates the head pointer of the message pointer + 1 to the message queue position 1;
例如, 数据緩存中存储有 N个数据 (以数据包的形式存储), 分 别记为数据包 1, 数据包 2 数据包 N;  For example, the data cache stores N data (stored in the form of data packets), which are respectively recorded as data packet 1, packet 2 packet N;
1 J , 对应的可以有 N个数据信息, 分别记为数据信息 1, 数据信 息 2 数据信息 N, 每个数据信息分别对应一个数据包, 每个数 据信息可以包含与该数据信息对应的数据包在数据緩存中存放的位 置的物理内存地址和数据特征; Bay 1 J , corresponding to N data information, respectively recorded as data information 1, data information 2 data information N, each data information corresponds to a data packet, each data information may contain data corresponding to the data information The physical memory address and data characteristics of the location where the packet is stored in the data cache;
假设, 消息队列的深度为 S 且该消息队列为空, 该消息队列的 位置可以记为消息队列位置 0、 消息队列位置 1 消息队列位置 Assume that the message queue has a depth of S and the message queue is empty. The location of the message queue can be recorded as message queue position 0, message queue position 1 message queue position
S-1, 其中, S 远远大于 N, 从消息队列位置 0 开始存放数据信息, 消息队列中存储有数据信息 1, 数据信息 2 数据信息 N, 对应 的消息指针中的头指针指示消息队列位置 0 ,而尾指针指示消息队列 位置 N; S-1, where S is far greater than N, storing data information from the message queue position 0, the message queue storing data information 1, data information 2 data information N, the corresponding head pointer in the message pointer indicating the message queue position 0, and the tail pointer indicates the message queue position N;
再假设, 消息队列的深度为 Y 且该消息队列为空, 该消息队列 的位置可以记为消息队列位置 0、 消息队列位置 1 消息队列 位置 Y-1, 其中, Y小于 N, 从消息队列位置 0开始存放数据信息, 消息队列中存储有数据信息 1, 数据信息 2 数据信息 Y-1, 那 么, 数据信息 Y 数据信息 N将等待消息队列有空闲位置再生成 并存储; 对应的消息指针中的头指针指示消息队列位置 0, 而尾指针 指示消息队列位置 Y-l。  Assume again that the message queue has a depth of Y and the message queue is empty. The location of the message queue can be recorded as message queue position 0, message queue position 1 message queue position Y-1, where Y is less than N, from the message queue location 0 starts to store data information, the message queue stores data information 1, data information 2 data information Y-1, then, data information Y data information N will wait for the message queue to have an idle location to be generated and stored; corresponding message pointer The head pointer indicates that the message queue location is 0, and the tail pointer indicates the message queue location Y1.
其中, 数据访问请求可以由第一设备生成, 下面分别以第一设 备读取第一内存区域中的数据包和第一设备向第一内存区域存储数 据包为例说明数据访问请求的生成过程;  The data access request may be generated by the first device, where the first device reads the data packet in the first memory area and the first device stores the data packet in the first memory area as an example to describe a data access request generation process.
1、 第一设备读取第一内存区域中的数据包;  1. The first device reads the data packet in the first memory area;
例如, 第一设备实时获取消息指针中数据信 , 的物理内存地址, 假设当前第一设备获取到数据信息 2 的物理内存地址, 第一设备生 成访问消息队列的数据访问请求, 该数据访问请求包含数据信息 2 的物理内存地址; For example, the first device acquires the physical memory address of the data message in the message pointer in real time, and assumes that the current device acquires the physical memory address of the data information 2, and the first device generates a data access request for accessing a message queue, the data access request including a physical memory address of the data information 2;
假设第一设备根据数据信息 2 的物理内存地址从消息队列中获 取数据信息 2 , 根据该数据信息 2获取数据包 2 的物理内存地址, 第 一设备生成访问数据緩存的数据访问请求, 该数据访问请求包含数 据包 2的物理内存地址。  It is assumed that the first device obtains the data information 2 from the message queue according to the physical memory address of the data information 2, obtains the physical memory address of the data packet 2 according to the data information 2, and the first device generates a data access request for accessing the data cache, the data access The request contains the physical memory address of packet 2.
2、 第一设备向第一内存区域存储数据包。  2. The first device stores the data packet to the first memory area.
例如, 当第一设备需要向第一内存区域保存数据 X 时, 第一设 备向第一内存区域申请存储数据包 X 所需要的数据緩存, 获取内存 分配给该数据包 X在数据緩存中的物理内存地址;  For example, when the first device needs to save the data X to the first memory area, the first device applies to the first memory area for the data cache required to store the data packet X, and obtains the physical memory allocated to the data packet X in the data cache. Memory address
第一设备根据内存分配给该数据包 X 在数据緩存中的物理内存 地址生成数据访问请求 ,该数据访问请求包含内存分配给该数据包 X 在数据緩存中的物理内存地址。  The first device generates a data access request according to a memory allocation to the physical memory address of the data packet X in the data cache, and the data access request includes a physical memory address allocated by the memory to the data packet X in the data cache.
1 02、 根据所述第一设备请求访问的数据的物理内存地址查询 I / O虚拟化控制器设备中的物理内存地址信息; 其中, 所述物理内存 地址;  The physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device; wherein, the physical memory address;
进一步的, 在步骤 1 01之前, 所述方法还可以包括,  Further, before step 119, the method may further include:
将第一内存区域的物理内存地址映射至 I / O 虚拟化控制器设备 中, 形成物理内存地址信息;  Mapping the physical memory address of the first memory area to the I/O virtualization controller device to form physical memory address information;
其中, 第一内存区域的物理内存地址包含数据緩存、 消息队列 及消息指针的物理内存地址。  The physical memory address of the first memory area includes a data cache, a message queue, and a physical memory address of the message pointer.
将第一内存区域的物理内存地址映射至所述第一设备中。  Mapping a physical memory address of the first memory area to the first device.
其中, 物理内存地址信息是通过将第一内存区域的物理内存地 址映射至 I / O虚拟化控制器设备中形成的,物理内存地址信息在 I / O 虚拟化控制器设备中的可以按照表格形式存在, 参见表 1 , 也可以按 照其他形式存在, 物理内存地址信息的形式不影响本发明的结果, 本发明对此不进行限制; 表 1 The physical memory address information is formed by mapping the physical memory address of the first memory area to the I/O virtualization controller device, and the physical memory address information may be in a table form in the I/O virtualization controller device. Existence, see Table 1, may also exist in other forms, and the form of physical memory address information does not affect the result of the present invention, and the present invention does not limit this; Table 1
物理内存地址 1  Physical memory address 1
物理内存地址 2  Physical memory address 2
物理内存地址 3 物理内存地址 N  Physical memory address 3 physical memory address N
可选的, I/O虚拟化控制器设备中包含由至少一个物理内存地址 信息组成的物理内存地址信息库, 其中, 每一个物理内存地址信息 分别对应一个不同的内存区域;  Optionally, the I/O virtualization controller device includes a physical memory address information database composed of at least one physical memory address information, where each physical memory address information corresponds to a different memory region;
示例性的, 当多个设备同时访问物理内存时, 物理内存中则会 分配多个内存区域, 当然, 不同的设备可以对应同一个内存区域; 通过将每个内存区域的物理内存地址映射至 I/O 虚拟化控制器设备 中多个形成物理内存信息, 则 I/O 虚拟化控制器设备中包含多个物 理内存信息组成的物理内存信息库, 其中, 每一个物理内存地址信 息分别对应一个不同的内存区域, 不同的设备可以对应同一个物理 内存地址信息;  Exemplarily, when multiple devices access physical memory at the same time, multiple memory areas are allocated in physical memory. Of course, different devices can correspond to the same memory area; by mapping the physical memory address of each memory area to I /O Virtualization controller device forms physical memory information, and the I/O virtualization controller device includes a physical memory information database composed of multiple physical memory information, where each physical memory address information corresponds to a different one. Memory area, different devices can correspond to the same physical memory address information;
物理内存地址信息库中的多个物理内存地址信息分别与多个内 存区域——对应, 物理内存地址信息库在 I/O 虚拟化控制器设备中 可以以表格的形式存在, 参见表 2, 当然, 物理内存地址信息库在 I/O虚拟化控制器设备中也可以按照其他形式存在,物理内存地址信 息库的形式不影响本发明的结果, 本发明对此不进行限制;  The physical memory address information in the physical memory address information database corresponds to a plurality of memory regions, respectively, and the physical memory address information library may exist in the form of a table in the I/O virtualization controller device, see Table 2, of course. The physical memory address information database may also exist in other forms in the I/O virtualization controller device. The form of the physical memory address information database does not affect the result of the present invention, and the present invention does not limit this;
表 1  Table 1
Figure imgf000014_0001
Figure imgf000014_0001
需要说明的是, 多个设备可以对应同一个内存区域, 在 I/O 虚 拟化控制器设备中的物理内存地址信息库中, 多个设备可以对应同 一个物理内存地址信息, 例如, 表 2 所示的第一设备的物理内存地 址信息可以与第 N设备的物理内存地址信息相同; It should be noted that multiple devices can correspond to the same memory area, and I/O is virtual. In the physical memory address information library of the controller device, multiple devices may correspond to the same physical memory address information. For example, the physical memory address information of the first device shown in Table 2 may be the physical memory address of the Nth device. The same information;
相应的,根据第一设备请求访问的数据的物理内存地址查询 I / O 虚拟化控制器设备中的物理内存地址信息, 可以包括,  Correspondingly, the physical memory address information of the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device, which may include
根据第一设备请求访问第一内存区域的数据访问请求查询物理 内存地址信息库, 获取第一设备对应的内存区域对应的物理内存地 址信息;  Querying the physical memory address information base according to the data access request of the first device to access the first memory area, and acquiring physical memory address information corresponding to the memory area corresponding to the first device;
根据所述第一设备请求访问的数据的物理内存地址查询所述 I / O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址 信息。  Querying physical memory address information corresponding to the first memory area in the I/O virtualization controller device according to a physical memory address of the data requested by the first device.
1 03、 若确定所述第一设备请求访问的数据的物理内存地址在所 述 I / O 虚拟化控制器设备中的物理内存地址信息中, 则访问所述第 一内存区 i或。  If the physical memory address of the data requested by the first device is determined to be in the physical memory address information in the I/O virtualization controller device, accessing the first memory area i or .
示例性的, 若数据访问请求中包含的第一设备请求访问的数据 的物理内存地址在 I / O虚拟化控制器设备中的物理内存地址信息内, 则说明第一设备发送的请求访问第一内存区域的数据访问请求可以 正确访问第一内存区域, 不会对系统内存误踩, 即不会影响系统内 存的安全性。  Illustratively, if the physical memory address of the data requested by the first device included in the data access request is in the physical memory address information in the I/O virtualization controller device, the first device sends the request to access the first The data access request in the memory area can correctly access the first memory area, and does not accidentally step on the system memory, that is, it does not affect the security of the system memory.
进一步的, 所述方法还可以包括,  Further, the method may further include
若确定所述第一设备请求访问的数据的物理内存地址不在所述 I / O虚拟化控制器设备中的物理内存地址信息中,将所述数据访问请 求丟弃。  If it is determined that the physical memory address of the data requested by the first device is not in the physical memory address information in the I/O virtualization controller device, the data access request is discarded.
可选的, 所述方法还可以包括,  Optionally, the method may further include:
若确定所述第一设备请求访问的数据的物理内存地址不在所述 I / O虚拟化控制器设备中的物理内存地址信息中, 记录异常信息。  If it is determined that the physical memory address of the data requested by the first device is not in the physical memory address information in the I/O virtualization controller device, the abnormal information is recorded.
本发明实施例提供的一种访问内存的方法, 通过获取第一设备 请求访问第一内存区域的数据访问请求, 其中, 所述数据访问请求 包含所述第一设备请求访问的数据的物理内存地址; 所述第一内存 区域为第一设备对应的专用物理内存区域; 根据所述第一设备请求 访问的数据的物理内存地址查询 I/O 虚拟化控制器设备中的物理内 存地址信息; 其中, 所述物理内存地址信息包含与所述第一内存区 访问的数据的物理内存地址在所述 I / 0 虚拟化控制器设备中的物理 内存地址信息中, 则访问所述第一内存区域; 有效的提高了 系统内 存的安全性。 实施例二 The method for accessing the memory provided by the embodiment of the present invention, by acquiring the data access request of the first device requesting access to the first memory area, where the data access request includes the physical memory address of the data requested by the first device The first memory The area is a dedicated physical memory area corresponding to the first device; the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device; wherein the physical memory address information Having the physical memory address of the data accessed by the first memory area in the physical memory address information in the I/O virtualization controller device, accessing the first memory area; effectively improving system memory safety. Embodiment 2
本发明实施例二提供一种访问内存的方法, 以在 X86 系统中, CPU配合 FPGA数据包转发系统中 FPGA向内存存储数据为例, 对图 1 所示的访问内存的方法进行详细描述, 该访问内存的方法的具体过 程可以由物理内存所在的物理机来完成;  The second embodiment of the present invention provides a method for accessing a memory. In the X86 system, the CPU cooperates with the FPGA in the FPGA packet forwarding system to store data in the memory as an example, and the method for accessing the memory shown in FIG. 1 is described in detail. The specific process of accessing the memory method can be completed by the physical machine where the physical memory is located;
需要说明的是, 参见图 3, 在 X86 系统的 CPU配合 FPGA数据包 转发系统中,FPGA与物理内存交互数据包括 FPGA向物理内存存储数 据和读取数据, 本发明实施例仅以 FPGA作为第一设备向物理内存存 储数据为例对访问内存的方法进行描述, 其他设备访问内存的方法 与 FPGA访问内存的方法相似, 此处不再进行赘述。  It should be noted that, in FIG. 3, in the CPU of the X86 system and the FPGA packet forwarding system, the interaction data between the FPGA and the physical memory includes the FPGA storing data and reading data to the physical memory, and the embodiment of the present invention only uses the FPGA as the first The device stores data in physical memory as an example to describe the method of accessing memory. The method for accessing memory by other devices is similar to the method for accessing memory by FPGA, and will not be described here.
参见图 4, 该方法可以包括:  Referring to Figure 4, the method can include:
401、 在物理内存中分配第一内存区域;  401. Allocate a first memory area in physical memory.
根据 CPU配合 FPGA数据包转发系统的需求, 在物理内存中分配 出 CPU和 FPGA对应的专用物理内存区域, 即第一内存区域, 定义为 转发内存;  According to the requirements of the CPU and the FPGA packet forwarding system, a dedicated physical memory area corresponding to the CPU and the FPGA is allocated in the physical memory, that is, the first memory area is defined as forwarding memory;
例如, CPU配合 FPGA数据包转发系统需要 1 千比特 ( KiloByte, 简称 KB ) 物理内存用于实现数据包转发功能, 则在物理内存中分配 1KB物理内存作为转发内存, 起始物理内存地址为 2001H, 则转发内 存的物理内存地址为 2001 H ~ 2400H;  For example, the CPU and the FPGA packet forwarding system require 1 kilobit (KiloByte, referred to as KB) physical memory for packet forwarding. In the physical memory, 1 KB of physical memory is allocated as forwarding memory, and the starting physical memory address is 2001H. The physical memory address of the forwarding memory is 2001 H ~ 2400H;
需要说明的是, 本实施例以在物理内存中分配连续的物理内存 区域作为转发内存为例进行说明, 对于分配物理内存的哪部分作为 转发内存, 本发明对此不进行具体限定。 It should be noted that, in this embodiment, a continuous physical memory area is allocated in the physical memory as an example of forwarding memory, and which part of the physical memory is allocated as The forwarding memory is not specifically limited in the present invention.
402、 将转发内存的物理内存地址映射至内存直接存取重映射 ( Direct Memory Access Remapping, 简称 DMA Remapping ) 结构中 , 形成物理内存地址信息; 同时将转发内存的物理内存地址映射至 FPGA;  402. The physical memory address of the forwarding memory is mapped to a Direct Memory Access Remapping (DMA Remapping) structure to form physical memory address information; and the physical memory address of the forwarding memory is mapped to the FPGA;
其中, DMA Remapping为配合 X86 系统中的 I/O虚拟化控制器设 备, 本实施例仅以 X86 为例对访问内存的方法进行说明, 对于 I/O 虚拟化控制器设备的类型本发明实施例不进行具体限定, 只需保证 I/O虚拟化控制器设备与本发明方法所使用的系统配套即可;凡是通 过 I/O虚拟化控制器设备访问内存的方法均属于本发明保护范围; 例如, 将转发内存的物理内存地址 2001H ~ 2400H 映射至 DMA Remapping结构中, 形成的物理内存地址信息如表 3所示;  The DMA Remapping is to cooperate with the I/O virtualization controller device in the X86 system. In this embodiment, the method for accessing the memory is only described by using the X86 as an example. For the type of the I/O virtualization controller device, the embodiment of the present invention Without limitation, it is only necessary to ensure that the I/O virtualization controller device is matched with the system used by the method of the present invention; any method for accessing memory through the I/O virtualization controller device belongs to the protection scope of the present invention; for example; The physical memory address 2001H ~ 2400H of the forwarding memory is mapped into the DMA Remapping structure, and the physical memory address information formed is as shown in Table 3;
表 3  table 3
2001H 2002H 2003H  2001H 2002H 2003H
2400H 当转发内存的物理内存地址分别映射至 DMA Remapping 结构和 FPGA中后, 贝' J完成了转发内存、 DMA Remapping结构和 FPGA三者之 间的映射关系; 此后, FPGA与转发内存之间的交互数据中包含的物 理内存地址啫 会通过 DMA Remapping结构的监测和控制。 2400H After the physical memory addresses of the forwarding memory are mapped to the DMA Remapping structure and the FPGA respectively, the mapping between the forwarding memory, the DMA Remapping structure and the FPGA is completed; thereafter, the interaction between the FPGA and the forwarding memory The physical memory address contained in the data is monitored and controlled by the DMA Remapping structure.
403、 定义转发内存中消息队列的基准地址和消息队列深度; 其中, 根据 CPU配合 FPGA数据包转发系统的需求, 在转发内存 中分配出作为消息队列的物理内存区域, 包含分配消息队列的基准 地址和消息队列深度;  403. Define a reference address and a message queue depth of the message queue in the forwarding memory. Wherein, according to the requirement of the CPU and the FPGA packet forwarding system, the physical memory area as the message queue is allocated in the forwarding memory, and the reference address of the allocated message queue is included. And message queue depth;
例如, CPU配合 FPGA数据包转发系统需要深度为 10的消息队列 , 根据该需求, 在转发内存中, 定义基准地址为 2001H, 深度为 10的 消息队列; 则, 消息队列中的位置可以记为消息队列位置 0、 消息队 列位置 1、 消息队列位置 2 消息队列位置 9; For example, a CPU with an FPGA packet forwarding system requires a message queue of depth 10. According to the requirement, in the forwarding memory, a message queue with a base address of 2001H and a depth of 10 is defined; then, the position in the message queue can be recorded as message queue position 0, message queue position 1, message queue position 2, message queue position 9 ;
因此, 从物理内存读取数据包的设备可以根据消息指针中头指 针指示的消息队列位置与消息队列的基准地址得出存放数据信息的 消息队列的物理内存地址;  Therefore, the device that reads the data packet from the physical memory can obtain the physical memory address of the message queue storing the data information according to the message queue position indicated by the header pointer in the message pointer and the reference address of the message queue;
相应的, 转发内存中除了消息队列、 消息指针外的区域则为数 据緩冲区域。  Correspondingly, the area in the forwarding memory except the message queue and the message pointer is the data buffer area.
404、 发起存储请求, 获取物理内存地址;  404. Initiate a storage request to obtain a physical memory address.
例如, 若 FPGA接收到一个大小为 1字节 ( Byte, 简称 B ) 的数 据包 X, 需要将该数据包 X转发出去, 首先需要将数据包 X存入转发 内存中;  For example, if the FPGA receives a packet X with a size of 1 byte (Byte, abbreviated as B), the packet X needs to be forwarded out. First, the packet X needs to be stored in the forwarding memory.
发起存储请求, 申请长度为 1B的物理内存, 用来存放数据包 X; 假设, 获取到长度为 1B 的物理内存, 该获取到的长度为 1B 的物理 内存对应的物理内存地址为 2300H。  The storage request is initiated, and the physical memory with a length of 1 B is used to store the data packet X. Assume that the physical memory address of the physical memory with a length of 1 B is 2300H.
405、 获取申请访问转发内存的数据访问请求, 其中数据访问请 求包含步骤 404获取的物理内存地址;  405. Obtain a data access request for requesting access to the forwarding memory, where the data access request includes the physical memory address obtained in step 404;
其中, 在步骤 404 中获取到用于存储数据包 X 的物理内存后, 需要生成数据访问请求, 申请将数据包 X存入步骤 404 获取的物理 内^"内;  After the physical memory for storing the data packet X is obtained in step 404, a data access request needs to be generated, and the data packet X is requested to be stored in the physical entity obtained in step 404;
例如, 获取申请访问转发内存的数据访问请求, 该数据访问请 求包含步骤 404 获取的物理内存地址, 即申请将数据包 X存入物理 内存中物理内存地址为 2300H的位置。  For example, the data access request for accessing the forwarding memory is obtained, and the data access request includes the physical memory address obtained in step 404, that is, the application for storing the data packet X in the physical memory with the physical memory address of 2300H.
406、 根据数据访问请求中 包含的物理内存地址查询 DMA Remapping结构的物理内存地址信息,检测数据访问请求中包含的物 理内存地址是否在 DMA Remapping 结构的物理内存地址信息中; 若 是, 则执行步骤 407; 若否, 则执行步骤 409;  406. Query the physical memory address information of the DMA Remapping structure according to the physical memory address included in the data access request, and check whether the physical memory address included in the data access request is in the physical memory address information of the DMA Remapping structure; if yes, execute step 407. If not, proceed to step 409;
例如, 步骤 405 中获取到数据访问请求, 该数据访问请求中包 含步骤 404获取的物理内存的物理内存地址, 即 2300H; 则根据获取 的数据访问请求中包含的物理内存地址 2300H 查询表 3 所示的物理 内存地址信息, 检测获取的数据访问请求中包含的物理内存地址 2300H是否在 DMA Remapping结构的物理内存地址信息中; For example, in step 405, a data access request is obtained, where the data access request includes the physical memory address of the physical memory acquired in step 404, that is, 2300H; The physical memory address 2300H included in the data access request queries the physical memory address information shown in Table 3, and detects whether the physical memory address 2300H included in the obtained data access request is in the physical memory address information of the DMA Remapping structure;
由于表 3 所示的物理内存地址信息中包含的物理内存地址为 2001H - 2400H, 而获取的数据访问请求中包含的物理内存地址为 2300H, 经过检测, 可以确定获取的数据访问请求中包含的物理内存 地址 2300H在 DMA Remapping结构的物理内存地址信息中;  The physical memory address contained in the physical memory address information shown in Table 3 is 2001H - 2400H, and the physical memory address contained in the obtained data access request is 2300H. After detection, the physical content included in the acquired data access request can be determined. The memory address 2300H is in the physical memory address information of the DMA Remapping structure;
再例如, 若步骤 404 获取的物理内存地址为 2600H, 步骤 405 中获取到的数据访问请求, 该数据访问请求中包含步骤 404 获取的 物理内存的物理内存地址, 即 2600H,; 则根据获取的数据访问请求 中包含的物理内存地址 2600H 查询表 3 所示的物理内存地址信息, 检测获取的数据访问请求中包含的物理内存地址 2600H 是否在 DMA Remapping结构的物理内存地址信息中;  For example, if the physical memory address obtained in step 404 is 2600H, the data access request obtained in step 405 includes the physical memory address of the physical memory obtained in step 404, that is, 2600H, and then according to the acquired data. The physical memory address 2600H included in the access request is used to query the physical memory address information shown in Table 3, and it is detected whether the physical memory address 2600H included in the obtained data access request is in the physical memory address information of the DMA Remapping structure;
由于表 3 所示的物理内存地址信息中包含的物理内存地址为 2001H - 2400H, 而获取的数据访问请求中包含的物理内存地址为 2600H, 经过检测, 可以确定获取的数据访问请求中包含的物理内存 地址 2600H不在 DMA Remapping结构的物理内存地址信息中。  The physical memory address contained in the physical memory address information shown in Table 3 is 2001H - 2400H, and the physical memory address contained in the obtained data access request is 2600H. After detection, the physical content included in the acquired data access request can be determined. The memory address 2600H is not in the physical memory address information of the DMA Remapping structure.
407、 将需要转发的数据包存放至数据访问请求中包含的物理内 存地址所对应的物理内存位置中;  407. Store the data packet that needs to be forwarded into a physical memory location corresponding to a physical memory address included in the data access request.
例如, 步骤 406 根据获取的数据访问请求中包含的物理内存地 址 2300H 查询表 3 所示的物理内存地址信息, 确定获取的数据访问 请求中包含的物理内存地址 2300H在 DMA Remapping 结构的物理内 存地址信息中, 则将数据包 X 存入物理内存中物理内存地址地址为 2300H的位置。  For example, step 406 determines, according to the physical memory address information of the physical memory address 2300H included in the obtained data access request, the physical memory address information of the physical memory address 2300H included in the acquired data access request in the DMA Remapping structure. In the middle, the packet X is stored in the physical memory where the physical memory address is 2300H.
408、 生成数据信息, 并将数据信息存入消息队列中, 且更新消 息指针; 征;  408. Generate data information, and store the data information in a message queue, and update the message pointer;
数据包的数据特征可以包括数据大小、 数据类型、 数据长度等 数据特征, 本发明对此不进行具体限定; The data characteristics of the data packet can include data size, data type, data length, etc. The data feature is not specifically limited in the present invention;
需要说明的是, 将数据信息存放到消息队列中之前, 首先判断 消息队列是否已满; 若消息队列已满, 则等待消息队列有空闲位置 后再生成数据信息; 对于判断消息队列是否已满的方法已经在实施 例一进行了详细描述, 此处不再进行赘述;  It should be noted that, before storing the data information in the message queue, first determine whether the message queue is full; if the message queue is full, wait for the message queue to have an idle position and then generate data information; for determining whether the message queue is full The method has been described in detail in the first embodiment, and will not be described again here;
若消息队列未满, 则生成消息信息存入消息队列, 本实施例以 消息队列未满为例进行说明;  If the message queue is not full, the generated message information is stored in the message queue. In this embodiment, the message queue is not full as an example.
若消息队列未满一般选择转发内存中消息队列中的第一个空闲 位置, 即消息指针中尾指针指示的位置; 当然, 也可以选择消息队 列中其他空闲的位置存放空闲位置存放所述数据包的物理内存地址 及数据特征, 具体位置不进行限定;  If the message queue is not full, it is generally selected to forward the first idle position in the message queue in the memory, that is, the position indicated by the tail pointer in the message pointer; of course, other idle locations in the message queue may also be selected to store the idle location to store the data packet. Physical memory address and data characteristics, the specific location is not limited;
进一步的, 将数据信息存入消息队列的第一个空闲位置后, 更 新消息指针中尾指针指示的位置, 使得消息指针中尾指针指示的位 置 + 1 ;  Further, after the data information is stored in the first idle position of the message queue, the position indicated by the tail pointer in the message pointer is updated, so that the position indicated by the tail pointer in the message pointer is + 1;
例如, 将数据包 X存入物理内存中物理内存地址为 2 3 0 0 H 的位 置后, 将数据包 X存放的位置即物理内存地址 2 3 0 0 H和数据包 X的 数据特征生成数据信息 X;将数据信息 X存放到转发内存中消息队列 的第一个空闲位置即消息指针中尾指针指示的位置;  For example, after storing the data packet X in the physical memory with the physical memory address of 2 3 0 0 H, the data location of the data packet X, that is, the physical memory address 2 3 0 0 H and the data characteristics of the data packet X, generates data information. X; storing the data information X in the first idle position of the message queue in the forwarding memory, that is, the position indicated by the tail pointer in the message pointer;
假设此时消息指针的尾指针指示消息队列中第一个空闲位置为 消息队列位置 4 , 则将数据信息存入该位置;  Suppose that the tail pointer of the message pointer indicates that the first idle location in the message queue is the message queue location 4, then the data information is stored in the location;
并更新消息指针中的尾指针指示消息队列位置 5 ;  And updating the tail pointer in the message pointer to indicate the message queue position 5;
需要说明的是, 在生成数据信息 X 的过程中, 有可能将错误的 物理内存地址包含到数据信息 X 中, 即数据信息 X 中包含的物理内 存地址不是数据包 X 实际保存的位置; 类似这种错误都可以在第一 设备访问物理内存读取数据包的过程中通过本发明所述的访问内存 的方法检测并纠正。  It should be noted that, in the process of generating the data information X, it is possible to include the wrong physical memory address in the data information X, that is, the physical memory address contained in the data information X is not the location where the data packet X is actually saved; Any kind of error can be detected and corrected by the method of accessing the memory according to the present invention during the process of the first device accessing the physical memory to read the data packet.
4 09、 丟弃数据访问请求;  4 09, discard data access request;
例如, 在步骤 4 06 中查询表 3 可确定数据访问请求中包含的物 理内存地址不在 DMA Rema p p i n g 结构的物理内存地址信息中, 故不 能将数据包 X存入物理内存中物理内存地址为 2600H 的位置, 将数 据访问请求丟弃; For example, querying Table 3 in step 060 can determine that the physical memory address contained in the data access request is not in the physical memory address information of the DMA Rema pping structure, so The data packet X can be stored in the physical memory address where the physical memory address is 2600H, and the data access request is discarded.
当丟弃数据访问请求后, 重新执行步骤 404 获取用来存放数据 包 X的物理内存的物理内存地址;  After discarding the data access request, step 404 is performed to obtain the physical memory address of the physical memory used to store the data packet X;
410、 记录错误访问信息。  410. Record error access information.
例如, 若丟弃数据访问请求, 记录此次错误访问信息, 以便于 访问内存的设备对访问问题的定位, 可以提高系统的可维护性;  For example, if the data access request is discarded, the error access information is recorded, so that the device accessing the memory can locate the access problem, thereby improving the maintainability of the system;
需要说明的是, 上述向物理内存存储数据包过程中, 此实施例 仅以申请将数据包 X 存入物理内存时的请求作为数据访问请求为例 进行说明, 在实际使用中, 向物理内存存储数据过程中包含有物理 内存地址的任何请求均可以作为数据访问请求, 本发明对此不进行 限定, 都属于本发明保护的范围。  It should be noted that, in the process of storing the data packet in the physical memory, the embodiment only uses the request for storing the data packet X in the physical memory as a data access request as an example. In actual use, the physical memory is stored. Any request that includes a physical memory address in the data process can be used as a data access request, which is not limited by the present invention and is within the scope of the present invention.
本发明实施例提供的一种访问内存的方法, 通过获取请求访问 转发内存的数据访问请求, 其中, 数据访问请求包含请求存放数据 包 X 的物理内存地址; 根据请求存放数据包 X 的物理内存地址查询 DMA Remapping结构中的物理内存地址信息; 若确定请求存放数据包 X的物理内存地址在 DMA Remapping结构中的物理内存地址信息中, 则访问转发内存; 检测请求存放数据包 X 的物理内存地址是否在分 配的专用的物理内存区域, 防止该请求存放数据包 X 的物理内存地 址若不在分配的专用的物理内存区域中时将数据包 X 错误的存储在 系统内存中影响系统内存的安全性; 有效的提高了系统内存的安全 性。 实施例三  The method for accessing the memory provided by the embodiment of the present invention obtains a data access request for requesting access to the forwarding memory, where the data access request includes a physical memory address requesting to store the data packet X; and the physical memory address of the data packet X is stored according to the request. Querying the physical memory address information in the DMA Remapping structure; if it is determined that the physical memory address of the request packet X is in the physical memory address information in the DMA Remapping structure, accessing the forwarding memory; detecting whether the physical memory address of the request packet X is stored In the allocated dedicated physical memory area, prevent the physical memory address of the request X from storing the packet X. If it is not in the allocated dedicated physical memory area, the error of storing the packet X in the system memory affects the security of the system memory; Improve the security of system memory. Embodiment 3
本发明实施例三提供一种访问内存的方法, 以从物理内存读取 数据包为例, 对图 1 所示的访问内存的方法进行详细描述, 该访问 内存的方法的具体过程可以由物理内存所在的物理机完成。  A third embodiment of the present invention provides a method for accessing a memory. The method for accessing a memory shown in FIG. 1 is described in detail by taking a data packet from a physical memory as an example. The specific process of accessing the memory may be performed by physical memory. The physical machine where it is located is completed.
对于分配第一内存区域和第一内存区域的物理内存地址映射以 及消息队列的定义的方法与实施例二中步骤 401、 步骤 402 和步骤 403描述的方法类似, 本实施例对此在此不再进行赘述; 在本实施例中, 假设: 在第一内存区域的物理地址为 2001H ~ 2400H; 消息队列深度 10, 基准地址为 2001H; 数据包 X存放的位置 的物理地址为 2300H;数据包 X对应的数据信息 X存放在消息队列的 消息队列位置 4,且此时消息指针的头指针指示在消息队列的位置 4; 下面以上述假设为背景, 详细描述从物理内存中读取数据包 X 的方法的详细过程, 参见图 5, 该方法可以包括: Method for allocating physical memory address mapping of the first memory area and the first memory area and definition of the message queue, and step 401, step 402 and steps in the second embodiment The method described in 403 is similar, and this embodiment will not be described herein again; in this embodiment, it is assumed that: the physical address in the first memory area is 2001H ~ 2400H; the message queue depth is 10, and the reference address is 2001H; The physical address of the location where the packet X is stored is 2300H; the data information X corresponding to the packet X is stored in the message queue position 4 of the message queue, and the head pointer of the message pointer indicates the position 4 of the message queue; Background, detailing a detailed process of a method of reading a packet X from physical memory, see FIG. 5, the method may include:
501、 实时获取第一内存区域中消息指针中头指针指示的消息队 列位置得到存放数据信息 X的物理内存地址;  501. Obtaining, in real time, a message queue position indicated by a head pointer in a message pointer in the first memory area to obtain a physical memory address of the data information X;
例如, 实时的获取第一内存区域中的消息指针中头指针指示的 最后一个非空消息队列位置为消息队列位置 4 ,根据消息队列的基准 地址 2001H可以得出存放数据信息 X 的消息队列的物理内存地址为 2005H。  For example, the real-time acquisition of the last non-empty message queue position indicated by the head pointer in the message pointer in the first memory area is the message queue position 4, and the physical structure of the message queue storing the data information X can be obtained according to the reference address 2001H of the message queue. The memory address is 2005H.
502、 获取数据信息 X;  502. Obtain data information X.
例如, 根据步骤 501 得到的存放数据信息 X 的物理内存地址, 在物理内存中物理内存地址 2005H 指示的位置获取该位置存放的数 据信息 X。  For example, according to the physical memory address of the data information X obtained in step 501, the data information X stored at the location is obtained at the location indicated by the physical memory address 2005H in the physical memory.
503、 根据步骤 502获取的数据信息 X获取数据包所存放的数据 緩存的物理内存地址;  503. Obtain, according to the data information X obtained in step 502, a physical memory address of a data cache in which the data packet is stored;
例如, 根据在物理内存中物理内存地址 2005H 位置获取的数据 信息 X, 获取到数据包 X 存放的位置, 即物理内存中物理内存地址 2300H的位置;  For example, according to the data information X obtained in the physical memory address 2005H location in the physical memory, the location where the packet X is stored, that is, the location of the physical memory address 2300H in the physical memory is obtained;
或者, 假设在向物理内存存放数据包 X 过程中, 在生成数据信 息 X时,生成的数据信息 X 中包含的物理内存地址不是保存数据包 X 的实际位置时, 而是系统内存的位置 2701 H , 此时, 在物理内存中物 理内存地址 2005H位置获取到数据信息 X,则获取到数据包 X存放的 位置为物理内存中物理内存地址 2701 H的位置。  Or, suppose that in the process of storing the data packet X into the physical memory, when the data information X is generated, the physical memory address contained in the generated data information X is not the actual location of the saved data packet X, but the location of the system memory is 2701 H. At this time, when the data information X is obtained in the physical memory address 2005H position in the physical memory, the location where the data packet X is stored is the location of the physical memory address 2701 H in the physical memory.
504、 获取申请访问第一内存区域的数据访问请求, 其中数据访 问请求包含步骤 503获取的物理内存地址; 例如, 获取申请访问第一内存区域的数据访问请求, 该数据访 问请求包含步骤 503获取的物理内存地址 2300H,即申请读取物理内 存中物理内存地址 2300H指示的位置存放的数据; 504. Obtain a data access request for requesting access to the first memory area, where the data access request includes the physical memory address obtained in step 503. For example, obtaining a data access request for accessing the first memory area, where the data access request includes the physical memory address 2300H acquired in step 503, that is, applying for reading the data stored in the location indicated by the physical memory address 2300H in the physical memory;
或者, 获取申请访问第一内存区域的数据访问请求, 该数据访 问请求包含步骤 503获取的物理内存地址 2701H,即申请读取物理内 存中物理内存地址 2701 H指示的位置存放的数据。  Alternatively, the data access request for accessing the first memory area is obtained, and the data access request includes the physical memory address 2701H acquired in step 503, that is, the data stored in the location indicated by the physical memory address 2701 H in the physical memory is requested to be read.
505、 根据数据访问请求中 包含的物理内存地址查询 DMA Remapping结构的物理内存地址信息,检测数据访问请求中包含的物 理内存地址是否在 DMA Remapping 结构的物理内存地址信息中; 若 是, 则执行步骤 506; 若否, 则执行步骤 507;  505. Query the physical memory address information of the DMA Remapping structure according to the physical memory address included in the data access request, and check whether the physical memory address included in the data access request is in the physical memory address information of the DMA Remapping structure; if yes, execute step 506. If not, proceed to step 507;
例如,根据数据访问请求中包含的物理内存地址 2300H查询表 3 所示的物理内存地址信息, 检测数据访问请求中包含的物理内存地 址 2300H是否在 DMA Remapping结构的物理内存地址信息中;  For example, according to the physical memory address information shown in Table 3 of the physical memory address 2300H included in the data access request, it is detected whether the physical memory address 2300H included in the data access request is in the physical memory address information of the DMA Remapping structure;
由于表 3 所示的物理内存地址信息中包含的物理内存地址为 2001H - 2400H, 而获取的数据访问请求中包含的物理内存地址为 2300H, 经过检测, 可以确定获取的数据访问请求中包含的物理内存 地址 2300H在 DMA Remapping 结构的物理内存地址信息中, 则执行 步骤 506;  The physical memory address contained in the physical memory address information shown in Table 3 is 2001H - 2400H, and the physical memory address contained in the obtained data access request is 2300H. After detection, the physical content included in the acquired data access request can be determined. The memory address 2300H is in the physical memory address information of the DMA Remapping structure, step 506 is performed;
或者, 根据获取的数据访问请求中包含的物理内存地址 2701H 查询表 3 所示的物理内存地址信息, 检测获取的数据访问请求中包 含的物理内存地址 2701H是否在 DMA Rema pp i ng 结构的物理内存地 址信息中;  Or, according to the physical memory address information indicated by the physical memory address 2701H included in the obtained data access request, the physical memory address information included in the obtained data access request is detected in the physical memory of the DMA Rema pp i ng structure. Address information;
由于表 3 所示的物理内存地址信息中包含的物理内存地址为 2001H - 2400H, 而获取的数据访问请求中包含的物理内存地址为 2701H, 经过检测, 可以确定获取的数据访问请求中包含的物理内存 地址 2701 H 不在 DMA Remapping 结构的物理内存地址信息中, 则执 行步骤 507。  The physical memory address contained in the physical memory address information shown in Table 3 is 2001H - 2400H, and the physical memory address included in the obtained data access request is 2701H. After detection, the physical content included in the acquired data access request can be determined. If the memory address 2701 H is not in the physical memory address information of the DMA Remapping structure, step 507 is performed.
506、 读取数据访问请求中包含的物理内存地址所对应的物理内 存位置存储的数据包, 并更新消息指针; 例如, 步骤 503 根据获取的数据访问请求中包含的物理内存地 址 2300H 查询表 3 所示的物理内存地址信息, 确定数据访问请求中 包含的物理内存地址 2300H在 DMA Remapping 结构的物理内存地址 信息中, 则读取数据访问请求中包含的物理内存地址 2300H 所对应 的物理内存位置存储的数据包 X; 506. Read a data packet stored in a physical memory location corresponding to a physical memory address included in the data access request, and update the message pointer. For example, step 503 determines, according to the physical memory address 2300H included in the obtained data access request, the physical memory address information shown in Table 3, and determines that the physical memory address 2300H included in the data access request is in the physical memory address information of the DMA Remapping structure. Then reading the data packet X stored in the physical memory location corresponding to the physical memory address 2300H included in the data access request;
进一步的, 更新消息指针中头指针指示的位置, 使得消息指针 中头指针指示的位置 + 1 , 即更新消息指针中的头指针指示消息队列 位置 5。  Further, the position indicated by the head pointer in the message pointer is updated such that the position indicated by the head pointer in the message pointer + 1 , that is, the head pointer in the update message pointer indicates the message queue position 5.
507、 丟弃数据访问请求;  507. Discard the data access request.
例如, 若步骤 505 中确定数据访问请求中包含的物理内存地址 不在 DMA Remapping 结构的物理内存地址信息中, 则不能进行此次 访问内存, 丟弃数据访问请求;  For example, if it is determined in step 505 that the physical memory address included in the data access request is not in the physical memory address information of the DMA Remapping structure, the access to the memory cannot be performed, and the data access request is discarded;
当丟弃数据访问请求后, 重新执行步骤 501 获取消息指针中头 指针指示的位置。  After discarding the data access request, step 501 is re-executed to obtain the location indicated by the head pointer in the message pointer.
508、 记录错误访问信息。  508. Record error access information.
例如, 若丟弃数据访问请求, 记录此次错误访问信息, 以便于 访问内存的设备对访问问题的定位, 可以提高系统的可维护性。  For example, if the data access request is discarded, the error access information is recorded, so that the device accessing the memory can locate the access problem, thereby improving the maintainability of the system.
需要说明的是, 上述从物理内存中读取数据过程中, 此实施例 仅以申请访问物理内存地址中的数据包 X 的请求作为数据访问请求 为例进行说明, 在实际使用中, 从物理内存中读取数据过程中任何 包含有物理内存地址的请求均可以作为数据访问请求, 本发明对此 不进行限定, 都属于本发明保护的范围。  It should be noted that, in the process of reading data from the physical memory, the embodiment only uses the request for accessing the data packet X in the physical memory address as a data access request as an example. In actual use, the physical memory is used. Any request for a physical memory address in the process of reading data may be used as a data access request, which is not limited by the present invention and is within the scope of the present invention.
本发明实施例提供的一种访问内存的方法, 通过获取请求访问 转发内存的数据访问请求, 其中, 数据访问请求包含请求读取的数 据的物理内存地址; 根据请求读取的数据的物理内存地址查询 DMA Remapping结构中的物理内存地址信息;若确定请求读取的数据的物 理内存地址在 DMA Remapping 结构中的物理内存地址信息中, 则访 问转发内存; 通过检测请求读取的数据的物理内存地址是否在分配 的专用的物理内存区域, 防止读取的数据包所存放的物理内存的物 理内存地址不在分配的专用的物理内存区域中时将系统内存的数据 包读取接收, 影响系统内存的安全性有效的提高了系统内存的安全 性。 实施例四 A method for accessing a memory by accessing a memory request requesting access to a forwarding memory, wherein the data access request includes a physical memory address of the data requested to be read; a physical memory address of the data read according to the request Querying the physical memory address information in the DMA Remapping structure; if it is determined that the physical memory address of the data requested to be read is in the physical memory address information in the DMA Remapping structure, accessing the forwarding memory; detecting the physical memory address of the data read by the request Whether it is in the dedicated physical memory area allocated, preventing the physical memory stored in the read data packet When the memory address is not in the allocated dedicated physical memory area, the system memory packet is read and received, which affects the security of the system memory and effectively improves the security of the system memory. Embodiment 4
本发明实施例四提供一种访问内存的方法, 以 X86 系统中 N个 设备同时访问内存为例, 对图 1 所示访问内存的方法进行详细描述; 参见图 6, 在 X86 系统中, 有 N个设备访问内存, 分别记为设备 A fourth embodiment of the present invention provides a method for accessing a memory. The method for accessing memory in FIG. 1 is described in detail by taking N devices simultaneously accessing memory in an X86 system. Referring to FIG. 6, in the X86 system, there is a N. Devices access memory, respectively, as devices
1、 设备 2、 设备 3 设备 N, 本实施例描述设备 1、 设备 2、 设 备 3 设备 N访问内存的方法; 1. Device 2, Device 3 Device N, This embodiment describes the device 1, device 2, device 3 device N access memory method;
参见图 7, 所述方法可以包括:  Referring to Figure 7, the method may include:
701、 在物理内存中给每个设备分配专用内存区域;  701. Allocate a dedicated memory area to each device in physical memory;
例如, 在物理内存中给设备 1、 设备 2、 设备 3 设备 N分 别分配内存区 i或 1、 内存区 i或 2、 内存区 i或 3 内存区 i或 N; 当 然, 多个设备可以对应同一个内存区域, 所以, 在分配内存区域 1、 内存区域 2、 内存区域 3 内存区域 N 内可以有相同的内存区域 存在, 此实施例以内存区 i或 1、 内存区 i或 2、 内存区 i或 3、 ……内存 区域 N全部都不相同为例进行说明。  For example, in the physical memory, device 1, device 2, device 3 device N are respectively allocated memory area i or 1, memory area i or 2, memory area i or 3 memory area i or N; of course, multiple devices can correspond to the same A memory area, so, in the memory area 1, memory area 2, memory area 3 memory area N can have the same memory area, this embodiment is memory area i or 1, memory area i or 2, memory area i Or 3, ... the memory area N is all different for an example.
702、将 N个内存区域的物理内存地址分别映射至 DMA Remapping 结构中形成物理内存地址信息;  702. Map physical memory addresses of the N memory areas to physical memory address information in the DMA Remapping structure.
例如, ^夺内存区 i或 1、 内存区 i或 2、 内存区 i或 3 内存区 i或 For example, ^ capture memory area i or 1, memory area i or 2, memory area i or 3 memory area i or
N的物理内存地址分另 'J映射至 DMA Remapping结构中, 形成 N个物理 内存地址信息, 记为物理内存地址信息 1、 物理内存地址信息 2、 物 理内存地址信息 3 物理内存地址信息 N; N physical memory address is divided into another 'J mapping to DMA Remapping structure, forming N physical memory address information, recorded as physical memory address information 1, physical memory address information 2, physical memory address information 3 physical memory address information N;
设备、 内存区域、 物理内存地址信息三者之间相互对应; 物理内存地址信息 1、 物理内存地址信息 2、 物理内存地址信息 3、 ……物理内存地址信息 N组成 DMA Remapping结构中的物理内存 地址信息库。  The device, the memory area, and the physical memory address information correspond to each other; physical memory address information 1, physical memory address information 2, physical memory address information 3, ... physical memory address information N constitutes a physical memory address in the DMA Remapping structure database.
703、 获取第一设备发送的申请访问第一内存区域的数据访问请 求, 其中, 数据访问请求包含第一设备申请访问的数据的物理内存 地址; 703. Obtain the data access of the application sent by the first device to access the first memory area. The data access request includes a physical memory address of data requested by the first device to access;
例如, 获取到设备 N发送的申请访问内存区域 N 的数据访问请 求, 其中, 该访问请求包含设备 N申请访问的数据的物理内存地址。  For example, the data access request sent by the device N to access the memory area N is obtained, where the access request includes the physical memory address of the data that the device N requests to access.
704、 根据第一设备请求访问第一内存区域的数据访问请求查询 物理内存地址信息库, 获取第一内存区域对应的物理内存地址信息; 例如, 根据设备 N发送的申请访问内存区域 N 的数据访问请求 查询物理内存地址信息库, 获取第一设备对应的第一内存区域对应 的物理内存地址信息 N。  704. Query the physical memory address information base according to the data access request of the first device to access the first memory area, and obtain the physical memory address information corresponding to the first memory area. For example, accessing the data access of the memory area N according to the application sent by the device N. The physical memory address information database corresponding to the first memory area corresponding to the first device is obtained.
705、 根据第一设备请求访问的数据的物理内存地址查询步骤 704获取的物理内存地址信息,检测第一设备请求访问的数据的物理 内存地址是否在 DMA Remapping 结构中与第一设备对应的物理内存 地址信息中; 若是, 则执行步骤 706; 若否, 则执行步骤 707;  705. Query the physical memory address information obtained by the step 704 according to the physical memory address of the data requested by the first device, and check whether the physical memory address of the data requested by the first device is in the physical memory corresponding to the first device in the DMA Remapping structure. In the address information; if yes, step 706 is performed; if not, step 707 is performed;
例如, 根据设备 N发送的申请访问内存区域 N 的数据访问请求 中包含的设备 N 申请访问的数据的物理内存地址查询物理内存地址 信息 N, 确定设备 N 请求访问的数据的物理内存地址是否在 DMA Remapping结构中与设备 N对应的物理内存地址信息 N 中。  For example, according to the physical memory address of the data requested by the device N requested by the device N accessed by the device N to access the memory area N, the physical memory address information N is queried, and the physical memory address of the data requested by the device N is determined to be in the DMA. The physical memory address information N corresponding to the device N in the Remapping structure.
706、 访问第一内存区域中申请访问的数据;  706. Access data requested to be accessed in the first memory area.
例如, 若步骤 705 确定设备 N请求访问的数据的物理内存地址 在 DMA Remapping 结构中与设备 N对应的物理内存地址信息 N 中, 则访问内存区域 N 中申请访问的数据。  For example, if the step 705 determines that the physical memory address of the data requested by the device N is in the physical memory address information N corresponding to the device N in the DMA Remapping structure, the data requested in the memory region N is accessed.
707、 丟弃数据访问请求;  707. Discard the data access request.
例如, 丟弃设备 N发送的数据访问请求。  For example, discard the data access request sent by device N.
708、 记录错误访问信息。  708. Record error access information.
例如, 若丟弃数据访问请求, 记录此次错误访问信息, 以便于 设备 N对访问问题的定位, 可以提高系统的可维护性。  For example, if the data access request is discarded and the error access information is recorded, so that the device N locates the access problem, the maintainability of the system can be improved.
本发明实施例提供的一种访问内存的方法, 当有多个设备访问 内存时, 通过获取第一设备请求访问第一内存区域的数据访问请求, 其中, 所述数据访问请求包含所述第一设备请求访问的数据的物理 内存地址; 根据第一设备请求访问的数据的物理内存地址查询物理 内存地址信息库, 获取第一内存区域对应的物理内存地址信息; 根 据第一设备请求访问的数据的物理内存地址查询 I / O 虚拟化控制器 设备中的第一内存区域对应的物理内存地址信息; 若确定第一设备 请求访问的数据的物理内存地址在 I / 0 虚拟化控制器设备中的物理 内存地址信息中, 则访问第一内存区域; 有效的提高了系统内存的 安全性。 实施例五 The method for accessing the memory provided by the embodiment of the present invention, when a plurality of devices access the memory, requesting the first device to access the data access request of the first memory area, where the data access request includes the first The physical of the data that the device is requesting access to The memory address is obtained by querying the physical memory address information base according to the physical memory address of the data requested by the first device, and acquiring the physical memory address information corresponding to the first memory area; and querying the I/O according to the physical memory address of the data requested by the first device. The physical memory address information corresponding to the first memory area in the virtualization controller device; if it is determined that the physical memory address of the data requested by the first device is in the physical memory address information in the I/O virtualization controller device, access The first memory area; effectively improves the security of the system memory. Embodiment 5
本发明实施例五提供一种访问内存的设备 8 0 , 参见图 8 , 该设 备 8 0可以包括:  The fifth embodiment of the present invention provides a device for accessing a memory 80. Referring to FIG. 8, the device 80 may include:
获取单元 8 01 ,用于获取第一设备请求访问第一内存区域的数据 访问请求, 其中, 所述数据访问请求包含所述第一设备请求访问的 数据的物理内存地址; 所述第一内存区域为第一设备对应的专用物 理内存区 i或;  The obtaining unit 8 01 is configured to obtain a data access request that the first device requests to access the first memory area, where the data access request includes a physical memory address of the data that the first device requests to access; the first memory area a dedicated physical memory area i corresponding to the first device;
其中, 第一设备为通过访问计算机的物理内存实现特定功能的 设备, 例如, 在 CPU配合 FPGA数据包转发系统中, 第一设备为 CPU 或者 FPGA ; 或者, 第一设备可以为虚拟化平台中虚拟机的外设; 本 发明对第一设备的类型不进行具体限定;  The first device is a device that implements a specific function by accessing a physical memory of the computer. For example, in the CPU and the FPGA packet forwarding system, the first device is a CPU or an FPGA; or the first device may be a virtualized virtual platform. Peripheral of the machine; the present invention does not specifically limit the type of the first device;
第一内存区域是在物理内存中分配的第一设备实现对应功能的 专用物理内存区域, 例如, 参见图 2 , 第一内存区域包含于物理内存 中, 第一内存区域至少包含有数据緩存、 消息队列及消息指针; 其中, 数据緩存用于储存第一设备实现对应功能过程中访问的 数据, 该数据可以以数据包的形式存储在数据緩存中;  The first memory area is a dedicated physical memory area in which the first device allocated in the physical memory implements the corresponding function. For example, referring to FIG. 2, the first memory area is included in the physical memory, and the first memory area includes at least the data cache and the message. a queue and a message pointer; wherein, the data cache is used to store data accessed by the first device in implementing the corresponding function, and the data may be stored in the data cache in the form of a data packet;
消息队列可以是循环队列, 消息队列中包含以队列形式排列的 数据信息, 每个数据信息分别用于存储数据緩存中对应的数据的相 关信息, 例如, 可以包含数据在数据緩存中存放的位置的物理内存 地址和数据特征, 例如, 数据特征可以包含数据的类型、 大小、 长 度等, 对于数据信息中包含的数据特征的具体内容, 可以根据需要 进行设置, 本发明不进行具体限定; The message queue may be a circular queue, and the message queue includes data information arranged in a queue form, and each data information is used to store related information of corresponding data in the data cache, for example, may include a location where the data is stored in the data cache. The physical memory address and data characteristics, for example, the data feature may include the type, size, length, etc. of the data, and the specific content of the data feature included in the data information may be as needed The setting is made, and the present invention is not specifically limited;
消息队列的深度是指消息队列可以用来存储数据信息的容量, 每一个消息队列可以是一个深度确定并且有限的循环队列, 且消息 队列的深度可以小于数据緩存的容量;  The depth of the message queue refers to the capacity that the message queue can use to store data information. Each message queue can be a depth-determined and limited circular queue, and the depth of the message queue can be smaller than the capacity of the data cache;
需要说明的是, 当消息队列的深度小于数据緩存的容量时, 数 据緩存中存储的每个数据对应的数据信息将可能一部分数据信息存 储于消息队列中, 一部分数据信息将等待消息队列有空闲位置时再 生成并存储;  It should be noted that when the depth of the message queue is smaller than the capacity of the data cache, the data information corresponding to each data stored in the data cache may store a part of the data information in the message queue, and some of the data information will wait for the message queue to have a free location. Regenerated and stored;
消息指针用于指示消息队列中数据信息的位置, 消息指针分为 头指针和尾指针, 例如, 可以用头指针来指示消息队列中最后一个 非空闲位置, 可以用尾指针来指示消息队列中第一个空闲位置, 这 样, 通过消息指针的指示, 可以明确得出消息队列中存放数据的位 置和空闲的位置; 当第一设备从消息队列中读取数据信息时, 可以 根据消息队列的基准地址加上消息指针头指针指示的消息队列位置 获取到数据信息存放的实际物理内存地址;  The message pointer is used to indicate the location of the data information in the message queue. The message pointer is divided into a head pointer and a tail pointer. For example, the head pointer can be used to indicate the last non-idle position in the message queue, and the tail pointer can be used to indicate the number in the message queue. An idle location, so that the location of the data in the message queue and the free location can be clearly indicated by the indication of the message pointer; when the first device reads the data information from the message queue, it can be based on the reference address of the message queue. Adding the actual physical memory address where the data information is stored by adding the message queue position indicated by the message pointer head pointer;
例如, 数据緩存中存储有 N个数据 (以数据包的形式存储), 分 别记为数据包 1 , 数据包 2 数据包 N。  For example, the data cache stores N data (stored in the form of data packets), which are respectively recorded as packet 1 and packet 2 packet N.
1 J , 对应的可以有 N个数据信息, 分别记为数据信息 1 , 数据信 息 2 数据信息 N , 每个数据信息分别对应一个数据包, 每个数 据信息可以包含与该数据信息对应的数据包在数据緩存中存放的位 置的物理内存地址和数据特征; Bay 1 J , corresponding to N data information, respectively recorded as data information 1, data information 2 data information N, each data information corresponds to a data packet, each data information may contain data corresponding to the data information The physical memory address and data characteristics of the location where the packet is stored in the data cache;
假设, 消息队列的深度为 S 且该消息队列为空, 该消息队列的 位置可以记为消息队列位置 0、 消息队列位置 1 消息队列位置 Assume that the message queue has a depth of S and the message queue is empty. The location of the message queue can be recorded as message queue position 0, message queue position 1 message queue position
S - 1 , 其中, S 远远大于 N , 从消息队列位置 0 开始存放数据信息, 消息队列中存储有数据信息 1 , 数据信息 2 数据信息 N , 对应 的消息指针中的头指针指示消息队列位置 0 ,而尾指针指示消息队列 位置 N ; S - 1 , where S is far greater than N, storing data information from the message queue position 0, the message queue storing data information 1, data information 2 data information N, the corresponding head pointer in the message pointer indicating the message queue position 0 , and the tail pointer indicates the message queue position N;
再假设, 消息队列的深度为 Y 且该消息队列为空, 该消息队列 的位置可以记为消息队列位置 0、 消息队列位置 1 消息队列 位置 Y- l , 其中, Υ小于 Ν , 从消息队列位置 0开始存放数据信息, 消息队列中存储有数据信息 1 , 数据信息 2 数据信息 Y- 1 , 那 么, 数据信息 Υ 数据信息 Ν将等待消息队列有空闲位置再生成 并存储; 对应的消息指针中的头指针指示消息队列位置 0 , 而尾指针 指示消息队列位置 Y- l。 Assume again that the message queue has a depth of Y and the message queue is empty. The location of the message queue can be recorded as message queue position 0, message queue position 1 message queue. Position Y-l, where Υ is less than Ν, data information is stored from message queue position 0, data message 1 is stored in message queue, data information 2 data information Y-1, then data information Υ data information Ν will wait for message The queue has an idle location that is regenerated and stored; the head pointer in the corresponding message pointer indicates the message queue location 0, and the tail pointer indicates the message queue location Y-l.
其中, 数据访问请求可以由第一设备生成, 下面分别以第一设 备读取第一内存区域中的数据包和第一设备向第一内存区域存储数 据包为例说明数据访问请求的生成过程;  The data access request may be generated by the first device, where the first device reads the data packet in the first memory area and the first device stores the data packet in the first memory area as an example to describe a data access request generation process.
1、 第一设备读取第一内存区域中的数据包;  1. The first device reads the data packet in the first memory area;
例如, 第一设备实时获取消息指针中数据信 , 的物理内存地址, 假设当前第一设备获取到数据信息 2 的物理内存地址, 第一设备生 成访问消息队列的数据访问请求, 该数据访问请求包含数据信息 2 的物理内存地址;  For example, the first device acquires the physical memory address of the data message in the message pointer in real time, and assumes that the first device acquires the physical memory address of the data information 2, and the first device generates a data access request for accessing the message queue, where the data access request includes The physical memory address of data information 2;
假设第一设备根据数据信息 2 的物理内存地址从消息队列中获 取数据信息 2 , 根据该数据信息 2获取数据包 2 的物理内存地址, 第 一设备生成访问数据緩存的数据访问请求, 该数据访问请求包含数 据包 2的物理内存地址。  It is assumed that the first device obtains the data information 2 from the message queue according to the physical memory address of the data information 2, obtains the physical memory address of the data packet 2 according to the data information 2, and the first device generates a data access request for accessing the data cache, the data access The request contains the physical memory address of packet 2.
2、 第一设备向第一内存区域存储数据包。  2. The first device stores the data packet to the first memory area.
例如, 当第一设备需要向第一内存区域保存数据 X 时, 第一设 备向第一内存区域申请存储数据包 X 所需要的数据緩存, 获取内存 分配给该数据包 X在数据緩存中的物理内存地址;  For example, when the first device needs to save the data X to the first memory area, the first device applies to the first memory area for the data cache required to store the data packet X, and obtains the physical memory allocated to the data packet X in the data cache. Memory address
第一设备根据内存分配给该数据包 X 在数据緩存中的物理内存 地址生成数据访问请求 ,该数据访问请求包含内存分配给该数据包 X 在数据緩存中的物理内存地址。  The first device generates a data access request according to a memory allocation to the physical memory address of the data packet X in the data cache, and the data access request includes a physical memory address allocated by the memory to the data packet X in the data cache.
查询单元 8 02 ,用于根据所述获取单元 8 01获取的所述第一设备 请求访问的数据的物理内存地址查询 I / O 虚拟化控制器设备中的物 理内存地址信息; 其中, 所述物理内存地址信息包含与所述第一内 进一步的, 参见图 9 , 所述设备还可以包括, 映射单元 804,用于在所述获取单元 801获取所述第一设备请求 访问第一内存区域的数据访问请求之前, 将第一内存区域的物理内 存地址映射至 I/O虚拟化控制器设备中, 形成物理内存地址信息; 其中, 第一内存区域的物理内存地址包含数据緩存、 消息队列 及消息指针的物理内存地址。 The query unit 802 is configured to query physical memory address information in the I/O virtualization controller device according to the physical memory address of the data requested by the first device acquired by the acquiring unit 810; wherein, the physical The memory address information is further included with the first one. Referring to FIG. 9, the device may further include The mapping unit 804 is configured to map the physical memory address of the first memory area to the I/O virtualization controller device before the acquiring unit 801 acquires the data access request of the first device requesting access to the first memory area Forming physical memory address information; wherein, the physical memory address of the first memory area includes a physical memory address of the data cache, the message queue, and the message pointer.
映射单元 804 还可以用于, 将第一内存区域的物理内存地址映 射至所述第一设备中。  The mapping unit 804 is further configured to map the physical memory address of the first memory area to the first device.
其中, 物理内存地址信息是通过将第一内存区域的物理内存地 址映射至 I/O虚拟化控制器设备中形成的,物理内存地址信息在 I/O 虚拟化控制器设备中的可以按照表格形式存在, 参见表 1, 也可以按 照其他形式存在, 物理内存地址信息的形式不影响本发明的结果, 本发明对此不进行限制;  The physical memory address information is formed by mapping the physical memory address of the first memory area to the I/O virtualization controller device, and the physical memory address information may be in a table form in the I/O virtualization controller device. Existence, see Table 1, may also exist in other forms, and the form of physical memory address information does not affect the result of the present invention, and the present invention does not limit this;
可选的, I/O虚拟化控制器设备中包含由至少一个物理内存地址 信息组成的物理内存地址信息库, 其中, 每一个物理内存地址信息 分别对应一个不同的内存区域;  Optionally, the I/O virtualization controller device includes a physical memory address information database composed of at least one physical memory address information, where each physical memory address information corresponds to a different memory region;
示例性的, 当多个设备同时访问物理内存时, 物理内存中则会 分配多个内存区域, 当然, 不同的设备可以对应同一个内存区域; 通过将每个内存区域的物理内存地址映射至 I/O 虚拟化控制器设备 中多个形成物理内存信息, 则 I/O 虚拟化控制器设备中包含多个物 理内存信息组成的物理内存信息库, 其中, 每一个物理内存地址信 息分别对应一个不同的内存区域, 不同的设备可以对应同一个物理 内存地址信息;  Exemplarily, when multiple devices access physical memory at the same time, multiple memory areas are allocated in physical memory. Of course, different devices can correspond to the same memory area; by mapping the physical memory address of each memory area to I /O Virtualization controller device forms physical memory information, and the I/O virtualization controller device includes a physical memory information database composed of multiple physical memory information, where each physical memory address information corresponds to a different one. Memory area, different devices can correspond to the same physical memory address information;
物理内存地址信息库中的多个物理内存地址信息分别与多个内 存区域——对应, 物理内存地址信息库在 I/O 虚拟化控制器设备中 可以以表格的形式存在, 参见表 2, 当然, 物理内存地址信息库在 I/O虚拟化控制器设备中也可以按照其他形式存在,物理内存地址信 息库的形式不影响本发明的结果, 本发明对此不进行限制;  The physical memory address information in the physical memory address information database corresponds to a plurality of memory regions, respectively, and the physical memory address information library may exist in the form of a table in the I/O virtualization controller device, see Table 2, of course. The physical memory address information database may also exist in other forms in the I/O virtualization controller device. The form of the physical memory address information database does not affect the result of the present invention, and the present invention does not limit this;
相应的, 查询单元 802具体可以用于:  Correspondingly, the query unit 802 can be specifically used to:
根据第一设备请求访问第一内存区域的数据访问请求查询物理 内存地址信息库, 获取第一设备对应的内存区域对应的物理内存地 址信息; Querying the physical according to the data access request of the first device requesting access to the first memory area The memory address information base acquires physical memory address information corresponding to the memory area corresponding to the first device;
根据所述第一设备请求访问的数据的物理内存地址查询所述 Querying according to a physical memory address of the data requested by the first device to access
I/O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址 信息; The physical memory address information corresponding to the first memory area in the I/O virtualization controller device;
访问单元 803,用于若查询单元 802确定所述第一设备请求访问 的数据的物理内存地址在所述 I/O 虚拟化控制器设备中的物理内存 地址信息中, 则访问所述第一内存区域;  The access unit 803 is configured to: if the query unit 802 determines that the physical memory address of the data requested by the first device is in the physical memory address information in the I/O virtualization controller device, accessing the first memory Area
示例性的, 若数据访问请求中包含的第一设备请求访问的数据 的物理内存地址在 I/O虚拟化控制器设备中的物理内存地址信息内 , 则说明第一设备发送的请求访问第一内存区域的数据访问请求可以 正确访问第一内存区域, 不会对系统内存误踩, 即不会影响系统内 存的安全性。  Illustratively, if the physical memory address of the data requested by the first device included in the data access request is in the physical memory address information in the I/O virtualization controller device, the first device sends the request to access the first The data access request in the memory area can correctly access the first memory area, and does not accidentally step on the system memory, that is, it does not affect the security of the system memory.
进一步的, 所述设备 80还可以包括,  Further, the device 80 may further include
丟弃单元 805,用于若所述查询单元 802确定所述第一设备请求 访问的数据的物理内存地址不在所述 I/O 虚拟化控制器设备中的物 理内存地址信息中, 将所述数据访问请求丟弃。  The discarding unit 805 is configured to: if the query unit 802 determines that the physical memory address of the data requested by the first device is not in the physical memory address information in the I/O virtualization controller device, the data is Access request is discarded.
可选的, 所述设备 80还可以包括,  Optionally, the device 80 may further include
记录单元 806,用于若所述查询单元 802确定所述第一设备请求 访问的数据的物理内存地址不在所述 I/O 虚拟化控制器设备中的物 理内存地址信息中, 记录异常信息。  The recording unit 806 is configured to: if the query unit 802 determines that the physical memory address of the data requested by the first device is not in the physical memory address information in the I/O virtualization controller device, the abnormal information is recorded.
本发明实施例提供的一种访问内存的设备 80, 通过获取第一设 备请求访问第一内存区域的数据访问请求, 其中, 所述数据访问请 求包含所述第一设备请求访问的数据的物理内存地址; 所述第一内 存区域为第一设备对应的专用物理内存区域; 根据所述第一设备请 求访问的数据的物理内存地址查询 I/O 虚拟化控制器设备中的物理 内存地址信息; 其中, 所述物理内存地址信息包含与所述第一内存 求访问的数据的物理内存地址在所述 I/O 虚拟化控制器设备中的物 理内存地址信息中, 则访问所述第一内存区域; 有效的提高了系统 内存的安全性。 实施例六 The device 80 for accessing the memory provided by the embodiment of the present invention acquires a data access request of the first memory area by requesting the first device, where the data access request includes the physical memory of the data requested by the first device. The first memory area is a dedicated physical memory area corresponding to the first device; and the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device; The physical memory address information includes a physical memory address of the data accessed by the first memory in the I/O virtualization controller device In the memory address information, the first memory area is accessed; the security of the system memory is effectively improved. Embodiment 6
本发明实施例六提供一种访问内存的设备 100, 参见图 10, 该 设备 100可以包括:  The sixth embodiment of the present invention provides a device 100 for accessing a memory. Referring to FIG. 10, the device 100 may include:
处理器 1001、 I/O虚拟化控制器设备 1002, 第一设备 1003, 至 少一个通信总线 1004, 用于实现这些装置之间的连接和相互通信; 处理器 1001可以是一个中央处理器(英文: central processing unit, 简称为 CPU );  The processor 1001, the I/O virtualization controller device 1002, the first device 1003, and at least one communication bus 1004 are configured to implement connection and mutual communication between the devices. The processor 1001 may be a central processing unit (English: Central processing unit, referred to as CPU);
其中, 处理器 1001, 用于获取第一设备 1003请求访问第一内存 区域的数据访问请求, 其中, 所述数据访问请求包含所述第一设备 请求访问的数据的物理内存地址; 所述第一内存区域为第一设备对 应的专用物理内存区域;  The processor 1001 is configured to obtain a data access request that the first device 1003 requests to access the first memory area, where the data access request includes a physical memory address of the data that the first device requests to access; The memory area is a dedicated physical memory area corresponding to the first device;
其中, 第一设备为通过访问计算机的物理内存实现特定功能的 设备, 例如, 在 CPU配合 FPG A数据包转发系统中, 第一设备为 CPU 或者 FPGA; 或者, 第一设备可以为虚拟化平台中虚拟机的外设; 本 发明对第一设备的类型不进行具体限定;  The first device is a device that implements a specific function by accessing a physical memory of the computer. For example, in the CPU and the FPG A packet forwarding system, the first device is a CPU or an FPGA; or the first device may be in a virtualization platform. The peripheral device of the virtual machine; the present invention does not specifically limit the type of the first device;
第一内存区域是在物理内存中分配的第一设备实现对应功能的 专用物理内存区域, 例如, 参见图 2, 第一内存区域包含于物理内存 中, 第一内存区域至少包含有数据緩存、 消息队列及消息指针; 其中, 数据緩存用于储存第一设备实现对应功能过程中访问的 数据, 该数据可以以数据包的形式存储在数据緩存中;  The first memory area is a dedicated physical memory area in which the first device allocated in the physical memory implements the corresponding function. For example, referring to FIG. 2, the first memory area is included in the physical memory, and the first memory area includes at least the data cache and the message. a queue and a message pointer; wherein, the data cache is used to store data accessed by the first device in implementing the corresponding function, and the data may be stored in the data cache in the form of a data packet;
消息队列可以是循环队列, 消息队列中包含以队列形式排列的 数据信息, 每个数据信息分别用于存储数据緩存中对应的数据的相 关信息, 例如, 可以包含数据在数据緩存中存放的位置的物理内存 地址和数据特征, 例如, 数据特征可以包含数据的类型、 大小、 长 度等, 对于数据信息中包含的数据特征的具体内容, 可以根据需要 进行设置, 本发明不进行具体限定; 消息队列的深度是指消息队列可以用来存储数据信息的容量, 每一个消息队列可以是一个深度确定并且有限的循环队列, 且消息 队列的深度可以小于数据緩存的容量; The message queue may be a circular queue, and the message queue includes data information arranged in a queue form, and each data information is used to store related information of corresponding data in the data cache, for example, may include a location where the data is stored in the data cache. The physical memory address and the data feature, for example, the data feature may include the type, the size, the length, and the like of the data. The specific content of the data feature included in the data information may be set as needed, and the present invention is not specifically limited; The depth of the message queue refers to the capacity that the message queue can use to store data information. Each message queue can be a depth-determined and limited circular queue, and the depth of the message queue can be smaller than the capacity of the data cache;
需要说明的是, 当消息队列的深度小于数据緩存的容量时, 数 据緩存中存储的每个数据对应的数据信息将可能一部分数据信息存 储于消息队列中, 一部分数据信息将等待消息队列有空闲位置时再 生成并存储;  It should be noted that when the depth of the message queue is smaller than the capacity of the data cache, the data information corresponding to each data stored in the data cache may store a part of the data information in the message queue, and some of the data information will wait for the message queue to have a free location. Regenerated and stored;
消息指针用于指示消息队列中数据信息的位置, 消息指针分为 头指针和尾指针, 例如, 可以用头指针来指示消息队列中最后一个 非空闲位置, 可以用尾指针来指示消息队列中第一个空闲位置, 这 样, 通过消息指针的指示, 可以明确得出消息队列中存放数据的位 置和空闲的位置; 当第一设备从消息队列中读取数据信息时, 可以 根据消息队列的基准地址加上消息指针头指针指示的消息队列位置 获取到数据信息存放的实际物理内存地址;  The message pointer is used to indicate the location of the data information in the message queue. The message pointer is divided into a head pointer and a tail pointer. For example, the head pointer can be used to indicate the last non-idle position in the message queue, and the tail pointer can be used to indicate the number in the message queue. An idle location, so that the location of the data in the message queue and the free location can be clearly indicated by the indication of the message pointer; when the first device reads the data information from the message queue, it can be based on the reference address of the message queue. Adding the actual physical memory address where the data information is stored by adding the message queue position indicated by the message pointer head pointer;
例如, 数据緩存中存储有 N个数据 (以数据包的形式存储), 分 别记为数据包 1 , 数据包 2 数据包 N。  For example, the data cache stores N data (stored in the form of data packets), which are respectively recorded as packet 1 and packet 2 packet N.
1 J , 对应的可以有 N个数据信息, 分别记为数据信息 1 , 数据信 息 2 数据信息 N , 每个数据信息分别对应一个数据包, 每个数 据信息可以包含与该数据信息对应的数据包在数据緩存中存放的位 置的物理内存地址和数据特征; Bay 1 J , corresponding to N data information, respectively recorded as data information 1, data information 2 data information N, each data information corresponds to a data packet, each data information may contain data corresponding to the data information The physical memory address and data characteristics of the location where the packet is stored in the data cache;
假设, 消息队列的深度为 S 且该消息队列为空, 该消息队列的 位置可以记为消息队列位置 0、 消息队列位置 1 消息队列位置 Assume that the message queue has a depth of S and the message queue is empty. The location of the message queue can be recorded as message queue position 0, message queue position 1 message queue position
S - 1 , 其中, S 远远大于 N , 从消息队列位置 0 开始存放数据信息, 消息队列中存储有数据信息 1 , 数据信息 2 数据信息 N , 对应 的消息指针中的头指针指示消息队列位置 0 ,而尾指针指示消息队列 位置 N ; S - 1 , where S is far greater than N, storing data information from the message queue position 0, the message queue storing data information 1, data information 2 data information N, the corresponding head pointer in the message pointer indicating the message queue position 0 , and the tail pointer indicates the message queue position N;
再假设, 消息队列的深度为 Y 且该消息队列为空, 该消息队列 的位置可以记为消息队列位置 0、 消息队列位置 1 消息队列 位置 Y - 1 , 其中, Y小于 N , 从消息队列位置 0开始存放数据信息, 消息队列中存储有数据信息 1 , 数据信息 2 数据信息 Y- 1 , 那 么, 数据信息 Y 数据信息 N将等待消息队列有空闲位置再生成 并存储; 对应的消息指针中的头指针指示消息队列位置 0 , 而尾指针 指示消息队列位置 Y- l。 Assume again that the message queue has a depth of Y and the message queue is empty. The location of the message queue can be recorded as message queue position 0, message queue position 1 message queue position Y - 1 , where Y is less than N, from the message queue location 0 starts to store data information, The message queue stores data information 1 and data information 2 data information Y-1. Then, the data information Y data information N will wait for the message queue to have an idle location to be regenerated and stored; the head pointer in the corresponding message pointer indicates the message queue position. 0 , and the tail pointer indicates the message queue position Y- l.
其中, 数据访问请求可以由第一设备生成, 下面分别以第一设 备读取第一内存区域中的数据包和第一设备向第一内存区域存储数 据包为例说明数据访问请求的生成过程;  The data access request may be generated by the first device, where the first device reads the data packet in the first memory area and the first device stores the data packet in the first memory area as an example to describe a data access request generation process.
1、 第一设备读取第一内存区域中的数据包;  1. The first device reads the data packet in the first memory area;
例如, 第一设备实时获取消息指针中数据信 , 的物理内存地址, 假设当前第一设备获取到数据信息 2 的物理内存地址, 第一设备生 成访问消息队列的数据访问请求, 该数据访问请求包含数据信息 2 的物理内存地址;  For example, the first device acquires the physical memory address of the data message in the message pointer in real time, and assumes that the current device acquires the physical memory address of the data information 2, and the first device generates a data access request for accessing the message queue, where the data access request includes The physical memory address of data information 2;
假设第一设备根据数据信息 2 的物理内存地址从消息队列中获 取数据信息 2 , 根据该数据信息 2获取数据包 2 的物理内存地址, 第 一设备生成访问数据緩存的数据访问请求, 该数据访问请求包含数 据包 2的物理内存地址。  It is assumed that the first device obtains the data information 2 from the message queue according to the physical memory address of the data information 2, obtains the physical memory address of the data packet 2 according to the data information 2, and the first device generates a data access request for accessing the data cache, the data access The request contains the physical memory address of packet 2.
2、 第一设备向第一内存区域存储数据包。  2. The first device stores the data packet to the first memory area.
例如, 当第一设备需要向第一内存区域保存数据 X 时, 第一设 备向第一内存区域申请存储数据包 X 所需要的数据緩存, 获取内存 分配给该数据包 X在数据緩存中的物理内存地址;  For example, when the first device needs to save the data X to the first memory area, the first device applies to the first memory area for the data cache required to store the data packet X, and obtains the physical memory allocated to the data packet X in the data cache. Memory address
第一设备根据内存分配给该数据包 X 在数据緩存中的物理内存 地址生成数据访问请求 ,该数据访问请求包含内存分配给该数据包 X 在数据緩存中的物理内存地址。  The first device generates a data access request according to a memory allocation to the physical memory address of the data packet X in the data cache, and the data access request includes a physical memory address allocated by the memory to the data packet X in the data cache.
I / O虚拟化控制器设备 1 002 , 用于根据所述第一设备 1 003请求 访问的数据的物理内存地址查询所述 I / O虚拟化控制器设备 1 002中 的物理内存地址信息; 其中, 所述物理内存地址信息包含与所述第 进一步的, 所述处理器 1 001具体可以用于, 在所述获取第一设 备请求访问第一内存区域的数据访问请求之前, 将所述第一内存区 域的物理内存地址映射至所述 I/O 虚拟化控制器设备中, 形成所述 物理内存地址信息; The I/O virtualization controller device 1 002 is configured to query physical memory address information in the I/O virtualization controller device 1 002 according to a physical memory address of the data requested by the first device 1 003; The physical memory address information is included in the first step, and the processor 1 001 may be specifically configured to: before the acquiring, by the first device, a data access request for accessing the first memory area, the first Memory area Mapping a physical memory address of the domain into the I/O virtualization controller device to form the physical memory address information;
其中, 第一内存区域的物理内存地址包含数据緩存、 消息队列 及消息指针的物理内存地址。  The physical memory address of the first memory area includes a data cache, a message queue, and a physical memory address of the message pointer.
所述处理器 1001具体还可以用于, 将所述第一内存区域的物理 内存地址映射至所述第一设备中。  The processor 1001 is further configured to: map a physical memory address of the first memory area to the first device.
其中, 物理内存地址信息是通过将第一内存区域的物理内存地 址映射至 I/O虚拟化控制器设备中形成的,物理内存地址信息在 I/O 虚拟化控制器设备中的可以按照表格形式存在, 参见表 1, 也可以按 照其他形式存在, 物理内存地址信息的形式不影响本发明的结果, 本发明对此不进行限制;  The physical memory address information is formed by mapping the physical memory address of the first memory area to the I/O virtualization controller device, and the physical memory address information may be in a table form in the I/O virtualization controller device. Existence, see Table 1, may also exist in other forms, and the form of physical memory address information does not affect the result of the present invention, and the present invention does not limit this;
可选的, I/O虚拟化控制器设备中包含由至少一个物理内存地址 信息组成的物理内存地址信息库, 其中, 每一个物理内存地址信息 分别对应一个不同的内存区域;  Optionally, the I/O virtualization controller device includes a physical memory address information database composed of at least one physical memory address information, where each physical memory address information corresponds to a different memory region;
示例性的, 当多个设备同时访问物理内存时, 物理内存中则会 分配多个内存区域, 当然, 不同的设备可以对应同一个内存区域; 通过将每个内存区域的物理内存地址映射至 I/O 虚拟化控制器设备 中多个形成物理内存信息, 则 I/O 虚拟化控制器设备中包含多个物 理内存信息组成的物理内存信息库, 其中, 每一个物理内存地址信 息分别对应一个不同的内存区域, 不同的设备可以对应同一个物理 内存地址信息;  Exemplarily, when multiple devices access physical memory at the same time, multiple memory areas are allocated in physical memory. Of course, different devices can correspond to the same memory area; by mapping the physical memory address of each memory area to I /O Virtualization controller device forms physical memory information, and the I/O virtualization controller device includes a physical memory information database composed of multiple physical memory information, where each physical memory address information corresponds to a different one. Memory area, different devices can correspond to the same physical memory address information;
物理内存地址信息库中的多个物理内存地址信息分别与多个内 存区域——对应, 物理内存地址信息库在 I/O 虚拟化控制器设备中 可以以表格的形式存在, 参见表 2, 当然, 物理内存地址信息库在 I/O虚拟化控制器设备中也可以按照其他形式存在,物理内存地址信 息库的形式不影响本发明的结果, 本发明对此不进行限制;  The physical memory address information in the physical memory address information database corresponds to a plurality of memory regions, respectively, and the physical memory address information library may exist in the form of a table in the I/O virtualization controller device, see Table 2, of course. The physical memory address information database may also exist in other forms in the I/O virtualization controller device. The form of the physical memory address information database does not affect the result of the present invention, and the present invention does not limit this;
相应的, 所述 I/O虚拟化控制器设备 1002还可以用于, 根据所述第一设备 1003请求访问第一内存区域的数据访问请求 查询物理内存地址信息库, 获取所述第一设备对应的内存区域对应 的物理内存地址信息; Correspondingly, the I/O virtualization controller device 1002 is further configured to: query the physical memory address information database according to the data access request of the first device 1003 to access the first memory area, and obtain the corresponding Memory area corresponding Physical memory address information;
根据所述第一设备 1003请求访问的数据的物理内存地址查询所 述 I/O虚拟化控制器设备 1002中的所述第一内存区域对应的物理内 存地址信息。  The physical memory address information corresponding to the first memory area in the I/O virtualization controller device 1002 is queried according to the physical memory address of the data requested by the first device 1003.
第一设备 1003,用于若 I/O虚拟化控制器设备 1002确定所述第 一设备 1003请求访问的数据的物理内存地址在所述 I/O虚拟化控制 器设备 1002 中的物理内存地址信息中, 则访问所述第一内存区域; 示例性的, 若数据访问请求中包含的第一设备请求访问的数据 的物理内存地址在 I/O虚拟化控制器设备中的物理内存地址信息内 , 则说明第一设备发送的请求访问第一内存区域的数据访问请求可以 正确访问第一内存区域, 不会对系统内存误踩, 即不会影响系统内 存的安全性。  The first device 1003 is configured to: if the I/O virtualization controller device 1002 determines the physical memory address information of the physical memory address of the data requested by the first device 1003 in the I/O virtualization controller device 1002 Accessing the first memory area; exemplarily, if the physical memory address of the data requested by the first device included in the data access request is in the physical memory address information in the I/O virtualization controller device, The data access request sent by the first device to access the first memory area can correctly access the first memory area, and the system memory is not accidentally stepped on, that is, the system memory security is not affected.
进一步的, 所述 I/O虚拟化控制器设备 1002还可以用于, 若确定所述第一设备 1003请求访问的数据的物理内存地址不在 所述 I/O虚拟化控制器设备 1002 中的物理内存地址信息中, 将所述 数据访问请求丟弃。  Further, the I/O virtualization controller device 1002 is further configured to: if it is determined that the physical memory address of the data requested by the first device 1003 is not in the physical state of the I/O virtualization controller device 1002 In the memory address information, the data access request is discarded.
可选的, 所述 I/O虚拟化控制器设备 1002还可以用于, 若确定所述第一设备 1003请求访问的数据的物理内存地址不在 所述 I/O 虚拟化控制器设备中的物理内存地址信息中, 记录异常信 息。  Optionally, the I/O virtualization controller device 1002 is further configured to: if it is determined that the physical memory address of the data requested by the first device 1003 is not in the physical of the I/O virtualization controller device In the memory address information, the abnormal information is recorded.
本发明实施例提供的一种访问内存的设备 100,通过获取第一设 备请求访问第一内存区域的数据访问请求, 其中, 所述数据访问请 求包含所述第一设备请求访问的数据的物理内存地址; 所述第一内 存区域为第一设备对应的专用物理内存区域; 根据所述第一设备请 求访问的数据的物理内存地址查询 I/O 虚拟化控制器设备中的物理 内存地址信息; 其中, 所述物理内存地址信息包含与所述第一内存 求访问的数据的物理内存地址在所述 I/O 虚拟化控制器设备中的物 理内存地址信息中, 则访问所述第一内存区域, 有效的提高了系统 内存的安全性。 实施例七 The device 100 for accessing the memory provided by the embodiment of the present invention acquires a data access request of the first memory area by requesting the first device, where the data access request includes the physical memory of the data requested by the first device. The first memory area is a dedicated physical memory area corresponding to the first device; and the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device; The physical memory address information includes a physical memory address of the data accessed by the first memory in the physical memory address information in the I/O virtualization controller device, and the first memory area is accessed. Effectively improved the system Memory security. Example 7
本发明实施例七提供一种物理机 110, 参见图 11A和图 11B, 该 物理机 110可以包括:  The seventh embodiment of the present invention provides a physical machine 110. Referring to FIG. 11A and FIG. 11B, the physical machine 110 may include:
上述任一实施例所述的访问内存的设备 80或 90;  The device 80 or 90 for accessing the memory according to any of the above embodiments;
物理内存 1101, 可以包括只读存储器和随机存取存储器, 用来存储访 问内存的设备 80或 90的数据;物理内存 1101的一部分还可以包括非易失 行随机存取存储器 (NVRAM) 。  The physical memory 1101 may include read only memory and random access memory for storing data of the device 80 or 90 accessing the memory; a portion of the physical memory 1101 may also include non-volatile random access memory (NVRAM).
其中, 所述访问内存的设备包含第一设备以及 I/O 虚拟化控制 器设备;  The device for accessing the memory includes a first device and an I/O virtualization controller device;
所述访问内存的设备 80或 90可以用于,  The device 80 or 90 that accesses the memory can be used,
获取第一设备请求访问第一内存区域的数据访问请求, 其中, 所述数据访问请求包含所述第一设备请求访问的数据的物理内存地 址; 所述第一内存区域为第一设备对应的专用物理内存区域;  Obtaining a data access request that the first device requests access to the first memory area, where the data access request includes a physical memory address of the data that the first device requests to access; the first memory area is dedicated to the first device Physical memory area;
根据所述第一设备请求访问的数据的物理内存地址查询 I/O 虚 拟化控制器设备中的物理内存地址信息; 其中, 所述物理内存地址 信息包含与所述第一内存区域的物理内存地址对应的物理内存地 址;  Querying physical memory address information in the I/O virtualization controller device according to the physical memory address of the data requested by the first device; wherein the physical memory address information includes a physical memory address of the first memory region Corresponding physical memory address;
若确定所述第一设备请求访问的数据的物理内存地址在所述 I/O虚拟化控制器设备中的物理内存地址信息中,则访问所述第一内 存区域。  And if it is determined that the physical memory address of the data requested by the first device is in the physical memory address information in the I/O virtualization controller device, accessing the first memory area.
进一步的, 所述访问内存的设备 80或 90还可以用于: 在所述获 取第一设备请求访问第一内存区域的数据访问请求之前, 将所述第 一内存区域的物理内存地址映射至所述 I/O 虚拟化控制器设备中, 形成所述物理内存地址信息;  Further, the device 80 or 90 for accessing the memory may be further configured to: map the physical memory address of the first memory area to the location before the acquiring the first device requests the data access request of the first memory area In the I/O virtualization controller device, the physical memory address information is formed;
将所述第一内存区域的物理内存地址映射至所述第一设备中。 可选的, 所述 I/O 虚拟化控制器设备中包含由至少一个物理内 存地址信息组成的物理内存地址信息库, 其中, 每一个物理内存地 址信息分别对应一个不同的内存区域; 相应的, 所述访问内存的设 备 80或 90具体用于, Mapping a physical memory address of the first memory area to the first device. Optionally, the I/O virtualization controller device includes a physical memory address information library composed of at least one physical memory address information, where each physical memory location The address information respectively corresponds to a different memory area; correspondingly, the device 80 or 90 for accessing the memory is specifically used,
根据所述第一设备请求访问第一内存区域的数据访问请求查询 物理内存地址信息库, 获取所述第一设备对应的内存区域的物理内 存地址信息;  Obtaining physical memory address information of the memory area corresponding to the first device, by querying the physical memory address information database by requesting the data access request of the first device to access the first memory area;
根据所述第一设备请求访问的数据的物理内存地址查询所述 I / O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址 信息。  Querying physical memory address information corresponding to the first memory area in the I/O virtualization controller device according to a physical memory address of the data requested by the first device.
进一步的, 访问内存的设备 80或 90还可以用于,  Further, the device 80 or 90 that accesses the memory can also be used,
若确定所述第一设备请求访问的数据的物理内存地址不在所述 If it is determined that the physical memory address of the data requested by the first device is not in the
I / O虚拟化控制器设备中的物理内存地址信息中,将所述数据访问请 求丟弃。 The data access request is discarded in the physical memory address information in the I/O virtualization controller device.
本发明实施例提供的一种物理机 1 1 0 ,通过获取第一设备请求访 问第一内存区域的数据访问请求, 其中, 所述数据访问请求包含所 述第一设备请求访问的数据的物理内存地址; 所述第一内存区域为 第一设备对应的专用物理内存区域; 根据所述第一设备请求访问的 数据的物理内存地址查询 I / O 虚拟化控制器设备中的物理内存地址 信息; 其中, 所述物理内存地址信息包含与所述第一内存区域的物 理内存地址对应的物理内存地址; 若确定所述第一设备请求访问的 数据的物理内存地址在所述 I / O 虚拟化控制器设备中的物理内存地 址信息中, 则访问所述第一内存区域, 有效的提高了系统内存的安 全性。  The physical machine 1 1 0 provided by the embodiment of the present invention obtains a data access request of the first memory area by requesting the first device, where the data access request includes the physical memory of the data requested by the first device. The first memory area is a dedicated physical memory area corresponding to the first device; and the physical memory address information in the I/O virtualization controller device is queried according to the physical memory address of the data requested by the first device; The physical memory address information includes a physical memory address corresponding to a physical memory address of the first memory area; if it is determined that the physical memory address of the data requested by the first device is in the I/O virtualization controller In the physical memory address information in the device, accessing the first memory area effectively improves the security of the system memory.
所属领域的技术人员可以清楚地了解到, 为描述的方便和简洁, 上述描述的系统, 装置和单元的具体工作过程, 可以参考前述方法 实施例中的对应过程, 在此不再赘述。  A person skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can be referred to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在本申请所提供的几个实施例中, 应该理解到, 所揭露的系统, 装置和方法, 可以通过其它的方式实现。 例如, 以上所描述的装置 实施例仅仅是示意性的, 例如, 所述单元的划分, 仅仅为一种逻辑 功能划分, 实际实现时可以有另外的划分方式, 例如多个单元或组 件可以结合或者可以集成到另一个系统, 或一些特征可以忽略, 或 不执行。 另一点, 所显示或讨论的相互之间的耦合或直接耦合或通 信连接可以是通过一些接口, 装置或单元的间接耦合或通信连接, 可以是电性或其它的形式。 In the several embodiments provided by the present application, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, such as multiple units or groups. Pieces can be combined or integrated into another system, or some features can be ignored, or not executed. In addition, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical or otherwise.
所述作为分离部件说明的单元可以是或者也可以不是物理上分 开的, 作为单元显示的部件可以是或者也可以不是物理单元, 即可 以位于一个地方, 或者也可以分布到多个网络单元上。 可以根据实 际的需要选择其中的部分或者全部单元来实现本实施例方案的 目 的。  The units described as separate components may or may not be physically separated, and the components displayed as the units may or may not be physical units, and may be located in one place or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the embodiment of the present embodiment.
另外, 在本发明各个实施例中的各功能单元可以集成在一个处 理单元中, 也可以是各个单元单独物理包括, 也可以两个或两个以 上单元集成在一个单元中。 上述集成的单元既可以釆用硬件的形式 实现, 也可以釆用硬件加软件功能单元的形式实现。  In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
上述以软件功能单元的形式实现的集成的单元, 可以存储在一 个计算机可读取存储介质中。 上述软件功能单元存储在一个存储介 质中, 包括若干指令用以使得一台计算机设备(可以是个人计算机, 服务器, 或者网络设备等) 执行本发明各个实施例所述方法的部分 步骤。 而前述的存储介质包括: U 盘、 移动硬盘、 只读存储器 ( R e a d-O n l y Memo r y , 简称 應)、 随机存取存储器 ( Ra ndom A c c e s s Memo r y , 简称 RAM )、 磁碟或者光盘等各种可以存储程序代码的介质。  The above-described integrated unit implemented in the form of a software functional unit can be stored in a computer readable storage medium. The software functional unit described above is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform portions of the steps of the various embodiments of the present invention. The foregoing storage medium includes: a U disk, a mobile hard disk, a read only memory (R ea dO nly Memo ry, abbreviated as), a random access memory (Ra ndom A ccess Memo ry, RAM for short), a magnetic disk or an optical disk, and the like. A medium that can store program code.
最后应说明的是: 以上实施例仅用以说明本发明的技术方案, 而非对其限制; 尽管参照前述实施例对本发明进行了详细的说明, 本领域的普通技术人员应当理解: 其依然可以对前述各实施例所记 载的技术方案进行修改, 或者对其中部分技术特征进行等同替换; 而这些修改或者替换, 并不使相应技术方案的本质脱离本发明各实 施例技术方案的精神和范围。  It should be noted that the above embodiments are only for explaining the technical solutions of the present invention, and are not intended to be limiting; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that: The technical solutions described in the foregoing embodiments are modified, or some of the technical features are equivalently replaced. The modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

权 利 要 求 书 claims
1、 一种访问内存的方法, 其特征在于, 包括, 1. A method of accessing memory, characterized by:
获取第一设备请求访问第一内存区域的数据访问请求, 其中, 所 述数据访问请求包含所述第一设备请求访问的数据的物理内存地址; 所述第一内存区域为第一设备对应的专用物理内存区域; Obtain a data access request from the first device to access the first memory area, where the data access request includes the physical memory address of the data that the first device requests to access; the first memory area is dedicated to the first device. physical memory area;
根据所述第一设备请求访问的数据的物理内存地址查询输入 /输 出 I / O虚拟化控制器设备中的物理内存地址信息; 其中, 所述物理内 存地址; Query the physical memory address information in the input/output I/O virtualization controller device according to the physical memory address of the data requested to be accessed by the first device; wherein, the physical memory address;
若确定所述第一设备请求访问的数据的物理内存地址在所述 I / O 虚拟化控制器设备中的物理内存地址信息中, 则访问所述第一内存区 域。 If it is determined that the physical memory address of the data requested to be accessed by the first device is in the physical memory address information in the I/O virtualization controller device, the first memory area is accessed.
2、 根据权利要求 1 所述的访问内存的方法, 其特征在于, 在所 述获取第一设备请求访问第一内存区域的数据访问请求之前, 所述方 法还包括, 2. The method of accessing memory according to claim 1, characterized in that, before obtaining the data access request of the first device requesting access to the first memory area, the method further includes:
将所述第一内存区域的物理内存地址映射至所述 I / O虚拟化控制 器设备中, 形成所述物理内存地址信息; Map the physical memory address of the first memory area to the I/O virtualization controller device to form the physical memory address information;
将所述第一内存区域的物理内存地址映射至所述第一设备中。 Map the physical memory address of the first memory area to the first device.
3、 根据权利要求 1 或 2 所述的访问内存的方法, 其特征在于, 所述 I / O虚拟化控制器设备中包含由至少一个物理内存地址信息组成 的物理内存地址信息库, 其中, 每一个物理内存地址信息分别对应一 个不同的内存区域; 相应的, 所述根据所述第一设备请求访问的数据 的物理内存地址查询 I / O虛拟化控制器设备中的物理内存地址信息, 包括, 3. The method of accessing memory according to claim 1 or 2, characterized in that the I/O virtualization controller device contains a physical memory address information library composed of at least one physical memory address information, wherein each Each piece of physical memory address information corresponds to a different memory area; accordingly, querying the physical memory address information in the I/O virtualization controller device according to the physical memory address of the data requested to be accessed by the first device includes,
根据所述第一设备请求访问第一内存区域的数据访问请求查询 物理内存地址信息库, 获取所述第一设备对应的内存区域的物理内存 地址信息; Query the physical memory address information library according to the data access request of the first device to access the first memory area, and obtain the physical memory address information of the memory area corresponding to the first device;
根据所述第一设备请求访问的数据的物理内存地址查询所述 I / O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址信息。 Query the physical memory address information corresponding to the first memory area in the I/O virtualization controller device according to the physical memory address of the data requested to be accessed by the first device.
4、 根据权利要求 1 - 3 任一项所述的访问内存的方法, 其特征在 于, 所述方法还包括, 4. The method of accessing memory according to any one of claims 1 to 3, characterized in that the method further includes:
若确定所述第一设备请求访问的数据的物理内存地址不在所述 I / O虚拟化控制器设备中的物理内存地址信息中, 将所述数据访问请 求丟弃。 If it is determined that the physical memory address of the data requested to be accessed by the first device is not in the physical memory address information in the I/O virtualization controller device, the data access request is discarded.
5、 根据权利要求 4 所述的访问内存的方法, 其特征在于, 所述 方法还包括, 5. The method of accessing memory according to claim 4, characterized in that the method further includes:
若确定所述第一设备请求访问的数据的物理内存地址不在所述 I / O虚拟化控制器设备中的物理内存地址信息中, 记录异常信息。 If it is determined that the physical memory address of the data requested to be accessed by the first device is not in the physical memory address information in the I/O virtualization controller device, exception information is recorded.
6、 一种访问内存的设备, 其特征在于, 包括: 6. A device for accessing memory, characterized by:
获取单元, 用于获取第一设备请求访问第一内存区域的数据访问 请求, 其中, 所述数据访问请求包含所述第一设备请求访问的数据的 物理内存地址; 所述第一内存区域为第一设备对应的专用物理内存区 域; An acquisition unit configured to acquire a data access request from a first device requesting access to a first memory area, wherein the data access request includes the physical memory address of the data requested by the first device to access; the first memory area is the A dedicated physical memory area corresponding to a device;
查询单元, 用于根据所述获取单元获取的所述第一设备请求访问 的数据的物理内存地址查询 I / O虚拟化控制器设备中的物理内存地址 信息; 其中, 所述物理内存地址信息包含与所述第一内存区域的物理 内存地址对应的物理内存地址; A query unit configured to query the physical memory address information in the I/O virtualization controller device according to the physical memory address of the data requested to be accessed by the first device obtained by the acquisition unit; wherein, the physical memory address information includes a physical memory address corresponding to the physical memory address of the first memory area;
访问单元, 用于若查询单元确定所述第一设备请求访问的数据的 物理内存地址在所述 I / O 虚拟化控制器设备中的物理内存地址信息 中, 则访问所述第一内存区域。 The access unit is configured to access the first memory area if the query unit determines that the physical memory address of the data requested to be accessed by the first device is in the physical memory address information in the I/O virtualization controller device.
7、 根据权利要求 6 所述的访问内存的设备, 其特征在于, 所述 设备还包括, 7. The device for accessing memory according to claim 6, characterized in that the device further includes:
映射单元, 用于在所述获取单元获取所述第一设备请求访问第一 内存区域的数据访问请求之前, 将所述第一内存区域的物理内存地 址映射至所述 I / O虚拟化控制器设备中,形成所述物理内存地址信息; 所述映射单元还用于, 将所述第一内存区域的物理内存地址映射 至所述第一设备中。 A mapping unit configured to map the physical memory address of the first memory area to the I/O virtualization controller before the acquisition unit obtains the data access request of the first device requesting access to the first memory area. In the device, the physical memory address information is formed; the mapping unit is also used to map the physical memory address of the first memory area to the first device.
8、 根据权利要求 6 或 7 所述的访问内存的设备, 其特征在于, 所述 I / O虚拟化控制器设备中包含由至少一个物理内存地址信息组成 的物理内存地址信息库, 其中, 每一个物理内存地址信息分别对应一 个不同的内存区域; 相应的, 所述查询单元具体用于, 8. The device for accessing memory according to claim 6 or 7, characterized in that, The I/O virtualization controller device contains a physical memory address information library composed of at least one physical memory address information, where each physical memory address information corresponds to a different memory area; accordingly, the query unit Specifically used for,
根据所述第一设备请求访问第一内存区域的数据访问请求查询 物理内存地址信息库, 获取所述第一设备对应的内存区域对应的物理 内存地址信息; Query the physical memory address information library according to the data access request of the first device to access the first memory area, and obtain the physical memory address information corresponding to the memory area corresponding to the first device;
根据所述第一设备请求访问的数据的物理内存地址查询所述 I / O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址信息。 Query the physical memory address information corresponding to the first memory area in the I/O virtualization controller device according to the physical memory address of the data requested to be accessed by the first device.
9、 根据权利要求 6 - 8 任一项所述的访问内存的设备, 其特征在 于, 所述设备还包括, 9. The device for accessing memory according to any one of claims 6 to 8, characterized in that the device further includes:
丟弃单元, 用于若所述查询单元确定所述第一设备请求访问的数 据的物理内存地址不在所述 I / 0虚拟化控制器设备中的物理内存地址 信息中, 将所述数据访问请求丟弃。 a discarding unit configured to, if the query unit determines that the physical memory address of the data requested to be accessed by the first device is not in the physical memory address information in the I/O virtualization controller device, discard the data access request Discard.
1 0、 根据权利要求 9所述的访问内存的设备, 其特征在于, 所述 设备还包括, 10. The device for accessing memory according to claim 9, characterized in that the device further includes:
记录单元, 用于若所述查询单元确定所述第一设备请求访问的数 据的物理内存地址不在所述 I / 0虚拟化控制器设备中的物理内存地址 信息中, 记录异常信息。 A recording unit, configured to record exception information if the query unit determines that the physical memory address of the data requested to be accessed by the first device is not in the physical memory address information in the I/O virtualization controller device.
1 1、 一种访问内存的设备, 其特征在于, 包括 1 1. A device for accessing memory, characterized by: including
处理器, 用于获取第一设备请求访问第一内存区域的数据访问请 求, 其中, 所述数据访问请求包含所述第一设备请求访问的数据的物 理内存地址; 所述第一内存区域为第一设备对应的专用物理内存区 域; A processor configured to obtain a data access request from a first device requesting access to a first memory area, wherein the data access request includes the physical memory address of the data requested to be accessed by the first device; the first memory area is the A dedicated physical memory area corresponding to a device;
I / O虚拟化控制器设备, 用于根据所述第一设备请求访问的数据 的物理内存地址查询所述 I / 0虚拟化控制器设备中的物理内存地址信 息; 其中, 所述物理内存地址信息包含与所述第一内存区域的物理内 存地址对应的物理内存地址; I/O virtualization controller device, configured to query the physical memory address information in the I/O virtualization controller device according to the physical memory address of the data requested to be accessed by the first device; wherein, the physical memory address The information includes a physical memory address corresponding to the physical memory address of the first memory area;
第一设备, 用于若 I / O虚拟化控制器设备确定所述第一设备请求 存地址信息中, 则访问所述第一内存区域。 The first device is used if the I/O virtualization controller device determines that the first device requests If the address information is stored in the first memory area, the first memory area is accessed.
12、 根据权利要求 11 所述的访问内存的设备, 其特征在于, 所 述处理器具体用于, 在所述获取第一设备请求访问第一内存区域的数 据访问请求之前, 将所述第一内存区域的物理内存地址映射至所述 I/O虚拟化控制器设备中, 形成所述物理内存地址信息; 12. The device for accessing memory according to claim 11, wherein the processor is specifically configured to, before obtaining the data access request of the first device requesting access to the first memory area, obtain the first data access request from the first device. The physical memory address of the memory area is mapped to the I/O virtualization controller device to form the physical memory address information;
所述处理器具体还用于, 将所述第一内存区域的物理内存地址映 射至所述第一设备中。 The processor is specifically configured to map the physical memory address of the first memory area to the first device.
13、根据权利要求 11或 12所述的访问内存的设备,其特征在于, 所述 I/O虚拟化控制器设备中包含由至少一个物理内存地址信息组成 的物理内存地址信息库, 其中, 每一个物理内存地址信息分别对应一 个不同的内存区域; 相应的, 所述 I/O虚拟化控制器设备还用于, 根据所述第一设备请求访问第一内存区域的数据访问请求查询 物理内存地址信息库, 获取所述第一设备对应的内存区域对应的物理 内存地址信息; 13. The device for accessing memory according to claim 11 or 12, characterized in that, the I/O virtualization controller device contains a physical memory address information library composed of at least one physical memory address information, wherein, each Each piece of physical memory address information corresponds to a different memory area; accordingly, the I/O virtualization controller device is also used to query the physical memory address according to the data access request of the first device requesting access to the first memory area. Information database, obtain physical memory address information corresponding to the memory area corresponding to the first device;
根据所述第一设备请求访问的数据的物理内存地址查询所述 I/O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址信息。 Query the physical memory address information corresponding to the first memory area in the I/O virtualization controller device according to the physical memory address of the data requested to be accessed by the first device.
14、 根据权利要求 11-13任一项所述的访问内存的设备, 其特征 在于, 所述 I/O虚拟化控制器设备还用于, 14. The device for accessing memory according to any one of claims 11 to 13, characterized in that the I/O virtualization controller device is also used to:
若确定所述第一设备请求访问的数据的物理内存地址不在所述 I/O虚拟化控制器设备中的物理内存地址信息中, 将所述数据访问请 求丟弃。 If it is determined that the physical memory address of the data requested to be accessed by the first device is not in the physical memory address information in the I/O virtualization controller device, the data access request is discarded.
15、 根据权利要求 14 所述的访问内存的设备, 其特征在于, 所 述 I/O虚拟化控制器设备还用于, 15. The device for accessing memory according to claim 14, characterized in that the I/O virtualization controller device is also used to:
若确定所述第一设备请求访问的数据的物理内存地址不在所述 I/O虚拟化控制器设备中的物理内存地址信息中, 记录异常信息。 If it is determined that the physical memory address of the data requested to be accessed by the first device is not in the physical memory address information in the I/O virtualization controller device, exception information is recorded.
16、 一种物理机, 其特征在于, 包括, 访问内存的设备以及物理 内存, 其中, 所述访问内存的设备包含第一设备以及 I/O虚拟化控制 器设备; 16. A physical machine, characterized in that it includes a device that accesses memory and a physical memory, wherein the device that accesses memory includes a first device and an I/O virtualization controller device;
所述访问内存的设备用于, 获取第一设备请求访问第一内存区域的数据访问请求, 其中, 所 述数据访问请求包含所述第一设备请求访问的数据的物理内存地址; 所述第一内存区域为第一设备对应的专用物理内存区域; The device for accessing memory is used to, Obtain a data access request from the first device to access the first memory area, where the data access request includes the physical memory address of the data that the first device requests to access; the first memory area is dedicated to the first device. physical memory area;
根据所述第一设备请求访问的数据的物理内存地址查询所述 I/O 虚拟化控制器设备中的物理内存地址信息; 其中, 所述物理内存地址 若确定所述第一设备请求访问的数据的物理内存地址在所述 I/O 虚拟化控制器设备中的物理内存地址信息中, 则访问所述第一内存区 域。 Query the physical memory address information in the I/O virtualization controller device according to the physical memory address of the data requested to be accessed by the first device; wherein, if the physical memory address determines the data requested to be accessed by the first device The physical memory address is in the physical memory address information in the I/O virtualization controller device, then the first memory area is accessed.
17、 根据权利要求 16 所述的物理机, 其特征在于, 所述访问内 存的设备还用于, 在所述获取第一设备请求访问第一内存区域的数据 访问请求之前, 将所述第一内存区域的物理内存地址映射至所述 I/O 虚拟化控制器设备中, 形成所述物理内存地址信息; 17. The physical machine according to claim 16, wherein the device for accessing memory is further configured to: before obtaining the data access request of the first device requesting access to the first memory area, obtain the first data access request from the first device. The physical memory address of the memory area is mapped to the I/O virtualization controller device to form the physical memory address information;
将所述第一内存区域的物理内存地址映射至所述第一设备中。 Map the physical memory address of the first memory area to the first device.
18、根据权利要求 16或 17所述的物理机,其特征在于,所述 I/O 虚拟化控制器设备中包含由至少一个物理内存地址信息组成的物理 内存地址信息库, 其中, 每一个物理内存地址信息分别对应一个不同 的内存区域; 相应的, 所述访问内存的设备具体用于, 18. The physical machine according to claim 16 or 17, characterized in that the I/O virtualization controller device contains a physical memory address information library composed of at least one physical memory address information, wherein each physical memory address information library is composed of at least one physical memory address information. The memory address information respectively corresponds to a different memory area; accordingly, the device that accesses the memory is specifically used to:
根据所述第一设备请求访问第一内存区域的数据访问请求查询 物理内存地址信息库, 获取所述第一设备对应的内存区域的物理内存 地址信息; Query the physical memory address information library according to the data access request of the first device to access the first memory area, and obtain the physical memory address information of the memory area corresponding to the first device;
根据所述第一设备请求访问的数据的物理内存地址查询所述 I/O 虚拟化控制器设备中的所述第一内存区域对应的物理内存地址信息。 Query the physical memory address information corresponding to the first memory area in the I/O virtualization controller device according to the physical memory address of the data requested to be accessed by the first device.
19、 根据权利要求 16-18任一项所述的物理机, 其特征在于, 所 述访问内存的设备还用于, 19. The physical machine according to any one of claims 16 to 18, characterized in that the device for accessing memory is also used to:
若确定所述第一设备请求访问的数据的物理内存地址不在所述 I/O虚拟化控制器设备中的物理内存地址信息中, 将所述数据访问请 求丟弃。 If it is determined that the physical memory address of the data requested to be accessed by the first device is not in the physical memory address information in the I/O virtualization controller device, the data access request is discarded.
PCT/CN2013/086167 2013-10-29 2013-10-29 Method and device for accessing internal memory WO2015061970A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201380004536.4A CN104169891B (en) 2013-10-29 2013-10-29 A kind of method and apparatus for accessing internal memory
PCT/CN2013/086167 WO2015061970A1 (en) 2013-10-29 2013-10-29 Method and device for accessing internal memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/086167 WO2015061970A1 (en) 2013-10-29 2013-10-29 Method and device for accessing internal memory

Publications (1)

Publication Number Publication Date
WO2015061970A1 true WO2015061970A1 (en) 2015-05-07

Family

ID=51912346

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/086167 WO2015061970A1 (en) 2013-10-29 2013-10-29 Method and device for accessing internal memory

Country Status (2)

Country Link
CN (1) CN104169891B (en)
WO (1) WO2015061970A1 (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104360955B (en) * 2014-12-08 2018-08-14 山东工商学院 It is a kind of to apply independent caching system and method
CN106295267B (en) 2015-06-09 2019-04-19 阿里巴巴集团控股有限公司 It is a kind of access electronic equipment physical memory in private data method and apparatus
CN107239407B (en) * 2016-03-29 2021-01-12 华为技术有限公司 Wireless access method and device for memory
CN107329790B (en) * 2017-06-30 2021-01-15 联想(北京)有限公司 Data processing method and electronic equipment
CN109308269B (en) * 2017-07-26 2021-02-23 华为技术有限公司 Memory management method and device
CN110968599B (en) * 2018-09-30 2023-04-07 北京国双科技有限公司 Inquiry method and device based on Impala
CN110008726B (en) * 2019-04-09 2021-08-20 杨力祥 Runtime access control device and method
CN110162965B (en) * 2019-04-09 2021-10-01 杨力祥 Runtime access control method and computing device
CN113906398A (en) * 2019-06-10 2022-01-07 华为技术有限公司 Secure access method and electronic equipment
CN113360420A (en) * 2020-03-06 2021-09-07 北京机械设备研究所 Memory control method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1599902A (en) * 2001-12-05 2005-03-23 先进微装置公司 System and method for handling device accesses to a memory providing increased memory access security
CN1637703A (en) * 2003-12-25 2005-07-13 松下电器产业株式会社 Data processing apparatus and compiler apparatus
CN101149717A (en) * 2007-11-16 2008-03-26 威盛电子股份有限公司 Computer system and direct RAM access transmission method
CN101231619A (en) * 2008-02-22 2008-07-30 浙江大学 Method for managing dynamic internal memory base on discontinuous page
CN102331977A (en) * 2011-09-07 2012-01-25 上海交通大学 Memory controller, processor system and memory access control method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1599902A (en) * 2001-12-05 2005-03-23 先进微装置公司 System and method for handling device accesses to a memory providing increased memory access security
CN1637703A (en) * 2003-12-25 2005-07-13 松下电器产业株式会社 Data processing apparatus and compiler apparatus
CN101149717A (en) * 2007-11-16 2008-03-26 威盛电子股份有限公司 Computer system and direct RAM access transmission method
CN101231619A (en) * 2008-02-22 2008-07-30 浙江大学 Method for managing dynamic internal memory base on discontinuous page
CN102331977A (en) * 2011-09-07 2012-01-25 上海交通大学 Memory controller, processor system and memory access control method

Also Published As

Publication number Publication date
CN104169891B (en) 2017-07-21
CN104169891A (en) 2014-11-26

Similar Documents

Publication Publication Date Title
WO2015061970A1 (en) Method and device for accessing internal memory
Zhang et al. {FlashShare}: Punching Through Server Storage Stack from Kernel to Firmware for {Ultra-Low} Latency {SSDs}
US10289555B1 (en) Memory read-ahead using learned memory access patterns
US8738856B2 (en) System for handling memory requests and method thereof
JP6307461B2 (en) Method and apparatus for coherent memory copy with replicated write request
WO2018076793A1 (en) Nvme device, and methods for reading and writing nvme data
JP2020009492A (en) Hybrid memory management
US20180307535A1 (en) Computer system and method for controlling computer
US8200939B2 (en) Memory management unit in a microprocessor system
US8719524B2 (en) Storage system including flash drives for improving performance by controlling data caching
Lesokhin et al. Page fault support for network controllers
US9405725B2 (en) Writing message to controller memory space
US20140122803A1 (en) Information processing apparatus and method thereof
WO2012088894A1 (en) Method and device for requesting exclusive resource
WO2015180598A1 (en) Method, apparatus and system for processing access information of storage device
WO2012142894A1 (en) Method and apparatus for reducing cpu resource consumption using giant page mapping
US11960945B2 (en) Message passing circuitry and method
CN112463307A (en) Data transmission method, device, equipment and readable storage medium
US9298375B2 (en) Method and apparatus for returning reads in the presence of partial data unavailability
WO2016019566A1 (en) Memory management method, device and system and network-on-chip
US11151064B2 (en) Information processing apparatus and storage device access control method
CN115933975A (en) Data processing method, computing device and computer system
KR20180041037A (en) Method for shared distributed memory management in multi-core solid state driver
EP3293625A1 (en) Method and device for accessing file, and storage system
JP6725662B2 (en) Computer system and processing method

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13896212

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13896212

Country of ref document: EP

Kind code of ref document: A1