On 09/13/2012 04:52 PM, Michal Privoznik wrote:
On 13.09.2012 16:12, Martin Kletzander wrote:
> This patch adds full support for EOI setting for domains. Because this
> is CPU feature (flag), the model needs to be added even when it's not
> specified. Fortunately this problem was already solved with kvmclock,
> so this patch simply abuses that.
>
> And due to the size of the patch (17 lines) I dared to include the tests.
> ---
> src/qemu/qemu_command.c | 17 +++++++++++++
> .../qemuxml2argv-cpu-eoi-disabled.args | 4 ++++
> .../qemuxml2argv-cpu-eoi-disabled.xml | 28 ++++++++++++++++++++++
> .../qemuxml2argv-cpu-eoi-enabled.args | 4 ++++
> .../qemuxml2argv-cpu-eoi-enabled.xml | 28 ++++++++++++++++++++++
> .../qemuxml2argv-eoi-disabled.args | 4 ++++
> .../qemuxml2argvdata/qemuxml2argv-eoi-disabled.xml | 25 +++++++++++++++++++
> .../qemuxml2argvdata/qemuxml2argv-eoi-enabled.args | 4 ++++
> .../qemuxml2argvdata/qemuxml2argv-eoi-enabled.xml | 25 +++++++++++++++++++
> tests/qemuxml2argvtest.c | 5 ++++
> tests/qemuxml2xmltest.c | 6 +++++
> 11 files changed, 150 insertions(+)
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-eoi-disabled.args
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-eoi-disabled.xml
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-eoi-enabled.args
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-eoi-enabled.xml
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-eoi-disabled.args
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-eoi-disabled.xml
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-eoi-enabled.args
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-eoi-enabled.xml
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index cd4ee93..4aed8f6 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -4193,6 +4193,18 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
> }
> }
>
> + if (def->apic_eoi) {
> + char sign;
> + if (def->apic_eoi == VIR_DOMAIN_APIC_EOI_ON)
> + sign = '+';
> + else
> + sign = '-';
> +
> + virBufferAsprintf(&buf, "%s,%ckvm_pv_eoi",
> + have_cpu ? "" : default_model,
> + sign);
> + }
> +
> if (virBufferError(&buf))
> goto no_memory;
>
> @@ -7650,6 +7662,11 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
> }
> dom->clock.timers[i]->present = present;
> ret = 0;
> + } else if (STREQ(feature, "kvm_pv_eoi")) {
> + if (policy == VIR_CPU_FEATURE_REQUIRE)
> + dom->apic_eoi = VIR_DOMAIN_APIC_EOI_ON;
> + else
> + dom->apic_eoi = VIR_DOMAIN_APIC_EOI_OFF;
Hey, this is nice. I feel like we are forgetting this part sometimes.
> } else {
> if (!cpu) {
> if (!(cpu = qemuInitGuestCPU(dom)))
ACK
Michal
Thanks, pushed.
Martin