From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xensource.com, keir.fraser@eu.citrix.com
Cc: konrad.wilk@oracle.com
Subject: [PATCH 2 of 5] x86: make the pv-only e820 array be dynamic
Date: Thu, 07 Apr 2011 16:25:23 -0400 [thread overview]
Message-ID: <01d0d338b97491a3aa81.1302207923@localhost6.localdomain6> (raw)
In-Reply-To: <patchbomb.1302207921@localhost6.localdomain6>
# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1302202697 14400
# Node ID 01d0d338b97491a3aa816dab43cc709a234214f7
# Parent decab6c21cc3d7ce4d4dad949d34ba35d4600490
x86: make the pv-only e820 array be dynamic.
During creation of the PV domain we allocate the E820 structure to be
the E820MAX. This will allow the tool stack to fill the E820 with more
than three entries.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
diff -r decab6c21cc3 -r 01d0d338b974 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c Thu Apr 07 12:36:26 2011 -0400
+++ b/xen/arch/x86/domain.c Thu Apr 07 14:58:17 2011 -0400
@@ -634,14 +634,23 @@
d->arch.pirq_emuirq[i] = IRQ_UNBOUND;
for (i = 0; i < nr_irqs; i++)
d->arch.emuirq_pirq[i] = IRQ_UNBOUND;
+ } else
+ {
+ d->arch.pv_domain.e820 = xmalloc_array(struct e820entry, E820MAX);
+
+ if ( !d->arch.pv_domain.e820 )
+ goto fail;
+
+ memset(d->arch.pv_domain.e820, 0,
+ E820MAX * sizeof(*d->arch.pv_domain.e820));
}
-
if ( (rc = iommu_domain_init(d)) != 0 )
goto fail;
/* For Guest vMCE MSRs virtualization */
vmce_init_msr(d);
+
}
if ( is_hvm_domain(d) )
@@ -668,6 +677,10 @@
fail:
d->is_dying = DOMDYING_dead;
vmce_destroy_msr(d);
+ if ( !is_hvm_domain(d) )
+ {
+ xfree(d->arch.pv_domain.e820);
+ }
xfree(d->arch.pirq_irq);
xfree(d->arch.irq_pirq);
xfree(d->arch.pirq_emuirq);
@@ -696,6 +709,8 @@
if ( is_hvm_domain(d) )
hvm_domain_destroy(d);
+ else
+ xfree(d->arch.pv_domain.e820);
vmce_destroy_msr(d);
pci_release_devices(d);
diff -r decab6c21cc3 -r 01d0d338b974 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Thu Apr 07 12:36:26 2011 -0400
+++ b/xen/arch/x86/mm.c Thu Apr 07 14:58:17 2011 -0400
@@ -4710,7 +4710,7 @@
if ( copy_from_guest(&fmap, arg, 1) )
return -EFAULT;
- if ( fmap.map.nr_entries > ARRAY_SIZE(d->arch.pv_domain.e820) )
+ if ( fmap.map.nr_entries > E820MAX )
return -EINVAL;
rc = rcu_lock_target_domain_by_id(fmap.domid, &d);
@@ -4730,9 +4730,16 @@
return -EPERM;
}
+ if ( d->arch.pv_domain.e820 == NULL )
+ {
+ rcu_unlock_domain(d);
+ return -EINVAL;
+ }
rc = copy_from_guest(d->arch.pv_domain.e820, fmap.map.buffer,
fmap.map.nr_entries) ? -EFAULT : 0;
- d->arch.pv_domain.nr_e820 = fmap.map.nr_entries;
+
+ if ( rc == 0 )
+ d->arch.pv_domain.nr_e820 = fmap.map.nr_entries;
rcu_unlock_domain(d);
return rc;
@@ -4747,6 +4754,9 @@
if ( d->arch.pv_domain.nr_e820 == 0 )
return -ENOSYS;
+ if ( d->arch.pv_domain.e820 == NULL )
+ return -ENOSYS;
+
if ( copy_from_guest(&map, arg, 1) )
return -EFAULT;
diff -r decab6c21cc3 -r 01d0d338b974 xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h Thu Apr 07 12:36:26 2011 -0400
+++ b/xen/include/asm-x86/domain.h Thu Apr 07 14:58:17 2011 -0400
@@ -238,7 +238,7 @@
unsigned long pirq_eoi_map_mfn;
/* Pseudophysical e820 map (XENMEM_memory_map). */
- struct e820entry e820[3];
+ struct e820entry *e820;
unsigned int nr_e820;
};
next prev parent reply other threads:[~2011-04-07 20:25 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-07 20:25 [PATCH 0 of 5] Patches for PCI passthrough with modified E820 Konrad Rzeszutek Wilk
2011-04-07 20:25 ` [PATCH 1 of 5] tools: Add xc_domain_set_memory_map and xc_get_machine_memory_map calls Konrad Rzeszutek Wilk
2011-04-08 8:18 ` Ian Campbell
2011-04-08 13:19 ` Konrad Rzeszutek Wilk
2011-04-07 20:25 ` Konrad Rzeszutek Wilk [this message]
2011-04-08 8:22 ` [PATCH 2 of 5] x86: make the pv-only e820 array be dynamic Ian Campbell
2011-04-08 13:21 ` Konrad Rzeszutek Wilk
2011-04-07 20:25 ` [PATCH 3 of 5] x86: adjust the size of the e820 for pv guest to " Konrad Rzeszutek Wilk
2011-04-07 20:25 ` [PATCH 4 of 5] libxl: Add support for passing in the machine's E820 for PCI passthrough Konrad Rzeszutek Wilk
2011-04-08 8:36 ` Ian Campbell
2011-04-08 10:56 ` Ian Jackson
2011-04-08 13:35 ` Konrad Rzeszutek Wilk
2011-04-08 13:55 ` Ian Campbell
2011-04-08 14:09 ` Tim Deegan
2011-04-08 14:17 ` Ian Campbell
2011-04-08 14:25 ` Tim Deegan
2011-04-08 14:33 ` Ian Campbell
2011-04-08 15:00 ` Konrad Rzeszutek Wilk
2011-04-08 14:34 ` Konrad Rzeszutek Wilk
2011-04-08 14:42 ` Ian Campbell
2011-04-08 14:54 ` Konrad Rzeszutek Wilk
2011-04-08 16:01 ` Ian Jackson
2011-04-08 13:33 ` Konrad Rzeszutek Wilk
2011-04-08 14:00 ` Ian Campbell
2011-04-07 20:25 ` [PATCH 5 of 5] libxl: Convert E820_UNUSABLE and E820_RAM to E820_UNUSABLE as appropriate Konrad Rzeszutek Wilk
2011-04-08 8:42 ` [PATCH 0 of 5] Patches for PCI passthrough with modified E820 Ian Campbell
2011-04-08 13:24 ` Konrad Rzeszutek Wilk
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=01d0d338b97491a3aa81.1302207923@localhost6.localdomain6 \
--to=konrad.wilk@oracle.com \
--cc=keir.fraser@eu.citrix.com \
--cc=xen-devel@lists.xensource.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).