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

[Xen-devel] [PATCH v3 4/4] x86/PV: enable the emulated PIT



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@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
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 v2:
 - Change 'if ( (a && b) || (!a && c) )' into 'if ( a ? b : c )'.

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(-)

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..ae85e45 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) :
+             (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! */
 
-- 
1.9.5 (Apple Git-50.3)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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