Re: [PATCH] drm/i915/lmem: add the fake lmem region

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Matthew Auld (2019-10-29 16:51:34)
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 21273b516dbe..db1736d95651 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1483,6 +1483,21 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>         if (!i915_modparams.nuclear_pageflip && match_info->gen < 5)
>                 dev_priv->drm.driver_features &= ~DRIVER_ATOMIC;
>  
> +       /*
> +        * Check if we support fake LMEM -- for now we only unleash this for
> +        * the live selftests.
> +        */
> +       if (IS_ENABLED(CONFIG_DRM_I915_UNSTABLE)) {

The pattern I have in mind for unstable config options was to add

config DRM_I915_UNSTABLE_FAKE_LMEM
        bool "Enable the experimental fake lmem"
        depends on DRM_I915_UNSTABLE
        default n
        help
          Convert some system memory into a fake local memory region for
	  testing.

So each is isolated and less likely to cross-contanimate.

> +               if (INTEL_GEN(dev_priv) >= 9 && i915_selftest.live &&

Probably want i915_selftest.live < 0 so that we only enable it for
selftest-and-exit rather than inline selftests that keep the module
loaded afterwards

i915_selftest.live=0 => no tests
i915_selftest.live=-1 => test and exit
i915_selftest.live=1 => test and run userspace

> +                   i915_modparams.fake_lmem_start) {
> +                       mkwrite_device_info(dev_priv)->memory_regions =
> +                               REGION_SMEM | REGION_LMEM | REGION_STOLEN;
> +                       mkwrite_device_info(dev_priv)->is_dgfx = true;
> +                       GEM_BUG_ON(!HAS_LMEM(dev_priv));
> +                       GEM_BUG_ON(!IS_DGFX(dev_priv));
> +               }
> +       }
> +

> +struct intel_memory_region *
> +intel_setup_fake_lmem(struct drm_i915_private *i915)
> +{
> +       struct pci_dev *pdev = i915->drm.pdev;
> +       struct intel_memory_region *mem;
> +       resource_size_t mappable_end;
> +       resource_size_t io_start;
> +       resource_size_t start;
> +
> +       GEM_BUG_ON(i915_ggtt_has_aperture(&i915->ggtt));
> +       GEM_BUG_ON(!i915_modparams.fake_lmem_start);
> +
> +       /* Your mappable aperture belongs to me now! */
> +       mappable_end = pci_resource_len(pdev, 2);
> +       io_start = pci_resource_start(pdev, 2),
> +       start = i915_modparams.fake_lmem_start;
> +
> +       mem = intel_memory_region_create(i915,
> +                                        start,
> +                                        mappable_end,
> +                                        PAGE_SIZE,
> +                                        io_start,
> +                                        &intel_region_lmem_ops);
> +       if (!IS_ERR(mem)) {
> +               DRM_INFO("Intel graphics fake LMEM: %pR\n", &mem->region);
> +               DRM_INFO("Intel graphics fake LMEM IO start: %llx\n",
> +                        (u64)mem->io_start);
> +               DRM_INFO("Intel graphics fake LMEM size: %llx\n",
> +                        (u64)resource_size(&mem->region));

Ok, as this is unstable and therefore dev-centric I'll let you off
having clear user information.

resource_size_t => %pa

Remember to make BAT happy!
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux