From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Wei Liu <wei.liu2@citrix.com>, Jan Beulich <jbeulich@suse.com>
Subject: [PATCH for-next v2 06/10] x86/domain: push some code down to hvm_domain_initialise
Date: Tue, 25 Apr 2017 14:52:07 +0100 [thread overview]
Message-ID: <20170425135211.4696-7-wei.liu2@citrix.com> (raw)
In-Reply-To: <20170425135211.4696-1-wei.liu2@citrix.com>
We want to have a single entry point to initialise hvm guest. Now the
timing to set hap bit and create per domain mapping is deferred, but
that's not a problem.
No functional change.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
v2:
1. reorder things to avoid rename labels
2. add config to hvm_domain_initialise
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
xen/arch/x86/domain.c | 14 +++-----------
xen/arch/x86/hvm/hvm.c | 11 ++++++++++-
xen/include/asm-x86/hvm/hvm.h | 3 ++-
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 38fc4f5d8b..fd5d47ab3d 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -596,16 +596,8 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
d->arch.emulation_flags = emflags;
}
- if ( is_hvm_domain(d) )
- {
- d->arch.hvm_domain.hap_enabled =
- hvm_funcs.hap_supported && (domcr_flags & DOMCRF_hap);
-
- rc = create_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0, NULL, NULL);
- }
- else if ( is_idle_domain(d) )
- rc = 0;
- else
+ rc = 0; /* HVM and idle domain */
+ if ( is_pv_domain(d) )
{
d->arch.pv_domain.gdt_ldt_l1tab =
alloc_xenheap_pages(0, MEMF_node(domain_to_node(d)));
@@ -672,7 +664,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
if ( is_hvm_domain(d) )
{
- if ( (rc = hvm_domain_initialise(d)) != 0 )
+ if ( (rc = hvm_domain_initialise(d, domcr_flags, config)) != 0 )
goto fail;
}
else
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index a441955322..9e9f1dbd53 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -595,7 +595,8 @@ static int hvm_print_line(
return X86EMUL_OKAY;
}
-int hvm_domain_initialise(struct domain *d)
+int hvm_domain_initialise(struct domain *d, unsigned long domcr_flags,
+ struct xen_arch_domainconfig *config)
{
unsigned int nr_gsis;
int rc;
@@ -613,6 +614,12 @@ int hvm_domain_initialise(struct domain *d)
INIT_LIST_HEAD(&d->arch.hvm_domain.write_map.list);
INIT_LIST_HEAD(&d->arch.hvm_domain.g2m_ioport_list);
+ d->arch.hvm_domain.hap_enabled =
+ hvm_funcs.hap_supported && (domcr_flags & DOMCRF_hap);
+ rc = create_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0, NULL, NULL);
+ if ( rc )
+ goto fail;
+
hvm_init_cacheattr_region_list(d);
rc = paging_enable(d, PG_refcounts|PG_translate|PG_external);
@@ -696,6 +703,8 @@ int hvm_domain_initialise(struct domain *d)
xfree(d->arch.hvm_domain.irq);
fail0:
hvm_destroy_cacheattr_region_list(d);
+ destroy_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0);
+ fail:
return rc;
}
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 7a85b2e3b5..b687e03dce 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -236,7 +236,8 @@ extern s8 hvm_port80_allowed;
extern const struct hvm_function_table *start_svm(void);
extern const struct hvm_function_table *start_vmx(void);
-int hvm_domain_initialise(struct domain *d);
+int hvm_domain_initialise(struct domain *d, unsigned long domcr_flags,
+ struct xen_arch_domainconfig *config);
void hvm_domain_relinquish_resources(struct domain *d);
void hvm_domain_destroy(struct domain *d);
void hvm_domain_soft_reset(struct domain *d);
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-04-25 13:52 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 13:52 [PATCH for-next v2 00/10] x86: refactor x86/domain.c Wei Liu
2017-04-25 13:52 ` [PATCH for-next v2 01/10] x86/mm: make free_perdomain_mappings idempotent Wei Liu
2017-04-25 13:54 ` Andrew Cooper
2017-04-25 13:52 ` [PATCH for-next v2 02/10] x86/domain: provide pv_{create, destroy}_gdt_ldt_l1tab and use them Wei Liu
2017-04-25 13:56 ` Andrew Cooper
2017-04-25 14:02 ` Wei Liu
2017-04-25 13:52 ` [PATCH for-next v2 03/10] x86/domain: make release_compact_l4 NULL tolerant Wei Liu
2017-04-25 13:56 ` Andrew Cooper
2017-04-25 13:52 ` [PATCH for-next v2 04/10] x86/domain: factor out pv_vcpu_destroy Wei Liu
2017-04-25 13:58 ` Andrew Cooper
2017-04-26 12:21 ` Jan Beulich
2017-04-25 13:52 ` [PATCH for-next v2 05/10] x86/domain: factor out pv_vcpu_initialise Wei Liu
2017-04-25 14:08 ` Andrew Cooper
2017-04-25 14:27 ` Wei Liu
2017-04-26 12:25 ` Jan Beulich
2017-04-26 12:53 ` Wei Liu
2017-04-26 13:27 ` Jan Beulich
2017-04-26 13:35 ` Wei Liu
2017-04-25 13:52 ` Wei Liu [this message]
2017-04-25 14:15 ` [PATCH for-next v2 06/10] x86/domain: push some code down to hvm_domain_initialise Andrew Cooper
2017-04-25 14:29 ` Wei Liu
2017-04-25 13:52 ` [PATCH for-next v2 07/10] x86/domain: factor out pv_domain_destroy Wei Liu
2017-04-25 14:18 ` Andrew Cooper
2017-04-26 12:32 ` Jan Beulich
2017-04-26 12:56 ` Wei Liu
2017-04-26 13:29 ` Jan Beulich
2017-04-26 13:36 ` Wei Liu
2017-04-25 13:52 ` [PATCH for-next v2 08/10] x86/domain: factor out pv_domain_initialise Wei Liu
2017-04-25 14:30 ` Andrew Cooper
2017-04-25 13:52 ` [PATCH for-next v2 09/10] x86/domain: move PV specific code to pv/domain.c Wei Liu
2017-04-25 14:52 ` Andrew Cooper
2017-04-25 15:07 ` Wei Liu
2017-04-26 6:04 ` Jan Beulich
2017-04-26 12:38 ` Andrew Cooper
2017-04-26 12:39 ` Jan Beulich
2017-04-26 12:46 ` Andrew Cooper
2017-04-26 13:00 ` Wei Liu
2017-04-26 13:26 ` Jan Beulich
2017-04-26 13:32 ` Wei Liu
2017-04-26 14:12 ` Jan Beulich
2017-04-26 15:46 ` Wei Liu
2017-04-25 13:52 ` [PATCH for-next v2 10/10] x86/domain: move HVM specific code to hvm/domain.c Wei Liu
2017-04-25 14:56 ` Andrew Cooper
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=20170425135211.4696-7-wei.liu2@citrix.com \
--to=wei.liu2@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=xen-devel@lists.xenproject.org \
/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).