WO2016197947A1 - Paging address space management method and controller - Google Patents

Paging address space management method and controller Download PDF

Info

Publication number
WO2016197947A1
WO2016197947A1 PCT/CN2016/085279 CN2016085279W WO2016197947A1 WO 2016197947 A1 WO2016197947 A1 WO 2016197947A1 CN 2016085279 W CN2016085279 W CN 2016085279W WO 2016197947 A1 WO2016197947 A1 WO 2016197947A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
target
address space
page
space
Prior art date
Application number
PCT/CN2016/085279
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 华为技术有限公司
Publication of WO2016197947A1 publication Critical patent/WO2016197947A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Small-Scale Networks (AREA)

Abstract

Provided are a paging address space management method and controller. The paging address space management method comprises: determining an address page (301); determining a target peripheral address space (302); determining an address page satisfying a first preset requirement as a first target address page (303); and establishing a mapping between each of the first target address page and the target peripheral address space (304). The method can determine the first target address page satisfying the first preset requirement according to a size of the target peripheral address space in a peripheral device, and the established mapping is a correspondence between the address space of the first target address page and the effective target peripheral address space accessible to the peripheral device, thereby avoiding a waste of address resources resulting from mapping to a controller an address space in a peripheral device and inaccessible to the controller.

Description

一种分页式地址空间管理方法以及控制器Paging address space management method and controller
本申请要求于2015年6月12日提交中国专利局、申请号为CN201510324059.0、发明名称为“一种分页式地址空间管理方法以及控制器”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on June 12, 2015, the Chinese Patent Office, the application number is CN201510324059.0, and the invention name is "a paging address space management method and controller". The citations are incorporated herein by reference.
技术领域Technical field
本发明涉及计算机系统,尤其涉及的是一种分页式地址空间管理方法以及控制器。The present invention relates to a computer system, and more particularly to a paging address space management method and controller.
背景技术Background technique
参见图1所示对现有技术所提供的计算机系统的结构进行说明,如图1所示,计算机系统包括但不限于设置有处理器100、控制器101以及存储器102,所述存储器102是计算机系统的基本单元,计算机系统需要从所述存储器102移动资料或将资料写入所述存储器102,外部设备103用于计算机系统与外部进行通信或者补充计算机系统的额外功能,所述控制器101则是用于连接处理器100和所述外部设备103,且所述控制器101还提供了所述存储器102的存储方法,以使所述控制器101能够帮助所述处理器100以及所述外部设备103去存取所述存储器102;Referring to FIG. 1, the structure of a computer system provided by the prior art is illustrated. As shown in FIG. 1, the computer system includes, but is not limited to, a processor 100, a controller 101, and a memory 102, which is a computer. The basic unit of the system, the computer system needs to move data from or write data to the memory 102, and the external device 103 is used to communicate with the external system or supplement the additional functions of the computer system, the controller 101 Is for connecting the processor 100 and the external device 103, and the controller 101 further provides a storage method of the memory 102 to enable the controller 101 to assist the processor 100 and the external device 103 to access the memory 102;
参见图2所示,现有技术中,所述控制器101的地址空间会分成多个独立存储的存储单元,所述控制器101预先确定各所述存储单元与各外部设备103的存储器地址映射关系,即控制器101预先确定了存储器地址映射关系,该存储器地址映射关系包括各存储单元与各外部设备的一一对应的关系,如图2所示为例,即所述地址映射关系包括了存储单元1与外部设备1的映射关系,存储单元2与外部设备2的映射关系等,各个所述存储单元有固定的起始地址和结束地址,所述控制器101可根据各存储单元的地址范围选择合适的外部设备用于建立所述存储器地址映射关系,因控制器101已确定所述存储器地址映射关系,则使得所述控制器101能够直接读写外部设备103的存储器,以使读取过程中不会产生额外的软件开销;Referring to FIG. 2, in the prior art, the address space of the controller 101 is divided into a plurality of independently stored storage units, and the controller 101 predetermines a memory address mapping of each of the storage units and each external device 103. Relationship, that is, the controller 101 predetermines a memory address mapping relationship, which includes a one-to-one correspondence between each storage unit and each external device, as shown in FIG. 2, that is, the address mapping relationship includes The mapping relationship between the storage unit 1 and the external device 1, the mapping relationship between the storage unit 2 and the external device 2, and the like, each of the storage units has a fixed start address and an end address, and the controller 101 can be based on the address of each storage unit. Selecting a suitable external device for establishing the memory address mapping relationship, because the controller 101 has determined the memory address mapping relationship, enabling the controller 101 to directly read and write the memory of the external device 103 to enable reading No additional software overhead is incurred during the process;
现有技术的弊端在于,各所述存储单元的地址范围大小是固定的,且一旦某个存储单元分配一个外部设备103时,即便该外部设备103不能用完存储单 元的地址资源,但是该存储单元的剩余的地址无法被使用,从而造成了控制器101地址资源的浪费;而且若某个外部设备103的地址空间大于与该外部设备103对应的存储单元的地址空间时,则控制器101无法成功挂接该外部设备103。A disadvantage of the prior art is that the address range size of each of the storage units is fixed, and once a certain storage unit allocates an external device 103, even if the external device 103 cannot run out of the storage list The address resource of the element, but the remaining address of the storage unit cannot be used, thereby causing waste of the address resource of the controller 101; and if the address space of a certain external device 103 is larger than the address of the storage unit corresponding to the external device 103 In the case of space, the controller 101 cannot successfully attach the external device 103.
发明内容Summary of the invention
本发明实施例提供了一种分页式地址空间管理方法以及控制器,能够有效的节省控制器的地址资源,避免控制器地址资源的浪费;The embodiment of the invention provides a paging address space management method and a controller, which can effectively save the address resource of the controller and avoid waste of the controller address resource;
本发明实施例第一方面提供了一种分页式地址空间管理方法,包括:A first aspect of the embodiments of the present invention provides a paging address space management method, including:
确定地址分页,所述地址分页由控制器的地址空间进行划分以形成;Determining address paging, which is divided by the address space of the controller to form;
确定目标外设地址空间,所述目标外设地址空间为外部设备请求当前与所述地址空间建立映射关系的外设地址空间,所述地址空间用于对已映射到所述地址空间上的所述目标外设地址空间进行存取;Determining a target peripheral address space, where the external device requests a peripheral address space that is currently mapped to the address space, and the address space is used to map to the address space The target peripheral address space is accessed;
确定满足第一预设条件的所述地址分页为第一目标地址分页,所述第一预设条件为所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间;Determining that the address page that meets the first preset condition is paged as a first target address, and the first preset condition is that a sum of address spaces of all the first target address pages is greater than or equal to the target peripheral address space ;
建立各所述第一目标地址分页与所述目标外设地址空间的映射关系,所述映射关系用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上。Establishing a mapping relationship between each of the first target address pages and the target peripheral address space, where the mapping relationship is used to map the target peripheral address space to the first target address page according to the mapping relationship On the address space.
结合本发明实施例第一方面,本发明实施例第一方面的第一种实现方式中,With reference to the first aspect of the embodiments of the present invention, in a first implementation manner of the first aspect of the embodiment of the present invention,
所述确定地址分页之前,所述方法还包括:Before the determining the address paging, the method further includes:
划分所述地址空间以形成多个所述地址分页,所有所述地址分页的地址空间的和等于所述地址空间,且各所述地址分页的地址空间为2的幂次方。The address space is divided to form a plurality of the address pages, the sum of the address spaces of all the address pages is equal to the address space, and the address space of each of the address pages is a power of two.
结合本发明实施例第一方面或本发明实施例第一方面的第一种实现方式,本发明实施例第一方面的第二种实现方式中,With reference to the first aspect of the embodiments of the present invention or the first implementation manner of the first aspect of the embodiments of the present invention,
确定空闲地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;Determining a free address page that is an address page that does not currently have a mapping relationship with an external device's peripheral address space;
所述确定目标外设地址空间之后,所述方法还包括: After the determining the target peripheral address space, the method further includes:
若确定所有所述空闲地址分页的地址空间的和大于所述目标外设地址空间,则所述确定满足第一预设条件的所述地址分页为第一目标地址分页包括:If it is determined that the sum of the address spaces of all the free address pages is greater than the target peripheral address space, the determining that the address paging satisfying the first preset condition is the first target address paging comprises:
在所有所述空闲地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The first target address page that satisfies the first preset condition is determined in all of the free address pages.
结合本发明实施例第一方面或本发明实施例第一方面的第一种实现方式,本发明实施例第一方面的第三种实现方式中,With reference to the first aspect of the embodiment of the present invention or the first implementation manner of the first aspect of the embodiment of the present invention, in a third implementation manner of the first aspect of the embodiment of the present invention,
所述确定地址分页之后,所述方法还包括:After the determining the address paging, the method further includes:
确定空闲地址分页和已占用地址分页,所述已占用地址分页为已与外部设备的外设地址空间建立映射关系的地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;Determining a free address page and an occupied address page, the occupied address page is an address page that has been mapped to an external device's peripheral address space, and the free address page is not currently associated with an external device's peripheral address space. Address paging of the mapping relationship;
所述确定目标外设地址空间之后,所述方法还包括:After the determining the target peripheral address space, the method further includes:
若确定所有所述空闲地址分页的地址空间的和小于所述目标外设地址空间,则所述方法还包括:If the sum of the address spaces of all the free address pages is determined to be smaller than the target peripheral address space, the method further includes:
在所有所述已占用地址分页中确定满足第二预设条件的第二目标地址分页,所述第二预设条件为所述已占用地址分页中存取频率小于预设值的地址分页;Determining, in all of the occupied address pages, a second target address page that satisfies a second preset condition, where the second preset condition is an address page in the occupied address page whose access frequency is less than a preset value;
解除所述第二目标地址分页已建立的与外设地址空间的映射关系;Dissolving the mapping relationship between the second target address page and the peripheral address space that has been established;
所述确定满足第一预设条件的所述地址分页为第一目标地址分页包括:The determining that the address paging that meets the first preset condition is the first target address paging comprises:
在所有所述空闲地址分页中以及所述第二目标地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The first target address page that satisfies the first preset condition is determined in all of the free address pages and in the second target address page.
结合本发明实施例第一方面的实现方式,本发明实施例第一方面的第四种实现方式中,With the implementation of the first aspect of the embodiment of the present invention, in a fourth implementation manner of the first aspect of the embodiment of the present invention,
所述建立各所述第一目标地址分页与所述目标外设地址空间的映射关系之后,所述方法还包括:After the mapping between each of the first target address pages and the target peripheral address space is established, the method further includes:
将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上;Mapping the target peripheral address space to the address space of the first target address page according to the mapping relationship;
确定各所述第一目标地址分页的虚拟地址;Determining a virtual address of each of the first target address pages;
将各所述第一目标地址分页的虚拟地址进行重排以形成连续的虚拟地址段。 The virtual addresses of each of the first target address pages are rearranged to form a continuous virtual address segment.
本发明实施例第二方面提供了一种控制器,包括:A second aspect of the embodiments of the present invention provides a controller, including:
第一确定单元,用于确定地址分页,所述地址分页由控制器的地址空间进行划分以形成;a first determining unit, configured to determine address paging, where the address paging is divided by an address space of the controller to form;
第二确定单元,用于确定目标外设地址空间,所述目标外设地址空间为外部设备请求当前与所述地址空间建立映射关系的外设地址空间,所述地址空间用于对已映射到所述地址空间上的所述目标外设地址空间进行存取;a second determining unit, configured to determine a target peripheral address space, where the target peripheral address space is a peripheral device requesting an external address space that is currently mapped to the address space, where the address space is used to map to Accessing the target peripheral address space on the address space;
第三确定单元,用于确定满足第一预设条件的所述地址分页为第一目标地址分页,所述第一预设条件为所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间;a third determining unit, configured to determine that the address paging that meets the first preset condition is a first target address paging, and the first preset condition is that a sum of address spaces of all the first target address paging is greater than or equal to The target peripheral address space;
建立单元,用于建立各所述第一目标地址分页与所述目标外设地址空间的映射关系,所述映射关系用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上。a mapping unit, configured to establish a mapping relationship between each of the first target address pages and the target peripheral address space, where the mapping relationship is used to map the target peripheral address space to the first A destination address is paged over the address space.
结合本发明实施例第二方面,本发明实施例第二方面的第一种实现方式中,With reference to the second aspect of the embodiments of the present invention, in a first implementation manner of the second aspect of the embodiment of the present invention,
划分单元,用于划分所述地址空间以形成多个所述地址分页,所有所述地址分页的地址空间的和等于所述地址空间,且各所述地址分页的地址空间为2的幂次方。a dividing unit, configured to divide the address space to form a plurality of the address pages, a sum of address spaces of all the address pages is equal to the address space, and an address space of each of the address pages is a power of 2 .
结合本发明实施例第二方面或本发明实施例第二方面的第一种实现方式,本发明实施例第二方面的第二种实现方式中,With reference to the second aspect of the embodiment of the present invention or the first implementation manner of the second aspect of the embodiment of the present invention, in a second implementation manner of the second aspect of the embodiment of the present invention,
第四确定单元,用于确定空闲地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;a fourth determining unit, configured to determine a free address page, where the free address page is an address page that does not currently have a mapping relationship with an external device address space of the external device;
所述第三确定单元还用于,若确定所有所述空闲地址分页的地址空间的和大于所述目标外设地址空间,则在所有所述空闲地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The third determining unit is further configured to: if it is determined that the sum of the address spaces of all the free address pages is greater than the target peripheral address space, determine, in all the free address pages, that the first preset condition is met The first target address is paged.
结合本发明实施例第二方面或本发明实施例第二方面的第一种实现方式,本发明实施例第二方面的第三种实现方式中,With reference to the second aspect of the embodiment of the present invention or the first implementation manner of the second aspect of the embodiment of the present invention, in a third implementation manner of the second aspect of the embodiment of the present invention,
第五确定单元,用于确定空闲地址分页和已占用地址分页,所述已占用地址分页为已与外部设备的外设地址空间建立映射关系的地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页; a fifth determining unit, configured to determine a free address page and an occupied address page, wherein the occupied address page is an address page that has been mapped to a peripheral device address space of an external device, and the free address page is currently not external The peripheral address space of the device establishes the address paging of the mapping relationship;
第六确定单元,用于若确定所有所述空闲地址分页的地址空间的和小于所述目标外设地址空间,则在所有所述已占用地址分页中确定满足第二预设条件的第二目标地址分页,所述第二预设条件为所述已占用地址分页中存取频率小于预设值的地址分页;a sixth determining unit, configured to determine, in all of the occupied address pages, a second target that satisfies a second preset condition, if it is determined that a sum of address spaces of all the free address pages is smaller than the target peripheral address space Address paging, the second preset condition is an address paging of the occupied address paging whose access frequency is less than a preset value;
第七确定单元,用于解除所述第二目标地址分页已建立的与外设地址空间的映射关系;a seventh determining unit, configured to cancel the mapping relationship between the second target address paging and the peripheral address space;
所述第三确定单元还用于,在所有所述空闲地址分页中以及所述第二目标地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The third determining unit is further configured to determine, in all of the free address pagings and the second target address paging, the first target address paging that satisfies the first preset condition.
结合本发明实施例第二方面的第一种实现方式,本发明实施例第二方面的第三种实现方式中,还包括:With reference to the first implementation manner of the second aspect of the embodiment of the present invention, the third implementation manner of the second aspect of the embodiment of the present invention further includes:
第八确定单元,用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上;An eighth determining unit, configured to map the target peripheral address space to the address space of the first target address paging according to the mapping relationship;
第九确定单元,用于确定各所述第一目标地址分页的虚拟地址;a ninth determining unit, configured to determine a virtual address of each of the first target address pages;
第十确定单元,用于将各所述第一目标地址分页的虚拟地址进行重排以形成连续的虚拟地址段。And a tenth determining unit, configured to rearrange the virtual addresses of each of the first target addresses to form a continuous virtual address segment.
本发明实施例公开了一种分页式地址空间管理方法以及控制器,所述分页式地址空间管理方法包括:确定地址分页,确定目标外设地址空间,确定满足第一预设条件的所述地址分页为第一目标地址分页,所述第一预设条件为所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间,建立各所述第一目标地址分页与所述目标外设地址空间的映射关系。本实施例能够根据外部设备的目标外设地址空间的大小确定满足所述第一预设条件的所述第一目标地址分页,而且所述映射关系建立的是所述第一目标地址分页的地址空间和外部设备能够被存取的有效的目标外设地址空间之间的对应关系,从而避免了将外部设备中不能被所述控制器存取的地址空间映射到所述控制器上所带来的地址资源的浪费,有效的保障了控制器的地址资源的合理配置,节省了控制器的地址资源。The embodiment of the invention discloses a paging address space management method and a controller. The paging address space management method includes: determining address paging, determining a target peripheral address space, and determining the address that satisfies a first preset condition. The paging is paged for the first target address, and the first preset condition is that the sum of the address spaces of all the first target address pages is greater than or equal to the target peripheral address space, and each of the first target address pages is established. The mapping relationship of the target peripheral address space. The embodiment is capable of determining, according to the size of the target peripheral address space of the external device, the first target address paging that satisfies the first preset condition, and the mapping relationship establishes the address of the first target address paging The correspondence between the effective target peripheral address space that the space and the external device can be accessed, thereby avoiding mapping the address space in the external device that cannot be accessed by the controller to the controller. The waste of the address resources effectively ensures the reasonable configuration of the address resources of the controller and saves the address resources of the controller.
附图说明 DRAWINGS
图1为现有技术所示的计算机系统的结构示意图;1 is a schematic structural diagram of a computer system shown in the prior art;
图2为现有技术所示的控制器的结构示意图;2 is a schematic structural view of a controller shown in the prior art;
图3为本发明实施例所提供的分页式地址空间管理方法的一种较佳实施例步骤流程图;3 is a flow chart of steps of a preferred embodiment of a paging address space management method according to an embodiment of the present invention;
图4为本发明实施例所提供的片上系统的硬件结构示意图;4 is a schematic structural diagram of hardware of a system on chip according to an embodiment of the present invention;
图5为本发明实施例所提供的分页式地址空间管理方法的另一种较佳实施例步骤流程图;FIG. 5 is a flow chart of another preferred embodiment of a paging address space management method according to an embodiment of the present invention;
图6为外部设备的地址空间示例图;6 is a diagram showing an example of an address space of an external device;
图7为本发明实施例所提供的各所述第一目标地址分页与所述目标外设地址空间的映射关系一种示意图;FIG. 7 is a schematic diagram of mapping relationship between each of the first target address paging and the target peripheral address space according to an embodiment of the present invention;
图8为本发明实施例所提供的各所述第一目标地址分页与所述目标外设地址空间的映射关系另一种示意图;FIG. 8 is another schematic diagram of mapping relationship between each of the first target address paging and the target peripheral address space according to an embodiment of the present disclosure;
图9为本发明实施例所提供的连续的虚拟地址段的一种示意图;FIG. 9 is a schematic diagram of a continuous virtual address segment according to an embodiment of the present invention;
图10为本发明实施例所提供的分页式地址空间管理方法的另一种较佳实施例步骤流程图;FIG. 10 is a flowchart of another preferred embodiment of a paging address space management method according to an embodiment of the present disclosure;
图11为本发明实施例所提供的控制器的一种实施例结构示意图;FIG. 11 is a schematic structural diagram of an embodiment of a controller according to an embodiment of the present disclosure;
图12为本发明实施例所提供的控制器的另一种实施例结构示意图;FIG. 12 is a schematic structural diagram of another embodiment of a controller according to an embodiment of the present disclosure;
图13为本发明实施例所提供的控制器的另一种实施例结构示意图;FIG. 13 is a schematic structural diagram of another embodiment of a controller according to an embodiment of the present disclosure;
图14为本发明实施例所提供的控制器的另一种实施例结构示意图。FIG. 14 is a schematic structural diagram of another embodiment of a controller according to an embodiment of the present invention.
具体实施方式detailed description
本发明实施例提供一种分页式地址空间管理方法,以下结合图3所示对本实施例所提供的一种分页式地址空间管理方法进行详细说明:An embodiment of the present invention provides a paging address space management method. The following describes a paging address space management method provided by this embodiment in detail with reference to FIG. 3:
301、确定地址分页;301. Determine an address page;
计算机系统的控制器确定所述控制器的地址空间,所述地址分页由所述地址空间进行划分以形成,以使所有已确定的地址分页的地址空间的和等于所述地址空间;A controller of the computer system determines an address space of the controller, the address page being divided by the address space to form such that a sum of address spaces of all determined address pages is equal to the address space;
本实施例对已确定的所述地址分页的数量不做限定,且对各所述地址分页的地址空间的大小不做限定,只要能够将所述地址空间划分成所述地址分 页的即可。In this embodiment, the number of the address pages that have been determined is not limited, and the size of the address space of each of the address pages is not limited, as long as the address space can be divided into the address points. The page is OK.
302、确定目标外设地址空间;302. Determine a target peripheral address space.
所述目标外设地址空间为外部设备请求当前与所述地址空间建立映射关系的外设地址空间;The target peripheral address space is a peripheral address space that the external device requests to establish a mapping relationship with the address space;
所述地址空间用于对已映射到所述地址空间上的所述目标外设地址空间进行存取;The address space is used to access the target peripheral address space mapped to the address space;
具体的,即当某一外部设备接入计算机系统时,控制器即可确定当前接入的外部设备的目标外设地址空间,从而使得所述控制器能够建立所述控制器与所述目标外设地址空间的映射关系,进而根据该映射关系能够对该目标外设地址空间进行对应的存取动作;Specifically, when an external device accesses the computer system, the controller may determine a target peripheral address space of the currently accessed external device, thereby enabling the controller to establish the controller and the target. Setting a mapping relationship of the address space, and further performing a corresponding access operation on the target peripheral address space according to the mapping relationship;
更具体的,本实施例所示的所述目标外设地址空间为所述外部设备的有效存储空间,即外部设备的总地址空间中,一部分地址空间是不能被所述控制器存取的,例如外部设备设置的保留区等;另一部分是能够被所述控制器存取的,本实施例中将所述控制器能够进行存取的外部设备的地址空间统一称之为外设地址空间。More specifically, the target peripheral address space shown in this embodiment is an effective storage space of the external device, that is, a part of the address space of the external device cannot be accessed by the controller. For example, a reserved area set by an external device or the like; another part is accessible by the controller. In this embodiment, an address space of an external device that the controller can access is collectively referred to as a peripheral address space.
303、确定满足第一预设条件的所述地址分页为第一目标地址分页;303. Determine that the address paging that meets the first preset condition is a paging of the first target address.
所述控制器预先设置有所述第一预设条件;The controller is preset with the first preset condition;
所述第一预设条件为所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间;The first preset condition is that a sum of address spaces of all the first target address pages is greater than or equal to the target peripheral address space;
本实施例对所述控制器具体设置所述第一预设条件的时序不做限定。In this embodiment, the timing at which the controller specifically sets the first preset condition is not limited.
304、建立各所述第一目标地址分页与所述目标外设地址空间的映射关系。304. Establish a mapping relationship between each of the first target address pages and the target peripheral address space.
所述控制器建立各所述第一目标地址分页与所述目标外设地址空间的映射关系,所述映射关系用于所述控制器将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上。The controller establishes a mapping relationship between each of the first target address pages and the target peripheral address space, where the mapping relationship is used by the controller to map the target peripheral address space according to the mapping relationship to The first target address is paged on the address space.
所述控制器能够将根据所述映射关系映射到所述第一目标地址分页的地址空间上所述目标外设地址空间的物理地址映射成虚拟地址,以使处理器能够进行读取。The controller is capable of mapping a physical address of the target peripheral address space on an address space mapped to the first target address page according to the mapping relationship to a virtual address to enable a processor to perform reading.
本实施例中对所确定的各所述第一目标地址分页的地址空间的大小不做 限定,只要所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间即可,例如,所确定的所有所述第一目标地址分页的地址空间的大小可全部相同,也可全部不同,还可一部分相同等。In this embodiment, the size of the address space of each of the determined first target addresses is not used. Definitely, as long as the sum of the address spaces of all the first target address pages is greater than or equal to the target peripheral address space, for example, the determined address spaces of all the first target address pages may all be the same size They can all be different, and they can be the same.
本实施例所示的分页式地址空间管理方法能够将控制器的地址空间确定成地址分页,从而使得所述控制器能够根据外部设备的目标外设地址空间的大小确定满足所述第一预设条件的所述第一目标地址分页,而且本实施例中所述映射关系建立的是所述第一目标地址分页的地址空间和外部设备能够被控制器存取的有效的目标外设地址空间之间的对应关系,从而避免了将外部设备中不能被所述控制器存取的地址空间映射到所述控制器上所带来的地址资源的浪费,即本实施例中,映射到控制器地址空间上的所述目标外设地址空间均能够被所述控制器进行存取,有效的保障了控制器的地址资源的合理配置,节省了控制器的地址资源。The paging address space management method shown in this embodiment can determine the address space of the controller as address paging, so that the controller can determine that the first preset is satisfied according to the size of the target peripheral address space of the external device. The first target address of the condition is paged, and the mapping relationship in the embodiment establishes an address space of the first target address page and a valid target peripheral address space that the external device can be accessed by the controller. The correspondence between the addresses, thereby avoiding the waste of address resources caused by mapping the address space that cannot be accessed by the controller in the external device to the controller, that is, mapping to the controller address in this embodiment The target peripheral address space in the space can be accessed by the controller, which effectively ensures the reasonable configuration of the address resource of the controller and saves the address resource of the controller.
以下结合具体应用场景对本发明实施例所提供的分页式地址空间管理方法进行详细说明,以下以所述具体应用场景为片上系统为例进行说明,需明确的是,本发明实施例所提供的分页式地址空间管理方法还可应用至其他计算机系统,以下所示仅仅为举例进行说明,不做限定;The paging address space management method provided by the embodiment of the present invention is described in detail below with reference to a specific application scenario. The following is a description of the specific application scenario as an on-chip system. It should be clarified that the paging provided by the embodiment of the present invention is provided. The address space management method can also be applied to other computer systems, and the following description is merely for the purpose of illustration and not limitation;
首先结合图4所示对本实施例所应用的片上系统的结构进行说明;First, the structure of the system on chip applied in this embodiment will be described with reference to FIG. 4;
由图4所示,控制器的作用是将来自片上系统内部总线的、对外部设备进行访问的命令转换为外部设备能“理解”的指令。As shown in FIG. 4, the role of the controller is to convert commands from the on-chip system internal bus that are accessed by external devices into instructions that the external device can "understand".
典型外设总线,如,PCI/PCI-E总线,Rapid IO总线等,外设总线具体说明请详见现有技术所示,具体在本实施例中不做限定。A typical peripheral bus, such as a PCI/PCI-E bus, a Rapid IO bus, etc., and a description of the peripheral bus, please refer to the prior art, which is not limited in this embodiment.
所述控制器可以拆分为两部分,一是桥接器,二是物理线序控制器。The controller can be split into two parts, one is a bridge, and the other is a physical line sequence controller.
所述桥接器负责对接片上系统内部总线;The bridge is responsible for docking the on-chip system internal bus;
物理线序控制器负责对接具体外部设备的控制线序。The physical line sequence controller is responsible for docking the control line sequence of the specific external device.
以下结合图4和图5所示对所述分页式地址空间管理方法进行详细说明:The paging address space management method will be described in detail below with reference to FIG. 4 and FIG. 5:
501、划分所述地址空间以形成多个所述地址分页;501, dividing the address space to form a plurality of the address pages;
具体的,所述控制器的所述桥接器将所述控制器的地址空间进行划分以形成多个所述地址分页;Specifically, the bridge of the controller divides an address space of the controller to form a plurality of the address pages;
所有所述地址分页的地址空间的和等于所述地址空间; The sum of the address spaces of all the address pages is equal to the address space;
较佳的,本实施例中各所述地址分页的地址空间为2的幂次方。Preferably, the address space of each of the address pages in this embodiment is a power of 2.
本实施例中,对各所述地址分页的地址空间的大小不做限定,只要各所述地址分页的地址空间为2的幂次方即可。In this embodiment, the size of the address space of each of the address pages is not limited, as long as the address space of each of the address pages is a power of two.
502、确定地址分页;502. Determine address paging;
本实施例步骤502的具体实现过程请详见图3所示的步骤301,具体在本实施例中不做赘述。For the specific implementation process of step 502 in this embodiment, please refer to step 301 shown in FIG. 3, which is not specifically described in this embodiment.
503、确定空闲地址分页;503. Determine a free address page;
其中,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;The free address page is an address page that does not currently have a mapping relationship with an external device address space of the external device;
所述空闲地址分页为未被占用的地址分页。The free address page is paged for an unoccupied address.
504、确定目标外设地址空间;504. Determine a target peripheral address space.
如图4所示,本实施例中当前接入所述片上系统的外部设备的总空间为150MB,而能够被控制器所存取的目标外设地址空间为136MB;As shown in FIG. 4, the total space of the external device currently accessing the system on chip is 150 MB, and the target peripheral address space that can be accessed by the controller is 136 MB.
则当该外部设备接入所述片上系统时,所述控制器即可确定目标外设地址空间为136MB;Then, when the external device accesses the system on chip, the controller can determine that the target peripheral address space is 136 MB;
较佳的,在确定所述目标外设地址空间时,本实施例所采用的方式可为:Preferably, when determining the target peripheral address space, the method used in this embodiment may be:
当所述外部设备接入所述片上系统时,所述片上系统对该外部设备进行自检;When the external device accesses the system on chip, the system on chip performs a self-test on the external device;
常用的自检算法有简单自检法、九步法和棋盘跨步法,具体自检实现方式请详见现有技术所示,具体在本实施例中不做赘述。The commonly used self-test algorithms include a simple self-test method, a nine-step method, and a checkerboard step method. For details of the self-test implementation, please refer to the prior art, which is not described in detail in this embodiment.
在自检过程中,若所述片上系统确定外部设备的外设地址空间内有保留区,则跳过该保留区,以确定所述外部设备中的所述目标外设地址空间;During the self-test, if the system on chip determines that there is a reserved area in the peripheral address space of the external device, skip the reserved area to determine the target peripheral address space in the external device;
本实施例中接入片上系统的外部设备的外设地址空间可见图6所示;外部设备的外设地址空间的范围时从图6所示的起始地址到结束地址;The peripheral address space of the external device connected to the system on chip in this embodiment can be seen as shown in FIG. 6; the range of the peripheral address space of the external device is from the start address to the end address shown in FIG. 6;
其中外设地址空间中设置有多个不进行映射的保留区,这些保留区将图6所示的外设地址空间划分成大小不同的5段(段1、段2、段3、段4以及段5);The peripheral address space is provided with a plurality of reserved areas that are not mapped. The reserved areas divide the peripheral address space shown in FIG. 6 into five segments of different sizes (segment 1, segment 2, segment 3, segment 4, and Paragraph 5);
更具体的,如图6所示,段1为32MB、段2为16MB、段3为8MB, 段4为48MB,段5为32MB;More specifically, as shown in FIG. 6, segment 1 is 32 MB, segment 2 is 16 MB, and segment 3 is 8 MB. Segment 4 is 48MB and segment 5 is 32MB;
片上系统即可确定所述目标外设地址空间为136MB。The system on chip can determine that the target peripheral address space is 136MB.
需明确的是,本实施例以所述目标外设地址空间分段设置为例进行举例说明,不做限定,当然,已确定的所述目标外设地址空间也可不分段而是整段设置的;It should be clarified that, in this embodiment, the target peripheral address space segmentation setting is taken as an example for illustration and not limitation. Of course, the determined target peripheral address space may not be segmented but the entire segment is set. of;
本实施例通过片上系统对所述外部设备进行自检以确定所述目标外设地址空间为举例进行说明,不做限定,只要能够使得片上系统的控制器能够确定所述目标外设地址空间即可。In this embodiment, the external device is self-tested by the system on chip to determine the target peripheral address space as an example, which is not limited, as long as the controller of the system on chip can determine the target peripheral address space. can.
505、确定所有所述空闲地址分页的地址空间的和大于所述目标外设地址空间;505. Determine that a sum of address spaces of all the free address pages is greater than the target peripheral address space.
本实施例中以所有所述空闲地址分页的地址空间的和大于所述目标外设地址空间为例进行说明。In this embodiment, the sum of the address spaces of all the free address pages is larger than the target peripheral address space as an example.
506、在所有所述空闲地址分页中确定满足所述第一预设条件的所述第一目标地址分页;506. Determine, in all the free address pages, the first target address page that meets the first preset condition;
即当所有所述空闲地址分页的地址空间的和大于所述目标外设地址空间时,所述控制器在所述空闲地址分页中选定所述第一目标地址分页即可;That is, when the sum of the address spaces of all the free address pages is larger than the target peripheral address space, the controller may select the first target address page among the free address pages;
在所述空闲地址分页中选定所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间。The sum of the address spaces of the first target address page selected in the free address page is greater than or equal to the target peripheral address space.
507、建立各所述第一目标地址分页与所述目标外设地址空间的映射关系;507. Establish a mapping relationship between each of the first target address pages and the target peripheral address space.
本实施例中,所述映射关系可参见图7所示,需明确的是本实施例以图7所示为例对所述映射关系进行举例说明,不做限定;In this embodiment, the mapping relationship is as shown in FIG. 7 , and the mapping relationship is not illustrated in the embodiment.
具体的,如图7所示,对于小于16MB的分段(段3),选取一份或多份4MB的第一目标地址分页来映射,即本实施例中将段3与两份4MB的第一目标地址分页建立映射关系;Specifically, as shown in FIG. 7, for a segment smaller than 16 MB (segment 3), one or more copies of the first target address page of 4 MB are selected for mapping, that is, segment 3 and two copies of 4 MB in this embodiment A target address paging establishes a mapping relationship;
对于大于等于16MB的分段(段1、段2、段4以及段5),选取一份或多份16MB的第一目标地址分页来映射,即本实施例中将段1与两份16MB的第一目标地址分页建立映射关系,将段2与一份16MB的第一目标地址分页建立映射关系,将段4与三份16MB的第一目标地址分页建立映射关系,将段 5与二份16MB的第一目标地址分页建立映射关系;For segments greater than or equal to 16 MB (segment 1, segment 2, segment 4, and segment 5), one or more 16 MB first destination address pages are selected for mapping, that is, segment 1 and two 16 MB in this embodiment. The first target address is divided into pages to establish a mapping relationship, and the segment 2 is mapped to a 16 MB first target address page, and the segment 4 is mapped to three 16 MB first target addresses. 5 establishes a mapping relationship with two 16MB first target address pages;
需明确的是,本实施例所示的具体的映射关系的建立方式为举例进行说明,不做限定,只要所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间即可;It should be clarified that the specific mapping relationship shown in this embodiment is described by way of example, and is not limited, as long as the sum of the address spaces of all the first target address pages is greater than or equal to the target peripheral address. Space can be;
且本实施例中与一段目标外设地址空间对应的第一目标地址分页的地址空间大小相同仅仅为举例进行说明,不做限定,在具体应用中,与一段目标外设地址空间对应的各第一目标地址分页的地址空间大小可均不相同或部分相同,具体不做限定。In this embodiment, the address space size of the first target address page corresponding to a target peripheral address space is the same as an example, and is not limited. In a specific application, each part corresponding to a target peripheral address space The size of the address space of a target address page may be different or partially the same, and is not limited.
且本实施例中与一段目标外设地址空间对应的第一目标地址分页的地址空间大小相同仅仅为举例进行说明,不做限定,在具体应用中,与一段目标外设地址空间对应的各第一目标地址分页的地址空间大小可均不相同或部分相同,具体不做限定。In this embodiment, the address space size of the first target address page corresponding to a target peripheral address space is the same as an example, and is not limited. In a specific application, each part corresponding to a target peripheral address space The size of the address space of a target address page may be different or partially the same, and is not limited.
508、将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上;508. Map the target peripheral address space to the address space of the first target address page according to the mapping relationship.
所述控制器将所述目标外设地址空间根据所述映射关系可映射到所述第一目标地址分页的地址空间上,即通过该映射关系将外部设备的目标外设地址空间的物理地址映射成可被处理器读取的虚拟地址;The controller maps the target peripheral address space to the address space of the first target address page according to the mapping relationship, that is, mapping the physical address of the target peripheral address space of the external device by using the mapping relationship a virtual address that can be read by the processor;
即如图8所示,所述控制器能够将外部设备的目标外设地址空间的物理地址建立与所述各第一目标地址分页的映射关系,从而使得处理器能够通过读取该映射关系读取所述外部设备的目标外设地址空间。That is, as shown in FIG. 8, the controller can establish a mapping relationship between the physical address of the target peripheral address space of the external device and the first target address paging, so that the processor can read by reading the mapping relationship. Take the target peripheral address space of the external device.
509、确定各所述第一目标地址分页的虚拟地址;509. Determine a virtual address of each of the first target address pages.
本实施例中控制器能够确定各所述第一目标地址分页的虚拟地址。In this embodiment, the controller can determine the virtual address of each of the first target address pages.
510、将各所述第一目标地址分页的虚拟地址进行重排以形成连续的虚拟地址段;510. Rearrange the virtual addresses of each of the first target address pages to form a continuous virtual address segment.
控制器将各所述第一目标地址分页的虚拟地址进行重排以形成图9所示的虚拟地址段,本实施例中,对各所述第一目标地址分页的虚拟地址具体根据何种排序规律以形成所述虚拟地址段的不做限定,可由所述控制器根据所述外部设备业务的不同而选定较佳的排序规律,只要重排后所形成的所述虚拟地址段是连续的地址段,从而使得处理器感知到的虚拟地址段是连续的即 可。The controller rearranges the virtual addresses of the first target address pages to form a virtual address segment as shown in FIG. 9. In this embodiment, the virtual addresses of the first target address pages are sorted according to the order. The rule is not limited to form the virtual address segment, and the controller may select a better sorting rule according to different services of the external device, as long as the virtual address segment formed after the rearrangement is continuous The address segment, such that the virtual address segment perceived by the processor is continuous, ie can.
需明确的是,本实施例中步骤509至步骤510为可选定的步骤,即在实际应用中,可通过步骤509至步骤510对各第一目标地址分页进行重排,也可不对各第一目标地址分页进行重排,具体可根据实际需要进行确定,例如当与所述目标外设地址空间对应的第一目标地址分页之间本身就是连续的,则无需对各第一目标地址分页进行重排。It should be clarified that steps 509 to 510 in this embodiment are selectable steps, that is, in actual applications, the first target address pages may be rearranged through steps 509 to 510, or may not be used for each A target address is paged for rearrangement, which may be determined according to actual needs. For example, when the first target address page corresponding to the target peripheral address space is itself continuous, paging of each first target address is not required. rearrange.
本实施例所提供的分页式地址空间管理方法能够避免将外部设备中不能被所述控制器存取的地址空间映射到所述控制器上所带来的地址资源的浪费,且所选定的所述第一目标地址分页的地址空间的大小可与所述目标外设地址空间相匹配,有效的节省了控制器的地址资源。本实施例中,所述控制器还能够对各第一目标地址分页进行重排以形成连续的虚拟地址段,降低对非连续的虚拟地址段进行访问时对系统所造成的负担。The paging address space management method provided in this embodiment can avoid the waste of address resources caused by mapping an address space that cannot be accessed by the controller in the external device to the controller, and the selected The size of the address space of the first target address page can be matched with the target peripheral address space, which effectively saves the address resource of the controller. In this embodiment, the controller is further capable of rearranging the first target address pages to form a continuous virtual address segment, thereby reducing the burden on the system when accessing the non-contiguous virtual address segments.
以下结合图10所示对本发明实施例提供的能够降低系统逻辑资源的分页式地址空间管理方法进行详细说明:The paging address space management method capable of reducing system logic resources provided by the embodiment of the present invention is described in detail below with reference to FIG. 10:
1001、划分所述地址空间以形成多个所述地址分页;1001, dividing the address space to form a plurality of the address pages;
1002、确定地址分页;1002, determining address paging;
本实施例中的步骤1001和步骤1002具体请详见图5所示的步骤501至步骤502,具体在本实施例中不做赘述。The steps 1001 and 1002 in this embodiment are specifically shown in FIG. 5 to step 501 to step 502, and are not described in detail in this embodiment.
1003、确定空闲地址分页和已占用地址分页;1003. Determine a free address page and an occupied address page;
所述已占用地址分页为已与外部设备的外设地址空间建立映射关系的地址分页,即所述已占用地址分页为已被其他外部设备所占用,处理器不能够通过读取该已占用地址分页确定当前接入系统的外部设备的目标外设地址空间的物理地址;The occupied address page is an address page that has been mapped to a peripheral address space of an external device, that is, the occupied address page is occupied by other external devices, and the processor cannot read the occupied address by reading. The paging determines the physical address of the target peripheral address space of the external device currently accessing the system;
所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;The free address page is an address page that does not currently have a mapping relationship with an external device address space of the external device;
1004、确定目标外设地址空间;1004. Determine a target peripheral address space.
本实施例中的步骤1004具体请详见图5所示的步骤504。 Step 1004 in this embodiment is specifically shown in step 504 shown in FIG. 5.
1005、确定所有所述空闲地址分页的地址空间的和小于所述目标外设地址空间; 1005. Determine a sum of address spaces of all the free address pages that are smaller than the target peripheral address space.
所述控制器确定其所述空闲地址分页的地址空间的和小于所述目标外设地址空间,则进行步骤1006;The controller determines that the sum of the address spaces of the free address pages is smaller than the target peripheral address space, proceed to step 1006;
1006、在所有所述已占用地址分页中确定满足第二预设条件的第二目标地址分页;1006. Determine, in all the occupied address pages, a second target address page that meets the second preset condition;
其中,所述第二预设条件为所述已占用地址分页中存取频率小于预设值的地址分页;The second preset condition is an address page of the occupied address paging whose access frequency is less than a preset value;
即当所有所述空闲地址分页的地址空间的和小于所述目标外设地址空间时,所述控制器对所有已占用地址分页的地址空间的存取频率进行统计,以确定所述已占用地址分页中存取频率小于预设值的地址分页。That is, when the sum of the address spaces of all the free address pages is smaller than the target peripheral address space, the controller counts the access frequency of all occupied address page address spaces to determine the occupied address. Address paging in the paging that is less than the preset value.
1007、解除所述第二目标地址分页已建立的与外设地址空间的映射关系;1007. Release the mapping relationship between the second target address paging and the peripheral address space.
1008、在所有所述空闲地址分页中以及所述第二目标地址分页中确定满足所述第一预设条件的所述第一目标地址分页。1008. Determine, in all of the free address pagings and the second target address paging, the first target address paging that satisfies the first preset condition.
所述控制器将存取频率小于预设值的所述第二目标地址分页用于建立所述映射关系,从而使得所述控制器的逻辑资源能够良好的被利用,避免所述控制器的逻辑资源的闲置。The controller uses the second target address paging whose access frequency is less than a preset value to establish the mapping relationship, so that the logic resources of the controller can be utilized well, and the logic of the controller is avoided. The idleness of resources.
1009、建立各所述第一目标地址分页与所述目标外设地址空间的映射关系;1009. Establish a mapping relationship between each of the first target address pages and the target peripheral address space.
1010、将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上;1010. Map the target peripheral address space to the address space of the first target address page according to the mapping relationship;
1011、确定各所述第一目标地址分页的虚拟地址;1011. Determine a virtual address of each of the first target address pages;
1012、将各所述第一目标地址分页的虚拟地址进行重排以形成连续的虚拟地址段。1012. Rearrange the virtual addresses of each of the first target address pages to form a continuous virtual address segment.
本实施例中的步骤1009至步骤1012的具体实现过程请详见图5所示的步骤507至步骤510,具体在本实施例中不做赘述。For the specific implementation process of the steps 1009 to 1012 in this embodiment, please refer to the steps 507 to 510 shown in FIG. 5, which are not specifically described in this embodiment.
本实施例所提供的控制器能够避免将外部设备中不能被所述控制器存取的地址空间映射到所述控制器上所带来的地址资源的浪费,且所选定的所述第一目标地址分页的地址空间的大小可与所述目标外设地址空间相匹配,有效的节省了控制器的地址资源。本实施例中,所述控制器还能够对各第一目 标地址分页进行重排以形成连续的虚拟地址段,降低对非连续的虚拟地址段进行访问时对系统所造成的负担,而且因所述控制器将存取频率小于预设值的所述第二目标地址分页用于建立所述映射关系,从而使得所述控制器的逻辑资源能够良好的被利用,避免所述控制器的逻辑资源的闲置。The controller provided in this embodiment is capable of avoiding waste of address resources caused by mapping an address space that cannot be accessed by the controller in the external device to the controller, and the first selected The size of the address space of the target address page can be matched with the target peripheral address space, which effectively saves the address resource of the controller. In this embodiment, the controller is further capable of each first item The address address is paged to rearrange to form a continuous virtual address segment, reducing the burden on the system when accessing the non-contiguous virtual address segment, and because the controller will access the frequency less than the preset value The two target address paging is used to establish the mapping relationship, so that the logical resources of the controller can be utilized well, and the logical resources of the controller are prevented from being idle.
以下结合图11所示对所述控制器的具体结构进行详细说明:The specific structure of the controller is described in detail below with reference to FIG. 11:
如图11所示,所述控制器包括:As shown in FIG. 11, the controller includes:
第一确定单元1101,用于确定地址分页,所述地址分页由控制器的地址空间进行划分以形成;a first determining unit 1101, configured to determine address paging, where the address paging is divided by an address space of a controller to form;
第二确定单元1102,用于确定目标外设地址空间,所述目标外设地址空间为外部设备请求当前与所述地址空间建立映射关系的外设地址空间,所述地址空间用于对已映射到所述地址空间上的所述目标外设地址空间进行存取;The second determining unit 1102 is configured to determine a target peripheral address space, where the target peripheral address space is a peripheral device requesting an external address space that is currently mapped to the address space, where the address space is used for mapping Accessing to the target peripheral address space on the address space;
第三确定单元1103,用于确定满足第一预设条件的所述地址分页为第一目标地址分页,所述第一预设条件为所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间;a third determining unit 1103, configured to determine that the address paging that meets the first preset condition is a first target address paging, and the first preset condition is that a sum of address spaces of all the first target address paging is greater than or Equal to the target peripheral address space;
建立单元1104,用于建立各所述第一目标地址分页与所述目标外设地址空间的映射关系,所述映射关系用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上。The establishing unit 1104 is configured to establish a mapping relationship between each of the first target address pages and the target peripheral address space, where the mapping relationship is used to map the target peripheral address space to the The first destination address is paged on the address space.
本实施例所示的控制器能够将控制器的地址空间确定成地址分页,从而使得所述控制器能够根据外部设备的目标外设地址空间的大小确定满足所述第一预设条件的所述第一目标地址分页,而且本实施例中所述映射关系建立的是所述第一目标地址分页的地址空间和外部设备能够被控制器存取的有效的目标外设地址空间之间的对应关系,从而避免了将外部设备中不能被所述控制器存取的地址空间映射到所述控制器上所带来的地址资源的浪费,即本实施例中,映射到控制器地址空间上的所述目标外设地址空间均能够被所述控制器进行存取,有效的保障了控制器的地址资源的合理配置,节省了控制器的地址资源。The controller shown in this embodiment is capable of determining an address space of the controller as address paging, thereby enabling the controller to determine the content satisfying the first preset condition according to a size of a target peripheral address space of the external device. The first target address is paged, and the mapping relationship in the embodiment establishes a correspondence between the address space of the first target address page and the effective target peripheral address space that the external device can be accessed by the controller. Therefore, the waste of address resources caused by mapping an address space that cannot be accessed by the controller to the controller in the external device is avoided, that is, in this embodiment, mapping to the address space of the controller The target peripheral address space can be accessed by the controller, which effectively ensures the reasonable configuration of the address resource of the controller and saves the address resource of the controller.
以下结合图12所示对能够节省地址资源的控制器的具体结构进行详细说明: The specific structure of the controller capable of saving address resources is described in detail below with reference to FIG. 12:
所述控制器包括:The controller includes:
划分单元1201,用于划分所述地址空间以形成多个所述地址分页,所有所述地址分页的地址空间的和等于所述地址空间,且各所述地址分页的地址空间为2的幂次方;a dividing unit 1201, configured to divide the address space to form a plurality of the address pages, a sum of address spaces of all the address pages is equal to the address space, and an address space of each of the address pages is a power of 2 square;
第一确定单元1202,用于确定地址分页,所述地址分页由控制器的地址空间进行划分以形成;a first determining unit 1202, configured to determine address paging, where the address paging is divided by an address space of the controller to form;
第二确定单元1203,用于确定目标外设地址空间,所述目标外设地址空间为外部设备请求当前与所述地址空间建立映射关系的外设地址空间,所述地址空间用于对已映射到所述地址空间上的所述目标外设地址空间进行存取;The second determining unit 1203 is configured to determine a target peripheral address space, where the target peripheral address space is a peripheral device requesting an external address space that is currently mapped to the address space, where the address space is used for mapping Accessing to the target peripheral address space on the address space;
第四确定单元1204,用于确定空闲地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;The fourth determining unit 1204 is configured to determine a free address page, where the free address page is an address page that does not currently have a mapping relationship with a peripheral address space of the external device;
第三确定单元1205,用于若确定所有所述空闲地址分页的地址空间的和大于所述目标外设地址空间,则在所有所述空闲地址分页中确定满足所述第一预设条件的所述第一目标地址分页;The third determining unit 1205 is configured to: if it is determined that the sum of the address spaces of all the free address pages is greater than the target peripheral address space, determine, in all the free address pages, that the first preset condition is met Describe the first target address page;
建立单元1206,用于建立各所述第一目标地址分页与所述目标外设地址空间的映射关系,所述映射关系用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上;The establishing unit 1206 is configured to establish a mapping relationship between each of the first target address pages and the target peripheral address space, where the mapping relationship is used to map the target peripheral address space to the The first target address is paged on the address space;
第八确定单元1207,用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上;The eighth determining unit 1207 is configured to map the target peripheral address space to the address space of the first target address paging according to the mapping relationship;
第九确定单元1208,用于确定各所述第一目标地址分页的虚拟地址;a ninth determining unit 1208, configured to determine a virtual address of each of the first target address pages;
第十确定单元1209,用于将各所述第一目标地址分页的虚拟地址进行重排以形成连续的虚拟地址段。The tenth determining unit 1209 is configured to rearrange the virtual addresses of each of the first target address pages to form a continuous virtual address segment.
本实施例所提供的控制器能够避免将外部设备中不能被所述控制器存取的地址空间映射到所述控制器上所带来的地址资源的浪费,且所选定的所述第一目标地址分页的地址空间的大小可与所述目标外设地址空间相匹配,有效的节省了控制器的地址资源。本实施例中,所述控制器还能够对各第一目标地址分页进行重排以形成连续的虚拟地址段,降低对非连续的虚拟地址段进行访问时对系统所造成的负担。 The controller provided in this embodiment is capable of avoiding waste of address resources caused by mapping an address space that cannot be accessed by the controller in the external device to the controller, and the first selected The size of the address space of the target address page can be matched with the target peripheral address space, which effectively saves the address resource of the controller. In this embodiment, the controller is further capable of rearranging the first target address pages to form a continuous virtual address segment, thereby reducing the burden on the system when accessing the non-contiguous virtual address segments.
以下结合图13所示对避免逻辑资源的闲置的控制器的具体结构进行详细说明:The specific structure of the controller for avoiding the idleness of the logic resources is described in detail below with reference to FIG. 13:
所述控制器包括:The controller includes:
划分单元1301,用于划分所述地址空间以形成多个所述地址分页,所有所述地址分页的地址空间的和等于所述地址空间,且各所述地址分页的地址空间为2的幂次方;a dividing unit 1301, configured to divide the address space to form a plurality of the address pages, a sum of address spaces of all the address pages is equal to the address space, and an address space of each of the address pages is a power of 2 square;
第一确定单元1302,用于确定地址分页,所述地址分页由控制器的地址空间进行划分以形成;a first determining unit 1302, configured to determine address paging, where the address paging is divided by an address space of the controller to form;
第二确定单元1303,用于确定目标外设地址空间,所述目标外设地址空间为外部设备请求当前与所述地址空间建立映射关系的外设地址空间,所述地址空间用于对已映射到所述地址空间上的所述目标外设地址空间进行存取;a second determining unit 1303, configured to determine a target peripheral address space, where the target peripheral address space is an external device requesting a peripheral address space currently mapping with the address space, where the address space is used for mapping Accessing to the target peripheral address space on the address space;
第五确定单元1304,用于确定空闲地址分页和已占用地址分页,所述已占用地址分页为已与外部设备的外设地址空间建立映射关系的地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;The fifth determining unit 1304 is configured to determine a free address page and an occupied address page, where the occupied address page is an address page that has been mapped to a peripheral device address space of the external device, where the free address page is currently not associated with The peripheral address space of the external device establishes the address paging of the mapping relationship;
第六确定单元1305,用于若确定所有所述空闲地址分页的地址空间的和小于所述目标外设地址空间,则在所有所述已占用地址分页中确定满足第二预设条件的第二目标地址分页,所述第二预设条件为所述已占用地址分页中存取频率小于预设值的地址分页;a sixth determining unit 1305, configured to determine, in all the occupied address pages, a second that satisfies a second preset condition, if it is determined that a sum of address spaces of all the free address pages is smaller than the target peripheral address space The target address is paged, and the second preset condition is an address page in the occupied address page whose access frequency is less than a preset value;
第七确定单元1306,用于解除所述第二目标地址分页已建立的与外设地址空间的映射关系;The seventh determining unit 1306 is configured to release the mapping relationship between the second target address paging and the peripheral address space.
第三确定单元1307,用于在所有所述空闲地址分页中以及所述第二目标地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The third determining unit 1307 is configured to determine, in all the free address pagings and the second target address paging, the first target address paging that meets the first preset condition.
建立单元1308,用于建立各所述第一目标地址分页与所述目标外设地址空间的映射关系,所述映射关系用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上。The establishing unit 1308 is configured to establish a mapping relationship between each of the first target address pages and the target peripheral address space, where the mapping relationship is used to map the target peripheral address space to the The first destination address is paged on the address space.
第八确定单元1309,用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上; The eighth determining unit 1309 is configured to map the target peripheral address space to the address space of the first target address paging according to the mapping relationship;
第九确定单元1310,用于确定各所述第一目标地址分页的虚拟地址;a ninth determining unit 1310, configured to determine a virtual address of each of the first target address pages;
第十确定单元1311,用于将各所述第一目标地址分页的虚拟地址进行重排以形成连续的虚拟地址段。The tenth determining unit 1311 is configured to rearrange the virtual addresses of each of the first target address pages to form a continuous virtual address segment.
本实施例所提供的控制器能够避免将外部设备中不能被所述控制器存取的地址空间映射到所述控制器上所带来的地址资源的浪费,且所选定的所述第一目标地址分页的地址空间的大小可与所述目标外设地址空间相匹配,有效的节省了控制器的地址资源。本实施例中,所述控制器还能够对各第一目标地址分页进行重排以形成连续的虚拟地址段,降低对非连续的虚拟地址段进行访问时对系统所造成的负担,而且因所述控制器将存取频率小于预设值的所述第二目标地址分页用于建立所述映射关系,从而使得所述控制器的逻辑资源能够良好的被利用,避免所述控制器的逻辑资源的闲置。The controller provided in this embodiment is capable of avoiding waste of address resources caused by mapping an address space that cannot be accessed by the controller in the external device to the controller, and the first selected The size of the address space of the target address page can be matched with the target peripheral address space, which effectively saves the address resource of the controller. In this embodiment, the controller is further capable of rearranging the first target address pages to form a continuous virtual address segment, thereby reducing the burden on the system when accessing the non-contiguous virtual address segments, and The controller uses the second target address paging whose access frequency is less than a preset value to establish the mapping relationship, so that the logical resources of the controller can be utilized well, and the logical resources of the controller are avoided. Idle.
以上图11至图13从功能模块的角度对所述控制器的具体结构进行详细说明,以下结合图14所示从实体角度对所述控制器的具体结构进行详细说明:11 to 13 above illustrate the specific structure of the controller from the perspective of the functional module. The specific structure of the controller is described in detail below from the perspective of the entity as shown in FIG. 14:
如图14所示,所述控制器140包括桥接器1401和物理线序控制器1402;As shown in Figure 14, the controller 140 includes a bridge 1401 and a physical line sequence controller 1402;
所述桥接器1401负责对接计算机系统的内部总线;The bridge 1401 is responsible for docking an internal bus of the computer system;
所述物理线序控制器1402用于对接具体外部设备的控制线序;The physical line sequence controller 1402 is configured to interface with a control line sequence of a specific external device;
具体的,所述桥接器1401用于确定地址分页,所述地址分页由控制器的地址空间进行划分以形成;Specifically, the bridge 1401 is configured to determine address paging, where the address paging is divided by an address space of the controller to form;
确定目标外设地址空间,所述目标外设地址空间为外部设备请求当前与所述地址空间建立映射关系的外设地址空间,所述地址空间用于对已映射到所述地址空间上的所述目标外设地址空间进行存取;Determining a target peripheral address space, where the external device requests a peripheral address space that is currently mapped to the address space, and the address space is used to map to the address space The target peripheral address space is accessed;
确定满足第一预设条件的所述地址分页为第一目标地址分页,所述第一预设条件为所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间;Determining that the address page that meets the first preset condition is paged as a first target address, and the first preset condition is that a sum of address spaces of all the first target address pages is greater than or equal to the target peripheral address space ;
建立各所述第一目标地址分页与所述目标外设地址空间的映射关系,所述映射关系用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上。Establishing a mapping relationship between each of the first target address pages and the target peripheral address space, where the mapping relationship is used to map the target peripheral address space to the first target address page according to the mapping relationship On the address space.
更具体的,所述桥接器1401还用于:More specifically, the bridge 1401 is also used to:
划分所述地址空间以形成多个所述地址分页,所有所述地址分页的地址 空间的和等于所述地址空间,且各所述地址分页的地址空间为2的幂次方。Dividing the address space to form a plurality of the address pages, addresses of all of the address pages The sum of the spaces is equal to the address space, and the address space of each of the address pages is a power of two.
更具体的,所述桥接器1401还用于:More specifically, the bridge 1401 is also used to:
确定空闲地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;Determining a free address page that is an address page that does not currently have a mapping relationship with an external device's peripheral address space;
若确定所有所述空闲地址分页的地址空间的和大于所述目标外设地址空间,则在所有所述空闲地址分页中确定满足所述第一预设条件的所述第一目标地址分页。If it is determined that the sum of the address spaces of all the free address pages is greater than the target peripheral address space, the first target address page that satisfies the first preset condition is determined in all of the free address pages.
更具体的,所述桥接器1401还用于:More specifically, the bridge 1401 is also used to:
确定空闲地址分页和已占用地址分页,所述已占用地址分页为已与外部设备的外设地址空间建立映射关系的地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;Determining a free address page and an occupied address page, the occupied address page is an address page that has been mapped to an external device's peripheral address space, and the free address page is not currently associated with an external device's peripheral address space. Address paging of the mapping relationship;
若确定所有所述空闲地址分页的地址空间的和小于所述目标外设地址空间,则在所有所述已占用地址分页中确定满足第二预设条件的第二目标地址分页,所述第二预设条件为所述已占用地址分页中存取频率小于预设值的地址分页;Determining, in all of the occupied address pages, a second target address page that satisfies a second preset condition, if the sum of the address spaces of all the free address pages is smaller than the target peripheral address space, the second The preset condition is that the access frequency in the occupied address paging is less than a preset address paging;
解除所述第二目标地址分页已建立的与外设地址空间的映射关系;Dissolving the mapping relationship between the second target address page and the peripheral address space that has been established;
在所有所述空闲地址分页中以及所述第二目标地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The first target address page that satisfies the first preset condition is determined in all of the free address pages and in the second target address page.
更具体的,所述桥接器1401还用于:More specifically, the bridge 1401 is also used to:
将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上;Mapping the target peripheral address space to the address space of the first target address page according to the mapping relationship;
确定各所述第一目标地址分页的虚拟地址;Determining a virtual address of each of the first target address pages;
将各所述第一目标地址分页的虚拟地址进行重排以形成连续的虚拟地址段。The virtual addresses of each of the first target address pages are rearranged to form a continuous virtual address segment.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。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 refer 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, and the actual implementation may have another division manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be Ignore, or not execute. In addition, the mutual 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 in an electrical, mechanical or other form.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, 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 purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically 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 a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium. A number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。 The above embodiments are only used to illustrate 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, those skilled in the art will understand that The technical solutions described in the embodiments are modified, or the equivalents of the technical features are replaced by the equivalents of the technical solutions of the embodiments of the present invention.

Claims (16)

  1. 一种分页式地址空间管理方法,其特征在于,包括:A paging address space management method, comprising:
    确定地址分页,所述地址分页由控制器的地址空间进行划分以形成;Determining address paging, which is divided by the address space of the controller to form;
    确定目标外设地址空间,所述目标外设地址空间为外部设备请求当前与所述地址空间建立映射关系的外设地址空间,所述地址空间用于对已映射到所述地址空间上的所述目标外设地址空间进行存取;Determining a target peripheral address space, where the external device requests a peripheral address space that is currently mapped to the address space, and the address space is used to map to the address space The target peripheral address space is accessed;
    确定满足第一预设条件的所述地址分页为第一目标地址分页,所述第一预设条件为所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间;Determining that the address page that meets the first preset condition is paged as a first target address, and the first preset condition is that a sum of address spaces of all the first target address pages is greater than or equal to the target peripheral address space ;
    建立各所述第一目标地址分页与所述目标外设地址空间的映射关系,所述映射关系用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上。Establishing a mapping relationship between each of the first target address pages and the target peripheral address space, where the mapping relationship is used to map the target peripheral address space to the first target address page according to the mapping relationship On the address space.
  2. 根据权利要求1所述的分页式地址空间管理方法,其特征在于,所述确定地址分页之前,所述方法还包括:The paging address space management method according to claim 1, wherein before the determining the address paging, the method further comprises:
    划分所述地址空间以形成多个所述地址分页,所有所述地址分页的地址空间的和等于所述地址空间,且各所述地址分页的地址空间为2的幂次方。The address space is divided to form a plurality of the address pages, the sum of the address spaces of all the address pages is equal to the address space, and the address space of each of the address pages is a power of two.
  3. 根据权利要求1或2所述的分页式地址空间管理方法,其特征在于,所述确定地址分页之后,所述方法还包括:The paging address space management method according to claim 1 or 2, wherein after the determining the address paging, the method further comprises:
    确定空闲地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;Determining a free address page that is an address page that does not currently have a mapping relationship with an external device's peripheral address space;
    所述确定目标外设地址空间之后,所述方法还包括:After the determining the target peripheral address space, the method further includes:
    若确定所有所述空闲地址分页的地址空间的和大于所述目标外设地址空间,则所述确定满足第一预设条件的所述地址分页为第一目标地址分页包括:If it is determined that the sum of the address spaces of all the free address pages is greater than the target peripheral address space, the determining that the address paging satisfying the first preset condition is the first target address paging comprises:
    在所有所述空闲地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The first target address page that satisfies the first preset condition is determined in all of the free address pages.
  4. 根据权利要求1或2所述的分页式地址空间管理方法,其特征在于,所述确定地址分页之后,所述方法还包括:The paging address space management method according to claim 1 or 2, wherein after the determining the address paging, the method further comprises:
    确定空闲地址分页和已占用地址分页,所述已占用地址分页为已与外部设备的外设地址空间建立映射关系的地址分页,所述空闲地址分页为当前未与外 部设备的外设地址空间建立映射关系的地址分页;Determining a free address page and an occupied address page, the occupied address page is an address page that has been mapped to a peripheral device address space of the external device, and the free address page is currently not The peripheral address space of the device establishes the address page of the mapping relationship;
    所述确定目标外设地址空间之后,所述方法还包括:After the determining the target peripheral address space, the method further includes:
    若确定所有所述空闲地址分页的地址空间的和小于所述目标外设地址空间,则所述方法还包括:If the sum of the address spaces of all the free address pages is determined to be smaller than the target peripheral address space, the method further includes:
    在所有所述已占用地址分页中确定满足第二预设条件的第二目标地址分页,所述第二预设条件为所述已占用地址分页中存取频率小于预设值的地址分页;Determining, in all of the occupied address pages, a second target address page that satisfies a second preset condition, where the second preset condition is an address page in the occupied address page whose access frequency is less than a preset value;
    解除所述第二目标地址分页已建立的与外设地址空间的映射关系;Dissolving the mapping relationship between the second target address page and the peripheral address space that has been established;
    所述确定满足第一预设条件的所述地址分页为第一目标地址分页包括:The determining that the address paging that meets the first preset condition is the first target address paging comprises:
    在所有所述空闲地址分页中以及所述第二目标地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The first target address page that satisfies the first preset condition is determined in all of the free address pages and in the second target address page.
  5. 根据权利要求1所述的分页式地址空间管理方法,其特征在于,所述建立各所述第一目标地址分页与所述目标外设地址空间的映射关系之后,所述方法还包括:The paging address space management method according to claim 1, wherein after the mapping of each of the first target address pages and the target peripheral address space is established, the method further includes:
    将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上;Mapping the target peripheral address space to the address space of the first target address page according to the mapping relationship;
    确定各所述第一目标地址分页的虚拟地址;Determining a virtual address of each of the first target address pages;
    将各所述第一目标地址分页的虚拟地址进行重排以形成连续的虚拟地址段。The virtual addresses of each of the first target address pages are rearranged to form a continuous virtual address segment.
  6. 一种控制器,其特征在于,包括:A controller, comprising:
    第一确定单元,用于确定地址分页,所述地址分页由控制器的地址空间进行划分以形成;a first determining unit, configured to determine address paging, where the address paging is divided by an address space of the controller to form;
    第二确定单元,用于确定目标外设地址空间,所述目标外设地址空间为外部设备请求当前与所述地址空间建立映射关系的外设地址空间,所述地址空间用于对已映射到所述地址空间上的所述目标外设地址空间进行存取;a second determining unit, configured to determine a target peripheral address space, where the target peripheral address space is a peripheral device requesting an external address space that is currently mapped to the address space, where the address space is used to map to Accessing the target peripheral address space on the address space;
    第三确定单元,用于确定满足第一预设条件的所述地址分页为第一目标地址分页,所述第一预设条件为所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间;a third determining unit, configured to determine that the address paging that meets the first preset condition is a first target address paging, and the first preset condition is that a sum of address spaces of all the first target address paging is greater than or equal to The target peripheral address space;
    建立单元,用于建立各所述第一目标地址分页与所述目标外设地址空间的 映射关系,所述映射关系用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上。a establishing unit, configured to establish each of the first target address paging and the target peripheral address space Mapping relationship, the mapping relationship is used to map the target peripheral address space to the address space of the first target address page according to the mapping relationship.
  7. 根据权利要求6所述的控制器,其特征在于,还包括:The controller according to claim 6, further comprising:
    划分单元,用于划分所述地址空间以形成多个所述地址分页,所有所述地址分页的地址空间的和等于所述地址空间,且各所述地址分页的地址空间为2的幂次方。a dividing unit, configured to divide the address space to form a plurality of the address pages, a sum of address spaces of all the address pages is equal to the address space, and an address space of each of the address pages is a power of 2 .
  8. 根据权利要求6或7所述的控制器,其特征在于,还包括:The controller according to claim 6 or 7, further comprising:
    第四确定单元,用于确定空闲地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;a fourth determining unit, configured to determine a free address page, where the free address page is an address page that does not currently have a mapping relationship with an external device address space of the external device;
    所述第三确定单元还用于,若确定所有所述空闲地址分页的地址空间的和大于所述目标外设地址空间,则在所有所述空闲地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The third determining unit is further configured to: if it is determined that the sum of the address spaces of all the free address pages is greater than the target peripheral address space, determine, in all the free address pages, that the first preset condition is met The first target address is paged.
  9. 根据权利要求6或7所述的控制器,其特征在于,还包括:The controller according to claim 6 or 7, further comprising:
    第五确定单元,用于确定空闲地址分页和已占用地址分页,所述已占用地址分页为已与外部设备的外设地址空间建立映射关系的地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;a fifth determining unit, configured to determine a free address page and an occupied address page, wherein the occupied address page is an address page that has been mapped to a peripheral device address space of an external device, and the free address page is currently not external The peripheral address space of the device establishes the address paging of the mapping relationship;
    第六确定单元,用于若确定所有所述空闲地址分页的地址空间的和小于所述目标外设地址空间,则在所有所述已占用地址分页中确定满足第二预设条件的第二目标地址分页,所述第二预设条件为所述已占用地址分页中存取频率小于预设值的地址分页;a sixth determining unit, configured to determine, in all of the occupied address pages, a second target that satisfies a second preset condition, if it is determined that a sum of address spaces of all the free address pages is smaller than the target peripheral address space Address paging, the second preset condition is an address paging of the occupied address paging whose access frequency is less than a preset value;
    第七确定单元,用于解除所述第二目标地址分页已建立的与外设地址空间的映射关系;a seventh determining unit, configured to cancel the mapping relationship between the second target address paging and the peripheral address space;
    所述第三确定单元还用于,在所有所述空闲地址分页中以及所述第二目标地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The third determining unit is further configured to determine, in all of the free address pagings and the second target address paging, the first target address paging that satisfies the first preset condition.
  10. 根据权利要求6所述的控制器,其特征在于,还包括:The controller according to claim 6, further comprising:
    第八确定单元,用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上;An eighth determining unit, configured to map the target peripheral address space to the address space of the first target address paging according to the mapping relationship;
    第九确定单元,用于确定各所述第一目标地址分页的虚拟地址;a ninth determining unit, configured to determine a virtual address of each of the first target address pages;
    第十确定单元,用于将各所述第一目标地址分页的虚拟地址进行重排以形 成连续的虚拟地址段。a tenth determining unit, configured to rearrange virtual addresses of each of the first target addresses A continuous virtual address segment.
  11. 一种系统,其特征在于,包括处理器,控制器和存储器;A system comprising a processor, a controller and a memory;
    所述控制器用于确定地址分页,所述地址分页由控制器的地址空间进行划分以形成;确定目标外设地址空间,所述目标外设地址空间为外部设备请求当前与所述地址空间建立映射关系的外设地址空间,所述地址空间用于对已映射到所述地址空间上的所述目标外设地址空间进行存取;确定满足第一预设条件的所述地址分页为第一目标地址分页,所述第一预设条件为所有所述第一目标地址分页的地址空间的和大于或等于所述目标外设地址空间;建立各所述第一目标地址分页与所述目标外设地址空间的映射关系,所述映射关系用于将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上。The controller is configured to determine an address page, the address page is divided by an address space of the controller to form, and a target peripheral address space is determined, where the target peripheral address space is an external device requesting a mapping with the address space. a peripheral address space of the relationship, the address space is used to access the target peripheral address space mapped to the address space; determining the address paging that satisfies the first preset condition as the first target Address paging, the first preset condition is that a sum of address spaces of all the first target address pages is greater than or equal to the target peripheral address space; establishing each of the first target address pages and the target peripheral A mapping relationship of the address space, the mapping relationship is used to map the target peripheral address space to the address space of the first target address page according to the mapping relationship.
  12. 根据权利要求11所述的系统,其特征在于,所述控制器用于确定地址分页之前,所述控制器还用于:The system according to claim 11, wherein said controller is further configured to:
    划分所述地址空间以形成多个所述地址分页,所有所述地址分页的地址空间的和等于所述地址空间,且各所述地址分页的地址空间为2的幂次方。The address space is divided to form a plurality of the address pages, the sum of the address spaces of all the address pages is equal to the address space, and the address space of each of the address pages is a power of two.
  13. 根据权利要求11或12所述的系统,其特征在于,所述控制器用于确定地址分页之后,所述控制器还用于:The system according to claim 11 or 12, wherein after the controller is configured to determine address paging, the controller is further configured to:
    确定空闲地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页;Determining a free address page that is an address page that does not currently have a mapping relationship with an external device's peripheral address space;
    所述确定目标外设地址空间之后,所述控制器还用于:After determining the target peripheral address space, the controller is further configured to:
    若确定所有所述空闲地址分页的地址空间的和大于所述目标外设地址空间,则所述确定满足第一预设条件的所述地址分页为第一目标地址分页包括:If it is determined that the sum of the address spaces of all the free address pages is greater than the target peripheral address space, the determining that the address paging satisfying the first preset condition is the first target address paging comprises:
    在所有所述空闲地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The first target address page that satisfies the first preset condition is determined in all of the free address pages.
  14. 根据权利要求11或12所述的系统,其特征在于,所述确定地址分页之后,所述控制器还用于:The system according to claim 11 or 12, wherein after the determining the address paging, the controller is further configured to:
    确定空闲地址分页和已占用地址分页,所述已占用地址分页为已与外部设备的外设地址空间建立映射关系的地址分页,所述空闲地址分页为当前未与外部设备的外设地址空间建立映射关系的地址分页; Determining a free address page and an occupied address page, the occupied address page is an address page that has been mapped to an external device's peripheral address space, and the free address page is not currently associated with an external device's peripheral address space. Address paging of the mapping relationship;
    所述确定目标外设地址空间之后,所述控制器还用于:After determining the target peripheral address space, the controller is further configured to:
    若确定所有所述空闲地址分页的地址空间的和小于所述目标外设地址空间,If it is determined that the sum of the address spaces of all the free address pages is smaller than the target peripheral address space,
    在所有所述已占用地址分页中确定满足第二预设条件的第二目标地址分页,所述第二预设条件为所述已占用地址分页中存取频率小于预设值的地址分页;Determining, in all of the occupied address pages, a second target address page that satisfies a second preset condition, where the second preset condition is an address page in the occupied address page whose access frequency is less than a preset value;
    解除所述第二目标地址分页已建立的与外设地址空间的映射关系;Dissolving the mapping relationship between the second target address page and the peripheral address space that has been established;
    所述确定满足第一预设条件的所述地址分页为第一目标地址分页包括:The determining that the address paging that meets the first preset condition is the first target address paging comprises:
    在所有所述空闲地址分页中以及所述第二目标地址分页中确定满足所述第一预设条件的所述第一目标地址分页。The first target address page that satisfies the first preset condition is determined in all of the free address pages and in the second target address page.
  15. 根据权利要求11所述的系统,其特征在于,所述建立各所述第一目标地址分页与所述目标外设地址空间的映射关系之后,所述控制器还用于:The system according to claim 11, wherein after the establishing a mapping relationship between each of the first target address pages and the target peripheral address space, the controller is further configured to:
    将所述目标外设地址空间根据所述映射关系映射到所述第一目标地址分页的地址空间上;Mapping the target peripheral address space to the address space of the first target address page according to the mapping relationship;
    确定各所述第一目标地址分页的虚拟地址;Determining a virtual address of each of the first target address pages;
    将各所述第一目标地址分页的虚拟地址进行重排以形成连续的虚拟地址段。The virtual addresses of each of the first target address pages are rearranged to form a continuous virtual address segment.
  16. 一种计算机存储介质,其特征在于,包括程序,当所述程序被执行时,如权利要求1-5中任意一项所述的方法被执行。 A computer storage medium, comprising a program, when the program is executed, the method of any one of claims 1-5 is performed.
PCT/CN2016/085279 2015-06-12 2016-06-08 Paging address space management method and controller WO2016197947A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510324059.0 2015-06-12
CN201510324059.0A CN104951406B (en) 2015-06-12 2015-06-12 A kind of paging type address space menagement method and controller

Publications (1)

Publication Number Publication Date
WO2016197947A1 true WO2016197947A1 (en) 2016-12-15

Family

ID=54166072

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/085279 WO2016197947A1 (en) 2015-06-12 2016-06-08 Paging address space management method and controller

Country Status (2)

Country Link
CN (1) CN104951406B (en)
WO (1) WO2016197947A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104951406B (en) * 2015-06-12 2018-05-04 上海华为技术有限公司 A kind of paging type address space menagement method and controller
CN113360243B (en) * 2021-03-17 2023-07-14 龙芯中科技术股份有限公司 Device processing method, device, electronic device and readable medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075214A (en) * 2007-06-28 2007-11-21 腾讯科技(深圳)有限公司 Method and system for managing memory
CN101566969A (en) * 2008-04-21 2009-10-28 群联电子股份有限公司 Method and controller capable of enhancing management efficiency of nonvolatile storage
CN101770345A (en) * 2008-12-31 2010-07-07 成都市华为赛门铁克科技有限公司 Method for establishing logical address space, method for access to storage device and storage architecture
CN102446136A (en) * 2010-10-14 2012-05-09 无锡江南计算技术研究所 Self-adaptive large-page allocation method and device
CN103970680A (en) * 2014-04-28 2014-08-06 上海华为技术有限公司 Memory management method and device and embedded system
CN104951406A (en) * 2015-06-12 2015-09-30 上海华为技术有限公司 Paging type address space management method and controller

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5018074B2 (en) * 2006-12-22 2012-09-05 富士通セミコンダクター株式会社 Memory device, memory controller and memory system
CN101923512B (en) * 2009-05-29 2013-03-20 晶天电子(深圳)有限公司 Three-layer flash-memory devices, intelligent storage switch and three-layer controllers

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075214A (en) * 2007-06-28 2007-11-21 腾讯科技(深圳)有限公司 Method and system for managing memory
CN101566969A (en) * 2008-04-21 2009-10-28 群联电子股份有限公司 Method and controller capable of enhancing management efficiency of nonvolatile storage
CN101770345A (en) * 2008-12-31 2010-07-07 成都市华为赛门铁克科技有限公司 Method for establishing logical address space, method for access to storage device and storage architecture
CN102446136A (en) * 2010-10-14 2012-05-09 无锡江南计算技术研究所 Self-adaptive large-page allocation method and device
CN103970680A (en) * 2014-04-28 2014-08-06 上海华为技术有限公司 Memory management method and device and embedded system
CN104951406A (en) * 2015-06-12 2015-09-30 上海华为技术有限公司 Paging type address space management method and controller

Also Published As

Publication number Publication date
CN104951406B (en) 2018-05-04
CN104951406A (en) 2015-09-30

Similar Documents

Publication Publication Date Title
US11042297B2 (en) Techniques to configure a solid state drive to operate in a storage mode or a memory mode
US7484016B2 (en) Apparatus and method for high performance volatile disk drive memory access using an integrated DMA engine
US9547535B1 (en) Method and system for providing shared memory access to graphics processing unit processes
WO2018010654A1 (en) Method, device, and system for virtual machine live migration
US7287101B2 (en) Direct memory access using memory descriptor list
WO2016066073A1 (en) Storage resource access method supporting sr-iov, storage controller and storage device
US20210004322A1 (en) System and method to extend nvme queues to user space
CN107305534B (en) Method for simultaneously carrying out kernel mode access and user mode access
US8751547B2 (en) Multiple file system and/or multi-host single instance store techniques
US10776308B2 (en) Smart memory data store or load method and apparatus
CN112099941A (en) Method, equipment and system for realizing hardware acceleration processing
US8395631B1 (en) Method and system for sharing memory between multiple graphics processing units in a computer system
US8345052B1 (en) Method and system for using a GPU frame buffer in a multi-GPU system as cache memory
EP4004753B1 (en) Programmable network interface device comprising a host computing device and a network interface device
EP3131015B1 (en) Memory migration method and device
JP5893028B2 (en) System and method for efficient sequential logging on a storage device that supports caching
WO2016197947A1 (en) Paging address space management method and controller
US10754802B2 (en) Dynamically remapping in-process data transfers
KR20180041037A (en) Method for shared distributed memory management in multi-core solid state driver
EP3227787B1 (en) Systems and methods for providing improved latency in a non-uniform memory architecture
US20180074964A1 (en) Power aware hash function for cache memory mapping
WO2016119618A1 (en) Remote memory allocation method, device and system
US10481951B2 (en) Multi-queue device assignment for application groups
WO2017133493A1 (en) Virtual machine memory address assigning method and device
US8719466B2 (en) Direct data transfer for device drivers

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: 16806845

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: 16806845

Country of ref document: EP

Kind code of ref document: A1