All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: xen-devel@lists.xensource.com
Subject: [PATCH 2 of 4] unmodified_drivers: add pfn_is_ram helper for kdump
Date: Fri, 16 Mar 2012 08:48:06 +0100	[thread overview]
Message-ID: <dacdcaaf113263ee748b.1331884086@probook.site> (raw)
In-Reply-To: <patchbomb.1331884084@probook.site>

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1331883706 -3600
# Node ID dacdcaaf113263ee748bef99d175b1b7e7013be5
# Parent  5504366919926f8a2d6fc7fdc392e6218ae6c702
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>

diff -r 550436691992 -r dacdcaaf1132 unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- 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 d
 	return -ENODEV;
 }
 
+#if defined(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(s
 	if ((ret = xen_panic_handler_init()))
 		goto out;
 
+#if defined(HAVE_OLDMEM_PFN_IS_RAM)
+	register_oldmem_pfn_is_ram(&xen_oldmem_pfn_is_ram);
+#endif
  out:
 	if (ret) {
 		pci_release_region(pdev, 0);

  parent reply	other threads:[~2012-03-16  7:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16  7:48 [PATCH 0 of 4] unmodified_drivers: misc changes for xenlinux PVonHVM drivers Olaf Hering
2012-03-16  7:48 ` [PATCH 1 of 4] unmodified_drivers: hide xen_cpuid_base() in version 2.6.38+ Olaf Hering
2012-03-16  7:48 ` Olaf Hering [this message]
2012-03-16  7:48 ` [PATCH 3 of 4] unmodified_drivers: use upstream sync_bitops if available Olaf Hering
2012-03-16  7:48 ` [PATCH 4 of 4] unmodified_drivers: compile vcd.c into blkfront " Olaf Hering
2012-03-16  9:07   ` Jan Beulich

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=dacdcaaf113263ee748b.1331884086@probook.site \
    --to=olaf@aepfle.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.