# Patent

## Title
Associating input/output device requests with memory associated with a logical partition

## Abstract

An address controller includes a bit selector that receives a first portion of a requester id and selects a bit from a vector that identifies whether a requesting function is an SR-IOV device or a standard PCIe device. The controller also includes a selector coupled to the bit selector that forms an output comprised of either a second portion of the RID or a first portion of the address portion based on an input received from the selector and an address control unit that receives the first portion of the RID and the output and determines the LPAR that owns the requesting function based thereon, the address control unit providing the corrected memory request to the memory.

## Background
BACKGROUND
The present invention relates to computing devices and, more specifically, to systems and methods for associating input/output (I/O) requests with memory ranges assigned to particular logical partition (LPAR).
In a computing system, a logical partition (LPAR) is a subset of computer's hardware resources, vitualized as a separate computer. In effect, a physical machine can be partitioned into multiple LPARs, each supporting a separate instance of an operating system.
Each LPAR may access memory from a common memory subsystem, provided that the ranges of addresses directly accessible to each do not overlap. That is, each LPAR may be associated with a particular memory range. Special care is taken to ensure that that one LPAR cannot affect the memory assigned to another LPAR. One LPAR may, however, indirectly affect memory of a second partition, but only by commanding a process of the second partition to directly operate on its memory.
At any given time, an LPAR may be associated with one or more PCIe devices (I/O cards). Typically, multiple I/O cards are coupled to PCIe switches and the LPAR communicates to the individual cards through the PCIe switch.
In some cases, an I/O card or other PCIe device may comply with the Single Root I/O Virtualization (SR-IOV) specification. The SR-IOV specification allows a single PCIe device to represent multiple virtual devices where each virtual device appears to be a separate physical PCIe device. Thus, in the server context, a single I/O card conforming to the SR-IOV specification may be partitioned into multiple virtual devices. Such PCIe devices shall be referred to herein as “SR-IOV devices.” In other cases, the PCIe devices may only represent one device and are referred to herein as “standard PCIe devices.”
In operation, when an LPAR is controlling a PCIe device that device may need to read from or write to the memory associated with the LPAR. It is important that the PCIe device only have access to the memory range associated with the LPAR controlling it. Otherwise, one LPAR may indirectly affect the memory range assigned to another LPAR though memory access operations performed by a PCIe device.
In the case of SR-IOV compliant devices, a function number portion of the requestor ID (RID) identifies the particular virtual device. This function number may be associated with a particular LPAR and the LPAR may instruct the virtual device to use any address in the PCI address space. In the case of a non-SR-IOV compliant devices such a function number is not provided, and firmware may ensure that the addresses in requests made by the device are located within the memory range for the LPAR.
The difference in memory address request formats has required that each PCIe Root Complex be connected to only one of the two types of PCIe devices. In some instances, however, it may be desirable to have both SR-IOV compliant devices and non-SR-IOV devices connected to a single Root Complex through one or more PCIe switches. Current systems may not adequately support such a connection while ensuring PCIe device memory access requests are contained in the memory assigned to the LPAR controlling the PCIe device.
SUMMARY
According to one embodiment of the present invention, an address controller that receives a memory access request from a requesting function, the request including an address portion and a requester identification (RID) and provides a corrected memory request to a memory that does not request access to a portion of the memory not assigned to a logical partition LPAR that owns the requesting function. The address controller of this embodiment includes a bit selector that receives a first portion of the RID and selects a bit from a vector that identifies whether the requesting function is an SR-IOV device or a standard PCIe device. The address controller also includes a selector coupled to the bit selector that forms an output comprised of either a second portion of the RID or a first portion of the address portion based on an input received from the selector. In addition, the address controller includes an address control unit that receives the first portion of the RID and the output and determines the LPAR that owns the requesting function based thereon, the address control unit providing the corrected memory request to the memory.
Another embodiment of the present invention is directed to a computing system comprising that includes a host computing device. The host computing device includes a memory having multiple ranges and a processor divided into two or more logical partitions, each logical partition being associated with a one of the multiple ranges. The system also includes an input/output hub coupled to the host computing device, a PCIe expansion card coupled to input/output hub and two or more I/O devices coupled to the PCIe expansion card, including an SR-IOV device and a standard PCIe device. In this embodiment, the input/output hub receives a memory access request from a one of the two or more I/O devices through the PCI expansion card and provides a corrected memory request to a memory that does not request access to a portion of the memory not assigned to a logical partition LPAR that owns the one of the I/O devices.
Additional features and advantages are realized through the techniques of the present invention. Other embodiments and aspects of the invention are described in detail herein and are considered a part of the claimed invention. For a better understanding of the invention with the advantages and the features, refer to the description and to the drawings.



BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS
The subject matter which is regarded as the invention is particularly pointed out and distinctly claimed in the claims at the conclusion of the specification. The forgoing and other features, and advantages of the invention are apparent from the following detailed description taken in conjunction with the accompanying drawings in which:
FIG. 1 shows one embodiment of a computing system according to one embodiment of the present invention;
FIG. 2 shows an example of an address controller according to one embodiment of the present invention; and
FIG. 3 shows an address control unit that is part of the address controller of FIG. 2 according to one embodiment.



DETAILED DESCRIPTION
Embodiments of the present invention may help ensure that a PCIe function memory access request does not access memory assigned to any LPAR other than the LPAR owning the function. This may be accomplished in one embodiment with a single circuit that may operate on requests from both SR-IOV devices and standard PCIe devices. As the term is used herein, a “function” refers to a particular PCIe device, whether a virtual device or standard device. Accordingly, an SR-IOV device may include one or more functions and a standard PCIe device includes only one function.
It will be assumed that when an LPAR is given ownership of a function, that ownership association is stored in some location, typically as device table. The association may be used to produce a Zone_ID used to index into a zone relocation mechanism to convert a zone absolute address into a system absolute address. The Zone_ID may be determined based on information contained in the PCIe request header.
As two different types of PCIe devices may exist, according to one embodiment, two different ways of determining the Zone_ID may be provided. In one embodiment, a single circuit may be utilized to determine the Zone_ID regardless of the type of PCIe device making the request. In the case of SR-IOV devices, the function may be identified by a portion of the PCI Requester ID (RID) field. In this case, the RID is used to determine the Zone_ID. In the case of standard PCIe devices there is only one function and no virtual functions. Thus, all RID fields are the same for all the LPARs and include only a bus number. Accordingly the bus number is supplemented with a portion of the PCIe address field to uniquely identify the requester and serve as the index into a table containing the Zone_ID associations.
FIG. 1 shows one embodiment of a computing system 100 according to one embodiment of the present invention. The computing system 100 includes a host computing device 102. It will be appreciated that the host computing device 102 can be any suitable computer or computing platform, and may include a terminal, wireless device, information appliance, device, workstation, mini-computer, mainframe computer, personal digital assistant (PDA) or other computing device. It shall be understood that the device 102 may include multiple computing devices linked together by a communication network. For example, there may exist a client-server relationship between two systems and processing may be split between the two.
The host computing device 102 may be divided into one or more logical partitions (LPARs). As shown, the host computing device 102 is divided into three LPARs, a first LPAR 104, a second LPAR 106 and a third LPAR 108. Of course, any number of LPARs could be formed.
Each LPAR 104, 106, and 108 may include its own operating system and run applications independent of one another. Examples of operating systems that may be supported by the LPARs 104, 106 and 108 include zOS, Windows 95, Windows 98, Windows NT 4.0, Windows XP, Windows 2000, Windows CE, Windows Vista, Mac OS, Java, AIX, LINUX, and UNIX, or any other suitable operating system.
The host computing device 102 may include memory 110. The memory may be divided into several ranges. These ranges may be assigned to individual LPARs. In the example shown in FIG. 1, the first LPAR 104 is assigned to a first memory range 111, the second LPAR 106 is assigned to a second memory 112, and the third LPAR 108 is assigned to a third memory range 113.
In addition, the host computing device 102 may include a functionality 116 that ensures that each LPAR only accesses memory assigned to it. This functionality 116 may include trusted firmware for assigning addresses for memory blocks and for controlling certain memory access requests for one or more functions. The functionality unit 116 may be assigned to a fourth memory range 114. The functionality unit 116 may operate in different manners depending on the type of adapter being accessed. For example, for an SR-IOV adapter, firmware in the functionality unit 116 configures the I/O hub 120 (discussed below) and then the owing LPAR is free to create control blocks containing the addresses to be used by the SR-IOV adapter. In contrast, for standard adapters, the functionality unit 116 receives requests from the owing LPAR and creates the control blocks. As such, the functionality unit 116 ensures that the addresses are within the range owned by the LPAR.
In operation, memory 110 is controlled by a memory controller 118. The memory controller 118 receives memory access requests from multiple locations. In one embodiment, the memory controller 118 may receive requests from one or more functions.
The system 100 may also include an I/O hub 120. The I/O hub 120 facilitates communication between the memory 110 and one or more functions. The I/O hub 120 is coupled to the host computing device 102 by an I/O bus 122. The I/O hub 120 may be included within the host computing device 102 in some embodiments.
The I/O hub 120 may include one or more address controllers according to one embodiment of the present invention. As shown if FIG. 1, the I/O hub 120 includes first address controller 122, a second address controller 124, a first root complex 123, and a second root complex 125. The first root complex 123 and the second root complex 125 include the functionality required to send and receive PCIe packets. This functionality may include header, link, and transaction processing. The first address controller 122 is coupled to a first PCIe expansion device 126 via a first PCIe connection 127. In one embodiment, the first PCIe expansion device 126 is located in an I/O drawer that includes multiple slots. The PCIe expansion device 126 may be coupled via a backplane to other slots in the I/O drawer. For ease of explanation, the connection is given what is referred to herein as a bus number. Accordingly, the bus number may refer to a particular slot a PCIe device is located.
In the example shown in FIG. 1, the first PCIe expansion device 126 is coupled by a first PCIe bus 132 to a first PCIe device 128. The first PCIe device 128, in this example, may be an SR-IOV device. That is, the first PCIe device 128 may support multiple functions. The first PCIe expansion device 126 may also be coupled by a second PCIe bus 134 to a second PCIe device 130. In this example, the second PCIe device 130 may a standard PCIe device. That is, it may only support a single function.
In addition, the second address controller 124 may be coupled to a second PCIe expansion device 131 through a second PCIe connection 133. The second PCIe expansion device 131 may be coupled to a third PCIe device 134 via a third PCIe bus 135 in the same or similar manner as described above.
In operation, the address controllers 122 and 124 receive memory access requests from one or more functions of the PCIe devices 128, 130 and 134. Each of these requests may include PCI Requester ID (RID) and an address field. The address field may be 64 bits wide in one embodiment.
Either the RID alone or a combination of the RID and a portion of the address, depending on the type of PCIe device making the request, may be utilized by the address controllers 122 and 124 to determine which LPAR owns the function making the request. Based on which LPAR owns the device, the address controllers 122 and 124 ensure that the address is within the memory range assigned to the LPAR that owns the function.
FIG. 2 shows an example of an address controller 200 according to one embodiment of the present invention. The address controller 200 receives a memory access request 202 from a function and outputs a real memory address 204 that is provided to the memory controller 118 (FIG. 1).
The address controller 200 includes a selection portion 206 that, based on the access request 202, creates an index 208 used by an address control unit 211 to identify the LPAR controlling the requesting function. The index 208 is created by selecting a first portion (shown as bits 0-7 in FIG. 2) of the RID 220 and combining them with either the remainder of the RID (in the case that an SR-IOV device is making the request) or with a portion 210 of the address portion 213 of the request 202 (in the case that a standard PCI device is making the request). In one embodiment, the portion 210 may be 8 bits wide.
In more detail the selection portion 206 includes a bit selector 212. The bit selector 212 receives the first portion of the RID. The bits of the first portion identify the bus (slot) number of the requesting function. This number is used by the bit selector 212 to select a bit from a vector 214. In one embodiment, the vector 214 may be created by either configuration firmware or an autodetect function that determines the type of PCIe card in each slot of an I/O drawer. The vector 214 may include either a 1 or zero in each bit where each bit corresponds to an individual PCIe bus number (i.e., slot in an I/O drawer).
The selected bit indicates whether the requesting device is an SR-IOV device or a standard PCIe device. For example, and as illustrated in FIG. 2, the vector 214 may store a zero to indicate that the device is an SR-IOV device and a 1 to indicate that it is a standard PCIe device.
In the case of SR-IOV compliant devices, the remainder (shown as bits 8-15 in FIG. 2) of the RID identify a particular virtual device. In the case of standard PCIe device, these bits are always zeros. The bit selector 212 may be coupled to a multiplexer 230 or other selection device that selects either the remainder of the RID or the portion 210 of the address 202 to produce the index 208. In the case where requesting device is a standard PCIe device the device is instructed, by a control block, what values are to be placed in the portion 210. In particular, the values in portion 210 may be assigned by the functionality block 116 (FIG. 1) and stored in a table for later use.
The index 208 is provided to the address control unit 211. The address control unit 211 may also receive at least a portion of the address 213. In one embodiment, the address control unit 211 receives 48 bits (e.g., bits 16-63) of the address 213 (in the case where the address is 64 bits long) and creates real memory address 208 therefrom in such a manner that the real address is located in the memory range assigned to the LPAR owing the requesting function. In one embodiment, the some of the bits (e.g., bits 52-63) of the address 213 are passed directly through the address control unit 211 because they may not be able to effect which memory range is selected because the ranges be greater than 1 megabyte. Of course, depending on the zone sizes, a different number of bits may not be altered.
FIG. 3 shows an address control unit 211 according to one embodiment. In this embodiment, the address correction includes a look-up table (LUT) 302. The LUT 302 includes an index to an entry in the device table 304 that in turn includes a record of which LPAR owns a particular function at a particular time. The LUT 302 is accessed by the index 208 which includes the bus number (card slot) and the function number or an assigned number of the requesting function. In one embodiment, the LUT is formed by a content addressable memory (CAM).
LUT 302 creates an output that is the index into a device table 304. The device table 304, based on the input, creates an LPAR identification of the LPAR owning the requesting function. The LPAR identification is an index into another table, the LPAR relocation table 306 that includes a base and size of a memory associated with each LPAR. Depending on the LPAR identified by the device table 304, the LPAR relocation table 306 outputs a base 308 and size output 310. The base output 308 identifies the real memory address of a particular range and the size output 310 indicates the real address of the upper limit of the range.
The address control unit 211 may also include an address translation and protection unit 312. This unit 211 converts a requested address to a real address in memory. The requesting function does not, however, know the range of memory assigned to the LPAR that owns it. Thus, the address is added to the base portion 308 by adder 314 to create a real memory address 204. However, in the event that the requested address is greater than a size of the memory range assigned to the LPAR as determined by comparator 316, an a error may be generated.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one ore more other features, integers, steps, operations, element components, and/or groups thereof.
The corresponding structures, materials, acts, and equivalents of all means or step plus function elements in the claims below are intended to include any structure, material, or act for performing the function in combination with other claimed elements as specifically claimed. The description of the present invention has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the invention. The embodiment was chosen and described in order to best explain the principles of the invention and the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.
The flow diagrams depicted herein are just one example. There may be many variations to this diagram or the steps (or operations) described therein without departing from the spirit of the invention. For instance, the steps may be performed in a differing order or steps may be added, deleted or modified. All of these variations are considered a part of the claimed invention.
While the preferred embodiment to the invention had been described, it will be understood that those skilled in the art, both now and in the future, may make various improvements and enhancements which fall within the scope of the claims which follow. These claims should be construed to maintain the proper protection for the invention first described.

## Claims

1. An address controller that receives a memory access request from a requesting function, the request including an address portion and a requester identification (RID) and provides a corrected memory request to a memory, wherein the correct memory request does not request access to a portion of the memory not assigned to a logical partition LPAR that owns the requesting function, the address controller comprising:
a bit selector that receives a first portion of the RID and selects a bit from a vector that identifies whether the requesting function is an SR-IOV device or a standard PCIe device;
a selector coupled to the bit selector that forms an output comprised of either a second portion of the RID or a first portion of the address portion based on an input received from the selector; and
an address control unit that receives the first portion of the RID and the output and determines the LPAR that owns the requesting function based thereon, the address control unit providing the corrected memory request to the memory.

2. The address controller of claim 1, wherein the address controller is coupled to one or more PCIe expansion cards.

3. The address controller of claim 2, wherein at least one of the PCIe expansion cards is coupled to at least one SR-IOV device and at least one standard PCIe device.

4. The address controller of claim 1, wherein the corrected memory request includes an address corresponding to a real memory location in the memory.

5. The address controller of claim 1, wherein the address control unit includes a content addressable memory that determines the LPAR that owns the function.

6. The address controller of claim 5, wherein the address control unit includes a device table and a relocation table coupled to the device table.

7. The address controller of claim 6, wherein the device table receives an input from the content addressable memory and provides an output to the relocation table causing the relocation table to output the base and size for the LPAR that owns the function.

8. The address controller of claim 6, wherein the address control unit includes an adder that adds a second portion of the address to the base to create an address portion of the corrected memory request.

9. A computing system comprising:
a host computing device including:
a memory having multiple ranges;
a processor divided into two or more logical partitions, each logical partition being associated with a one of the multiple ranges;
an input/output hub coupled to the host computing device;
a PCIe expansion card coupled to input/output hub;
two or more I/O devices coupled to the PCIe expansion card, including an SR-IOV device and a standard PCIe device;
wherein the input/output hub receives a memory access request from a one of the two or more I/O devices through the PCI expansion card and provides a corrected memory request to a memory, wherein the correct memory request does not request access to a portion of the memory not assigned to a logical partition LPAR that owns the one of the I/O devices.

10. The computing system of claim 9, wherein the I/O hub includes a bit selector, the bit selector receiving a first portion of a requester identification (RID) contained in the memory access request and selects a bit from a vector that identifies whether the requesting I/O device is an SR-IOV device or a standard PCIe device.

11. The computing system of claim 10, wherein the I/O includes a selector coupled to the bit selector that forms an output comprised of either a second portion of the RID or a first portion of an address portion of the memory request based on an input received from the selector.

12. The computing system of claim 9, wherein the corrected memory request includes an address corresponding to a real memory location in the memory.

13. The computing system of claim 9, wherein the input/output hub includes an address control unit coupled an output of the selector.

14. The computing system of claim 13, wherein the address control unit includes a content addressable memory that determines the LPAR that owns the requesting I/O device.

15. The computing system of claim 14, wherein the wherein the address control unit includes a device table and a relocation table coupled to the device table.

16. The computing system of claim 15, wherein the device table receives an input from the content addressable memory and provides an output to the relocation table causing the relocation table to output the base and size for the LPAR that owns the function.

17. The address controller of claim 16, wherein the address control unit includes an adder that adds a second portion of the address portion of the memory request to the base to create an address portion of the corrected memory request.