[Intel-gfx] [PATCH] drm/i915: Refactor dma mask usage to a common helper

Ruhl, Michael J michael.j.ruhl at intel.com
Fri Apr 17 17:21:20 UTC 2020


>-----Original Message-----
>From: Chris Wilson <chris at chris-wilson.co.uk>
>Sent: Friday, April 17, 2020 12:20 PM
>To: Ruhl, Michael J <michael.j.ruhl at intel.com>; intel-
>gfx at lists.freedesktop.org
>Subject: Re: [Intel-gfx] [PATCH] drm/i915: Refactor dma mask usage to a
>common helper
>
>Quoting Ruhl, Michael J (2020-04-17 17:07:24)
>> >-----Original Message-----
>> >From: Chris Wilson <chris at chris-wilson.co.uk>
>> >Sent: Friday, April 17, 2020 11:43 AM
>> >To: Ruhl, Michael J <michael.j.ruhl at intel.com>; intel-
>> >gfx at lists.freedesktop.org
>> >Subject: Re: [Intel-gfx] [PATCH] drm/i915: Refactor dma mask usage to a
>> >common helper
>> >
>> >Quoting Michael J. Ruhl (2020-04-17 16:22:44)
>> >> DMA_MASK bit values are different for different generations.
>> >>
>> >> This will become more difficult to manage over time with the open
>> >> coded usage of different versions of the device.
>> >>
>> >> Fix by:
>> >>   adding dma_mask_size to the device info configuration,
>> >>   updating open code call sequence to the latest interface,
>> >>   refactoring into a common function for setting the dma_mask
>> >>
>> >> Note: GEN(5) and down is also set in intel_gmch_probe().
>> >
>> >Assume we pull that code into i915.ko, we will one day.
>>
>> The gen5 stuff has the same dma_mask_size that I added to the
>> i915 config structures.
>>
>> I thought about pulling it out of the gen 5 area, but it appears that that
>> can be built as a separate driver, and if I pulled it out, the ability for it to
>> be set in that path would be lost.
>
>It's not viable standalone anymore. It's over a decade dead by this
>point, we can drop the old AGP interface and then the sole user is
>i915.ko. Even if we did not, you can't use the AGP interface at the same
>time as i915.ko so we can just orphan char/agp, and use our own code.

Ok, so can I do something like this in char/agp/intel-gtt.c:

#if IS_ENABLED(CONFIG_AGP_INTEL)
	mask = intel_private.driver->dma_mask_size;
	if (pci_set_dma_mask(intel_private.pcidev, DMA_BIT_MASK(mask)))
		dev_err(&intel_private.pcidev->dev,
			"set gfx device dma mask %d-bit failed!\n", mask);
	else
		pci_set_consistent_dma_mask(intel_private.pcidev,
					    DMA_BIT_MASK(mask));
#endif

This would fix my flow issue from the previous comments.

Mike

>-Chris


More information about the Intel-gfx mailing list