* [PATCH 1/1] Drivers: hv: vmbus: Add device and vendor ID to vmbus devices
@ 2014-12-17 22:52 K. Y. Srinivasan
2014-12-18 0:17 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: K. Y. Srinivasan @ 2014-12-17 22:52 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, olaf, apw, jasowang; +Cc: K. Y. Srinivasan
Add vendor and device ID attributes to vmbus devices. This would allow us to
support vmbus based devices that can support guest RDMA.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/vmbus_drv.c | 20 ++++++++++++++++++++
include/linux/hyperv.h | 2 ++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 4d6b269..215aac9 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -385,6 +385,24 @@ static ssize_t in_write_bytes_avail_show(struct device *dev,
}
static DEVICE_ATTR_RO(in_write_bytes_avail);
+static ssize_t vendor_show(struct device *dev,
+ struct device_attribute *dev_atttr,
+ char *buf)
+{
+ struct hv_device *hv_dev = device_to_hv_device(dev);
+ return sprintf(buf, "0x%x\n", hv_dev->vendor_id);
+}
+static DEVICE_ATTR_RO(vendor);
+
+static ssize_t device_show(struct device *dev,
+ struct device_attribute *dev_atttr,
+ char *buf)
+{
+ struct hv_device *hv_dev = device_to_hv_device(dev);
+ return sprintf(buf, "0x%x\n", hv_dev->device_id);
+}
+static DEVICE_ATTR_RO(device);
+
/* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
static struct attribute *vmbus_attrs[] = {
&dev_attr_id.attr,
@@ -409,6 +427,8 @@ static struct attribute *vmbus_attrs[] = {
&dev_attr_in_write_index.attr,
&dev_attr_in_read_bytes_avail.attr,
&dev_attr_in_write_bytes_avail.attr,
+ &dev_attr_vendor.attr,
+ &dev_attr_device.attr,
NULL,
};
ATTRIBUTE_GROUPS(vmbus);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 476c685..6fe4dfe 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -891,6 +891,8 @@ struct hv_device {
/* the device instance id of this device */
uuid_le dev_instance;
+ u16 vendor_id;
+ u16 device_id;
struct device device;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] Drivers: hv: vmbus: Add device and vendor ID to vmbus devices
2014-12-17 22:52 [PATCH 1/1] Drivers: hv: vmbus: Add device and vendor ID to vmbus devices K. Y. Srinivasan
@ 2014-12-18 0:17 ` Greg KH
2014-12-18 0:46 ` KY Srinivasan
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2014-12-18 0:17 UTC (permalink / raw)
To: K. Y. Srinivasan; +Cc: linux-kernel, devel, olaf, apw, jasowang
On Wed, Dec 17, 2014 at 02:52:24PM -0800, K. Y. Srinivasan wrote:
> Add vendor and device ID attributes to vmbus devices. This would allow us to
> support vmbus based devices that can support guest RDMA.
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
> drivers/hv/vmbus_drv.c | 20 ++++++++++++++++++++
> include/linux/hyperv.h | 2 ++
> 2 files changed, 22 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 4d6b269..215aac9 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -385,6 +385,24 @@ static ssize_t in_write_bytes_avail_show(struct device *dev,
> }
> static DEVICE_ATTR_RO(in_write_bytes_avail);
>
> +static ssize_t vendor_show(struct device *dev,
> + struct device_attribute *dev_atttr,
> + char *buf)
> +{
> + struct hv_device *hv_dev = device_to_hv_device(dev);
> + return sprintf(buf, "0x%x\n", hv_dev->vendor_id);
> +}
> +static DEVICE_ATTR_RO(vendor);
> +
> +static ssize_t device_show(struct device *dev,
> + struct device_attribute *dev_atttr,
> + char *buf)
> +{
> + struct hv_device *hv_dev = device_to_hv_device(dev);
> + return sprintf(buf, "0x%x\n", hv_dev->device_id);
> +}
> +static DEVICE_ATTR_RO(device);
> +
> /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
> static struct attribute *vmbus_attrs[] = {
> &dev_attr_id.attr,
> @@ -409,6 +427,8 @@ static struct attribute *vmbus_attrs[] = {
> &dev_attr_in_write_index.attr,
> &dev_attr_in_read_bytes_avail.attr,
> &dev_attr_in_write_bytes_avail.attr,
> + &dev_attr_vendor.attr,
> + &dev_attr_device.attr,
> NULL,
> };
> ATTRIBUTE_GROUPS(vmbus);
> diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
> index 476c685..6fe4dfe 100644
> --- a/include/linux/hyperv.h
> +++ b/include/linux/hyperv.h
> @@ -891,6 +891,8 @@ struct hv_device {
>
> /* the device instance id of this device */
> uuid_le dev_instance;
> + u16 vendor_id;
> + u16 device_id;
>
> struct device device;
>
You are adding new sysfs files without proper Documentation/ABI/ updates
as well? You know better than that...
And I don't see anything setting these fields, seems kind of pointless
as-is, right?
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH 1/1] Drivers: hv: vmbus: Add device and vendor ID to vmbus devices
2014-12-18 0:17 ` Greg KH
@ 2014-12-18 0:46 ` KY Srinivasan
0 siblings, 0 replies; 3+ messages in thread
From: KY Srinivasan @ 2014-12-18 0:46 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com
> -----Original Message-----
> From: Greg KH [mailto:gregkh@linuxfoundation.org]
> Sent: Wednesday, December 17, 2014 4:17 PM
> To: KY Srinivasan
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> olaf@aepfle.de; apw@canonical.com; jasowang@redhat.com
> Subject: Re: [PATCH 1/1] Drivers: hv: vmbus: Add device and vendor ID to
> vmbus devices
>
> On Wed, Dec 17, 2014 at 02:52:24PM -0800, K. Y. Srinivasan wrote:
> > Add vendor and device ID attributes to vmbus devices. This would allow
> > us to support vmbus based devices that can support guest RDMA.
> >
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > ---
> > drivers/hv/vmbus_drv.c | 20 ++++++++++++++++++++
> > include/linux/hyperv.h | 2 ++
> > 2 files changed, 22 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index
> > 4d6b269..215aac9 100644
> > --- a/drivers/hv/vmbus_drv.c
> > +++ b/drivers/hv/vmbus_drv.c
> > @@ -385,6 +385,24 @@ static ssize_t in_write_bytes_avail_show(struct
> > device *dev, } static DEVICE_ATTR_RO(in_write_bytes_avail);
> >
> > +static ssize_t vendor_show(struct device *dev,
> > + struct device_attribute *dev_atttr,
> > + char *buf)
> > +{
> > + struct hv_device *hv_dev = device_to_hv_device(dev);
> > + return sprintf(buf, "0x%x\n", hv_dev->vendor_id); } static
> > +DEVICE_ATTR_RO(vendor);
> > +
> > +static ssize_t device_show(struct device *dev,
> > + struct device_attribute *dev_atttr,
> > + char *buf)
> > +{
> > + struct hv_device *hv_dev = device_to_hv_device(dev);
> > + return sprintf(buf, "0x%x\n", hv_dev->device_id); } static
> > +DEVICE_ATTR_RO(device);
> > +
> > /* Set up per device attributes in /sys/bus/vmbus/devices/<bus
> > device> */ static struct attribute *vmbus_attrs[] = {
> > &dev_attr_id.attr,
> > @@ -409,6 +427,8 @@ static struct attribute *vmbus_attrs[] = {
> > &dev_attr_in_write_index.attr,
> > &dev_attr_in_read_bytes_avail.attr,
> > &dev_attr_in_write_bytes_avail.attr,
> > + &dev_attr_vendor.attr,
> > + &dev_attr_device.attr,
> > NULL,
> > };
> > ATTRIBUTE_GROUPS(vmbus);
> > diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index
> > 476c685..6fe4dfe 100644
> > --- a/include/linux/hyperv.h
> > +++ b/include/linux/hyperv.h
> > @@ -891,6 +891,8 @@ struct hv_device {
> >
> > /* the device instance id of this device */
> > uuid_le dev_instance;
> > + u16 vendor_id;
> > + u16 device_id;
> >
> > struct device device;
> >
>
> You are adding new sysfs files without proper Documentation/ABI/ updates
> as well? You know better than that...
>
> And I don't see anything setting these fields, seems kind of pointless as-is,
> right?
Greg,
You are right, nothing sets these fields today but I am working on a guest infiniband RDMA driver that uses this.
This driver registers itself as an infiniband HW driver and the vendor device id is needed for IHV libraries to discover this driver from user mode. In some sense, these two fields are equivalent to the vendor ID and device of standard PCI devices as this VMBUS based infiniband driver needs to masquerade as the infiniband card in the host that is being presented to the guest.
I can resubmit this patch with the additional documentation.
Regards,
K. Y
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-18 1:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-17 22:52 [PATCH 1/1] Drivers: hv: vmbus: Add device and vendor ID to vmbus devices K. Y. Srinivasan
2014-12-18 0:17 ` Greg KH
2014-12-18 0:46 ` KY Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox