LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: QEMU top-level IDs for (sub)vendor & device
@ 2016-01-25 16:37 Robin H. Johnson
  2016-01-29  8:49 ` Gerd Hoffmann
  2016-01-29  9:02 ` Jani Nikula
  0 siblings, 2 replies; 4+ messages in thread
From: Robin H. Johnson @ 2016-01-25 16:37 UTC (permalink / raw
  To: linux-kernel; +Cc: dri-devel, Robin H. Johnson

Introduce PCI_VENDOR/PCI_SUBVENDOR/PCI_SUBDEVICE defines to replace the
constants scattered in the kernel already used to detect QEMU.

They are defined in the QEMU codebase per docs/specs/pci-ids.txt.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
This change prompted by a near-miss in the review of recent change:
'drm/i915: refine qemu south bridge detection'

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
---
 drivers/gpu/drm/bochs/bochs_drv.c   | 4 ++--
 drivers/gpu/drm/cirrus/cirrus_drv.c | 5 +++--
 drivers/virtio/virtio_pci_common.c  | 2 +-
 include/linux/pci_ids.h             | 4 ++++
 sound/pci/intel8x0.c                | 4 ++--
 5 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
index 7f1a360..b332b4d3 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -182,8 +182,8 @@ static const struct pci_device_id bochs_pci_tbl[] = {
 	{
 		.vendor      = 0x1234,
 		.device      = 0x1111,
-		.subvendor   = 0x1af4,
-		.subdevice   = 0x1100,
+		.subvendor   = PCI_SUBVENDOR_ID_REDHAT_QUMRANET,
+		.subdevice   = PCI_SUBDEVICE_ID_QEMU,
 		.driver_data = BOCHS_QEMU_STDVGA,
 	},
 	{
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
index b1619e2..7bc394e 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -33,8 +33,9 @@ static struct drm_driver driver;
 
 /* only bind to the cirrus chip in qemu */
 static const struct pci_device_id pciidlist[] = {
-	{ PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, 0x1af4, 0x1100, 0,
-	  0, 0 },
+	{ PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446,
+	  PCI_SUBVENDOR_ID_REDHAT_QUMRANET, PCI_SUBDEVICE_ID_QEMU,
+	  0, 0, 0 },
 	{ PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, PCI_VENDOR_ID_XEN,
 	  0x0001, 0, 0, 0 },
 	{0,}
diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
index 36205c2..127dfe4 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -467,7 +467,7 @@ static const struct dev_pm_ops virtio_pci_pm_ops = {
 
 /* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. */
 static const struct pci_device_id virtio_pci_id_table[] = {
-	{ PCI_DEVICE(0x1af4, PCI_ANY_ID) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, PCI_ANY_ID) },
 	{ 0 }
 };
 
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 37f05cb..6d249d3 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2506,6 +2506,10 @@
 
 #define PCI_VENDOR_ID_AZWAVE		0x1a3b
 
+#define PCI_VENDOR_ID_REDHAT_QUMRANET    0x1af4
+#define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4
+#define PCI_SUBDEVICE_ID_QEMU            0x1100
+
 #define PCI_VENDOR_ID_ASMEDIA		0x1b21
 
 #define PCI_VENDOR_ID_CIRCUITCO		0x1cc8
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 42bcbac..12c2c18 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2980,8 +2980,8 @@ static int snd_intel8x0_inside_vm(struct pci_dev *pci)
 		goto fini;
 
 	/* check for known (emulated) devices */
-	if (pci->subsystem_vendor == 0x1af4 &&
-	    pci->subsystem_device == 0x1100) {
+	if (pci->subsystem_vendor == PCI_SUBVENDOR_ID_REDHAT_QUMRANET &&
+	    pci->subsystem_device == PCI_SUBDEVICE_ID_QEMU) {
 		/* KVM emulated sound, PCI SSID: 1af4:1100 */
 		msg = "enable KVM";
 	} else if (pci->subsystem_vendor == 0x1ab8) {
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: QEMU top-level IDs for (sub)vendor & device
  2016-01-25 16:37 [PATCH] PCI: QEMU top-level IDs for (sub)vendor & device Robin H. Johnson
@ 2016-01-29  8:49 ` Gerd Hoffmann
  2016-01-29  9:02 ` Jani Nikula
  1 sibling, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2016-01-29  8:49 UTC (permalink / raw
  To: Robin H. Johnson; +Cc: linux-kernel, dri-devel

On Mo, 2016-01-25 at 08:37 -0800, Robin H. Johnson wrote:
> Introduce PCI_VENDOR/PCI_SUBVENDOR/PCI_SUBDEVICE defines to replace the
> constants scattered in the kernel already used to detect QEMU.
> 
> They are defined in the QEMU codebase per docs/specs/pci-ids.txt.

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: QEMU top-level IDs for (sub)vendor & device
  2016-01-25 16:37 [PATCH] PCI: QEMU top-level IDs for (sub)vendor & device Robin H. Johnson
  2016-01-29  8:49 ` Gerd Hoffmann
@ 2016-01-29  9:02 ` Jani Nikula
  2016-01-29  9:45   ` Takashi Iwai
  1 sibling, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2016-01-29  9:02 UTC (permalink / raw
  To: Robin H. Johnson, linux-kernel, mst, perex, tiwai, bhelgaas,
	Dave Airlie
  Cc: dri-devel, linux-pci, Gerd Hoffmann


This one's lacking some maintainers, adding for acks. There's already
review from Gerd [1], and seems like a good idea anyway.

Bjorn, I suppose it would make most sense to merge this via PCI tree,
right?


BR,
Jani.


[1] http://mid.gmane.org/1454057342.28516.45.camel@redhat.com



On Mon, 25 Jan 2016, "Robin H. Johnson" <robbat2@gentoo.org> wrote:
> Introduce PCI_VENDOR/PCI_SUBVENDOR/PCI_SUBDEVICE defines to replace the
> constants scattered in the kernel already used to detect QEMU.
>
> They are defined in the QEMU codebase per docs/specs/pci-ids.txt.
>
> Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
> ---
> This change prompted by a near-miss in the review of recent change:
> 'drm/i915: refine qemu south bridge detection'
>
> Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
> ---
>  drivers/gpu/drm/bochs/bochs_drv.c   | 4 ++--
>  drivers/gpu/drm/cirrus/cirrus_drv.c | 5 +++--
>  drivers/virtio/virtio_pci_common.c  | 2 +-
>  include/linux/pci_ids.h             | 4 ++++
>  sound/pci/intel8x0.c                | 4 ++--
>  5 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
> index 7f1a360..b332b4d3 100644
> --- a/drivers/gpu/drm/bochs/bochs_drv.c
> +++ b/drivers/gpu/drm/bochs/bochs_drv.c
> @@ -182,8 +182,8 @@ static const struct pci_device_id bochs_pci_tbl[] = {
>  	{
>  		.vendor      = 0x1234,
>  		.device      = 0x1111,
> -		.subvendor   = 0x1af4,
> -		.subdevice   = 0x1100,
> +		.subvendor   = PCI_SUBVENDOR_ID_REDHAT_QUMRANET,
> +		.subdevice   = PCI_SUBDEVICE_ID_QEMU,
>  		.driver_data = BOCHS_QEMU_STDVGA,
>  	},
>  	{
> diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
> index b1619e2..7bc394e 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_drv.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
> @@ -33,8 +33,9 @@ static struct drm_driver driver;
>  
>  /* only bind to the cirrus chip in qemu */
>  static const struct pci_device_id pciidlist[] = {
> -	{ PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, 0x1af4, 0x1100, 0,
> -	  0, 0 },
> +	{ PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446,
> +	  PCI_SUBVENDOR_ID_REDHAT_QUMRANET, PCI_SUBDEVICE_ID_QEMU,
> +	  0, 0, 0 },
>  	{ PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, PCI_VENDOR_ID_XEN,
>  	  0x0001, 0, 0, 0 },
>  	{0,}
> diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
> index 36205c2..127dfe4 100644
> --- a/drivers/virtio/virtio_pci_common.c
> +++ b/drivers/virtio/virtio_pci_common.c
> @@ -467,7 +467,7 @@ static const struct dev_pm_ops virtio_pci_pm_ops = {
>  
>  /* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. */
>  static const struct pci_device_id virtio_pci_id_table[] = {
> -	{ PCI_DEVICE(0x1af4, PCI_ANY_ID) },
> +	{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, PCI_ANY_ID) },
>  	{ 0 }
>  };
>  
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index 37f05cb..6d249d3 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -2506,6 +2506,10 @@
>  
>  #define PCI_VENDOR_ID_AZWAVE		0x1a3b
>  
> +#define PCI_VENDOR_ID_REDHAT_QUMRANET    0x1af4
> +#define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4
> +#define PCI_SUBDEVICE_ID_QEMU            0x1100
> +
>  #define PCI_VENDOR_ID_ASMEDIA		0x1b21
>  
>  #define PCI_VENDOR_ID_CIRCUITCO		0x1cc8
> diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
> index 42bcbac..12c2c18 100644
> --- a/sound/pci/intel8x0.c
> +++ b/sound/pci/intel8x0.c
> @@ -2980,8 +2980,8 @@ static int snd_intel8x0_inside_vm(struct pci_dev *pci)
>  		goto fini;
>  
>  	/* check for known (emulated) devices */
> -	if (pci->subsystem_vendor == 0x1af4 &&
> -	    pci->subsystem_device == 0x1100) {
> +	if (pci->subsystem_vendor == PCI_SUBVENDOR_ID_REDHAT_QUMRANET &&
> +	    pci->subsystem_device == PCI_SUBDEVICE_ID_QEMU) {
>  		/* KVM emulated sound, PCI SSID: 1af4:1100 */
>  		msg = "enable KVM";
>  	} else if (pci->subsystem_vendor == 0x1ab8) {

-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: QEMU top-level IDs for (sub)vendor & device
  2016-01-29  9:02 ` Jani Nikula
@ 2016-01-29  9:45   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2016-01-29  9:45 UTC (permalink / raw
  To: Jani Nikula
  Cc: Robin H. Johnson, Dave Airlie, bhelgaas, perex, mst, linux-kernel,
	dri-devel, Gerd Hoffmann, linux-pci

On Fri, 29 Jan 2016 10:02:54 +0100,
Jani Nikula wrote:
> 
> 
> This one's lacking some maintainers, adding for acks. There's already
> review from Gerd [1], and seems like a good idea anyway.

Feel free to take my ack, too
  Reviewed-by: Takashi Iwai <tiwai@suse.de>


thanks,

Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-29  9:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 16:37 [PATCH] PCI: QEMU top-level IDs for (sub)vendor & device Robin H. Johnson
2016-01-29  8:49 ` Gerd Hoffmann
2016-01-29  9:02 ` Jani Nikula
2016-01-29  9:45   ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).