Emulated endpoint configuration
Techniques for emulating a configuration space may include emulating a set of configuration registers in an integrated circuit device for a set of functions corresponding to a type of peripheral device. The type of peripheral device represented by the integrated circuit device can be modified by changing the set of configuration registers being emulated in the integrated circuit device. Multiple sets of configuration registers can also be emulated to support different virtual machines or different operating systems.
1 . An integrated circuit device comprising:
an emulated configuration space configured to:
represent the integrated circuit device as a first type of peripheral device by emulating a first set of configuration registers for a first set of functions corresponding to the first type of peripheral device; and
represent the integrated circuit device as a second type of peripheral device by emulating a second set of configuration registers for a second set of functions corresponding to the second type of peripheral device,
a bus interface configured to receive a configuration access request; and
emulation control logic configured to process the configuration access request by retrieving an emulated configuration register from the emulated configuration space and servicing the configuration access request,
wherein the integrated circuit device is configured to dynamically add an additional emulated capability register to the emulated configuration space, and dynamically remove an existing emulated capability register from the emulated configuration space based on which of the first and second types of peripheral device the integrated circuit device is emulating.
2 . The integrated circuit device of claim 1 , wherein the first set of functions includes a physical function and one or more virtual functions.
3 . The integrated circuit device of claim 2 , wherein the one or more virtual functions are emulated on a same target bus number as the physical function.
4 . The integrated circuit device of claim 2 , wherein each of the one or more virtual functions is emulated on a higher target bus number than a target bus number of the physical function.
5 . The integrated circuit device of claim 1 , wherein the emulation control logic operates in a secure mode of the integrated circuit device.
6 . The integrated circuit device of claim 1 , wherein the configuration access request triggers a secure interrupt that is masked from an operating system.
7 . The integrated circuit device of claim 1 , wherein the emulated configuration space is an encrypted emulated configuration space.
8 . The integrated circuit device of claim 1 , wherein the integrated circuit device is an endpoint peripheral device.
9 . An integrated circuit device comprising:
a memory storing a plurality of emulated configuration spaces, wherein each of the emulated configuration spaces includes an emulated device class code register, one or more emulated base address registers, and one or more emulated capability registers;
a bus interface configured to receive a configuration access request from a host;
emulation control logic configured to process the configuration access request by retrieving an emulated configuration from the memory and servicing the configuration access request; and
a configuration transaction log configured to track progress of the configuration access request,
wherein the integrated circuit device is configured to dynamically modify at least one of the plurality of emulated configuration spaces by adding an additional emulated capability register and removing an existing emulated capability register based on which type of peripheral device the integrated circuit device is emulating.
10 . The integrated circuit device of claim 9 , wherein the plurality of emulated configuration spaces includes:
a first emulated configuration space emulating a first set of emulated configuration registers for a first set of functions corresponding to a first type of peripheral device; and
a second emulated configuration space emulating a second set of emulated configuration registers for a second set of functions corresponding to a second type of peripheral device.
11 . The integrated circuit device of claim 9 , wherein the host is configured to execute a first operating system and a second operating system, and wherein the plurality of emulated configuration spaces includes:
a first emulated configuration space emulating a first set of emulated configuration registers of a peripheral device function for the first operating system; and
a second emulated configuration space emulating a second set of emulated configuration registers of the peripheral device function for the second operating system.
12 . The integrated circuit device of claim 9 , wherein the host is configured to execute a plurality of virtual machines, and wherein the plurality of emulated configuration spaces includes an emulated configuration space for each of the plurality of virtual machines.
13 . The integrated circuit device of claim 12 , wherein the emulation control logic is configured to block the configuration access request from a virtual machine to prevent the integrated circuit device from hanging when a denial of service attack from the virtual machine is detected, or when the configuration access request is an invalid or untimely request.
14 . The integrated circuit device of claim 9 , wherein the plurality of emulated configuration spaces includes an encrypted emulated configuration space.
15 . The integrated circuit device of claim 9 , wherein the integrated circuit device is configured to dynamically add an additional emulated configuration space to the memory, or dynamically replace one of the emulated configuration spaces with the additional emulated configuration space.
16 . The integrated circuit device of claim 15 , wherein the additional emulated configuration space is obtained via a network.
17 . The integrated circuit device of claim 9 , wherein the one or more emulated capability registers includes an emulated routing identification capability register and an emulated virtualization capability register.
18 . A method comprising:
emulating a plurality of emulated configuration spaces in a memory, wherein each of the emulated configuration spaces includes an emulated device class code register, one or more emulated base address registers, and one or more emulated capability registers;
receiving a configuration access request;
logging the configuration access request in a configuration transaction log to track progress of the configuration access request;
processing the configuration access request by retrieving an emulated configuration register from the memory; and
dynamically modifying at least one of the plurality of emulated configuration spaces by adding an additional emulated capability register and removing an existing emulated capability register based on which type of peripheral device is being emulated.
19 . The method of claim 18 , further comprising dynamically adding or replacing an emulated configuration space in the memory.
20 . The method of claim 18 , wherein the plurality of emulated configuration spaces includes an encrypted emulated configuration space.