From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: Xen-devel@lists.xensource.com, keir.xen@gmail.com
Subject: [PATCH 14/23] PVH xen: additional changes to support PVH guest creation and execution.
Date: Fri, 19 Jul 2013 18:44:56 -0700 [thread overview]
Message-ID: <1374284705-23122-15-git-send-email-mukesh.rathor@oracle.com> (raw)
In-Reply-To: <1374284705-23122-1-git-send-email-mukesh.rathor@oracle.com>
Fail creation of 32bit PVH guest. Change hap_update_cr3() to return long
mode for PVH, this called during domain creation from arch_set_info_guest().
Return correct features for PVH to guest during it's boot.
Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
---
xen/arch/x86/domain.c | 8 ++++++++
xen/arch/x86/mm/hap/hap.c | 4 +++-
xen/common/domain.c | 10 ++++++++++
xen/common/domctl.c | 5 +++++
xen/common/kernel.c | 6 +++++-
5 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index fccb4ee..288872a 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -339,6 +339,14 @@ int switch_compat(struct domain *d)
if ( d == NULL )
return -EINVAL;
+
+ if ( is_pvh_domain(d) )
+ {
+ printk(XENLOG_INFO
+ "Xen currently does not support 32bit PVH guests\n");
+ return -EINVAL;
+ }
+
if ( !may_switch_mode(d) )
return -EACCES;
if ( is_pv_32on64_domain(d) )
diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
index bff05d9..19a085c 100644
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -639,7 +639,9 @@ static void hap_update_cr3(struct vcpu *v, int do_locking)
const struct paging_mode *
hap_paging_get_mode(struct vcpu *v)
{
- return !hvm_paging_enabled(v) ? &hap_paging_real_mode :
+ /* PVH 32bitfixme. */
+ return is_pvh_vcpu(v) ? &hap_paging_long_mode :
+ !hvm_paging_enabled(v) ? &hap_paging_real_mode :
hvm_long_mode_enabled(v) ? &hap_paging_long_mode :
hvm_pae_enabled(v) ? &hap_paging_pae_mode :
&hap_paging_protected_mode;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 38b1bad..3b4af4b 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -237,6 +237,16 @@ struct domain *domain_create(
if ( domcr_flags & DOMCRF_hvm )
d->guest_type = guest_type_hvm;
+ else if ( domcr_flags & DOMCRF_pvh )
+ {
+ if ( !(domcr_flags & DOMCRF_hap) )
+ {
+ err = -EOPNOTSUPP;
+ printk(XENLOG_INFO "PVH guest must have HAP on\n");
+ goto fail;
+ }
+ d->guest_type = guest_type_pvh;
+ }
if ( domid == 0 )
{
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index c653efb..48e4c08 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -187,6 +187,8 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
if ( is_hvm_domain(d) )
info->flags |= XEN_DOMINF_hvm_guest;
+ else if ( is_pvh_domain(d) )
+ info->flags |= XEN_DOMINF_pvh_guest;
xsm_security_domaininfo(d, info);
@@ -443,6 +445,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
domcr_flags = 0;
if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_hvm_guest )
domcr_flags |= DOMCRF_hvm;
+ else if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_hap )
+ domcr_flags |= DOMCRF_pvh; /* PV with HAP is a PVH guest */
+
if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_hap )
domcr_flags |= DOMCRF_hap;
if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_s3_integrity )
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 72fb905..3bba758 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -289,7 +289,11 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
if ( current->domain == dom0 )
fi.submap |= 1U << XENFEAT_dom0;
#ifdef CONFIG_X86
- if ( !is_hvm_vcpu(current) )
+ if ( is_pvh_vcpu(current) )
+ fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) |
+ (1U << XENFEAT_supervisor_mode_kernel) |
+ (1U << XENFEAT_hvm_callback_vector);
+ else if ( !is_hvm_vcpu(current) )
fi.submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) |
(1U << XENFEAT_highmem_assist) |
(1U << XENFEAT_gnttab_map_avail_bits);
--
1.7.2.3
next prev parent reply other threads:[~2013-07-20 1:44 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-20 1:44 [PATCH 00/23][V9]PVH xen: Phase I, Version 9 patches Mukesh Rathor
2013-07-20 1:44 ` [PATCH 01/23] PVH xen: Add readme docs/misc/pvh-readme.txt Mukesh Rathor
2013-07-20 1:44 ` [PATCH 02/23] PVH xen: turn gdb_frames/gdt_ents into union Mukesh Rathor
2013-08-05 15:55 ` George Dunlap
2013-08-05 21:51 ` Mukesh Rathor
2013-08-06 7:36 ` Ian Campbell
2013-08-06 13:50 ` George Dunlap
2013-08-06 13:57 ` Ian Campbell
2013-08-06 19:09 ` Mukesh Rathor
2013-08-07 8:32 ` Ian Campbell
2013-07-20 1:44 ` [PATCH 03/23] PVH xen: add params to read_segment_register Mukesh Rathor
2013-07-20 1:44 ` [PATCH 04/23] PVH xen: Move e820 fields out of pv_domain struct Mukesh Rathor
2013-07-20 1:44 ` [PATCH 05/23] PVH xen: hvm related preparatory changes for PVH Mukesh Rathor
2013-07-20 1:44 ` [PATCH 06/23] PVH xen: vmx " Mukesh Rathor
2013-07-20 1:44 ` [PATCH 07/23] PVH xen: vmcs " Mukesh Rathor
2013-07-20 1:44 ` [PATCH 08/23] PVH xen: Introduce PVH guest type and some basic changes Mukesh Rathor
2013-07-20 1:44 ` [PATCH 09/23] PVH xen: introduce pvh_set_vcpu_info() and vmx_pvh_set_vcpu_info() Mukesh Rathor
2013-07-20 1:44 ` [PATCH 10/23] PVH xen: domain create, context switch related code changes Mukesh Rathor
2013-07-20 1:44 ` [PATCH 11/23] PVH xen: support invalid op emulation for PVH Mukesh Rathor
2013-07-20 1:44 ` [PATCH 12/23] PVH xen: Support privileged " Mukesh Rathor
2013-07-20 1:44 ` [PATCH 13/23] PVH xen: interrupt/event-channel delivery to PVH Mukesh Rathor
2013-07-20 1:44 ` Mukesh Rathor [this message]
2013-07-20 1:44 ` [PATCH 15/23] PVH xen: mapcache and show registers Mukesh Rathor
2013-07-20 1:44 ` [PATCH 16/23] PVH xen: mtrr, tsc, grant changes Mukesh Rathor
2013-07-20 1:44 ` [PATCH 17/23] PVH xen: Checks, asserts, and limitations for PVH Mukesh Rathor
2013-07-20 1:45 ` [PATCH 18/23] PVH xen: add hypercall support " Mukesh Rathor
2013-07-20 1:45 ` [PATCH 19/23] PVH xen: vmcs related changes Mukesh Rathor
2013-07-20 1:45 ` [PATCH 20/23] PVH xen: HVM support of PVH guest creation/destruction Mukesh Rathor
2013-07-20 1:45 ` [PATCH 21/23] PVH xen: VMX " Mukesh Rathor
2013-07-22 14:25 ` Egger, Christoph
2013-07-20 1:45 ` [PATCH 22/23] PVH xen: preparatory patch for the pvh vmexit handler patch Mukesh Rathor
2013-07-20 1:45 ` [PATCH 23/23] PVH xen: introduce vmexit handler for PVH Mukesh Rathor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374284705-23122-15-git-send-email-mukesh.rathor@oracle.com \
--to=mukesh.rathor@oracle.com \
--cc=Xen-devel@lists.xensource.com \
--cc=keir.xen@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).