Thomas Zimmermann
2021-Jan-07 08:07 UTC
[Nouveau] [PATCH v3 8/8] drm: Upcast struct drm_device.dev to struct pci_device; replace pdev
We have DRM drivers based on USB, SPI and platform devices. All of them are fine with storing their device reference in struct drm_device.dev. PCI devices should be no exception. Therefore struct drm_device.pdev is deprecated. Instead upcast from struct drm_device.dev with to_pci_dev(). PCI-specific code can use dev_is_pci() to test for a PCI device. This patch changes the DRM core code and documentation accordingly. Struct drm_device.pdev is being moved to legacy status. Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de> Acked-by: Sam Ravnborg <sam at ravnborg.org> --- drivers/gpu/drm/drm_agpsupport.c | 9 ++++++--- drivers/gpu/drm/drm_bufs.c | 4 ++-- drivers/gpu/drm/drm_edid.c | 7 ++++++- drivers/gpu/drm/drm_irq.c | 12 +++++++----- drivers/gpu/drm/drm_pci.c | 26 +++++++++++++++----------- drivers/gpu/drm/drm_vm.c | 2 +- include/drm/drm_device.h | 12 +++++++++--- 7 files changed, 46 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c index 4c7ad46fdd21..a4040fe4f4ba 100644 --- a/drivers/gpu/drm/drm_agpsupport.c +++ b/drivers/gpu/drm/drm_agpsupport.c @@ -103,11 +103,13 @@ int drm_agp_info_ioctl(struct drm_device *dev, void *data, */ int drm_agp_acquire(struct drm_device *dev) { + struct pci_dev *pdev = to_pci_dev(dev->dev); + if (!dev->agp) return -ENODEV; if (dev->agp->acquired) return -EBUSY; - dev->agp->bridge = agp_backend_acquire(dev->pdev); + dev->agp->bridge = agp_backend_acquire(pdev); if (!dev->agp->bridge) return -ENODEV; dev->agp->acquired = 1; @@ -402,14 +404,15 @@ int drm_agp_free_ioctl(struct drm_device *dev, void *data, */ struct drm_agp_head *drm_agp_init(struct drm_device *dev) { + struct pci_dev *pdev = to_pci_dev(dev->dev); struct drm_agp_head *head = NULL; head = kzalloc(sizeof(*head), GFP_KERNEL); if (!head) return NULL; - head->bridge = agp_find_bridge(dev->pdev); + head->bridge = agp_find_bridge(pdev); if (!head->bridge) { - head->bridge = agp_backend_acquire(dev->pdev); + head->bridge = agp_backend_acquire(pdev); if (!head->bridge) { kfree(head); return NULL; diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index aeb1327e3077..e3d77dfefb0a 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -326,7 +326,7 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset, * As we're limiting the address to 2^32-1 (or less), * casting it down to 32 bits is no problem, but we * need to point to a 64bit variable first. */ - map->handle = dma_alloc_coherent(&dev->pdev->dev, + map->handle = dma_alloc_coherent(dev->dev, map->size, &map->offset, GFP_KERNEL); @@ -556,7 +556,7 @@ int drm_legacy_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) case _DRM_SCATTER_GATHER: break; case _DRM_CONSISTENT: - dma_free_coherent(&dev->pdev->dev, + dma_free_coherent(dev->dev, map->size, map->handle, map->offset); diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 394cc55b3214..c2bbe7bee7b6 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -32,6 +32,7 @@ #include <linux/i2c.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/pci.h> #include <linux/slab.h> #include <linux/vga_switcheroo.h> @@ -2075,9 +2076,13 @@ EXPORT_SYMBOL(drm_get_edid); struct edid *drm_get_edid_switcheroo(struct drm_connector *connector, struct i2c_adapter *adapter) { - struct pci_dev *pdev = connector->dev->pdev; + struct drm_device *dev = connector->dev; + struct pci_dev *pdev = to_pci_dev(dev->dev); struct edid *edid; + if (drm_WARN_ON_ONCE(dev, !dev_is_pci(dev->dev))) + return NULL; + vga_switcheroo_lock_ddc(pdev); edid = drm_get_edid(connector, adapter); vga_switcheroo_unlock_ddc(pdev); diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 803af4bbd214..c3bd664ea733 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -122,7 +122,7 @@ int drm_irq_install(struct drm_device *dev, int irq) dev->driver->irq_preinstall(dev); /* PCI devices require shared interrupts. */ - if (dev->pdev) + if (dev_is_pci(dev->dev)) sh_flags = IRQF_SHARED; ret = request_irq(irq, dev->driver->irq_handler, @@ -140,7 +140,7 @@ int drm_irq_install(struct drm_device *dev, int irq) if (ret < 0) { dev->irq_enabled = false; if (drm_core_check_feature(dev, DRIVER_LEGACY)) - vga_client_register(dev->pdev, NULL, NULL, NULL); + vga_client_register(to_pci_dev(dev->dev), NULL, NULL, NULL); free_irq(irq, dev); } else { dev->irq = irq; @@ -203,7 +203,7 @@ int drm_irq_uninstall(struct drm_device *dev) DRM_DEBUG("irq=%d\n", dev->irq); if (drm_core_check_feature(dev, DRIVER_LEGACY)) - vga_client_register(dev->pdev, NULL, NULL, NULL); + vga_client_register(to_pci_dev(dev->dev), NULL, NULL, NULL); if (dev->driver->irq_uninstall) dev->driver->irq_uninstall(dev); @@ -252,6 +252,7 @@ int drm_legacy_irq_control(struct drm_device *dev, void *data, { struct drm_control *ctl = data; int ret = 0, irq; + struct pci_dev *pdev; /* if we haven't irq we fallback for compatibility reasons - * this used to be a separate function in drm_dma.h @@ -262,12 +263,13 @@ int drm_legacy_irq_control(struct drm_device *dev, void *data, if (!drm_core_check_feature(dev, DRIVER_LEGACY)) return 0; /* UMS was only ever supported on pci devices. */ - if (WARN_ON(!dev->pdev)) + if (WARN_ON(!dev_is_pci(dev->dev))) return -EINVAL; switch (ctl->func) { case DRM_INST_HANDLER: - irq = dev->pdev->irq; + pdev = to_pci_dev(dev->dev); + irq = pdev->irq; if (dev->if_version < DRM_IF_VERSION(1, 2) && ctl->irq != irq) diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 6dba4b8ce4fe..c7868418e36d 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c @@ -65,7 +65,7 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali return NULL; dmah->size = size; - dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, + dmah->vaddr = dma_alloc_coherent(dev->dev, size, &dmah->busaddr, GFP_KERNEL); @@ -88,7 +88,7 @@ EXPORT_SYMBOL(drm_pci_alloc); */ void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) { - dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr, + dma_free_coherent(dev->dev, dmah->size, dmah->vaddr, dmah->busaddr); kfree(dmah); } @@ -107,16 +107,18 @@ static int drm_get_pci_domain(struct drm_device *dev) return 0; #endif /* __alpha__ */ - return pci_domain_nr(dev->pdev->bus); + return pci_domain_nr(to_pci_dev(dev->dev)->bus); } int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) { + struct pci_dev *pdev = to_pci_dev(dev->dev); + master->unique = kasprintf(GFP_KERNEL, "pci:%04x:%02x:%02x.%d", drm_get_pci_domain(dev), - dev->pdev->bus->number, - PCI_SLOT(dev->pdev->devfn), - PCI_FUNC(dev->pdev->devfn)); + pdev->bus->number, + PCI_SLOT(pdev->devfn), + PCI_FUNC(pdev->devfn)); if (!master->unique) return -ENOMEM; @@ -126,12 +128,14 @@ int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) { + struct pci_dev *pdev = to_pci_dev(dev->dev); + if ((p->busnum >> 8) != drm_get_pci_domain(dev) || - (p->busnum & 0xff) != dev->pdev->bus->number || - p->devnum != PCI_SLOT(dev->pdev->devfn) || p->funcnum != PCI_FUNC(dev->pdev->devfn)) + (p->busnum & 0xff) != pdev->bus->number || + p->devnum != PCI_SLOT(pdev->devfn) || p->funcnum != PCI_FUNC(pdev->devfn)) return -EINVAL; - p->irq = dev->pdev->irq; + p->irq = pdev->irq; DRM_DEBUG("%d:%d:%d => IRQ %d\n", p->busnum, p->devnum, p->funcnum, p->irq); @@ -159,7 +163,7 @@ int drm_legacy_irq_by_busid(struct drm_device *dev, void *data, return -EOPNOTSUPP; /* UMS was only ever support on PCI devices. */ - if (WARN_ON(!dev->pdev)) + if (WARN_ON(!dev_is_pci(dev->dev))) return -EINVAL; if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) @@ -183,7 +187,7 @@ void drm_pci_agp_destroy(struct drm_device *dev) static void drm_pci_agp_init(struct drm_device *dev) { if (drm_core_check_feature(dev, DRIVER_USE_AGP)) { - if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP)) + if (pci_find_capability(to_pci_dev(dev->dev), PCI_CAP_ID_AGP)) dev->agp = drm_agp_init(dev); if (dev->agp) { dev->agp->agp_mtrr = arch_phys_wc_add( diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index 6d5a03b32238..9b3b989d7cad 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c @@ -278,7 +278,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) case _DRM_SCATTER_GATHER: break; case _DRM_CONSISTENT: - dma_free_coherent(&dev->pdev->dev, + dma_free_coherent(dev->dev, map->size, map->handle, map->offset); diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h index 283a93ce4617..9d9db178119a 100644 --- a/include/drm/drm_device.h +++ b/include/drm/drm_device.h @@ -290,9 +290,6 @@ struct drm_device { /** @agp: AGP data */ struct drm_agp_head *agp; - /** @pdev: PCI device structure */ - struct pci_dev *pdev; - #ifdef __alpha__ /** @hose: PCI hose, only used on ALPHA platforms. */ struct pci_controller *hose; @@ -336,6 +333,15 @@ struct drm_device { /* Everything below here is for legacy driver, never use! */ /* private: */ #if IS_ENABLED(CONFIG_DRM_LEGACY) + /** + * @pdev: PCI device structure + * + * This is deprecated. to get the PCI device, upcast from @dev + * with to_pci_dev(). To test if the hardware is a PCI device, + * use dev_is_pci() with @dev. + */ + struct pci_dev *pdev; + /* Context handle management - linked list of context handles */ struct list_head ctxlist; -- 2.29.2
kernel test robot
2021-Jan-07 09:45 UTC
[Nouveau] [PATCH v3 8/8] drm: Upcast struct drm_device.dev to struct pci_device; replace pdev
Hi Thomas, I love your patch! Yet something to improve: [auto build test ERROR on drm-tip/drm-tip] [cannot apply to drm-intel/for-linux-next linus/master v5.11-rc2 next-20210104] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Move-struct-drm_device-pdev-to-legacy/20210107-161007 base: git://anongit.freedesktop.org/drm/drm-tip drm-tip config: x86_64-randconfig-s021-20210107 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-208-g46a52ca4-dirty # https://github.com/0day-ci/linux/commit/380912f7b62c23322562c40e19efd7ad84d57e9c git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Thomas-Zimmermann/drm-Move-struct-drm_device-pdev-to-legacy/20210107-161007 git checkout 380912f7b62c23322562c40e19efd7ad84d57e9c # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp at intel.com> All errors (new ones prefixed by >>): drivers/gpu/drm/gma500/oaktrail_device.c: In function 'oaktrail_chip_setup':>> drivers/gpu/drm/gma500/oaktrail_device.c:509:26: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'?509 | if (pci_enable_msi(dev->pdev)) | ^~~~ | dev -- drivers/gpu/drm/gma500/oaktrail_lvds.c: In function 'oaktrail_lvds_set_power':>> drivers/gpu/drm/gma500/oaktrail_lvds.c:63:25: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'?63 | pm_request_idle(&dev->pdev->dev); | ^~~~ | dev -- drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c: In function 'get_clock': drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c:69:11: warning: variable 'tmp' set but not used [-Wunused-but-set-variable] 69 | u32 val, tmp; | ^~~ drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c: In function 'get_data': drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c:83:11: warning: variable 'tmp' set but not used [-Wunused-but-set-variable] 83 | u32 val, tmp; | ^~~ drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c: In function 'oaktrail_lvds_i2c_init':>> drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c:148:35: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'?148 | chan->adapter.dev.parent = &dev->pdev->dev; | ^~~~ | dev -- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c: In function 'vmw_driver_load':>> drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:661:22: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'?661 | pci_set_master(dev->pdev); | ^~~~ | dev In file included from drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:31: drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:690:47: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 690 | dev_priv->io_start = pci_resource_start(dev->pdev, 0); | ^~~~ include/linux/pci.h:1854:40: note: in definition of macro 'pci_resource_start' 1854 | #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) | ^~~ drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:691:49: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 691 | dev_priv->vram_start = pci_resource_start(dev->pdev, 1); | ^~~~ include/linux/pci.h:1854:40: note: in definition of macro 'pci_resource_start' 1854 | #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) | ^~~ drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:692:49: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 692 | dev_priv->mmio_start = pci_resource_start(dev->pdev, 2); | ^~~~ include/linux/pci.h:1854:40: note: in definition of macro 'pci_resource_start' 1854 | #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) | ^~~ drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:842:33: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 842 | ret = pci_request_regions(dev->pdev, "vmwgfx probe"); | ^~~~ | dev drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:851:33: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 851 | ret = pci_request_region(dev->pdev, 2, "vmwgfx stealth probe"); | ^~~~ | dev drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:859:35: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 859 | ret = vmw_irq_install(dev, dev->pdev->irq); | ^~~~ | dev drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:1005:27: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 1005 | pci_release_region(dev->pdev, 2); | ^~~~ | dev drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:1007:28: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 1007 | pci_release_regions(dev->pdev); | ^~~~ | dev drivers/gpu/drm/vmwgfx/vmwgfx_drv.c: In function 'vmw_driver_unload': drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:1056:27: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 1056 | pci_release_region(dev->pdev, 2); | ^~~~ | dev drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:1058:28: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 1058 | pci_release_regions(dev->pdev); | ^~~~ | dev drivers/gpu/drm/vmwgfx/vmwgfx_drv.c: In function 'vmw_probe': drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:1522:7: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 1522 | dev->pdev = pdev; | ^~~~ | dev -- drivers/gpu/drm/vmwgfx/vmwgfx_fb.c: In function 'vmw_fb_init':>> drivers/gpu/drm/vmwgfx/vmwgfx_fb.c:641:42: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'?641 | struct device *device = &vmw_priv->dev->pdev->dev; | ^~~~ | dev In file included from drivers/gpu/drm/vmwgfx/vmwgfx_fb.c:35: At top level: drivers/gpu/drm/vmwgfx/vmwgfx_kms.h:256:23: warning: 'vmw_cursor_plane_formats' defined but not used [-Wunused-const-variable=] 256 | static const uint32_t vmw_cursor_plane_formats[] = { | ^~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/vmwgfx/vmwgfx_kms.h:248:23: warning: 'vmw_primary_plane_formats' defined but not used [-Wunused-const-variable=] 248 | static const uint32_t vmw_primary_plane_formats[] = { | ^~~~~~~~~~~~~~~~~~~~~~~~~ -- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function 'vmw_cmdbuf_set_pool_size':>> drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:1233:48: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'?1233 | man->map = dma_alloc_coherent(&dev_priv->dev->pdev->dev, size, | ^~~~ | dev drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function 'vmw_cmdbuf_man_create': drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:1316:28: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 1316 | &dev_priv->dev->pdev->dev, | ^~~~ | dev drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:1325:22: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 1325 | &dev_priv->dev->pdev->dev, | ^~~~ | dev drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function 'vmw_cmdbuf_remove_pool': drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:1390:42: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'? 1390 | dma_free_coherent(&man->dev_priv->dev->pdev->dev, | ^~~~ | dev vim +509 drivers/gpu/drm/gma500/oaktrail_device.c 1b082ccf5901108 Alan Cox 2011-11-03 503 1b22edfd6efd02b Alan Cox 2011-11-29 504 static int oaktrail_chip_setup(struct drm_device *dev) aa0c45fdca0cff3 Alan Cox 2011-11-29 505 { 1b22edfd6efd02b Alan Cox 2011-11-29 506 struct drm_psb_private *dev_priv = dev->dev_private; 1b22edfd6efd02b Alan Cox 2011-11-29 507 int ret; 1b22edfd6efd02b Alan Cox 2011-11-29 508 9c0b6fcdc9faee5 Alan Cox 2012-05-11 @509 if (pci_enable_msi(dev->pdev)) 9c0b6fcdc9faee5 Alan Cox 2012-05-11 510 dev_warn(dev->dev, "Enabling MSI failed!\n"); 9c0b6fcdc9faee5 Alan Cox 2012-05-11 511 8512e0748729a49 Alan Cox 2012-05-11 512 dev_priv->regmap = oaktrail_regmap; 8512e0748729a49 Alan Cox 2012-05-11 513 1b22edfd6efd02b Alan Cox 2011-11-29 514 ret = mid_chip_setup(dev); aa0c45fdca0cff3 Alan Cox 2011-11-29 515 if (ret < 0) aa0c45fdca0cff3 Alan Cox 2011-11-29 516 return ret; 4086b1e2b19729e Kirill A. Shutemov 2012-05-03 517 if (!dev_priv->has_gct) { aa0c45fdca0cff3 Alan Cox 2011-11-29 518 /* Now pull the BIOS data */ d839ede47a56ff5 Alan Cox 2012-05-03 519 psb_intel_opregion_init(dev); aa0c45fdca0cff3 Alan Cox 2011-11-29 520 psb_intel_init_bios(dev); aa0c45fdca0cff3 Alan Cox 2011-11-29 521 } 6528c897966c7d5 Patrik Jakobsson 2013-11-07 522 gma_intel_setup_gmbus(dev); 5f503148efdda26 Alan Cox 2012-05-03 523 oaktrail_hdmi_setup(dev); aa0c45fdca0cff3 Alan Cox 2011-11-29 524 return 0; aa0c45fdca0cff3 Alan Cox 2011-11-29 525 } aa0c45fdca0cff3 Alan Cox 2011-11-29 526 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/gzip Size: 35839 bytes Desc: not available URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20210107/a791e9ad/attachment-0001.gz>
kernel test robot
2021-Jan-07 09:47 UTC
[Nouveau] [PATCH v3 8/8] drm: Upcast struct drm_device.dev to struct pci_device; replace pdev
Hi Thomas, I love your patch! Yet something to improve: [auto build test ERROR on drm-tip/drm-tip] [cannot apply to drm-intel/for-linux-next linus/master v5.11-rc2 next-20210104] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Move-struct-drm_device-pdev-to-legacy/20210107-161007 base: git://anongit.freedesktop.org/drm/drm-tip drm-tip config: microblaze-randconfig-r013-20210107 (attached as .config) compiler: microblaze-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/380912f7b62c23322562c40e19efd7ad84d57e9c git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Thomas-Zimmermann/drm-Move-struct-drm_device-pdev-to-legacy/20210107-161007 git checkout 380912f7b62c23322562c40e19efd7ad84d57e9c # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp at intel.com> All errors (new ones prefixed by >>): drivers/gpu/drm/virtio/virtgpu_drv.c: In function 'virtio_gpu_pci_quirk':>> drivers/gpu/drm/virtio/virtgpu_drv.c:57:7: error: 'struct drm_device' has no member named 'pdev'; did you mean 'dev'?57 | dev->pdev = pdev; | ^~~~ | dev vim +57 drivers/gpu/drm/virtio/virtgpu_drv.c dc5698e80cf724 Dave Airlie 2013-09-09 46 d516e75c71c985 Ezequiel Garcia 2019-01-08 47 static int virtio_gpu_pci_quirk(struct drm_device *dev, struct virtio_device *vdev) d516e75c71c985 Ezequiel Garcia 2019-01-08 48 { d516e75c71c985 Ezequiel Garcia 2019-01-08 49 struct pci_dev *pdev = to_pci_dev(vdev->dev.parent); d516e75c71c985 Ezequiel Garcia 2019-01-08 50 const char *pname = dev_name(&pdev->dev); d516e75c71c985 Ezequiel Garcia 2019-01-08 51 bool vga = (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA; d516e75c71c985 Ezequiel Garcia 2019-01-08 52 char unique[20]; d516e75c71c985 Ezequiel Garcia 2019-01-08 53 d516e75c71c985 Ezequiel Garcia 2019-01-08 54 DRM_INFO("pci: %s detected at %s\n", d516e75c71c985 Ezequiel Garcia 2019-01-08 55 vga ? "virtio-vga" : "virtio-gpu-pci", d516e75c71c985 Ezequiel Garcia 2019-01-08 56 pname); d516e75c71c985 Ezequiel Garcia 2019-01-08 @57 dev->pdev = pdev; d516e75c71c985 Ezequiel Garcia 2019-01-08 58 if (vga) d516e75c71c985 Ezequiel Garcia 2019-01-08 59 drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, d516e75c71c985 Ezequiel Garcia 2019-01-08 60 "virtiodrmfb"); d516e75c71c985 Ezequiel Garcia 2019-01-08 61 d516e75c71c985 Ezequiel Garcia 2019-01-08 62 /* d516e75c71c985 Ezequiel Garcia 2019-01-08 63 * Normally the drm_dev_set_unique() call is done by core DRM. d516e75c71c985 Ezequiel Garcia 2019-01-08 64 * The following comment covers, why virtio cannot rely on it. d516e75c71c985 Ezequiel Garcia 2019-01-08 65 * d516e75c71c985 Ezequiel Garcia 2019-01-08 66 * Unlike the other virtual GPU drivers, virtio abstracts the d516e75c71c985 Ezequiel Garcia 2019-01-08 67 * underlying bus type by using struct virtio_device. d516e75c71c985 Ezequiel Garcia 2019-01-08 68 * d516e75c71c985 Ezequiel Garcia 2019-01-08 69 * Hence the dev_is_pci() check, used in core DRM, will fail d516e75c71c985 Ezequiel Garcia 2019-01-08 70 * and the unique returned will be the virtio_device "virtio0", d516e75c71c985 Ezequiel Garcia 2019-01-08 71 * while a "pci:..." one is required. d516e75c71c985 Ezequiel Garcia 2019-01-08 72 * d516e75c71c985 Ezequiel Garcia 2019-01-08 73 * A few other ideas were considered: d516e75c71c985 Ezequiel Garcia 2019-01-08 74 * - Extend the dev_is_pci() check [in drm_set_busid] to d516e75c71c985 Ezequiel Garcia 2019-01-08 75 * consider virtio. d516e75c71c985 Ezequiel Garcia 2019-01-08 76 * Seems like a bigger hack than what we have already. d516e75c71c985 Ezequiel Garcia 2019-01-08 77 * d516e75c71c985 Ezequiel Garcia 2019-01-08 78 * - Point drm_device::dev to the parent of the virtio_device d516e75c71c985 Ezequiel Garcia 2019-01-08 79 * Semantic changes: d516e75c71c985 Ezequiel Garcia 2019-01-08 80 * * Using the wrong device for i2c, framebuffer_alloc and d516e75c71c985 Ezequiel Garcia 2019-01-08 81 * prime import. d516e75c71c985 Ezequiel Garcia 2019-01-08 82 * Visual changes: d516e75c71c985 Ezequiel Garcia 2019-01-08 83 * * Helpers such as DRM_DEV_ERROR, dev_info, drm_printer, d516e75c71c985 Ezequiel Garcia 2019-01-08 84 * will print the wrong information. d516e75c71c985 Ezequiel Garcia 2019-01-08 85 * d516e75c71c985 Ezequiel Garcia 2019-01-08 86 * We could address the latter issues, by introducing d516e75c71c985 Ezequiel Garcia 2019-01-08 87 * drm_device::bus_dev, ... which would be used solely for this. d516e75c71c985 Ezequiel Garcia 2019-01-08 88 * d516e75c71c985 Ezequiel Garcia 2019-01-08 89 * So for the moment keep things as-is, with a bulky comment d516e75c71c985 Ezequiel Garcia 2019-01-08 90 * for the next person who feels like removing this d516e75c71c985 Ezequiel Garcia 2019-01-08 91 * drm_dev_set_unique() quirk. d516e75c71c985 Ezequiel Garcia 2019-01-08 92 */ d516e75c71c985 Ezequiel Garcia 2019-01-08 93 snprintf(unique, sizeof(unique), "pci:%s", pname); d516e75c71c985 Ezequiel Garcia 2019-01-08 94 return drm_dev_set_unique(dev, unique); d516e75c71c985 Ezequiel Garcia 2019-01-08 95 } d516e75c71c985 Ezequiel Garcia 2019-01-08 96 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org -------------- next part -------------- A non-text attachment was scrubbed... Name: .config.gz Type: application/gzip Size: 28882 bytes Desc: not available URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20210107/ffb28ea5/attachment-0001.gz>