From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751584AbdFIKOG (ORCPT ); Fri, 9 Jun 2017 06:14:06 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:33493 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751536AbdFIKOE (ORCPT ); Fri, 9 Jun 2017 06:14:04 -0400 MIME-Version: 1.0 In-Reply-To: <1496998787-6371-6-git-send-email-deathsimple@vodafone.de> References: <1496998787-6371-1-git-send-email-deathsimple@vodafone.de> <1496998787-6371-6-git-send-email-deathsimple@vodafone.de> From: Andy Shevchenko Date: Fri, 9 Jun 2017 13:14:02 +0300 Message-ID: Subject: Re: [PATCH v5 5/6] drm/amdgpu: move hw generation check into amdgpu_doorbell_init To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: Bjorn Helgaas , "linux-pci@vger.kernel.org" , dri-devel@lists.freedesktop.org, Platform Driver , "linux-kernel@vger.kernel.org" , amd-gfx@lists.freedesktop.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v59AE98P018953 On Fri, Jun 9, 2017 at 11:59 AM, Christian König wrote: > From: Christian König > > This way we can savely call it on SI as well. s/savely/safely FWIW, Reviewed-by: Andy Shevchenko > Signed-off-by: Christian König > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index a7d6804..99290af 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -419,6 +419,15 @@ void amdgpu_pci_config_reset(struct amdgpu_device *adev) > */ > static int amdgpu_doorbell_init(struct amdgpu_device *adev) > { > + /* No doorbell on SI hardware generation */ > + if (adev->asic_type < CHIP_BONAIRE) { > + adev->doorbell.base = 0; > + adev->doorbell.size = 0; > + adev->doorbell.num_doorbells = 0; > + adev->doorbell.ptr = NULL; > + return 0; > + } > + > /* doorbell bar mapping */ > adev->doorbell.base = pci_resource_start(adev->pdev, 2); > adev->doorbell.size = pci_resource_len(adev->pdev, 2); > @@ -2136,9 +2145,8 @@ int amdgpu_device_init(struct amdgpu_device *adev, > DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)adev->rmmio_base); > DRM_INFO("register mmio size: %u\n", (unsigned)adev->rmmio_size); > > - if (adev->asic_type >= CHIP_BONAIRE) > - /* doorbell bar mapping */ > - amdgpu_doorbell_init(adev); > + /* doorbell bar mapping */ > + amdgpu_doorbell_init(adev); > > /* io port mapping */ > for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { > @@ -2335,8 +2343,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev) > adev->rio_mem = NULL; > iounmap(adev->rmmio); > adev->rmmio = NULL; > - if (adev->asic_type >= CHIP_BONAIRE) > - amdgpu_doorbell_fini(adev); > + amdgpu_doorbell_fini(adev); > amdgpu_debugfs_regs_cleanup(adev); > } > > -- > 2.7.4 > -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: MIME-Version: 1.0 In-Reply-To: <1496998787-6371-6-git-send-email-deathsimple@vodafone.de> References: <1496998787-6371-1-git-send-email-deathsimple@vodafone.de> <1496998787-6371-6-git-send-email-deathsimple@vodafone.de> From: Andy Shevchenko Date: Fri, 9 Jun 2017 13:14:02 +0300 Message-ID: Subject: Re: [PATCH v5 5/6] drm/amdgpu: move hw generation check into amdgpu_doorbell_init To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: Bjorn Helgaas , "linux-pci@vger.kernel.org" , dri-devel@lists.freedesktop.org, Platform Driver , "linux-kernel@vger.kernel.org" , amd-gfx@lists.freedesktop.org Content-Type: text/plain; charset="UTF-8" List-ID: On Fri, Jun 9, 2017 at 11:59 AM, Christian K=C3=B6nig wrote: > From: Christian K=C3=B6nig > > This way we can savely call it on SI as well. s/savely/safely FWIW, Reviewed-by: Andy Shevchenko > Signed-off-by: Christian K=C3=B6nig > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm= /amd/amdgpu/amdgpu_device.c > index a7d6804..99290af 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -419,6 +419,15 @@ void amdgpu_pci_config_reset(struct amdgpu_device *a= dev) > */ > static int amdgpu_doorbell_init(struct amdgpu_device *adev) > { > + /* No doorbell on SI hardware generation */ > + if (adev->asic_type < CHIP_BONAIRE) { > + adev->doorbell.base =3D 0; > + adev->doorbell.size =3D 0; > + adev->doorbell.num_doorbells =3D 0; > + adev->doorbell.ptr =3D NULL; > + return 0; > + } > + > /* doorbell bar mapping */ > adev->doorbell.base =3D pci_resource_start(adev->pdev, 2); > adev->doorbell.size =3D pci_resource_len(adev->pdev, 2); > @@ -2136,9 +2145,8 @@ int amdgpu_device_init(struct amdgpu_device *adev, > DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)adev->rmmio_ba= se); > DRM_INFO("register mmio size: %u\n", (unsigned)adev->rmmio_size); > > - if (adev->asic_type >=3D CHIP_BONAIRE) > - /* doorbell bar mapping */ > - amdgpu_doorbell_init(adev); > + /* doorbell bar mapping */ > + amdgpu_doorbell_init(adev); > > /* io port mapping */ > for (i =3D 0; i < DEVICE_COUNT_RESOURCE; i++) { > @@ -2335,8 +2343,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev) > adev->rio_mem =3D NULL; > iounmap(adev->rmmio); > adev->rmmio =3D NULL; > - if (adev->asic_type >=3D CHIP_BONAIRE) > - amdgpu_doorbell_fini(adev); > + amdgpu_doorbell_fini(adev); > amdgpu_debugfs_regs_cleanup(adev); > } > > -- > 2.7.4 > --=20 With Best Regards, Andy Shevchenko