diff mbox

[v2,4/4] x86/PV: enable the emulated PIT

Message ID 1452869983-75956-5-git-send-email-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Pau Monné Jan. 15, 2016, 2:59 p.m. UTC
The HVMlite series removed the initialization of the emulated PIT for PV
guests, this patch re-enables it.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
NB: Since it's not clear why an emulated PIT is needed, it won't be enabled
by default for HVMlite guests until we can figure out if/why it's needed.
---
Changes since v1:
 - New in this version.
---
 tools/libxl/libxl_x86.c | 8 +++++++-
 xen/arch/x86/domain.c   | 5 +++--
 xen/arch/x86/setup.c    | 4 +++-
 3 files changed, 13 insertions(+), 4 deletions(-)

Comments

Jan Beulich Jan. 15, 2016, 5:08 p.m. UTC | #1
>>> On 15.01.16 at 15:59, <roger.pau@citrix.com> wrote:
> --- a/xen/arch/x86/domain.c
> +++ b/xen/arch/x86/domain.c
> @@ -542,8 +542,9 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
>                     d->domain_id, config->emulation_flags);
>              return -EINVAL;
>          }
> -        if ( config->emulation_flags != 0 &&
> -             (!is_hvm_domain(d) || config->emulation_flags != XEN_X86_EMU_ALL) )
> +        if ( (is_hvm_domain(d) && config->emulation_flags != XEN_X86_EMU_ALL &&
> +             config->emulation_flags != 0) ||
> +             (!is_hvm_domain(d) && config->emulation_flags != XEN_X86_EMU_PIT) )

IMO it would be more readable when transforming

    if ( (a && b) || (!a && c) )

into

    if ( a ? b : c )

With that change
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
diff mbox

Patch

diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index 46cfafb..7f47cc5 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -13,8 +13,14 @@  int libxl__arch_domain_prepare_config(libxl__gc *gc,
         LIBXL_DEVICE_MODEL_VERSION_NONE) {
         /* HVM domains with a device model. */
         xc_config->emulation_flags = XEN_X86_EMU_ALL;
+    } else if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV) {
+        /* PV domains. */
+        xc_config->emulation_flags = XEN_X86_EMU_PIT;
     } else {
-        /* PV or HVM domains without a device model. */
+        assert(d_config->c_info.type == LIBXL_DOMAIN_TYPE_HVM);
+        assert(d_config->b_info.device_model_version ==
+               LIBXL_DEVICE_MODEL_VERSION_NONE);
+        /* HVMlite domains. */
         xc_config->emulation_flags = 0;
     }
 
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 159d960..8ee5d76 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -542,8 +542,9 @@  int arch_domain_create(struct domain *d, unsigned int domcr_flags,
                    d->domain_id, config->emulation_flags);
             return -EINVAL;
         }
-        if ( config->emulation_flags != 0 &&
-             (!is_hvm_domain(d) || config->emulation_flags != XEN_X86_EMU_ALL) )
+        if ( (is_hvm_domain(d) && config->emulation_flags != XEN_X86_EMU_ALL &&
+             config->emulation_flags != 0) ||
+             (!is_hvm_domain(d) && config->emulation_flags != XEN_X86_EMU_PIT) )
         {
             printk(XENLOG_G_ERR "d%d: Xen does not allow %s domain creation "
                    "with the current selection of emulators: %#x\n",
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 76c7b0f..08bd3fb 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -582,7 +582,9 @@  void __init noreturn __start_xen(unsigned long mbi_p)
         .parity    = 'n',
         .stop_bits = 1
     };
-    struct xen_arch_domainconfig config = { .emulation_flags = 0 };
+    struct xen_arch_domainconfig config = {
+        .emulation_flags = XEN_X86_EMU_PIT,
+    };
 
     /* Critical region without IDT or TSS.  Any fault is deadly! */