From: Keir Fraser <keir.fraser@eu.citrix.com>
To: Ian Campbell <Ian.Campbell@eu.citrix.com>
Cc: ksrinivasan <ksrinivasan@novell.com>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH] PV driver compatibility
Date: Fri, 22 Jan 2010 10:45:06 +0000 [thread overview]
Message-ID: <C77F3234.71A9%keir.fraser@eu.citrix.com> (raw)
In-Reply-To: <1264149821.21707.88.camel@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 699 bytes --]
On 22/01/2010 08:43, "Ian Campbell" <Ian.Campbell@eu.citrix.com> wrote:
>> My default action right now will be to add a module option to specify
>> selective or complete flushing, keep the patch, but only fail to load
>> drivers if flush is requested but not possible, otherwise just warn.
>
> Sounds good, what will the default flush setting be?
>
> Could you swap out the 0xdead and 0xbeef for the defines which are
> specified right above the function in question while you are there?
Proposed patch is attached. It'd be good if someone could at least
build-test it -- I can't seem to work out how to build PV-on-HVM drivers any
more, against my stock selection of native kernels.
-- Keir
[-- Attachment #2: 00-pv-magic --]
[-- Type: application/octet-stream, Size: 2848 bytes --]
diff -r c06732ac2392 unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c Thu Jan 21 15:13:00 2010 +0000
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c Fri Jan 22 10:43:15 2010 +0000
@@ -62,6 +62,13 @@
MODULE_DESCRIPTION("Xen platform PCI device");
MODULE_LICENSE("GPL");
+/* NB. [aux-]ide-disks options do not unplug IDE CD-ROM drives. */
+/* NB. aux-ide-disks is equiv to ide-disks except ignores primary master. */
+static char *dev_unplug;
+module_param(dev_unplug, charp, 0644);
+MODULE_PARM_DESC(dev_unplug, "Emulated devices to unplug: "
+ "[all,][ide-disks,][aux-ide-disks,][nics]\n");
+
struct pci_dev *xen_platform_pdev;
static unsigned long shared_info_frame;
@@ -272,19 +279,43 @@
#define XEN_IOPORT_LINUX_PRODNUM 0xffff /* NB: register a proper one */
#define XEN_IOPORT_LINUX_DRVVER ((LINUX_VERSION_CODE << 8) + 0x0)
+#define UNPLUG_ALL_IDE_DISKS 1
+#define UNPLUG_ALL_NICS 2
+#define UNPLUG_AUX_IDE_DISKS 4
+#define UNPLUG_ALL 7
+
static int check_platform_magic(struct device *dev, long ioaddr, long iolen)
{
- short magic;
- char protocol;
+ short magic, unplug = 0;
+ char protocol, *p, *q, *err;
- if (iolen < 0x16)
- return -ENODEV;
+ for (p = dev_unplug; p; p = q) {
+ q = strchr(dev_unplug, ',');
+ if (q)
+ *q++ = '\0';
+ if (!strcmp(p, "all"))
+ unplug |= UNPLUG_ALL;
+ else if (!strcmp(p, "ide-disks"))
+ unplug |= UNPLUG_ALL_IDE_DISKS;
+ else if (!strcmp(p, "aux-ide-disks"))
+ unplug |= UNPLUG_AUX_IDE_DISKS;
+ else if (!strcmp(p, "nics"))
+ unplug |= UNPLUG_ALL_NICS;
+ else
+ dev_warn(dev, "unrecognised option '%s' "
+ "in module parameter 'dev_unplug'\n", p);
+ }
+
+ if (iolen < 0x16) {
+ err = "backend too old";
+ goto no_dev;
+ }
magic = inw(XEN_IOPORT_MAGIC);
if (magic != XEN_IOPORT_MAGIC_VAL) {
- dev_err(dev, "invalid magic %#x", magic);
- return -ENODEV;
+ err = "unrecognised magic value";
+ goto no_dev;
}
protocol = inb(XEN_IOPORT_PROTOVER);
@@ -293,8 +324,8 @@
switch (protocol) {
case 1:
- outw(XEN_IOPORT_PRODNUM, 0xbeef);
- outl(XEN_IOPORT_DRVVER, 0xdead);
+ outw(XEN_IOPORT_PRODNUM, XEN_IOPORT_LINUX_PRODNUM);
+ outl(XEN_IOPORT_DRVVER, XEN_IOPORT_LINUX_DRVVER);
if (inw(XEN_IOPORT_MAGIC) != XEN_IOPORT_MAGIC_VAL) {
dev_err(dev, "blacklisted by host\n");
return -ENODEV;
@@ -304,11 +335,18 @@
outw(XEN_IOPORT_UNPLUG, 0xf);
break;
default:
- dev_err(dev, "unknown qemu version\n");
- return -ENODEV;
+ err = "unknown I/O protocol version";
+ goto no_dev;
}
return 0;
+
+ no_dev:
+ dev_warn(dev, "failed backend handshake: %s\n", err);
+ if (!unplug)
+ return 0;
+ dev_err(dev, "failed to execute specified dev_unplug options!\n");
+ return -ENODEV;
}
static int __devinit platform_pci_init(struct pci_dev *pdev,
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2010-01-22 10:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-20 16:02 [PATCH] PV driver compatibility Ky Srinivasan
2010-01-20 16:07 ` Keir Fraser
2010-01-21 20:38 ` Ian Campbell
2010-01-21 21:46 ` Keir Fraser
2010-01-22 7:31 ` Ian Campbell
2010-01-22 8:03 ` Keir Fraser
2010-01-22 8:43 ` Ian Campbell
2010-01-22 9:07 ` Keir Fraser
2010-01-22 10:45 ` Keir Fraser [this message]
2010-01-22 11:16 ` Pasi Kärkkäinen
2010-01-26 10:12 ` Pasi Kärkkäinen
2010-01-26 10:19 ` Keir Fraser
[not found] <4B586E2D020000300007DDE1@sinclair.provo.novell.com>
2010-01-21 23:04 ` Ky Srinivasan
2010-01-22 7:37 ` Ian Campbell
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=C77F3234.71A9%keir.fraser@eu.citrix.com \
--to=keir.fraser@eu.citrix.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=ksrinivasan@novell.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 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.