From: Emil Velikov <emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Alexandre Courbot
<acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
Thierry Reding
<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [Nouveau] [PATCH v2] drm/nouveau: support for platform devices
Date: Wed, 12 Feb 2014 14:18:20 +0000 [thread overview]
Message-ID: <52FB82AC.1010405@gmail.com> (raw)
In-Reply-To: <1392183495-11481-1-git-send-email-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On 12/02/14 05:38, Alexandre Courbot wrote:
> Upcoming mobile Kepler GPUs (such as GK20A) use the platform bus instead
> of PCI to which Nouveau is tightly dependent. This patch allows Nouveau
> to handle platform devices by:
>
> - abstracting PCI-dependent functions that were typically used for
> resource querying and page mapping,
> - introducing a nv_device_is_pci() function that allows to make
> PCI-dependent code conditional,
> - providing a nouveau_drm_platform_probe() function that takes a GPU
> platform device to be probed.
>
> Core code as well as engine/subdev drivers are updated wherever possible
> to make use of these functions. Some older drivers are too dependent on
> PCI to be properly updated, but all newer code on which future chips may
> depend should at least be runnable with platform devices.
>
Hi Alexandre
I've tried really hard to find something wrong with this patch but it
seems that you have it polished very nicely.
There is one quite minor nit in-line, but I'm not fussed either way.
> Signed-off-by: Alexandre Courbot <acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
> Changes since v1:
> - Refactored nouveau_device_create_() to take an additional bus type
> argument instead of having two versions of it that duplicate code.
> - Fixed a typo when substituting pci_resource_* with nv_device_resource_*
> - Check whether devices are PCI in relevant functions instead of
> nouveau_drm_load().
>
> drivers/gpu/drm/nouveau/core/engine/device/base.c | 83 ++++++++++++++++++++--
> drivers/gpu/drm/nouveau/core/engine/falcon.c | 6 +-
> drivers/gpu/drm/nouveau/core/engine/fifo/base.c | 2 +-
> drivers/gpu/drm/nouveau/core/engine/graph/nv20.c | 2 +-
> drivers/gpu/drm/nouveau/core/engine/graph/nv40.c | 2 +-
> drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 4 +-
> drivers/gpu/drm/nouveau/core/engine/xtensa.c | 2 +-
> drivers/gpu/drm/nouveau/core/include/core/device.h | 30 ++++++++
> .../gpu/drm/nouveau/core/include/engine/device.h | 17 +++--
> drivers/gpu/drm/nouveau/core/include/subdev/mc.h | 1 +
> drivers/gpu/drm/nouveau/core/os.h | 1 +
> drivers/gpu/drm/nouveau/core/subdev/bar/base.c | 4 +-
> drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c | 4 +-
> drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c | 15 ++--
> .../gpu/drm/nouveau/core/subdev/devinit/fbmem.h | 8 ++-
> drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c | 2 +-
> drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c | 2 +-
> drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c | 2 +-
> drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c | 2 +-
> drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c | 9 +--
> drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c | 9 +--
> drivers/gpu/drm/nouveau/core/subdev/i2c/base.c | 2 +-
> drivers/gpu/drm/nouveau/core/subdev/instmem/nv40.c | 7 +-
> drivers/gpu/drm/nouveau/core/subdev/mc/base.c | 39 ++++++----
> drivers/gpu/drm/nouveau/core/subdev/mxm/base.c | 2 +-
> drivers/gpu/drm/nouveau/nouveau_abi16.c | 13 +++-
> drivers/gpu/drm/nouveau/nouveau_agp.c | 2 +-
> drivers/gpu/drm/nouveau/nouveau_bios.c | 4 ++
> drivers/gpu/drm/nouveau/nouveau_bo.c | 22 +++---
> drivers/gpu/drm/nouveau/nouveau_chan.c | 2 +-
> drivers/gpu/drm/nouveau/nouveau_display.c | 3 +-
> drivers/gpu/drm/nouveau/nouveau_drm.c | 59 ++++++++++++---
> drivers/gpu/drm/nouveau/nouveau_sysfs.c | 8 ++-
> drivers/gpu/drm/nouveau/nouveau_ttm.c | 31 ++++----
> drivers/gpu/drm/nouveau/nouveau_vga.c | 5 ++
> 35 files changed, 297 insertions(+), 109 deletions(-)
>
[snip]
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/base.c b/drivers/gpu/drm/nouveau/core/subdev/mc/base.c
> index b4b9943773bc..572190c8363b 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/mc/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/mc/base.c
> @@ -93,8 +93,8 @@ _nouveau_mc_dtor(struct nouveau_object *object)
> {
> struct nouveau_device *device = nv_device(object);
> struct nouveau_mc *pmc = (void *)object;
> - free_irq(device->pdev->irq, pmc);
> - if (pmc->use_msi)
> + free_irq(pmc->irq, pmc);
> + if (nv_device_is_pci(device) && pmc->use_msi)
You should be able to keep the conditional as is.
> pci_disable_msi(device->pdev);
> nouveau_subdev_destroy(&pmc->base);
> }
> @@ -114,22 +114,25 @@ nouveau_mc_create_(struct nouveau_object *parent, struct nouveau_object *engine,
> if (ret)
> return ret;
>
> - switch (device->pdev->device & 0x0ff0) {
> - case 0x00f0:
> - case 0x02e0:
> - /* BR02? NFI how these would be handled yet exactly */
> - break;
> - default:
> - switch (device->chipset) {
> - case 0xaa: break; /* reported broken, nv also disable it */
> - default:
> - pmc->use_msi = true;
> + if (nv_device_is_pci(device))
> + switch (device->pdev->device & 0x0ff0) {
> + case 0x00f0:
> + case 0x02e0:
> + /* BR02? NFI how these would be handled yet exactly */
> break;
> + default:
> + switch (device->chipset) {
> + case 0xaa:
> + /* reported broken, nv also disable it */
> + break;
> + default:
> + pmc->use_msi = true;
> + break;
> }
> }
>
> pmc->use_msi = nouveau_boolopt(device->cfgopt, "NvMSI", pmc->use_msi);
As you explicitly disable msi on platform devices you can move the
option parsing within the if (nv_device_is_pci()) block.
This way you can drop the change in the following conditional and the
similar one in _nouveau_mc_dtor.
> - if (pmc->use_msi && oclass->msi_rearm) {
> + if (nv_device_is_pci(device) && pmc->use_msi && oclass->msi_rearm) {
Many thanks, and again, welcome to nouveau :-)
-Emil
WARNING: multiple messages have this Message-ID (diff)
From: Emil Velikov <emil.l.velikov@gmail.com>
To: Alexandre Courbot <acourbot@nvidia.com>,
Thierry Reding <thierry.reding@gmail.com>,
Ben Skeggs <bskeggs@redhat.com>
Cc: emil.l.velikov@gmail.com, nouveau@lists.freedesktop.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-tegra@vger.kernel.org
Subject: Re: [Nouveau] [PATCH v2] drm/nouveau: support for platform devices
Date: Wed, 12 Feb 2014 14:18:20 +0000 [thread overview]
Message-ID: <52FB82AC.1010405@gmail.com> (raw)
In-Reply-To: <1392183495-11481-1-git-send-email-acourbot@nvidia.com>
On 12/02/14 05:38, Alexandre Courbot wrote:
> Upcoming mobile Kepler GPUs (such as GK20A) use the platform bus instead
> of PCI to which Nouveau is tightly dependent. This patch allows Nouveau
> to handle platform devices by:
>
> - abstracting PCI-dependent functions that were typically used for
> resource querying and page mapping,
> - introducing a nv_device_is_pci() function that allows to make
> PCI-dependent code conditional,
> - providing a nouveau_drm_platform_probe() function that takes a GPU
> platform device to be probed.
>
> Core code as well as engine/subdev drivers are updated wherever possible
> to make use of these functions. Some older drivers are too dependent on
> PCI to be properly updated, but all newer code on which future chips may
> depend should at least be runnable with platform devices.
>
Hi Alexandre
I've tried really hard to find something wrong with this patch but it
seems that you have it polished very nicely.
There is one quite minor nit in-line, but I'm not fussed either way.
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
> Changes since v1:
> - Refactored nouveau_device_create_() to take an additional bus type
> argument instead of having two versions of it that duplicate code.
> - Fixed a typo when substituting pci_resource_* with nv_device_resource_*
> - Check whether devices are PCI in relevant functions instead of
> nouveau_drm_load().
>
> drivers/gpu/drm/nouveau/core/engine/device/base.c | 83 ++++++++++++++++++++--
> drivers/gpu/drm/nouveau/core/engine/falcon.c | 6 +-
> drivers/gpu/drm/nouveau/core/engine/fifo/base.c | 2 +-
> drivers/gpu/drm/nouveau/core/engine/graph/nv20.c | 2 +-
> drivers/gpu/drm/nouveau/core/engine/graph/nv40.c | 2 +-
> drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c | 4 +-
> drivers/gpu/drm/nouveau/core/engine/xtensa.c | 2 +-
> drivers/gpu/drm/nouveau/core/include/core/device.h | 30 ++++++++
> .../gpu/drm/nouveau/core/include/engine/device.h | 17 +++--
> drivers/gpu/drm/nouveau/core/include/subdev/mc.h | 1 +
> drivers/gpu/drm/nouveau/core/os.h | 1 +
> drivers/gpu/drm/nouveau/core/subdev/bar/base.c | 4 +-
> drivers/gpu/drm/nouveau/core/subdev/bar/nv50.c | 4 +-
> drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c | 15 ++--
> .../gpu/drm/nouveau/core/subdev/devinit/fbmem.h | 8 ++-
> drivers/gpu/drm/nouveau/core/subdev/devinit/nv04.c | 2 +-
> drivers/gpu/drm/nouveau/core/subdev/devinit/nv05.c | 2 +-
> drivers/gpu/drm/nouveau/core/subdev/devinit/nv10.c | 2 +-
> drivers/gpu/drm/nouveau/core/subdev/devinit/nv20.c | 2 +-
> drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c | 9 +--
> drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c | 9 +--
> drivers/gpu/drm/nouveau/core/subdev/i2c/base.c | 2 +-
> drivers/gpu/drm/nouveau/core/subdev/instmem/nv40.c | 7 +-
> drivers/gpu/drm/nouveau/core/subdev/mc/base.c | 39 ++++++----
> drivers/gpu/drm/nouveau/core/subdev/mxm/base.c | 2 +-
> drivers/gpu/drm/nouveau/nouveau_abi16.c | 13 +++-
> drivers/gpu/drm/nouveau/nouveau_agp.c | 2 +-
> drivers/gpu/drm/nouveau/nouveau_bios.c | 4 ++
> drivers/gpu/drm/nouveau/nouveau_bo.c | 22 +++---
> drivers/gpu/drm/nouveau/nouveau_chan.c | 2 +-
> drivers/gpu/drm/nouveau/nouveau_display.c | 3 +-
> drivers/gpu/drm/nouveau/nouveau_drm.c | 59 ++++++++++++---
> drivers/gpu/drm/nouveau/nouveau_sysfs.c | 8 ++-
> drivers/gpu/drm/nouveau/nouveau_ttm.c | 31 ++++----
> drivers/gpu/drm/nouveau/nouveau_vga.c | 5 ++
> 35 files changed, 297 insertions(+), 109 deletions(-)
>
[snip]
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/base.c b/drivers/gpu/drm/nouveau/core/subdev/mc/base.c
> index b4b9943773bc..572190c8363b 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/mc/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/mc/base.c
> @@ -93,8 +93,8 @@ _nouveau_mc_dtor(struct nouveau_object *object)
> {
> struct nouveau_device *device = nv_device(object);
> struct nouveau_mc *pmc = (void *)object;
> - free_irq(device->pdev->irq, pmc);
> - if (pmc->use_msi)
> + free_irq(pmc->irq, pmc);
> + if (nv_device_is_pci(device) && pmc->use_msi)
You should be able to keep the conditional as is.
> pci_disable_msi(device->pdev);
> nouveau_subdev_destroy(&pmc->base);
> }
> @@ -114,22 +114,25 @@ nouveau_mc_create_(struct nouveau_object *parent, struct nouveau_object *engine,
> if (ret)
> return ret;
>
> - switch (device->pdev->device & 0x0ff0) {
> - case 0x00f0:
> - case 0x02e0:
> - /* BR02? NFI how these would be handled yet exactly */
> - break;
> - default:
> - switch (device->chipset) {
> - case 0xaa: break; /* reported broken, nv also disable it */
> - default:
> - pmc->use_msi = true;
> + if (nv_device_is_pci(device))
> + switch (device->pdev->device & 0x0ff0) {
> + case 0x00f0:
> + case 0x02e0:
> + /* BR02? NFI how these would be handled yet exactly */
> break;
> + default:
> + switch (device->chipset) {
> + case 0xaa:
> + /* reported broken, nv also disable it */
> + break;
> + default:
> + pmc->use_msi = true;
> + break;
> }
> }
>
> pmc->use_msi = nouveau_boolopt(device->cfgopt, "NvMSI", pmc->use_msi);
As you explicitly disable msi on platform devices you can move the
option parsing within the if (nv_device_is_pci()) block.
This way you can drop the change in the following conditional and the
similar one in _nouveau_mc_dtor.
> - if (pmc->use_msi && oclass->msi_rearm) {
> + if (nv_device_is_pci(device) && pmc->use_msi && oclass->msi_rearm) {
Many thanks, and again, welcome to nouveau :-)
-Emil
next prev parent reply other threads:[~2014-02-12 14:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-10 5:53 [PATCH] drm/nouveau: support for platform devices Alexandre Courbot
2014-02-10 5:53 ` Alexandre Courbot
[not found] ` <1392011580-28093-1-git-send-email-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-02-10 11:50 ` [Nouveau] " Thierry Reding
2014-02-10 11:50 ` Thierry Reding
[not found] ` <20140210115055.GC20143-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2014-02-11 6:18 ` Alexandre Courbot
2014-02-11 6:18 ` [Nouveau] " Alexandre Courbot
[not found] ` <CAAVeFuJaD1C7yPRGm3+hByLDuSiBhftehcbwFfrbLaYsAwRcZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-02-12 5:38 ` [PATCH v2] " Alexandre Courbot
2014-02-12 5:38 ` Alexandre Courbot
[not found] ` <1392183495-11481-1-git-send-email-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-02-12 14:18 ` Emil Velikov [this message]
2014-02-12 14:18 ` [Nouveau] " Emil Velikov
[not found] ` <52FB82AC.1010405-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-02-13 2:02 ` Alexandre Courbot
2014-02-13 2:02 ` Alexandre Courbot
[not found] ` <52FC2798.8030901-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-02-17 6:17 ` [PATCH v3] " Alexandre Courbot
2014-02-17 6:17 ` Alexandre Courbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52FB82AC.1010405@gmail.com \
--to=emil.l.velikov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.