aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2012-05-14 16:50:21 +0100
committerOlaf Hering <olaf@aepfle.de>2012-05-14 16:50:21 +0100
commit022d04432a61ce23a0a7e1a3676bbfc8a71365aa (patch)
tree05e29bcc792c3a7e09058f18bd788c849863e8ab
parent56b805b33b2073776f5bdd42123670d27c898084 (diff)
downloadxen-022d04432a61ce23a0a7e1a3676bbfc8a71365aa.tar.gz
xen-022d04432a61ce23a0a7e1a3676bbfc8a71365aa.tar.bz2
xen-022d04432a61ce23a0a7e1a3676bbfc8a71365aa.zip
unmodified drivers: add pfn_is_ram helper for kdump
Register pfn_is_ram helper speed up reading /proc/vmcore in the kdump kernel. It is compiled only if the kernel source is recent enough to have the pfn_is_ram helper (v3.0-rc1, commit 997c136f518c5debd63847e78e2a8694f56dcf90). Signed-off-by: Olaf Hering <olaf@aepfle.de> Committed-by: Jan Beulich <jbeulich@suse.com> xen-unstable changeset: 25068:e4460795ee66 xen-unstable date: Fri Mar 16 11:34:41 2012 +0100
-rw-r--r--unmodified_drivers/linux-2.6/platform-pci/platform-pci.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
index f36179ffe5..7e988a5e33 100644
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
@@ -351,6 +351,32 @@ static int check_platform_magic(struct device *dev, long ioaddr, long iolen)
return -ENODEV;
}
+#ifdef HAVE_OLDMEM_PFN_IS_RAM
+static int xen_oldmem_pfn_is_ram(unsigned long pfn)
+{
+ struct xen_hvm_get_mem_type a;
+ int ret;
+
+ a.domid = DOMID_SELF;
+ a.pfn = pfn;
+ if (HYPERVISOR_hvm_op(HVMOP_get_mem_type, &a))
+ return -ENXIO;
+
+ switch (a.mem_type) {
+ case HVMMEM_mmio_dm:
+ ret = 0;
+ break;
+ case HVMMEM_ram_rw:
+ case HVMMEM_ram_ro:
+ default:
+ ret = 1;
+ break;
+ }
+
+ return ret;
+}
+#endif
+
static int __devinit platform_pci_init(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -419,6 +445,9 @@ static int __devinit platform_pci_init(struct pci_dev *pdev,
if ((ret = xen_panic_handler_init()))
goto out;
+#ifdef HAVE_OLDMEM_PFN_IS_RAM
+ register_oldmem_pfn_is_ram(&xen_oldmem_pfn_is_ram);
+#endif
out:
if (ret) {
pci_release_region(pdev, 0);