Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1593251

Re: [PATCH 5/5] drm/amdgpu: resize VRAM BAR for CPU access

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 5/5] drm/amdgpu: resize VRAM BAR for CPU access
Date 2017-03-06 13:10 +0100
Message-ID <thZCF-7XE-3@gated-at.bofh.it> (permalink)
References <thZjk-7C0-7@gated-at.bofh.it> <thZjl-7C0-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Mar 6, 2017 at 1:40 PM, Christian König <deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> Try to resize BAR0 to let CPU access all of VRAM.

> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -616,6 +616,35 @@ void amdgpu_gtt_location(struct amdgpu_device *adev, struct amdgpu_mc *mc)

> +void amdgpu_resize_bar0(struct amdgpu_device *adev)
> +{
> +       u32 size = max(ilog2(adev->mc.real_vram_size - 1) + 1, 20) - 20;

Too complicated.

unsigned long = fls_long(real_vram_size | BIT(20));

And the result is not a size, right? It's a logarithm from size.

> +       int r;
> +
> +       r = pci_resize_resource(adev->pdev, 0, size);

> +

Redundant line.

> +       if (r == -ENOTSUPP) {
> +               /* The hardware don't support the extension. */
> +               return;
> +
> +       } else if (r == -ENOSPC) {
> +               DRM_INFO("Not enoigh PCI address space for a large BAR.");
> +       } else if (r) {
> +               DRM_ERROR("Problem resizing BAR0 (%d).", r);
> +       }
> +
> +       /* Reinit the doorbell mapping, it is most likely moved as well */
> +       amdgpu_doorbell_fini(adev);

> +       BUG_ON(amdgpu_doorbell_init(adev));

No way to recover?!

> +}
> +

-- 
With Best Regards,
Andy Shevchenko

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] PCI: add resizeable BAR infrastructure v2 Christian König <deathsimple@vodafone.de> - 2017-03-06 12:50 +0100
  [PATCH 3/5] x86/PCI: Enable a 64bit BAR on AMD Family 15h (Models 30h-3fh) Processors Christian König <deathsimple@vodafone.de> - 2017-03-06 12:50 +0100
  [PATCH 4/5] drm/amdgpu: fix printing the doorbell BAR info Christian König <deathsimple@vodafone.de> - 2017-03-06 12:50 +0100
    Re: [PATCH 4/5] drm/amdgpu: fix printing the doorbell BAR info Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-03-06 13:10 +0100
      Re: [PATCH 4/5] drm/amdgpu: fix printing the doorbell BAR info Christian König <deathsimple@vodafone.de> - 2017-03-06 13:30 +0100
  [PATCH 2/5] PCI: add functionality for resizing resources Christian König <deathsimple@vodafone.de> - 2017-03-06 12:50 +0100
  [PATCH 5/5] drm/amdgpu: resize VRAM BAR for CPU access Christian König <deathsimple@vodafone.de> - 2017-03-06 12:50 +0100
    Re: [PATCH 5/5] drm/amdgpu: resize VRAM BAR for CPU access Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-03-06 13:10 +0100
      Re: [PATCH 5/5] drm/amdgpu: resize VRAM BAR for CPU access Christian König <deathsimple@vodafone.de> - 2017-03-06 13:40 +0100
  Re: [PATCH 1/5] PCI: add resizeable BAR infrastructure v2 Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-03-06 13:30 +0100
    Re: [PATCH 1/5] PCI: add resizeable BAR infrastructure v2 Christian König <deathsimple@vodafone.de> - 2017-03-13 10:50 +0100

csiph-web