sparc64: Add vio_set_intr() to enable/disable Rx interrupts
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Tue, 23 Sep 2014 15:37:44 +0000 (11:37 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 Sep 2014 21:40:45 +0000 (14:40 -0700)
The vio_set_intr() API should be used by VIO consumers to enable/disable
Rx interrupts to facilitate deferred processing in softirq/bottom-half
context.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/include/asm/vio.h
arch/sparc/kernel/vio.c

index 7fce9b1e6228ea45cd1349e53206fd4799ebe50e..d758c8d8f47d90b9cefc18fc5ba973692b122a41 100644 (file)
@@ -298,6 +298,7 @@ struct vio_dev {
 
        unsigned int            tx_irq;
        unsigned int            rx_irq;
+       u64                     rx_ino;
 
        struct device           dev;
 };
@@ -453,5 +454,6 @@ int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev,
                    char *name);
 
 void vio_port_up(struct vio_driver_state *vio);
+int vio_set_intr(unsigned long dev_ino, int state);
 
 #endif /* _SPARC64_VIO_H */
index 8647fcc5ca6c5d5fad0f2b56f8865b8dcee876be..cb5789c9f9613ed692733d50dcf0e2c39784b1f7 100644 (file)
@@ -180,8 +180,10 @@ static void vio_fill_channel_info(struct mdesc_handle *hp, u64 mp,
                        vdev->tx_irq = sun4v_build_virq(cdev_cfg_handle, *irq);
 
                irq = mdesc_get_property(hp, target, "rx-ino", NULL);
-               if (irq)
+               if (irq) {
                        vdev->rx_irq = sun4v_build_virq(cdev_cfg_handle, *irq);
+                       vdev->rx_ino = *irq;
+               }
 
                chan_id = mdesc_get_property(hp, target, "id", NULL);
                if (chan_id)
@@ -189,6 +191,15 @@ static void vio_fill_channel_info(struct mdesc_handle *hp, u64 mp,
        }
 }
 
+int vio_set_intr(unsigned long dev_ino, int state)
+{
+       int err;
+
+       err = sun4v_vintr_set_valid(cdev_cfg_handle, dev_ino, state);
+       return err;
+}
+EXPORT_SYMBOL(vio_set_intr);
+
 static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
                                      struct device *parent)
 {