Example 8:Atomic Read-Modify-WriteProblem: Device 2 (UnitID2) in Figure 7-10 targets main memory with an Atomic RMW transaction. Memory start address is 0082402020h. Figure 7-10. Atomic Read-Modify-Write Targeting Main Memory
Example 8: Atomic RMW Request Packet Setup(Refer to [1] in Figure 7-10 on page 182) Command[5:0] Field (Byte 0, Bit 5:0)This is the Atomic RMW command code. There are no option bits within this field and the following limits are imposed: isochronous Atomic RMW is not allowed, target location may be cached, the response to an Atomic RMW may not pass posted writes . For this example, field = 111101b. SeqID[3:0] Field (Byte 0, Bit 7:6) and (Byte 1, Bit 6:5)This field tags groups of requests that were issued as part of an ordered sequence; the field is cleared if a request is not part of a sequence. In this example, this request is not part of an ordered sequence. For this example, field = 0000b. UnitID[4:0] Field (Byte 1, Bits 4:0)For both upstream and downstream requests, this field is programmed with the UnitID of the requester. UnitID is assigned during initialization by configuration software. In this example, the request originates at Device 2 (UnitID2). For this example, field = 00010b. PassPW Bit Field (Byte 1, Bit 7)This bit is reserved for Atomic RMW requests, and should be cleared. For this example, field = 0b. SrcTag[4:0] Field (Byte 2, Bits 4:0)This field is used to tag the 32 outstanding non-posted transactions allowed to each UnitID. The code is assigned by requester from a pool of available tags. Assume that the tag for this read request is 10d (Ah). For this example, field = 01010b. Compat Bit Field (Byte 2, Bit 5)Used by bridges to tag downstream requests targeting the compatibility chain (where subtractive decoder is found). Atomic RMW requests target main memory, so this bit should be clear. For this example, field = 0b. Mask/Count[3:0] Field (Byte 2, Bits 7:6) and (Byte 3, Bits 1:0)The value programmed in this field depends on which of the two Atomic RMW variants is being performed. For the Fetch and Add operation, the request is accompanied by one qword (2 dwords) of data. In this case, the Mask/Count would be programmed with one ( dword count -1). For the Compare and Swap operation, the request is accompanied by two qwords (4 dwords) of data. In this case, the Mask/Count would be programmed with three (again, dword count -1). Note: the value in this field is used by the Host Bridge to determine which variant is being requested . In this Fetch and Add example, the transfer is one qword (two dwords). For this example, field = 0001b. Start Address Field (Bytes 4-7, Bit 7:0) and (Byte 3, Bit 7:2)This field carries the 40-bit target start address. Note that the lower bits [1:0] are not in the field, and are assumed to be = 00b. This means that the start address is dword-aligned. For Atomic RMW, the target address is also expected to be in the main memory portion of the system memory map. For this example, the 40-bit address = 0082402020h. Example 8: Atomic RMW Request Data Packet(Refer to [2] in Figure 7-10 on page 182) The Atomic RMW Fetch and Add request is accompanied by a one qword Input value carried in the data packet. This is the value which will be added to the value currently in the target memory location. For this example, the Input value is: 104B300B2C3D0042h. Example 8: Atomic RMW Request, Sequence Of Events(Refer to Figure 7-10 on page 182)
Example 8: Atomic RMW Response Packet Setup(Refer to [3] in Figure 7-10 on page 182) When the Host Bridge has completed the read/modify/write of the target memory location, it still must return the "original" value read from memory to the requester. This is always a qword (2 dword) data object. The Host Bridge prepares to initiate a Read response to accompany the "readback" data, using the original UnitID and Source Tag information provided in the request. Command[5:0] Field (Byte 0, Bit 5:0)This is the command code for the Read Response. There are no option bits in this field. For this example, field = 110000b. Isoc Bit Field (Byte 0, Bit 7)This bit indicates whether this response should travel in the isochronous response virtual channel as it moves back to the original requester. Atomic RMW transactions are not allowed to use the isochronous virtual channels so this bit should be cleared. For this example, field = 0b. UnitID[4:0] Field (Byte 1, Bits 4:0)For responses, there are two ways this field is handled. If the response is traveling upstream, it is always programmed with the UnitID of the bridge (UnitID0). If the response is traveling downstream (as this one is), the UnitID field contains the Unit ID of the original Requester. For this example, field = 00010b. Bridge Bit Field (Byte 1, Bit 6)Set by host bridges in responses they issue downstream (such as this example). Devices use this information to decide if they may attempt to decode and claim a response; only downstream responses (Bridge = 1) may be claimed by non-bridges. For this example, field = 1b. PassPW Bit Field (Byte 1, Bit 7)This bit should be cleared because Atomic RMW responses are not allowed to pass posted writes. For this example, field = 0b. SrcTag[4:0] Field (Byte 2, Bits 4:0)The field is set to the same value as seen in the request. In our Atomic RMW example, the Source Tag was 0Ah. For this example, field = 01010b. Error Bit Field (Byte 2, Bit 5)In a read transaction, this bit in the response will be set to indicate an error was encountered in obtaining requested data. When the response finds its way back to the original requester, this bit means that the accompanying data is not valid; action taken by the requester is design-specific, but may range from an interrupt to a sync flood. Refer to "Response Errors" on page 248 for a discussion of how response errors are handled in HyperTransport. For this example, field = 0b. Count[3:0] Field (Byte 2, Bits 7:6) and (Byte 3, Bits 1:0)For both variants of Atomic RMW, this field should be set = one (2 dwords = 1 qword). For this example, field = 0001b. NXA Bit Field (Byte 3, Bit 5)This response bit is only valid if the Error bit (Byte 2, Bit 5) is set. IF NXA and Error are both set, the original request did not find the proper target at all, and the read response is being returned by a device at the end of the chain. If NXA is clear and Error set, then a read error occurred at the target device. For this example, field = 0b. Example 8: Atomic RMW Response Data Packet(Refer to [4] in Figure 7-10 on page 182) The Atomic RMW request that caused this data packet to be sent always results in a return of 1 qword (2 dwords) of data. The response data packet contains the "original" data value read from memory at the beginning of the Fetch and Add operation. For this example, the qword of "original" data at the target start address was: 102400000014000Fh. Example 8: Atomic RMW Response, Sequence Of Events(Refer to Figure 7-10 on page 182)
Some Notes About Atomic RMW Operations(Refer to Figure 7-10 on page 182)
|