DM: add vmm interface to get px data

The interface will be used to interact with VHM service via IOCTL.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
Victor Sun 2018-04-05 04:35:04 +08:00 committed by lijinxia
parent 1b73f92f99
commit b0e7c7a300
4 changed files with 46 additions and 0 deletions

View File

@ -720,3 +720,9 @@ vm_get_device_fd(struct vmctx *ctx)
{
return ctx->fd;
}
int
vm_get_cpu_state(struct vmctx *ctx, void *state_buf)
{
return ioctl(ctx->fd, IC_PM_GET_CPU_STATE, state_buf);
}

View File

@ -302,6 +302,39 @@ struct acrn_vm_pci_msix_remap {
*/
#define GUEST_CFG_OFFSET 0xd0000
/**
* @brief Info The power state data of a VCPU.
*
*/
struct cpu_px_data {
uint64_t core_frequency; /* megahertz */
uint64_t power; /* milliWatts */
uint64_t transition_latency; /* microseconds */
uint64_t bus_master_latency; /* microseconds */
uint64_t control; /* control value */
uint64_t status; /* success indicator */
} __attribute__((aligned(8)));
/**
* @brief Info PM command from DM/VHM.
*
* The command would specify request type(i.e. get px count or data) for
* specific VM and specific VCPU with specific state number.like P(n).
*/
#define PMCMD_VMID_MASK 0xff000000
#define PMCMD_VCPUID_MASK 0x00ff0000
#define PMCMD_STATE_NUM_MASK 0x0000ff00
#define PMCMD_TYPE_MASK 0x000000ff
#define PMCMD_VMID_SHIFT 24
#define PMCMD_VCPUID_SHIFT 16
#define PMCMD_STATE_NUM_SHIFT 8
enum pm_cmd_type {
PMCMD_GET_PX_CNT,
PMCMD_GET_PX_DATA,
};
/**
* @}
*/

View File

@ -101,6 +101,10 @@
#define IC_SET_PTDEV_INTR_INFO _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x03)
#define IC_RESET_PTDEV_INTR_INFO _IC_ID(IC_ID, IC_ID_PCI_BASE + 0x04)
/* Power management */
#define IC_ID_PM_BASE 0x60UL
#define IC_PM_GET_CPU_STATE _IC_ID(IC_ID, IC_ID_PM_BASE + 0x00)
/**
* struct vm_memseg - memory segment info for guest
*

View File

@ -147,4 +147,7 @@ int vm_set_ptdev_intx_info(struct vmctx *ctx, uint16_t virt_bdf,
int vm_reset_ptdev_intx_info(struct vmctx *ctx, int virt_pin, bool pic_pin);
int vm_create_vcpu(struct vmctx *ctx, int vcpu_id);
int vm_get_cpu_state(struct vmctx *ctx, void *state_buf);
#endif /* _VMMAPI_H_ */