P2M: check whether hap mode is enabled before using 2mb pages

This small patch checks whether hap mode is enabled when guest is
trying to allocate 2MB pages inside P2M. This prevents potential
errors when hap is disabled.

Cc: Chris Lalancette <clalance@redhat.com>
Cc: Sarathy, Bhavna <Bhavna.Sarathy@amd.com>
Signed-off-by: Wei Huang <wei.huang2@amd.com>
This commit is contained in:
Keir Fraser committed 2009-06-19 08:42:58 +01:00
1 parent 0506bc4d89
commit 0ca1669871
1 file changed
+5 -1
+5 -1
View File
@@ -1499,7 +1499,11 @@ int set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn,
while ( todo )
{
order = (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? 9 : 0;
if ( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled )
order = (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ?
9 : 0;
else
order = 0;
rc = d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt);
gfn += 1ul << order;
if ( mfn_x(mfn) != INVALID_MFN )
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.