V7 of the patchset fixes some bitrot in the intel driver.
The pdev field in struct drm_device points to a PCI device structure and goes back to UMS-only days when all DRM drivers were for PCI devices. Meanwhile we also support USB, SPI and platform devices. Each of those uses the generic device stored in struct drm_device.dev.
To reduce duplication and remove the special case of PCI, this patchset converts all modesetting drivers from pdev to dev and makes pdev a field for legacy UMS drivers.
For PCI devices, the pointer in struct drm_device.dev can be upcasted to struct pci_device; or tested for PCI with dev_is_pci(). In several places the code can use the dev field directly.
After converting all drivers and the DRM core, the pdev fields becomes only relevant for legacy drivers. In a later patchset, we may want to convert these as well and remove pdev entirely.
v7: * fix instances of pdev that have benn added under i915/ v6: * also remove assignment in i915/selftests in later patch (Chris) v5: * remove assignment in later patch (Chris) v4: * merged several patches * moved core changes into separate patch * vmwgfx build fix v3: * merged several patches * fix one pdev reference in nouveau (Jeremy) * rebases v2: * move whitespace fixes into separate patches (Alex, Sam) * move i915 gt/ and gvt/ changes into separate patches (Joonas)
Thomas Zimmermann (4): drm/i915/gt: Remove reference to struct drm_device.pdev drm/i915: Remove reference to struct drm_device.pdev drm/i915: Don't assign to struct drm_device.pdev drm: Move struct drm_device.pdev to legacy section
drivers/gpu/drm/i915/gt/intel_region_lmem.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 1 - drivers/gpu/drm/i915/intel_runtime_pm.h | 2 +- drivers/gpu/drm/i915/selftests/mock_gem_device.c | 1 - include/drm/drm_device.h | 6 +++--- 5 files changed, 5 insertions(+), 7 deletions(-)
-- 2.31.1
References to struct drm_device.pdev should be used any longer as the field will be moved into the struct's legacy section. Add a fix for the rsp commit.
Signed-off-by: Thomas Zimmermann tzimmermann@suse.de Fixes: a50ca39fbd01 ("drm/i915: setup the LMEM region") Cc: Lucas De Marchi lucas.demarchi@intel.com Cc: Joonas Lahtinen joonas.lahtinen@linux.intel.com Cc: Rodrigo Vivi rodrigo.vivi@intel.com Cc: Matthew Auld matthew.auld@intel.com Cc: Jani Nikula jani.nikula@intel.com Cc: Chris Wilson chris@chris-wilson.co.uk Cc: Daniel Vetter daniel.vetter@ffwll.ch Cc: Tvrtko Ursulin tvrtko.ursulin@intel.com Cc: Daniele Ceraolo Spurio daniele.ceraolospurio@intel.com Cc: Mika Kuoppala mika.kuoppala@linux.intel.com Cc: Maarten Lankhorst maarten.lankhorst@linux.intel.com Cc: Venkata Sandeep Dhanalakota venkata.s.dhanalakota@intel.com Cc: "Michał Winiarski" michal.winiarski@intel.com --- drivers/gpu/drm/i915/gt/intel_region_lmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c index be6f2c8f5184..73fceb0c25fc 100644 --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c @@ -177,7 +177,7 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt) { struct drm_i915_private *i915 = gt->i915; struct intel_uncore *uncore = gt->uncore; - struct pci_dev *pdev = i915->drm.pdev; + struct pci_dev *pdev = to_pci_dev(i915->drm.dev); struct intel_memory_region *mem; resource_size_t io_start; resource_size_t lmem_size;
References to struct drm_device.pdev should be used any longer as the field will be moved into the struct's legacy section. Fix a rsp comment.
Signed-off-by: Thomas Zimmermann tzimmermann@suse.de --- drivers/gpu/drm/i915/intel_runtime_pm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.h b/drivers/gpu/drm/i915/intel_runtime_pm.h index 1e4ddd11c12b..183ea2b187fe 100644 --- a/drivers/gpu/drm/i915/intel_runtime_pm.h +++ b/drivers/gpu/drm/i915/intel_runtime_pm.h @@ -49,7 +49,7 @@ enum i915_drm_suspend_mode { */ struct intel_runtime_pm { atomic_t wakeref_count; - struct device *kdev; /* points to i915->drm.pdev->dev */ + struct device *kdev; /* points to i915->drm.dev */ bool available; bool suspended; bool irqs_enabled;
Using struct drm_device.pdev is deprecated. Don't assign it. Users should upcast from struct drm_device.dev.
v6: * also fix the assignment in selftests in this patch (Chris)
Signed-off-by: Thomas Zimmermann tzimmermann@suse.de Reviewed-by: Chris Wilson chris@chris-wilson.co.uk Cc: Jani Nikula jani.nikula@linux.intel.com Cc: Joonas Lahtinen joonas.lahtinen@linux.intel.com Cc: Rodrigo Vivi rodrigo.vivi@intel.com --- drivers/gpu/drm/i915/i915_drv.c | 1 - drivers/gpu/drm/i915/selftests/mock_gem_device.c | 1 - 2 files changed, 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 785dcf20c77b..db513f93f0f5 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -758,7 +758,6 @@ i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent) if (IS_ERR(i915)) return i915;
- i915->drm.pdev = pdev; pci_set_drvdata(pdev, i915);
/* Device parameters start as a copy of module parameters. */ diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c index 2ffc763fe90d..cf40004bc92a 100644 --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c @@ -146,7 +146,6 @@ struct drm_i915_private *mock_gem_device(void) }
pci_set_drvdata(pdev, i915); - i915->drm.pdev = pdev;
dev_pm_domain_set(&pdev->dev, &pm_domain); pm_runtime_enable(&pdev->dev);
Struct drm_device.pdev is being moved to legacy status as only legacy DRM drivers use it. A possible follow-up patchset could remove pdev entirely.
v4: * rebased
Signed-off-by: Thomas Zimmermann tzimmermann@suse.de Reviewed-by: Chris Wilson chris@chris-wilson.co.uk Acked-by: Sam Ravnborg sam@ravnborg.org --- include/drm/drm_device.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h index d647223e8390..c5a195676e8f 100644 --- a/include/drm/drm_device.h +++ b/include/drm/drm_device.h @@ -279,9 +279,6 @@ struct drm_device { /** @agp: AGP data */ struct drm_agp_head *agp;
- /** @pdev: PCI device structure */ - struct pci_dev *pdev; - /** @num_crtcs: Number of CRTCs on this device */ unsigned int num_crtcs;
@@ -324,6 +321,9 @@ struct drm_device { /* List of devices per driver for stealth attach cleanup */ struct list_head legacy_dev_list;
+ /* PCI device structure */ + struct pci_dev *pdev; + #ifdef __alpha__ /** @hose: PCI hose, only used on ALPHA platforms. */ struct pci_controller *hose;
On Tue, 27 Apr 2021, Thomas Zimmermann tzimmermann@suse.de wrote:
V7 of the patchset fixes some bitrot in the intel driver.
The pdev field in struct drm_device points to a PCI device structure and goes back to UMS-only days when all DRM drivers were for PCI devices. Meanwhile we also support USB, SPI and platform devices. Each of those uses the generic device stored in struct drm_device.dev.
To reduce duplication and remove the special case of PCI, this patchset converts all modesetting drivers from pdev to dev and makes pdev a field for legacy UMS drivers.
For PCI devices, the pointer in struct drm_device.dev can be upcasted to struct pci_device; or tested for PCI with dev_is_pci(). In several places the code can use the dev field directly.
After converting all drivers and the DRM core, the pdev fields becomes only relevant for legacy drivers. In a later patchset, we may want to convert these as well and remove pdev entirely.
On the series,
Reviewed-by: Jani Nikula jani.nikula@intel.com
How should we merge these?
v7:
- fix instances of pdev that have benn added under i915/
v6:
- also remove assignment in i915/selftests in later patch (Chris)
v5:
- remove assignment in later patch (Chris)
v4:
- merged several patches
- moved core changes into separate patch
- vmwgfx build fix
v3:
- merged several patches
- fix one pdev reference in nouveau (Jeremy)
- rebases
v2:
- move whitespace fixes into separate patches (Alex, Sam)
- move i915 gt/ and gvt/ changes into separate patches (Joonas)
Thomas Zimmermann (4): drm/i915/gt: Remove reference to struct drm_device.pdev drm/i915: Remove reference to struct drm_device.pdev drm/i915: Don't assign to struct drm_device.pdev drm: Move struct drm_device.pdev to legacy section
drivers/gpu/drm/i915/gt/intel_region_lmem.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 1 - drivers/gpu/drm/i915/intel_runtime_pm.h | 2 +- drivers/gpu/drm/i915/selftests/mock_gem_device.c | 1 - include/drm/drm_device.h | 6 +++--- 5 files changed, 5 insertions(+), 7 deletions(-)
-- 2.31.1
Hi Jani
Am 27.04.21 um 14:04 schrieb Jani Nikula:
On Tue, 27 Apr 2021, Thomas Zimmermann tzimmermann@suse.de wrote:
V7 of the patchset fixes some bitrot in the intel driver.
The pdev field in struct drm_device points to a PCI device structure and goes back to UMS-only days when all DRM drivers were for PCI devices. Meanwhile we also support USB, SPI and platform devices. Each of those uses the generic device stored in struct drm_device.dev.
To reduce duplication and remove the special case of PCI, this patchset converts all modesetting drivers from pdev to dev and makes pdev a field for legacy UMS drivers.
For PCI devices, the pointer in struct drm_device.dev can be upcasted to struct pci_device; or tested for PCI with dev_is_pci(). In several places the code can use the dev field directly.
After converting all drivers and the DRM core, the pdev fields becomes only relevant for legacy drivers. In a later patchset, we may want to convert these as well and remove pdev entirely.
On the series,
Reviewed-by: Jani Nikula jani.nikula@intel.com
How should we merge these?
Thanks for the quick reply.
There is another pdev patch that I just sent out. [1] It has to go into the intel tree. After it landed, I want to get this patchset into drm-misc-next ASAP. Otherwise, drm-tip would stop building.
This should fix things in the correct order and finally remove pdev for current drivers.
Best regards Thomas
[1] https://lore.kernel.org/dri-devel/20210427110747.2065-1-tzimmermann@suse.de/...
v7:
- fix instances of pdev that have benn added under i915/
v6:
- also remove assignment in i915/selftests in later patch (Chris)
v5:
- remove assignment in later patch (Chris)
v4:
- merged several patches
- moved core changes into separate patch
- vmwgfx build fix
v3:
- merged several patches
- fix one pdev reference in nouveau (Jeremy)
- rebases
v2:
- move whitespace fixes into separate patches (Alex, Sam)
- move i915 gt/ and gvt/ changes into separate patches (Joonas)
Thomas Zimmermann (4): drm/i915/gt: Remove reference to struct drm_device.pdev drm/i915: Remove reference to struct drm_device.pdev drm/i915: Don't assign to struct drm_device.pdev drm: Move struct drm_device.pdev to legacy section
drivers/gpu/drm/i915/gt/intel_region_lmem.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 1 - drivers/gpu/drm/i915/intel_runtime_pm.h | 2 +- drivers/gpu/drm/i915/selftests/mock_gem_device.c | 1 - include/drm/drm_device.h | 6 +++--- 5 files changed, 5 insertions(+), 7 deletions(-)
-- 2.31.1
On Tue, 27 Apr 2021, Thomas Zimmermann tzimmermann@suse.de wrote:
Hi Jani
Am 27.04.21 um 14:04 schrieb Jani Nikula:
On Tue, 27 Apr 2021, Thomas Zimmermann tzimmermann@suse.de wrote:
V7 of the patchset fixes some bitrot in the intel driver.
The pdev field in struct drm_device points to a PCI device structure and goes back to UMS-only days when all DRM drivers were for PCI devices. Meanwhile we also support USB, SPI and platform devices. Each of those uses the generic device stored in struct drm_device.dev.
To reduce duplication and remove the special case of PCI, this patchset converts all modesetting drivers from pdev to dev and makes pdev a field for legacy UMS drivers.
For PCI devices, the pointer in struct drm_device.dev can be upcasted to struct pci_device; or tested for PCI with dev_is_pci(). In several places the code can use the dev field directly.
After converting all drivers and the DRM core, the pdev fields becomes only relevant for legacy drivers. In a later patchset, we may want to convert these as well and remove pdev entirely.
On the series,
Reviewed-by: Jani Nikula jani.nikula@intel.com
How should we merge these?
Thanks for the quick reply.
There is another pdev patch that I just sent out. [1] It has to go into the intel tree. After it landed, I want to get this patchset into drm-misc-next ASAP. Otherwise, drm-tip would stop building.
On merging the series via drm-misc-next,
Acked-by: Jani Nikula jani.nikula@intel.com
This should fix things in the correct order and finally remove pdev for current drivers.
Best regards Thomas
[1] https://lore.kernel.org/dri-devel/20210427110747.2065-1-tzimmermann@suse.de/...
v7:
- fix instances of pdev that have benn added under i915/
v6:
- also remove assignment in i915/selftests in later patch (Chris)
v5:
- remove assignment in later patch (Chris)
v4:
- merged several patches
- moved core changes into separate patch
- vmwgfx build fix
v3:
- merged several patches
- fix one pdev reference in nouveau (Jeremy)
- rebases
v2:
- move whitespace fixes into separate patches (Alex, Sam)
- move i915 gt/ and gvt/ changes into separate patches (Joonas)
Thomas Zimmermann (4): drm/i915/gt: Remove reference to struct drm_device.pdev drm/i915: Remove reference to struct drm_device.pdev drm/i915: Don't assign to struct drm_device.pdev drm: Move struct drm_device.pdev to legacy section
drivers/gpu/drm/i915/gt/intel_region_lmem.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 1 - drivers/gpu/drm/i915/intel_runtime_pm.h | 2 +- drivers/gpu/drm/i915/selftests/mock_gem_device.c | 1 - include/drm/drm_device.h | 6 +++--- 5 files changed, 5 insertions(+), 7 deletions(-)
-- 2.31.1
dri-devel@lists.freedesktop.org