Re: [PATCH 3/3] acpi_piix4: Call KVM_SETSTATE_VCPU ioctl on cpu ejection

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

 



On 2012-01-13 12:11, Vasilis Liaskovitis wrote:
> Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@xxxxxxxxxxxxxxxx>
> ---
>  hw/acpi_piix4.c |   21 +++++++++++++++++++++
>  1 files changed, 21 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
> index 8bf30dd..12eef55 100644
> --- a/hw/acpi_piix4.c
> +++ b/hw/acpi_piix4.c
> @@ -502,6 +502,27 @@ static uint32_t cpuej_read(void *opaque, uint32_t addr)
>  
>  static void cpuej_write(void *opaque, uint32_t addr, uint32_t val)
>  {
> +    struct kvm_vcpu_state state;
> +    CPUState *env;
> +    int cpu;
> +    int ret;
> +
> +    cpu = ffs(val);
> +    /* zero means no bit was set, i.e. no CPU ejection happened */
> +    if (!cpu)
> +       return;
> +    cpu--;
> +    env = cpu_phyid_to_cpu((uint64_t)cpu);
> +    if (env != NULL) {
> +        if (env->state == CPU_STATE_ZAPREQ) {
> +            state.vcpu_id = env->cpu_index;
> +            state.state = 1;
> +            ret = kvm_vm_ioctl(env->kvm_state, KVM_SETSTATE_VCPU, &state);

That breaks in the absence of KVM or if it is not enabled.

Also, where was this IOCTL introduced? Where are the linux header changes?

> +            if (ret)
> +                fprintf(stderr, "KVM_SETSTATE_VCPU failed: %s\n",
> +                        strerror(ret));
> +        }
> +    }
>      PIIX4_DPRINTF("cpuej write %x <== %d\n", addr, val);
>  }
>  

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux