2022-09-08 22:30:00

by Easwar Hariharan

[permalink] [raw]
Subject: [PATCH 1/3] hv: Use PCI_VENDOR_ID_MICROSOFT for better discoverability

From: Easwar Hariharan <[email protected]>

Signed-off-by: Easwar Hariharan <[email protected]>
---
drivers/hv/vmbus_drv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 23c680d..8d90855 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -38,6 +38,8 @@
#include <clocksource/hyperv_timer.h>
#include "hyperv_vmbus.h"

+#define PCI_VENDOR_ID_MICROSOFT 0x1414
+
struct vmbus_dynid {
struct list_head node;
struct hv_vmbus_device_id id;
@@ -2051,7 +2053,7 @@ struct hv_device *vmbus_device_create(const guid_t *type,
child_device_obj->channel = channel;
guid_copy(&child_device_obj->dev_type, type);
guid_copy(&child_device_obj->dev_instance, instance);
- child_device_obj->vendor_id = 0x1414; /* MSFT vendor ID */
+ child_device_obj->vendor_id = PCI_VENDOR_ID_MICROSOFT;

return child_device_obj;
}
--
1.8.3.1


2022-09-08 22:34:03

by Easwar Hariharan

[permalink] [raw]
Subject: [PATCH 3/3] pci_ids: Add the various Microsoft PCI device IDs

From: Easwar Hariharan <[email protected]>

Signed-off-by: Easwar Hariharan <[email protected]>
---
drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 4 +---
drivers/net/ethernet/microsoft/mana/gdma.h | 3 ---
drivers/net/ethernet/microsoft/mana/gdma_main.c | 6 +++---
drivers/video/fbdev/hyperv_fb.c | 6 ++----
include/linux/pci_ids.h | 3 +++
5 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
index 61083c7..695d3a7 100644
--- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
@@ -23,8 +23,6 @@
#define DRIVER_MAJOR 1
#define DRIVER_MINOR 0

-#define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353
-
DEFINE_DRM_GEM_FOPS(hv_fops);

static struct drm_driver hyperv_driver = {
@@ -53,7 +51,7 @@ static void hyperv_pci_remove(struct pci_dev *pdev)
static const struct pci_device_id hyperv_pci_tbl[] = {
{
.vendor = PCI_VENDOR_ID_MICROSOFT,
- .device = PCI_DEVICE_ID_HYPERV_VIDEO,
+ .device = PCI_DEVICE_ID_MICROSOFT_HYPERV_VIDEO,
},
{ /* end of list */ }
};
diff --git a/drivers/net/ethernet/microsoft/mana/gdma.h b/drivers/net/ethernet/microsoft/mana/gdma.h
index 4a6efe6..9d3a9f7 100644
--- a/drivers/net/ethernet/microsoft/mana/gdma.h
+++ b/drivers/net/ethernet/microsoft/mana/gdma.h
@@ -476,9 +476,6 @@ struct gdma_eqe {

#define GDMA_SRIOV_REG_CFG_BASE_OFF 0x108

-#define MANA_PF_DEVICE_ID 0x00B9
-#define MANA_VF_DEVICE_ID 0x00BA
-
struct gdma_posted_wqe_info {
u32 wqe_size_in_bu;
};
diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
index 00d8198..18cf168 100644
--- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
+++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
@@ -1333,7 +1333,7 @@ static void mana_gd_cleanup(struct pci_dev *pdev)

static bool mana_is_pf(unsigned short dev_id)
{
- return dev_id == MANA_PF_DEVICE_ID;
+ return dev_id == PCI_DEVICE_ID_MICROSOFT_MANA_PF;
}

static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
@@ -1466,8 +1466,8 @@ static void mana_gd_shutdown(struct pci_dev *pdev)
}

static const struct pci_device_id mana_id_table[] = {
- { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_PF_DEVICE_ID) },
- { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_VF_DEVICE_ID) },
+ { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, PCI_DEVICE_ID_MICROSOFT_MANA_PF) },
+ { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, PCI_DEVICE_ID_MICROSOFT_MANA_VF) },
{ }
};

diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index a502c80..b9277e5 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -73,8 +73,6 @@
#define SYNTHVID_DEPTH_WIN8 32
#define SYNTHVID_FB_SIZE_WIN8 (8 * 1024 * 1024)

-#define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353
-
enum pipe_msg_type {
PIPE_MSG_INVALID,
PIPE_MSG_DATA,
@@ -998,7 +996,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)

if (!gen2vm) {
pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
- PCI_DEVICE_ID_HYPERV_VIDEO, NULL);
+ PCI_DEVICE_ID_MICROSOFT_HYPERV_VIDEO, NULL);
if (!pdev) {
pr_err("Unable to find PCI Hyper-V video\n");
return -ENODEV;
@@ -1312,7 +1310,7 @@ static int hvfb_resume(struct hv_device *hdev)
static const struct pci_device_id pci_stub_id_table[] = {
{
.vendor = PCI_VENDOR_ID_MICROSOFT,
- .device = PCI_DEVICE_ID_HYPERV_VIDEO,
+ .device = PCI_DEVICE_ID_MICROSOFT_HYPERV_VIDEO,
},
{ /* end of list */ }
};
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c008fda..0bef8e6 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2080,6 +2080,9 @@
#define PCI_DEVICE_ID_VT1724 0x1724

#define PCI_VENDOR_ID_MICROSOFT 0x1414
+#define PCI_DEVICE_ID_MICROSOFT_HYPERV_VIDEO 0x5353
+#define PCI_DEVICE_ID_MICROSOFT_MANA_PF 0x00B9
+#define PCI_DEVICE_ID_MICROSOFT_MANA_VF 0x00BA

#define PCI_VENDOR_ID_OXSEMI 0x1415
#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403
--
1.8.3.1

2022-09-08 22:37:55

by Easwar Hariharan

[permalink] [raw]
Subject: [PATCH 2/3] pci_ids: Add Microsoft PCI Vendor ID, and remove redundant definitions

From: Easwar Hariharan <[email protected]>

Move the Microsoft PCI Vendor ID from the various drivers to the pci_ids
file

Signed-off-by: Easwar Hariharan <[email protected]>
---
drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 1 -
drivers/net/ethernet/microsoft/mana/gdma_main.c | 4 ----
drivers/video/fbdev/hyperv_fb.c | 3 ---
include/linux/pci_ids.h | 2 ++
4 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
index 6d11e79..61083c7 100644
--- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
@@ -23,7 +23,6 @@
#define DRIVER_MAJOR 1
#define DRIVER_MINOR 0

-#define PCI_VENDOR_ID_MICROSOFT 0x1414
#define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353

DEFINE_DRM_GEM_FOPS(hv_fops);
diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
index 5f92401..00d8198 100644
--- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
+++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
@@ -1465,10 +1465,6 @@ static void mana_gd_shutdown(struct pci_dev *pdev)
pci_disable_device(pdev);
}

-#ifndef PCI_VENDOR_ID_MICROSOFT
-#define PCI_VENDOR_ID_MICROSOFT 0x1414
-#endif
-
static const struct pci_device_id mana_id_table[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_PF_DEVICE_ID) },
{ PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_VF_DEVICE_ID) },
diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index 886c564..a502c80 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -58,7 +58,6 @@

#include <linux/hyperv.h>

-
/* Hyper-V Synthetic Video Protocol definitions and structures */
#define MAX_VMBUS_PKT_SIZE 0x4000

@@ -74,10 +73,8 @@
#define SYNTHVID_DEPTH_WIN8 32
#define SYNTHVID_FB_SIZE_WIN8 (8 * 1024 * 1024)

-#define PCI_VENDOR_ID_MICROSOFT 0x1414
#define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353

-
enum pipe_msg_type {
PIPE_MSG_INVALID,
PIPE_MSG_DATA,
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 6feade6..c008fda 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2079,6 +2079,8 @@
#define PCI_DEVICE_ID_ICE_1712 0x1712
#define PCI_DEVICE_ID_VT1724 0x1724

+#define PCI_VENDOR_ID_MICROSOFT 0x1414
+
#define PCI_VENDOR_ID_OXSEMI 0x1415
#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403
#define PCI_DEVICE_ID_OXSEMI_PCIe840 0xC000
--
1.8.3.1

2022-09-09 14:26:40

by Vitaly Kuznetsov

[permalink] [raw]
Subject: Re: [PATCH 2/3] pci_ids: Add Microsoft PCI Vendor ID, and remove redundant definitions

[email protected] writes:

> From: Easwar Hariharan <[email protected]>
>
> Move the Microsoft PCI Vendor ID from the various drivers to the pci_ids
> file
>
> Signed-off-by: Easwar Hariharan <[email protected]>
> ---
> drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 1 -
> drivers/net/ethernet/microsoft/mana/gdma_main.c | 4 ----
> drivers/video/fbdev/hyperv_fb.c | 3 ---
> include/linux/pci_ids.h | 2 ++
> 4 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> index 6d11e79..61083c7 100644
> --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> @@ -23,7 +23,6 @@
> #define DRIVER_MAJOR 1
> #define DRIVER_MINOR 0
>
> -#define PCI_VENDOR_ID_MICROSOFT 0x1414
> #define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353
>
> DEFINE_DRM_GEM_FOPS(hv_fops);
> diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> index 5f92401..00d8198 100644
> --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> @@ -1465,10 +1465,6 @@ static void mana_gd_shutdown(struct pci_dev *pdev)
> pci_disable_device(pdev);
> }
>
> -#ifndef PCI_VENDOR_ID_MICROSOFT
> -#define PCI_VENDOR_ID_MICROSOFT 0x1414
> -#endif
> -
> static const struct pci_device_id mana_id_table[] = {
> { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_PF_DEVICE_ID) },
> { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_VF_DEVICE_ID) },
> diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
> index 886c564..a502c80 100644
> --- a/drivers/video/fbdev/hyperv_fb.c
> +++ b/drivers/video/fbdev/hyperv_fb.c
> @@ -58,7 +58,6 @@
>
> #include <linux/hyperv.h>
>
> -
> /* Hyper-V Synthetic Video Protocol definitions and structures */
> #define MAX_VMBUS_PKT_SIZE 0x4000
>
> @@ -74,10 +73,8 @@
> #define SYNTHVID_DEPTH_WIN8 32
> #define SYNTHVID_FB_SIZE_WIN8 (8 * 1024 * 1024)
>
> -#define PCI_VENDOR_ID_MICROSOFT 0x1414
> #define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353
>
> -
> enum pipe_msg_type {
> PIPE_MSG_INVALID,
> PIPE_MSG_DATA,
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index 6feade6..c008fda 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -2079,6 +2079,8 @@
> #define PCI_DEVICE_ID_ICE_1712 0x1712
> #define PCI_DEVICE_ID_VT1724 0x1724
>
> +#define PCI_VENDOR_ID_MICROSOFT 0x1414
> +
> #define PCI_VENDOR_ID_OXSEMI 0x1415
> #define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403
> #define PCI_DEVICE_ID_OXSEMI_PCIe840 0xC000

I've sent a similar patch recently:
https://lore.kernel.org/linux-hyperv/[email protected]/

which Wei has already queued to hyperv/fixes. Moving
PCI_DEVICE_ID_MICROSOFT_MANA_PF/VF definitions to 'pci_ids.h' does make
sense but please rebase first.

--
Vitaly