[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: [PATCH 2/2] ioemu: make management of PCI D-states by guest optional



On Fri, 6 Mar 2009 14:26:37 +0900
Kouya Shimura <kouya@xxxxxxxxxxxxxx> wrote:

> +/* read Power Management Control/Status register */
> +static int pt_pmcsr_reg_read(struct pt_dev *ptdev,
> +        struct pt_reg_tbl *cfg_entry,
> +        uint16_t *value, uint16_t valid_mask)
> +{
> +    struct pt_reg_info_tbl *reg = cfg_entry->reg;
> +    uint16_t valid_emu_mask = reg->emu_mask;
> +
> +    if (!ptdev->power_mgmt)
> +        valid_emu_mask |= PCI_PM_CTRL_STATE_MASK;

(snip)

> @@ -3082,6 +3113,24 @@ static int pt_pmcsr_reg_write(struct pt_dev *ptdev,
>      struct pt_pm_info *pm_state = ptdev->pm_state;
>      uint16_t read_val = 0;
>  
> +    if (!ptdev->power_mgmt) {
> +        uint16_t emu_mask = 
> +            PCI_PM_CTRL_PME_STATUS | PCI_PM_CTRL_DATA_SCALE_MASK |
> +            PCI_PM_CTRL_PME_ENABLE |
> +            PCI_PM_CTRL_DATA_SEL_MASK | PCI_PM_CTRL_STATE_MASK;
> +        uint16_t ro_mask = PCI_PM_CTRL_DATA_SCALE_MASK;

Hi,

Why are Data_Scale field and Data_Select field emulated?
I think we can pass-through them as follows.

On the other hand, No_Soft_Reset field needs to be emulated and fixed
to 1. The reason is PowerState field is emulated, that means guest
software can change power state, but actual power state of device is
not changed. So internal reset never occurs.

As a result, the code will be as the following.

read:
      valid_emu_mask |= PCI_PM_CTRL_STATE_MASK |
             PCI_PM_CTRL_NO_SOFT_RESET;

write:
      uint16_t emu_mask = reg->emu_mask | PCI_PM_CTRL_STATE_MASK |
             PCI_PM_CTRL_NO_SOFT_RESET;
      uint16_t ro_mask = reg->ro_mask;

Thanks,
--
Yuji Shimada


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.