Revision history   OpenPOWER Library

 4.2. Shared Programming Models

 The shared programming models allow for all or a subset of processes from all or a subset of partitions in the system to use an AFU. There are two programming models where the AFU is shared by multiple processes and partitions; PSL time-sliced shared and AFU-directed shared. Figure 4.2, “Accelerator Invocation Process in the Shared Model ” shows how an application invokes an AFU under the shared programming model.

 In this model, the system hypervisor owns the AFU and makes the function available to all operating systems. For an AFU to support virtualization by the system hypervisor, the AFU must adhere to the following requirements:

  •  An application's job request must be autonomous (that is, the state does not need to be maintained between jobs),

    -- OR --

    The AFU must provide a context save and restore mechanism.

  •  An application's job request must be guaranteed by the AFU to complete in a specified amount of time, including any translation faults,

    -- OR --

    The AFU must provide the ability to preempt the processing of the job.

  •  The AFU must be guaranteed fairness between processes when operating in the AFU-directed shared programming model.

 In the case where an AFU can be preempted, the AFU can either require the current job to be restarted from the beginning, or it can provide a method to save and restore the context so that the current job can be restarted from the preemption point at a later time.

 For the shared model, the application is required to make an operating-system system call with at least the following information:

  •  An AFU type (AFU_Type)

    The AFU type describes the targeted acceleration function for the system call. The AFU_Type is a system-specific value.

  •  A work element descriptor (WED)

    This document does not define the contents of the WED. The WED is AFU implementation specific and can be in the form of an AFU command, an effective address pointer to a user-defined structure, an effective address pointer to a queue of commands, or any other data structure to describe the work to be done by the AFU.

  •  An Authority Mask Register (AMR) value

    The AMR value is the AMR state to use for the current process. The value passed to the operating system is similar to an application setting the AMR in the processor by using SPR 13 or by calling a system library. If the PSL and AFU implementations do not support a User Authority Mask Override Register (UAMOR), the operating system should apply the current UAMOR value to the AMR value before passing the AMR in the hypervisor call (hcall). The UAMOR is not described in this document.

    For more information about the UAMOR, see the Power ISA, Book III . The hypervisor can optionally apply the current Authority Mask Override Register (AMOR) value before placing the AMR into the process element. The PSL applies the PSL_AMOR_An when updating the PSL_AMR_An Register from the process element.

  •  A Context Save/Restore Area Pointer (CSRP)

    The CSRP is the effective address of an area in the application's memory space for the AFU to save and restore the context state. This pointer is optional if no state is required to be saved between jobs or when a job is preempted. The context save/restore area must be pinned system memory.

 Upon receiving the system call (syscall), the operating system verifies that the application has registered and been given the authority to use the AFU. The operating system then calls the hypervisor (hcall) with at least the following information:

  •  A work element descriptor (WED)

  •  An Authority Mask Register (AMR) value, masked with the current PSL_AMOR_An Register value by the PSL and optionally masked with the current UAMOR by the hypervisor.

  •  An effective address (EA) Context Save/Restore Area Pointer (CSRP)

  •  A process ID (PID) and optional thread ID (TID)

  •  A virtual address (VA) Accelerator Utilization Record Pointer (AURP)

  •  The virtual address of the Storage Segment Table Pointer (SSTP)

  •  A logical interrupt service number (LISN)

 Upon receiving the hypervisor call (hcall), the hypervisor verifies that the operating system has registered and been given the authority to use the AFU. The hypervisor then puts the process element into the process element linked list for the corresponding AFU type. The process element minimally contains the following:

  •  A work element descriptor (WED)

  •  An Authority Mask Register (AMR) value, masked with the current AMOR

  •  An effective address Context Save/Restore Area Pointer (CSRP)

  •  A process ID (PID) and optional thread ID (TID)

  •  A virtual address Accelerator Utilization Record Pointer (AURP)

  •  The virtual address of the Storage Segment Table Pointer (SSTP)

  •  Interrupt VectorTable (IVTE_Offset_n, IVTE_Range_n), derived from the LISNs in the hypervisor call parameters.

  •  A State Register (SR) value

  •  A logical partition ID (LPID)

  •  A real address (RA) hypervisor accelerator utilization record pointer (HAURP)

  •  The Storage Descriptor Register (SDR)

 The hypervisor initializes the following PSL registers:

  •  PSL Control Register (PSL_SCNTL_An)

  •  Real address Scheduled Processes Area Pointer (PSL_SPAP_An)

  •  PSL Authority Mask Override Register (PSL_AMOR_An)


loading table of contents...