Changing the firmware for virtualized devices
By introducing a virtualization scheduler and a microcontroller into the virtualization device and switching the firmware address of the virtual function, efficient resource sharing and context switching between virtual machines are realized, which solves the problem of hardware resource sharing efficiency between virtual machines in the existing technology. This reduces the problem and improves virtualization performance.
Patent Information
- Application Number
- CN201880038029.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2017-06-30
- Filing Date
- 2018-06-28
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2039-01-30
AI Technical Summary
Existing virtualization technology has the problems of low switching efficiency and complex context switching in hardware resource sharing between virtual machines. Especially when virtualization context switching between graphics processing and computing tasks, it is difficult to efficiently manage and optimize.
By introducing a virtualization scheduler and a microcontroller into the virtualization device, the firmware addresses of different virtual functions are checked and switched to realize time slice switching and resource sharing between virtual machines. The SIMD paradigm is used to perform parallel processing tasks and support multiple virtualizations. APD resource sharing and virtualization context switching between machines.
It improves the resource sharing efficiency and switching speed between virtual machines, optimizes the execution performance of graphics processing and computing tasks, reduces the complexity and pause time of virtualization context switching, and improves the virtualization performance of the overall system.
Smart Images

Figure CN110741349B_ABST
Abstract
Description
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims the benefit of U.S. Non-Provisional Application No. 15 / 639,971, filed June 30, 2017, the contents of which are hereby incorporated by reference as if fully set forth herein. Background Art
[0003] Computer virtualization is a technology that allows a single set of hardware to be shared between different virtual instances of a computer system. Each instance, a virtual machine ("VM"), believes it owns the entire hardware computer system, but in reality, the computer system's hardware resources are shared between the different VMs. Virtualization is making progress, including virtualization of devices beyond the CPU and system memory. BRIEF DESCRIPTION OF THE DRAWINGS
[0004] A more detailed understanding may be obtained from the following description given by way of example in conjunction with the accompanying drawings, in which:
[0005] Figure 1 is a block diagram of an exemplary apparatus in which one or more features of the present disclosure may be implemented;
[0006] Figure 2 Based on an example Figure 1 A block diagram of an apparatus showing details related to virtualization;
[0007] Figure 3 It shows Figure 2 A block diagram showing additional details of the graphics processing pipeline;
[0008] Figure 4 is a diagram showing the steps associated with changing firmware according to an example. Figure 1 a block diagram of the features of the work engine; and
[0009] Figure 5 is a flow chart of a method for changing firmware on a virtualized device according to one example. DETAILED DESCRIPTION
[0010] A technique is provided for changing firmware for different virtual functions in a virtualization device. The virtualization device includes a hardware accelerator and a microcontroller that executes firmware. The virtualization device is virtualized in that the virtualization device performs work for different virtual functions (where different virtual functions are associated with different virtual machines), and each function is given a "time slice" during which work for that function is performed. To change the firmware, each time the virtualization device switches from performing work for a current virtual function to performing work for a subsequent virtual function, one or more microcontrollers of the virtualization device check a memory storing an address of firmware for the subsequent virtual function and begin executing the firmware for the subsequent virtual function. The address of the firmware is provided by the corresponding virtual machine at configuration time.
[0011] Figure 1 is a block diagram of an exemplary device 100 in which one or more features of the present disclosure may be implemented. The device 100 may include, for example, a computer, a gaming device, a handheld device, a set-top box, a television, a mobile phone, or a tablet computer. The device 100 includes a processor 102, a memory 104, a storage device 106, one or more input devices 108, and one or more output devices 110. The device 100 may also optionally include an input driver 112 and an output driver 114. It should be understood that the device 100 may include Figure 1 Additional components not shown.
[0012] In various alternatives, processor 102 includes a central processing unit (CPU), a graphics processing unit (GPU), a CPU and GPU on the same die, or one or more processor cores, where each processor core can be a CPU or a GPU. In various alternatives, memory 104 is located on the same die as processor 102 or is located separately from processor 102. Memory 104 includes volatile or non-volatile memory, such as random access memory (RAM), dynamic RAM, or cache.
[0013] Storage device 106 includes fixed storage devices or removable storage devices, such as a hard drive, solid-state drive, optical disk, or flash drive. Input device 108 includes, but is not limited to, a keyboard, a keypad, a touch screen, a touchpad, a detector, a microphone, an accelerometer, a gyroscope, a biometric scanner, or a network connection (e.g., a wireless local area network card for transmitting and / or receiving wireless IEEE 802 signals). Output device 110 includes, but is not limited to, a display, a speaker, a printer, a tactile feedback device, one or more lights, an antenna, or a network connection (e.g., a wireless local area network card for transmitting and / or receiving wireless IEEE 802 signals).
[0014] The input driver 112 and the output driver 114 comprise one or more hardware, software, and firmware components configured to interface with and drive the input device 108 and the output device 110, respectively. The input driver 112 communicates with the processor 102 and the input device 108 and allows the processor 102 to receive input from the input device 108. The output driver 114 communicates with the processor 102 and the output device 110 and allows the processor 102 to send output to the output device 110. It should be noted that the input driver 112 and the output driver 114 are optional components and that the device 100 would operate in the same manner without the input driver 112 and the output driver 114. The output driver 114 includes an accelerated processing device ("APD") 116 that is coupled to a display device 118, which in some examples is a physical display device or a simulated device that displays output using a remote display protocol. The APD is configured to: accept computational commands and graphics rendering commands from processor 102, process these computational commands and graphics rendering commands, and provide pixel output to display device 118 for display. As described in further detail below, APD 116 includes one or more parallel processing units configured to perform computations according to the Single Instruction, Multiple Data ("SIMD") paradigm. Thus, although various functions are described herein as being performed by or in conjunction with APD 116, in various alternatives, the functions described as being performed by APD 116 may additionally or alternatively be performed by other computational devices with similar capabilities that are not driven by a host processor (e.g., processor 102) and are configured to provide graphical output to display device 118. For example, it is contemplated that any processing system that performs processing tasks according to the SIMD paradigm may be configured to perform the functions described herein. Alternatively, it is contemplated that a computing system that does not perform processing tasks according to the SIMD paradigm may perform the functions described herein. Output driver 114 also includes one or more virtualized worker engines 117. Work engines 117 perform work at the request of processor 102, APD 116, or other entities. In one example, work engines 117 include a video encoder engine, such as an engine for encoding frames of image data generated by APD 116 into compressed video data. Such a video encoding work engine 117 may encode data according to a standard such as the High Efficiency Video Coding (HEVC, also known as H.265) codec, the Advanced Video Coding (AVC, also known as H.264) codec, the VP9 video codec, or any other codec. In other examples, work engines 117 may perform other types of encoding work or other types of non-encoding work, such as decoding or any other work.
[0015] Processor 102 is configured to support a virtualization scheme in which multiple virtual machines execute on processor 102. Each virtual machine ("VM") "appears" to be software executing in the VM as a completely "real" hardware computer system, but actually includes a virtualized computing environment that can share device 100 with other virtual machines. Virtualization can be supported entirely in software, partially in hardware and partially in software, or entirely in hardware. APD 116 supports virtualization, which means that APD 116 can be shared among multiple virtual machines executing on processor 102, where each VM "thinks" that the VM has full ownership of the real hardware APD 116. With virtualization, the VMs take turns executing on processor 102. Switching from one VM to another is referred to herein as a "virtualization context switch." One or more of work engines 117 also supports virtualization.
[0016] Figure 2 Details of the virtualization-related apparatus 100 and APD 116 are shown according to an example. The processor 102 supports multiple virtual machines. Dedicated host virtual machine 202 is not a "general-purpose" VM like guest VM 204, but rather implements virtualization support for APD 116 for use by guest VM 204. Hypervisor 206 provides virtualization support for virtual machines, including a wide variety of functions such as managing resources allocated to virtual machines, spawning and killing virtual machines, handling system calls, managing access to peripheral devices, managing memory and page tables, and various other functions.
[0017] APD 116 supports virtualization by allowing time-based sharing of APD 116 between virtual machines. On APD 116, host VM 202 is mapped to physical function 208, and guest VM 204 is mapped to virtual function 210. A "physical function" is essentially an addressing parameter in the Peripheral Component Interconnect Express ("PCIe") standard. More specifically, a physical function allows communications involving devices coupled to a PCIe interconnect fabric to specify a particular physical function of the device so that the device can handle the communications according to the functionality specifically assigned to the physical function. In one example, a physical function is associated with conventional graphics rendering on a graphics processing device such as APD 116. Herein, a single physical function is described, but the teachings of the present disclosure apply to APDs 116 for which more than one physical function is active.
[0018] A virtual function is a feature of the PCIe standard that facilitates hardware virtualization and also serves as an addressing parameter in the PCIe standard. Typically, a set of virtual functions is associated with a specific physical function. Each virtual machine is assigned a different virtual function, where the hypervisor 206 manages the association between the VM and the virtual function. This association between the virtual function and the virtual machine is Figure 2 The same is true for the system as in
[0044] , except that the host VM 202 has access to the physical function 208 as well as the different virtual functions 210. In this sense, the host VM 202 acts as a kind of "master virtual machine" for APD virtualization.
[0019] As described above, physical function and virtual function are addressing parameters in PCIe, where transactions conducted across PCIe specify or are intended for specific virtual functions and / or physical functions, and the processor 102 or APD 116 responds accordingly (note that some ways of addressing through PCIe do not explicitly specify virtual functions or physical functions; for example, transactions conducted through PCIe can be routed by memory address rather than explicitly by function because the device implicitly understands which function is associated with a specific memory address). The processor 102 directs transactions for a specific VM to the appropriate virtual function of the APD 116 through a memory mapping mechanism. More specifically, when a virtual machine accesses the APD 116, the memory address used to make the access is converted from a guest physical address to a system physical address. The specific system physical address used is mapped to a specific virtual function of the APD 116 through the memory mapping mechanism, and thus the transaction conducted is routed to the APD 116 and the appropriate virtual function through the mapping information.
[0020] Sharing the APD 116 between different virtual machines is achieved by time-slicing the operations of the APD 116 between the different virtual machines. The virtualization scheduler 212 performs this task, scheduling different virtual machines for operation by switching between tasks for different virtual machines as the execution time allocated to the virtual machines elapses. Although the APD 116 is shared between different virtual machines, each virtual machine believes it has a separate instance of the actual hardware APD 116. Although the terms "virtual function" and "physical function" refer to addressing parameters of the PCIe standard, since these functions are mapped to different VMs, the logical instance of the APD 116 assigned to a particular virtual machine will also be referred to herein as a virtual function or physical function. In other words, this disclosure may use terms such as "a virtual function performs a task" (or physical function) or "an operation is performed on a virtual function" (or physical function), and such terms should be understood to mean that the APD 116 performs the task within the time slice allocated to or on behalf of the VM associated with that particular virtual or physical function.
[0021] Host VM 202 and guest VM 204 have operating systems 120. Host VM 202 has management applications 123 and GPU virtualization drivers 121. Guest VM 204 has applications 126, operating systems 120, and GPU drivers 122. These elements control various features of the operation of processor 102 and APD 116.
[0022] As described above, host VM 202 configures various aspects of virtualization within APD 116 for guest VM 204. Thus, host VM 202 includes an operating system 120 that supports the execution of other components, such as a management application 123 and a GPU virtualization driver 121. GPU virtualization driver 121 is not a traditional graphics driver that simply communicates with APD 116 and sends it graphics rendering (or other) commands without understanding the various aspects of APD 116's virtualization. Instead, GPU virtualization driver 121 communicates with APD 116 to configure various aspects of APD 116 for virtualization. In one example, GPU virtualization driver 121 manages parameters related to the time-slicing mechanism used to share APD 116 between different VMs, controlling parameters such as the amount of time in each time slice, how switching between different virtual functions occurs, and other aspects. GPU virtualization driver 121 can be separate from a different graphics driver that actually sends graphics-related commands to APD 116, or it can be incorporated into such a graphics-related driver. In other words, virtualization-related functions may be in a separate driver from graphics functions, or may be included in a single driver together with graphics functions. Management application 123 performs one or more tasks for managing virtualization and / or data from two or more different guest VMs 204. In one example, host VM 202 performs a desktop composition function through management application 123, wherein the desktop composition function may access rendered frames from different guest VMs 204 and composite these frames into a single output view.
[0023] The guest VM 204 includes an operating system 120, a GPU driver 122, and applications 126. The operating system 120 is any type of operating system that can be executed on the processor 102. The GPU driver 122 is a "native" driver for the APD 116 because the GPU driver 122 controls the operation of the APD 116 for the guest VM 204 on which the GPU driver 122 is running, sending tasks such as graphics rendering tasks or other work to the APD 116 for processing. The native driver can be an unmodified or only slightly modified version of the device driver for the GPU that would exist in a bare-metal, non-virtualized computing system.
[0024] Although the GPU virtualization driver 121 is described as being included within the host VM 202, in other implementations, the GPU virtualization driver 121 is included in the hypervisor 206. In such implementations, the host VM 202 may not exist, and the functions of the host VM 202 may be performed by the hypervisor 206.
[0025] The operating systems 120 of the host VM 202 and guest VMs 204 perform standard functions for an operating system in a virtualized environment, such as communicating with hardware, managing resources and file systems, managing virtual memory, managing the network stack, and many other functions. The GPU driver 122 controls the operation of the APD 116 for any particular guest VM 204 by, for example, providing an application programming interface ("API") to software (e.g., application 126) to access various functions of the APD 116. The driver 122 also includes a just-in-time compiler that compiles programs for execution by processing components of the APD 116 (such as the SIMD units 138 discussed in more detail below). For any particular guest VM 204, the GPU driver 122 controls the functions on the APD 116 associated with that guest VM 204 and not with other VMs.
[0026] The APD 116 executes commands and programs for selected functions, such as graphics operations and non-graphics operations that may be suitable for parallel processing. The APD 116 can be used to perform graphics pipeline operations, such as pixel operations, geometric calculations, and rendering images to the display device 118, based on commands received from the processor 102. The APD 116 also performs computational processing operations not directly related to graphics operations, such as operations related to video, physics simulations, computational fluid dynamics, or other tasks, based on commands received from the processor 102. The command processor 213 accepts commands from the processor 102 (or another source) and delegates the tasks associated with these commands to various elements of the APD 116, such as the graphics processing pipeline 134 and the compute unit 132. The VM uses the doorbell memory 214 to notify the APD 116 of new tasks to be executed through the doorbell mechanism.
[0027] APD 116 includes a compute unit 132, which includes one or more SIMD units 138 configured to execute operations in parallel at the request of processor 102 according to the SIMD paradigm. The SIMD paradigm is one in which multiple processing elements share a single program control flow unit and program counter and, therefore, execute the same program but can execute it with different data. In one example, each SIMD unit 138 includes sixteen lanes, each of which can execute the same instruction concurrently with the other lanes in SIMD unit 138, but with different data. If not all lanes are required to execute a given instruction, a lane can be shut down through prediction. Prediction can also be used to execute programs with divergent control flow. More specifically, for programs with conditional branches or other instructions where control flow is based on computations performed by separate lanes, prediction of lanes corresponding to currently unexecuted control flow paths and serial execution of different control flow paths allows for arbitrary control flow.
[0028] The basic execution unit in the computing unit 132 is the work item. Each work item represents a single instantiation of a program to be executed in parallel in a specific channel. Work items can be executed simultaneously as "wavefronts" on a single SIMD processing unit 138. One or more wavefronts are included in a "workgroup", which includes a collection of work items designated to execute the same program. A workgroup can be executed by executing each of the wavefronts that make up the workgroup. In an alternative embodiment, the wavefronts are executed sequentially on a single SIMD unit 138, or partially or completely in parallel on different SIMD units 138. A wavefront can be considered as the largest set of work items that can be executed simultaneously on a single SIMD unit 138. Therefore, if a command received from the processor 102 indicates that a particular program is to be parallelized to the extent that the program cannot be executed simultaneously on a single SIMD unit 138, the program is decomposed into wavefronts that are parallelized on two or more SIMD units 138 or serialized on the same SIMD unit 138 (or parallelized and serialized as needed). Scheduler 136 is configured to perform operations related to scheduling the various wavefronts across the different compute units 132 and SIMD units 138 .
[0029] The parallelism provided by compute units 132 is suitable for graphics-related operations such as pixel value calculations, vertex transformations, and other graphics operations. Therefore, in some examples, graphics pipeline 134, which receives graphics processing commands from processor 102, provides computing tasks to compute units 132 for parallel execution.
[0030] Compute unit 132 is also used to perform computational tasks that are not graphics-related or that are not performed as part of the "normal" operation of graphics pipeline 134 (e.g., custom operations performed to supplement the processing performed for the operation of graphics pipeline 134). Application programs 126 or other software executing on processor 102 transmit programs defining such computational tasks to APD 116 for execution.
[0031] Virtualization scheduler 212 manages time-sharing of APD 116 between different virtual machines. During each time slice, virtualization scheduler 212 allows work to proceed in APD 116 for the virtual machine associated with that time slice. Doorbell memory 214 stores doorbells, which are indications that work for a particular virtual machine is ready to be executed on APD 116. The doorbell mechanism operates asynchronously with respect to the virtual machine currently scheduled to work on APD 116. This means that a particular virtual machine may place a doorbell in doorbell memory 214 while executing a task on APD 116 for a VM other than the VM that placed the doorbell in doorbell memory 214.
[0032] Virtualization on APD 116 works as follows. Virtualization scheduler 212 manages time slices on APD 116 for the VMs (both host VM 202 and guest VMs 204) that share APD 116. Virtualization scheduler 212 keeps track of time slices, stopping work on APD 116 when a particular VM's time slice has expired and starting work for the VM with the next time slice. Thus, virtualization scheduler 212 switches between different VMs with work to be executed on APD 116.
[0033] To begin work for a particular time slice associated with a particular VM, the virtualization scheduler 212 selects a virtual function associated with the VM to run and causes the command processor 213 to begin running for the VM. The command processor 213 checks the doorbell for the VM, where the doorbell is a pointer to a command buffer indicating where commands for processing are stored. The command processor 213 executes the commands indicated by the doorbell, thereby executing these commands on the APD 116 (such as in the graphics processing pipeline 134 and / or for general computing work).
[0034] It should be noted that other portions of the APD 116 whose functionality is not specifically described in the context of virtualization operate as described above, and as if no virtualization occurs. For example, the graphics processing pipeline 134 performs operations related to graphics rendering in response to graphics rendering commands obtained by the command processor 213. For at least some of the graphics rendering commands associated with the graphics processing pipeline 134, and / or for general-purpose compute operations, the SIMD scheduler 136 generates and manages wavefronts based on the commands processed by the command processor 213 for execution on the SIMD units 138 of the compute units 132. In one example, the command is a command to render a specific tile of geometry using a specific pixel shader program (among other facilities of the graphics processing pipeline 134). The graphics processing pipeline 134 processes the geometry through various stages of the graphics processing pipeline 134, such as the input assembler stage 302, the hull shader stage 306, the tessellator stage 308, etc., and at the pixel shader stage 316, causes the geometry to be processed by a particular pixel shader on the SIMD unit 138. The SIMD scheduler 136 manages and schedules wavefronts for the pixel shaders for execution.
[0035] Figure 3 It shows Figure 2 , a block diagram illustrating further details of graphics processing pipeline 134 is shown in FIG. Graphics processing pipeline 134 includes stages that each perform a specific function. These stages represent a breakdown of the functionality of graphics processing pipeline 134. Each stage is implemented partially or fully as a shader program executed within programmable compute unit 132, or partially or fully as fixed-function, non-programmable hardware external to compute unit 132.
[0036] The input assembler stage 302 reads primitive data from a user-filled buffer (e.g., a buffer filled at the request of software executed by the processor 102, such as the application 126) and assembles the data into primitives for use by the rest of the pipeline. The input assembler stage 302 can generate different types of primitives based on the primitive data included in the user-filled buffer. The input assembler stage 302 formats the assembled primitives for use by the rest of the pipeline.
[0037] The vertex shader stage 304 processes the vertices of the primitives assembled by the input assembler stage 302. The vertex shader stage 304 performs various per-vertex operations, such as transformations, skinning, deformation, and per-vertex lighting. Transformation operations include various operations for transforming the coordinates of a vertex. These operations include one or more of a modeling transform, a viewing transform, a projection transform, a perspective division, and a viewport transform. In this document, such transformations are considered to modify the coordinates or "position" of the vertex on which the transformation is performed. Other operations of the vertex shader stage 304 modify attributes other than coordinates.
[0038] The vertex shader stage 304 is partially or completely implemented as a vertex shader program to be executed on one or more compute units 132. The vertex shader program is provided by the processor 102 and is based on a program previously written by a computer programmer. The driver 122 compiles such a computer program to generate a vertex shader program in a format suitable for execution within the compute unit 132.
[0039] The hull shader stage 306, the tessellator stage 308, and the domain shader stage 310 work together to implement tessellation, which converts simple primitives into more complex primitives by subdividing them. The hull shader stage 306 generates patches for tessellation based on input primitives. The tessellator stage 308 generates a set of samples for the patch. The domain shader stage 310 calculates the vertex positions of the vertices corresponding to the samples for the patch. The hull shader stage 306 and the domain shader stage 310 can be implemented as shader programs to be executed on the compute unit 132.
[0040] The geometry shader stage 312 performs vertex operations on a per-primitive basis. The geometry shader stage 312 can perform a variety of different types of operations, including operations such as point sprint expansion, dynamic particle system operations, fur-fin generation, shadow volume generation, single-pass render-to-cubemap, per-primitive material swapping, and per-primitive material setup. In some examples, a shader program executed on the compute unit 132 performs the operations of the geometry shader stage 312.
[0041] The rasterizer stage 314 accepts simple primitives generated upstream and rasterizes them. Rasterization involves determining which screen pixels (or sub-pixel samples) are covered by a particular primitive. Rasterization is performed by fixed-function hardware.
[0042] The pixel shader stage 316 calculates the output value of the screen pixel based on the primitives generated upstream and the results of rasterization. The pixel shader stage 316 can apply textures from texture memory. The operation of the pixel shader stage 316 is performed by the shader program executed on the compute unit 132.
[0043] The output merger stage 318 accepts the outputs from the pixel shader stage 316 and merges them, performing operations such as z-testing and alpha blending to determine the final color of the screen pixel.
[0044] Return Reference Figure 2 When the virtualization scheduler 212 determines that the time slice of the VM having work currently executing on the APD 116 has expired, the virtualization scheduler 212 causes the APD 116 to complete the work and not accept any new work (e.g., not accepting new tasks pointed to by the doorbell stored in the doorbell memory 214, but completing tasks that are already "in flight" in the graphics processing pipeline 134 and / or compute unit 138). Completing the tasks involves allowing the work currently in flight in the APD 116 to complete and write out the final output values to the target memory location. For example, for graphics rendering, the output pixels will be written to the frame buffer (or other rendering target). (It should be noted that stalls may occur where the work currently being executed in the APD 116 is not completed or takes an extremely long time to complete). The virtualization scheduler 212, the GPU virtualization driver 121, the management application 123 in the host VM 202, and / or another entity may work independently or collaboratively to handle stalls.
[0045] After the work for a particular VM is completed, the virtualization scheduler 212 advances to the time slice for the next VM, causing the command processor 213 to retrieve the tasks for that VM based on the contents of the doorbell memory 214 and execute them directly on the graphics processing pipeline 134 and / or in the compute unit 132 (e.g., for general-purpose computations). This process of stopping execution of work for the expired time slice and starting work for the next VM continues to provide time sharing of the APD 116 to different VMs.
[0046] Changing between executing work for one VM and executing work for another VM is referred to herein as a "virtualization context switch." In addition to stopping work for one VM and starting work for another VM, a virtualization context switch involves saving the state of the VM to be switched out of and loading the state of the VM to be switched to. Generally, state includes values stored throughout or for the APD 116 that manage various aspects of the workflow executed for the APD 116. In various examples, state may include values stored in registers (e.g., registers 216) that control how graphics are rendered, how SIMD work is performed, how shaders are executed, and various other aspects of controlling operations on the APD 116. Saving state involves writing state from an in-use location (where the state value actually affects the operation of the APD 116) to a saved state location of the VM. Loading state involves loading state from a saved state location of the VM to an in-use location.
[0047] The APD 116 includes one or more programmable microcontrollers 230, which execute one or more functions on the APD 116. Each microcontroller 230 executes firmware to perform the associated function. The firmware executed by at least one microcontroller 230 is per-VF firmware 232. Per-VF firmware 232 can run different versions for different VFs. The microcontroller 230 consults the per-VF firmware address 232 to determine the address of the firmware executing for any given VF. When a virtualization context switch occurs, the microcontroller 230 stops executing the firmware for the current virtual function and begins executing the firmware for the subsequent function. The per-VF firmware address 233 is assigned during the initialization of the APD 116. In some examples, each per-VF firmware address is only "understandable" to a specific virtual function or physical function and is not understandable to any other function. In one embodiment, this "restriction on understandability" is due to the address being in the guest virtual address space or guest physical address space of the VM associated with the per-VF firmware address. Therefore, an address is meaningful only to one specific VM.
[0048] Figure 4 is a diagram showing the steps associated with changing firmware according to an example. Figure 1 A block diagram of the features of the work engine 117. Figure 4 exhibit Figure 2 Many elements of the CMOS are shown, but the APD 116 is not shown and is omitted for clarity.
[0049] Various worker engines 117 are shown. One or more of the worker engines 117 include one or more hardware accelerators 234, one or more microcontrollers 230, and one or more per-virtual function firmware addresses 233. The terms "one or more hardware accelerators 234" and "one or more microcontrollers 230" may be used herein, and these terms indicate that a particular worker engine 117 includes one or more hardware accelerators 234 and / or one or more microcontrollers 230. The various worker engines 117 are assigned to perform various types of work. One example of such work is video encoding, such as encoding images generated by the APD 116 based on the H.264 codec.
[0050] One or more hardware accelerators 234 and one or more microcontrollers 230 of a worker engine 117 cooperate to perform the work assigned to the associated worker engine 117. The one or more microcontrollers 230 are programmable components that execute software (as shown, per-VF firmware 232 stored in memory within the APD 116, in system memory 104, or elsewhere) to perform the work. It should be noted that the per-VF firmware 232 is shown with dashed lines to indicate that a specific location for the per-VF firmware 232 is not mandatory (e.g., the per-VF firmware 232 may be stored in the APD 116, in system memory 104, or elsewhere). Among other tasks, the one or more microcontrollers 230 control the operation of the one or more hardware accelerators 234. The one or more microcontrollers 230 also optionally process data associated with the work performed by the worker engine 117. The one or more hardware accelerators 234 include hardware that does not execute software but is considered "fixed function" hardware. By executing per-VF firmware 232, one or more microcontrollers 230 configure and / or control one or more hardware accelerators 234 to perform the desired work. Typically (but not always), one or more hardware accelerators 234 perform the desired work faster than can be performed in software (e.g., by one or more programmable microcontrollers 230 or on processor 102).
[0051] To perform work associated with a particular worker engine 117, one or more microcontrollers 230 execute per-VF firmware 232. Per-VF firmware 232 typically includes instructions for configuring one or more hardware accelerators 234 to process data in a certain manner, and also includes instructions for causing the one or more microcontrollers 230 themselves to cooperate with the one or more hardware accelerators 234 to process data. In some examples, configuring the one or more hardware accelerators 234 includes setting register values. In some examples, processing data includes receiving data as input (e.g., from processor 102 or from some other component of device 100, including from within the worker engine 117 itself), processing the data according to instructions specified by per-VF firmware 232, and passing the processed data to one or more of the one or more hardware accelerators 234. In some examples, processing data may alternatively or additionally include receiving data from one or more of the one or more hardware accelerators 234 and processing the data according to instructions of per-VF firmware 232. After this processing, the one or more microcontrollers 230 forward the processed data to appropriate components such as hardware accelerators 234 for further processing, to processor 102 as output from work engine 117, or to other components for other functions.
[0052] As described above, one or more of worker engines 117 are virtualized. In a manner similar to APD 116, worker engines 117 switch between executing work for different virtual functions. As with APD 116, different virtual machines are associated with different virtual functions on worker engines 117. Virtualization scheduler 236 switches between executing work for different virtual functions by stopping work for the current virtual function and starting work for the subsequent virtual function. Virtualization scheduler 236 is shown in dashed lines to illustrate its optional placement within worker engine 117. More specifically, in implementations where virtualization scheduler 236 is absent from worker engine 117, virtualization scheduling control is implemented by a virtualization driver (not shown) executing on processor 102 or other entity. Therefore, herein, actions described as being performed by virtualization scheduler 236 should be understood to be capable of being performed by any entity that performs virtualization scheduling. The act of switching between virtual functions on worker engine 117 is referred to as a virtualization context switch (just as with APD 116). It should be noted that virtualization on worker engine 117 is asynchronous with respect to virtualization of other elements of device 100. Thus, worker engine 117 may be engaged in work for one virtual machine while a different virtual machine is executing on processor 102, while work for yet another virtual machine is executing on APD 116.
[0053] Per-VF firmware 232 is, in a sense, "per-VF" in that it can execute different versions of firmware for different virtual functions. It should be noted that all virtual functions can execute different firmware versions, some virtual functions can execute the same firmware version while others execute different firmware versions, or all virtual functions can execute the same firmware version. "Capable of executing different versions of firmware for different virtual functions" means that some or all virtual functions execute the same or different firmware versions. To cause different firmware to run when a virtualization context switch occurs, for example, during initialization (i.e., when the processor 102 configures the worker engine 117 when starting a virtual machine), the per-VF firmware address 233 is configured to include the address of the per-VF firmware 232. The per-VF firmware address 233 associates a virtual function with an associated firmware instance. When the virtualization scheduler 236 performs a virtualization context switch from the current virtual function to the subsequent virtual function, the virtualization scheduler 236 causes the microcontroller 230 to check the per-VF firmware address 233 to obtain the address of the firmware instance associated with the subsequent virtual function and execute that firmware. The virtualization context switch also includes performing a "reset" on the work engine 117, which causes the work for the current virtual function to stop in the one or more hardware accelerators 234 and the one or more microcontrollers 230, and causes the one or more hardware accelerators 234 and the microcontroller 230 to restart. During the restart, the virtualization scheduler 236 reinitializes the one or more hardware accelerators 234 and reprograms the firmware location of the microcontroller 230. Once the reinitialization and reprogramming are complete, the virtualization scheduler 236 causes the one or more hardware accelerators 234 and the microcontroller 230 to begin processing any pending work.
[0054] Figure 5 is a flow chart of a method 500 for changing firmware on a virtualized device according to one example. Figures 1 to 4 However, it should be understood that method 500 performed by any system with the steps as shown, or in any other technically feasible order, falls within the scope of the present disclosure.
[0055] Method 500 begins at step 502, where a worker engine 117 determines that a virtualization context switch is to occur on the worker engine 117. In various implementations, this determination is made by a virtualization scheduler 236 of the worker engine 117 or a virtualization scheduler elsewhere in the device. Additionally, in some implementations, this determination is made after the current timeslice of the current virtual function has expired.
[0056] At step 504, virtualization scheduler 236 stops execution of work on the worker engine for the current virtual function. At step 506, worker engine 117 obtains the address of the firmware for the subsequent virtual function. At step 508, worker engine 117 begins work on the subsequent virtual function, including beginning execution of the firmware for the subsequent virtual function.
[0057] It will be appreciated that many variations based on what is disclosed herein are possible. Although features and elements have been described above in particular combinations, each feature or element may be used alone without the other features and elements, or in various combinations with or without the other features and elements.
[0058] The provided methods can be implemented in a general purpose computer, a processor, or a processor core. By way of example, suitable processors include a general purpose processor, a special purpose processor, a conventional processor, a digital signal processor (DSP), a plurality of microprocessors, one or more microprocessors associated with a DSP core, a controller, a microcontroller, an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) circuit, any other type of integrated circuit (IC), and / or a state machine. Such processors can be manufactured by configuring a manufacturing process using the result of processed hardware description language (HDL) instructions and other intermediate data including a netlist (these instructions can be stored on a computer-readable medium). The result of such processing can be a mask work that is subsequently used in a semiconductor manufacturing process to manufacture a processor that implements the features of the present disclosure.
[0059] The methods or flow charts provided herein may be implemented in a computer program, software, or firmware that is incorporated into a non-transitory computer-readable storage medium for execution by a general-purpose computer or processor. Examples of non-transitory computer-readable storage media include read-only memory (ROM), random access memory (RAM), registers, cache memory, semiconductor memory devices, magnetic media such as internal hard disks and removable disks, magneto-optical media, and optical media such as CD-ROM disks and digital versatile disks (DVDs).
Claims
1. A method for executing firmware in a virtualized processing device, the method comprising: For a first client of the virtualization processing device, executing a first firmware for the first client on the virtualization processing device, wherein the virtualization processing device includes a hardware accelerator, the hardware accelerator is configured to execute work received from a processor executing a virtual machine, wherein the first firmware specifies instructions instructing the hardware accelerator to process the work; detecting a virtualization context switch from the first client to a second client of the virtualization processing device; as well as In response to the virtualization context switch, stopping execution of the first firmware on the virtualization processing device and starting execution of second firmware on the virtualization processing device, the second firmware being associated with the second client and different from the first firmware, wherein the second firmware specifies instructions instructing the hardware accelerator on a manner to process work received from the processor.
2. The method of claim 1, wherein the first client corresponds to a first virtual function. 3 . The method of claim 2 , wherein the first virtual function corresponds to a first virtual machine, and in a first time period, the virtualization processing device is configured to perform work for the first virtual machine. The method of claim 1 , wherein the second client corresponds to a second virtual function. 5 . The method of claim 4 , wherein the second virtual function corresponds to a second virtual machine, and in the second time period, the virtualization processing device is configured to perform work for the second virtual machine.
6. The method of claim 1, further comprising: In response to the virtualization context switch, the work associated with the first client on the virtualization processing device is stopped and the work associated with the second client on the virtualization processing device is started.
7. The method of claim 1, wherein: The first firmware and the second firmware include instructions for controlling the hardware accelerator of the virtualization device.
8. The method of claim 1, wherein the virtualized device comprises a hardware accelerated video encoder.
9. A virtualization processing device, comprising: processor; as well as A virtualization scheduler, the virtualization scheduler being configured to: executing, for a first client of the virtualization processing device, a first firmware for the first client, wherein the virtualization processing device includes a hardware accelerator, the hardware accelerator being configured to execute work received from a processor executing a virtual machine, wherein the first firmware specifies instructions instructing the hardware accelerator on a manner of processing the work; detecting a virtualization context switch from the first client to a second client of the virtualization processing device; as well as In response to the virtualization context switch, stopping execution of the first firmware on the virtualization processing device and starting execution of second firmware on the virtualization processing device, the second firmware being associated with the second client and different from the first firmware, wherein the second firmware specifies instructions instructing the hardware accelerator on a manner to process work received from the processor.
10. The virtualization processing device according to claim 9, wherein the first client corresponds to a first virtual function. 11 . The virtualization processing apparatus according to claim 10 , wherein the first virtual function corresponds to a first virtual machine, and in a first time period, the virtualization processing apparatus is configured to execute work for the first virtual machine.
12. The virtualization processing device according to claim 9, wherein the second client corresponds to a second virtual function. 13 . The virtualization processing device according to claim 12 , wherein the second virtual function corresponds to a second virtual machine, and in the second time period, the virtualization processing device is configured to execute work for the second virtual machine.
14. The virtualization processing device of claim 9, wherein the virtualization scheduler is further configured to: in response to the virtualization context switch, stop the work associated with the first client on the virtualization processing device and start the work associated with the second client on the virtualization processing device.
15. The virtualization processing device according to claim 9, wherein: The first firmware and the second firmware include instructions for controlling the hardware accelerator of the virtualization device.
16. The virtualization processing device of claim 9, wherein the virtualization device comprises a hardware accelerated video encoder.
17. A computing device comprising: a first processor; as well as A virtualization processing device, the virtualization processing device is configured to perform work at the request of the first processor, the virtualization processing device comprising: a second processor; and A virtualization scheduler, the virtualization scheduler being configured to: executing, for a first client of the virtualization processing device, a first firmware for the first client, wherein the virtualization processing device includes a hardware accelerator, the hardware accelerator being configured to execute work received from a processor executing a virtual machine, wherein the first firmware specifies instructions instructing the hardware accelerator on a manner of processing the work; detecting a virtualization context switch from the first client to a second client of the virtualization processing device; and In response to the virtualization context switch, stopping execution of the first firmware on the virtualization processing device and starting execution of second firmware on the virtualization processing device, the second firmware being associated with the second client and different from the first firmware, wherein the second firmware specifies instructions instructing the hardware accelerator on a manner to process work received from the processor.
18. The computing device of claim 17, wherein the first client corresponds to a first virtual function and the second client corresponds to a second virtual function.
