Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938663AbcJXJZO (ORCPT ); Mon, 24 Oct 2016 05:25:14 -0400 Received: from pegasos-out.vodafone.de ([80.84.1.38]:43063 "EHLO pegasos-out.vodafone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934500AbcJXJZL (ORCPT ); Mon, 24 Oct 2016 05:25:11 -0400 X-Spam-Flag: NO X-Spam-Score: -0.044 Authentication-Results: rohrpostix1.prod.vfnet.de (amavisd-new); dkim=pass header.i=@vodafone.de X-DKIM: OpenDKIM Filter v2.6.8 pegasos-out.vodafone.de 2CF90261DED Subject: Re: [PATCH 2/2] drm/drivers: add support for using the arch wc mapping API. To: Dave Airlie , mcgrof@suse.com, torvalds@linux-foundation.org, dan.j.williams@intel.com, x86@kernel.org References: <1477290706-7696-1-git-send-email-airlied@redhat.com> <1477290706-7696-3-git-send-email-airlied@redhat.com> Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <43fc3720-6775-7030-4ecc-edb00ac3ae1a@vodafone.de> Date: Mon, 24 Oct 2016 11:24:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1477290706-7696-3-git-send-email-airlied@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6856 Lines: 188 Am 24.10.2016 um 08:31 schrieb Dave Airlie: > This fixes a regression in all these drivers since the cache > mode tracking was fixed for mixed mappings. It uses the new > arch API to add the VRAM range to the PAT mapping tracking > tables. > > Fixes: 87744ab3832 (mm: fix cache mode tracking in vm_insert_mixed()) > Signed-off-by: Dave Airlie Reviewed-by: Christian König . > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 +++++ > drivers/gpu/drm/ast/ast_ttm.c | 6 ++++++ > drivers/gpu/drm/cirrus/cirrus_ttm.c | 7 +++++++ > drivers/gpu/drm/mgag200/mgag200_ttm.c | 7 +++++++ > drivers/gpu/drm/nouveau/nouveau_ttm.c | 8 ++++++++ > drivers/gpu/drm/radeon/radeon_object.c | 5 +++++ > 6 files changed, 38 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > index aa074fa..f3efb1c 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c > @@ -754,6 +754,10 @@ static const char *amdgpu_vram_names[] = { > > int amdgpu_bo_init(struct amdgpu_device *adev) > { > + /* reserve PAT memory space to WC for VRAM */ > + arch_io_reserve_memtype_wc(adev->mc.aper_base, > + adev->mc.aper_size); > + > /* Add an MTRR for the VRAM */ > adev->mc.vram_mtrr = arch_phys_wc_add(adev->mc.aper_base, > adev->mc.aper_size); > @@ -769,6 +773,7 @@ void amdgpu_bo_fini(struct amdgpu_device *adev) > { > amdgpu_ttm_fini(adev); > arch_phys_wc_del(adev->mc.vram_mtrr); > + arch_io_free_memtype_wc(adev->mc.aper_base, adev->mc.aper_size); > } > > int amdgpu_bo_fbdev_mmap(struct amdgpu_bo *bo, > diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c > index 608df4c..0743e65 100644 > --- a/drivers/gpu/drm/ast/ast_ttm.c > +++ b/drivers/gpu/drm/ast/ast_ttm.c > @@ -267,6 +267,8 @@ int ast_mm_init(struct ast_private *ast) > return ret; > } > > + arch_io_reserve_memtype_wc(pci_resource_start(dev->pdev, 0), > + pci_resource_len(dev->pdev, 0)); > ast->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0), > pci_resource_len(dev->pdev, 0)); > > @@ -275,11 +277,15 @@ int ast_mm_init(struct ast_private *ast) > > void ast_mm_fini(struct ast_private *ast) > { > + struct drm_device *dev = ast->dev; > + > ttm_bo_device_release(&ast->ttm.bdev); > > ast_ttm_global_release(ast); > > arch_phys_wc_del(ast->fb_mtrr); > + arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0), > + pci_resource_len(dev->pdev, 0)); > } > > void ast_ttm_placement(struct ast_bo *bo, int domain) > diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c > index bb2438d..5e7e63c 100644 > --- a/drivers/gpu/drm/cirrus/cirrus_ttm.c > +++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c > @@ -267,6 +267,9 @@ int cirrus_mm_init(struct cirrus_device *cirrus) > return ret; > } > > + arch_io_reserve_memtype_wc(pci_resource_start(dev->pdev, 0), > + pci_resource_len(dev->pdev, 0)); > + > cirrus->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0), > pci_resource_len(dev->pdev, 0)); > > @@ -276,6 +279,8 @@ int cirrus_mm_init(struct cirrus_device *cirrus) > > void cirrus_mm_fini(struct cirrus_device *cirrus) > { > + struct drm_device *dev = cirrus->dev; > + > if (!cirrus->mm_inited) > return; > > @@ -285,6 +290,8 @@ void cirrus_mm_fini(struct cirrus_device *cirrus) > > arch_phys_wc_del(cirrus->fb_mtrr); > cirrus->fb_mtrr = 0; > + arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0), > + pci_resource_len(dev->pdev, 0)); > } > > void cirrus_ttm_placement(struct cirrus_bo *bo, int domain) > diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c > index 919b35f..dcf7d11 100644 > --- a/drivers/gpu/drm/mgag200/mgag200_ttm.c > +++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c > @@ -266,6 +266,9 @@ int mgag200_mm_init(struct mga_device *mdev) > return ret; > } > > + arch_io_reserve_memtype_wc(pci_resource_start(dev->pdev, 0), > + pci_resource_len(dev->pdev, 0)); > + > mdev->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0), > pci_resource_len(dev->pdev, 0)); > > @@ -274,10 +277,14 @@ int mgag200_mm_init(struct mga_device *mdev) > > void mgag200_mm_fini(struct mga_device *mdev) > { > + struct drm_device *dev = mdev->dev; > + > ttm_bo_device_release(&mdev->ttm.bdev); > > mgag200_ttm_global_release(mdev); > > + arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0), > + pci_resource_len(dev->pdev, 0)); > arch_phys_wc_del(mdev->fb_mtrr); > mdev->fb_mtrr = 0; > } > diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c > index 1825dbc..a6dbe82 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c > @@ -398,6 +398,9 @@ nouveau_ttm_init(struct nouveau_drm *drm) > /* VRAM init */ > drm->gem.vram_available = drm->device.info.ram_user; > > + arch_io_reserve_memtype_wc(device->func->resource_addr(device, 1), > + device->func->resource_size(device, 1)); > + > ret = ttm_bo_init_mm(&drm->ttm.bdev, TTM_PL_VRAM, > drm->gem.vram_available >> PAGE_SHIFT); > if (ret) { > @@ -430,6 +433,8 @@ nouveau_ttm_init(struct nouveau_drm *drm) > void > nouveau_ttm_fini(struct nouveau_drm *drm) > { > + struct nvkm_device *device = nvxx_device(&drm->device); > + > ttm_bo_clean_mm(&drm->ttm.bdev, TTM_PL_VRAM); > ttm_bo_clean_mm(&drm->ttm.bdev, TTM_PL_TT); > > @@ -439,4 +444,7 @@ nouveau_ttm_fini(struct nouveau_drm *drm) > > arch_phys_wc_del(drm->ttm.mtrr); > drm->ttm.mtrr = 0; > + arch_io_free_memtype_wc(device->func->resource_addr(device, 1), > + device->func->resource_size(device, 1)); > + > } > diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c > index be30861..41b72ce 100644 > --- a/drivers/gpu/drm/radeon/radeon_object.c > +++ b/drivers/gpu/drm/radeon/radeon_object.c > @@ -446,6 +446,10 @@ void radeon_bo_force_delete(struct radeon_device *rdev) > > int radeon_bo_init(struct radeon_device *rdev) > { > + /* reserve PAT memory space to WC for VRAM */ > + arch_io_reserve_memtype_wc(rdev->mc.aper_base, > + rdev->mc.aper_size); > + > /* Add an MTRR for the VRAM */ > if (!rdev->fastfb_working) { > rdev->mc.vram_mtrr = arch_phys_wc_add(rdev->mc.aper_base, > @@ -463,6 +467,7 @@ void radeon_bo_fini(struct radeon_device *rdev) > { > radeon_ttm_fini(rdev); > arch_phys_wc_del(rdev->mc.vram_mtrr); > + arch_io_free_memtype_wc(rdev->mc.aper_base, rdev->mc.aper_size); > } > > /* Returns how many bytes TTM can move per IB.