Skip to contentSkip to conversation

Minor fixes for alacrityvm/linux-next branch

PATCH New Gregory Haskins 1 participant 5 messages Nov 23, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Minor fixes for alacrityvm/linux-next branch

The following are trivial fixes for the drivers in alacrityvm/linux-next

Patches 1-3 were necessary to enable the building of these drivers as a KMP package for older distribution kernels. Patch 4/4 is just a cleanup discovered during testing.

Kind Regards,
-Greg

---

Gregory Haskins (4):
vbus: fix pcibridge busmaster support
vbus: add autoprobe capability to guest
venet: add missing ethtool include
vbus: make library code properly declared as GPL

 drivers/net/vbus-enet.c     |    3 +++
 drivers/vbus/bus-proxy.c    |   33 ++++++++++++++++++++++++++++++++-
 drivers/vbus/pci-bridge.c   |    2 ++
 include/linux/vbus_driver.h |    2 ++
 lib/ioq.c                   |    4 ++++
 lib/shm_signal.c            |    4 ++++
 6 files changed, 47 insertions(+), 1 deletions(-)
Signature · 1 line
Signature
#1 lore raw

PATCH 1/4 vbus: make library code properly declared as GPL

This facilitates building the shm-signal and ioq libraries as kernel modules.

---

 lib/ioq.c        |    4 ++++
 lib/shm_signal.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)
lib/ioq.c +4 -0
index a6c8664..d5e57be 100644
@@ -25,6 +25,10 @@
 #include <linux/bitops.h>
 #include <linux/module.h>
 
+MODULE_AUTHOR("Gregory Haskins");
+MODULE_LICENSE("GPL");
+MODULE_VERSION("1");
+
 #ifndef NULL
 #define NULL 0
 #endif
lib/shm_signal.c +4 -0
index fbba74f..8d3e9b4 100644
@@ -24,6 +24,10 @@
 #include <linux/interrupt.h>
 #include <linux/shm_signal.h>
 
+MODULE_AUTHOR("Gregory Haskins");
+MODULE_LICENSE("GPL");
+MODULE_VERSION("1");
+
 int shm_signal_enable(struct shm_signal *s, int flags)
 {
 	struct shm_signal_irq *irq = &s->desc->irq[s->locale];
#2 lore raw

PATCH 2/4 venet: add missing ethtool include

In reply to Gregory Haskins

It's sloppy to use the facility without officially including its header file.

---

 drivers/net/vbus-enet.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/vbus-enet.c +1 -0
index 29b388f..25c6bea 100644
@@ -22,6 +22,7 @@
 #include <linux/in.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/ethtool.h>
 #include <linux/ip.h>
 #include <linux/tcp.h>
 #include <linux/skbuff.h>
#3 lore raw

PATCH 3/4 vbus: add autoprobe capability to guest

In reply to Gregory Haskins

This enables the guest to automatically load the appropriate driver when vbus devices are detected.

---

 drivers/net/vbus-enet.c     |    2 ++
 drivers/vbus/bus-proxy.c    |   33 ++++++++++++++++++++++++++++++++-
 include/linux/vbus_driver.h |    2 ++
 3 files changed, 36 insertions(+), 1 deletions(-)
drivers/net/vbus-enet.c +2 -0
index 25c6bea..4e9ecac 100644
@@ -1556,3 +1556,5 @@ vbus_enet_cleanup(void)
 
 module_init(vbus_enet_init_module);
 module_exit(vbus_enet_cleanup);
+
+VBUS_DRIVER_AUTOPROBE(VENET_TYPE);
drivers/vbus/bus-proxy.c +32 -1
index 5d34942..106e2fe 100644
@@ -48,6 +48,16 @@ static int vbus_dev_proxy_match(struct device *_dev, struct device_driver *_drv)
 	return !strcmp(dev->type, drv->type);
 }
 
+static int vbus_dev_proxy_uevent(struct device *_dev, struct kobj_uevent_env *env)
+{
+	struct vbus_device_proxy *dev = to_dev(_dev);
+
+	if (add_uevent_var(env, "MODALIAS=vbus-proxy:%s", dev->type))
+		return -ENOMEM;
+
+	return 0;
+}
+
 /*
  * This function is invoked after the bus infrastructure has already made a
  * match.  The device will contain a reference to the paired driver which
@@ -68,6 +78,7 @@ static int vbus_dev_proxy_probe(struct device *_dev)
 static struct bus_type vbus_proxy = {
 	.name   = VBUS_PROXY_NAME,
 	.match  = vbus_dev_proxy_match,
+	.uevent = vbus_dev_proxy_uevent,
 };
 
 static struct device vbus_proxy_rootdev = {
@@ -99,18 +110,38 @@ static void device_release(struct device *dev)
 	_dev->ops->release(_dev);
 }
 
+static ssize_t _show_modalias(struct device *dev,
+			      struct device_attribute *attr, char *buf)
+{
+	return sprintf(buf, "vbus-proxy:%s\n", to_dev(dev)->type);
+}
+DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, _show_modalias, NULL);
+
 int vbus_device_proxy_register(struct vbus_device_proxy *new)
 {
+	int ret;
+
 	new->dev.parent  = &vbus_proxy_rootdev;
 	new->dev.bus     = &vbus_proxy;
 	new->dev.release = &device_release;
 
-	return device_register(&new->dev);
+	ret = device_register(&new->dev);
+	if (ret < 0)
+		return ret;
+
+	ret = device_create_file(&new->dev, &dev_attr_modalias);
+	if (ret < 0) {
+		device_unregister(&new->dev);
+		return ret;
+	}
+
+	return 0;
 }
 EXPORT_SYMBOL_GPL(vbus_device_proxy_register);
 
 void vbus_device_proxy_unregister(struct vbus_device_proxy *dev)
 {
+	device_remove_file(&dev->dev, &dev_attr_modalias);
 	device_unregister(&dev->dev);
 }
 EXPORT_SYMBOL_GPL(vbus_device_proxy_unregister);
include/linux/vbus_driver.h +2 -0
index 2b1dac4..8a7acb1 100644
@@ -78,4 +78,6 @@ void vbus_driver_unregister(struct vbus_driver *drv);
 int vbus_driver_ioq_alloc(struct vbus_device_proxy *dev, const char *name,
 			  int id, int prio, size_t ringsize, struct ioq **ioq);
 
+#define VBUS_DRIVER_AUTOPROBE(name) MODULE_ALIAS("vbus-proxy:" name)
+
 #endif /* _LINUX_VBUS_DRIVER_H */
#4 lore raw

PATCH 4/4 vbus: fix pcibridge busmaster support

In reply to Gregory Haskins

We should technically enable the busmaster bit, even though its not actually used on the host side

---

 drivers/vbus/pci-bridge.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/vbus/pci-bridge.c +2 -0
index ddc3f39..962ef58 100644
@@ -932,6 +932,8 @@ vbus_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret < 0)
 		return ret;
 
+	pci_set_master(pdev);
+
 	ret = pci_request_regions(pdev, VBUS_PCI_NAME);
 	if (ret < 0) {
 		printk(KERN_ERR "VBUS_PCI: Could not init BARs: %d\n", ret);