Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751280AbaLXCpV (ORCPT ); Tue, 23 Dec 2014 21:45:21 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:16078 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750909AbaLXCpT (ORCPT ); Tue, 23 Dec 2014 21:45:19 -0500 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Tue, 23 Dec 2014 18:40:03 -0800 Message-ID: <549A289B.7030705@nvidia.com> Date: Wed, 24 Dec 2014 10:44:43 +0800 From: Vince Hsu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Ilia Mirkin CC: Thierry Reding , Stephen Warren , Alexandre Courbot , Ben Skeggs , Martin Peres , Roy Spliet , Samuel Pitoiset , "linux-tegra@vger.kernel.org" , "nouveau@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Subject: Re: [Nouveau] [PATCH nouveau 08/11] instmem: add dummy support for GK20A References: <1419331204-26679-1-git-send-email-vinceh@nvidia.com> <1419331204-26679-9-git-send-email-vinceh@nvidia.com> In-Reply-To: X-Originating-IP: [10.19.108.126] X-ClientProxiedBy: DRBGMAIL104.nvidia.com (10.18.16.23) To HKMAIL101.nvidia.com (10.18.16.10) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 12/24/2014 12:39 AM, Ilia Mirkin wrote: > On Tue, Dec 23, 2014 at 5:40 AM, Vince Hsu wrote: >> This is a workaround to avoid the instmem backup/restore during the suspend >> and resume process in nv50 instemem driver. >> >> Signed-off-by: Vince Hsu >> --- >> drm/Kbuild | 1 + >> nvkm/engine/device/nve0.c | 2 +- >> nvkm/include/subdev/instmem.h | 1 + >> nvkm/subdev/instmem/gk20a.c | 70 +++++++++++++++++++++++++++++++++++++++++++ >> 4 files changed, 73 insertions(+), 1 deletion(-) >> create mode 100644 nvkm/subdev/instmem/gk20a.c >> >> diff --git a/drm/Kbuild b/drm/Kbuild >> index 6461e3565afe..ea40cd653c7c 100644 >> --- a/drm/Kbuild >> +++ b/drm/Kbuild >> @@ -176,6 +176,7 @@ nouveau-y += core/subdev/instmem/base.o >> nouveau-y += core/subdev/instmem/nv04.o >> nouveau-y += core/subdev/instmem/nv40.o >> nouveau-y += core/subdev/instmem/nv50.o >> +nouveau-y += core/subdev/instmem/gk20a.o >> nouveau-y += core/subdev/ltc/base.o >> nouveau-y += core/subdev/ltc/gf100.o >> nouveau-y += core/subdev/ltc/gk104.o >> diff --git a/nvkm/engine/device/nve0.c b/nvkm/engine/device/nve0.c >> index 732922690653..fcbdc5259c7c 100644 >> --- a/nvkm/engine/device/nve0.c >> +++ b/nvkm/engine/device/nve0.c >> @@ -170,7 +170,7 @@ nve0_identify(struct nouveau_device *device) >> device->oclass[NVDEV_SUBDEV_FB ] = gk20a_fb_oclass; >> device->oclass[NVDEV_SUBDEV_LTC ] = gk104_ltc_oclass; >> device->oclass[NVDEV_SUBDEV_IBUS ] = &gk20a_ibus_oclass; >> - device->oclass[NVDEV_SUBDEV_INSTMEM] = nv50_instmem_oclass; >> + device->oclass[NVDEV_SUBDEV_INSTMEM] = gk20a_instmem_oclass; >> device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass; >> device->oclass[NVDEV_SUBDEV_BAR ] = &gk20a_bar_oclass; >> device->oclass[NVDEV_ENGINE_DMAOBJ ] = nvd0_dmaeng_oclass; >> diff --git a/nvkm/include/subdev/instmem.h b/nvkm/include/subdev/instmem.h >> index c1df26f3230c..6264660bedce 100644 >> --- a/nvkm/include/subdev/instmem.h >> +++ b/nvkm/include/subdev/instmem.h >> @@ -48,5 +48,6 @@ nouveau_instmem(void *obj) >> extern struct nouveau_oclass *nv04_instmem_oclass; >> extern struct nouveau_oclass *nv40_instmem_oclass; >> extern struct nouveau_oclass *nv50_instmem_oclass; >> +extern struct nouveau_oclass *gk20a_instmem_oclass; >> >> #endif >> diff --git a/nvkm/subdev/instmem/gk20a.c b/nvkm/subdev/instmem/gk20a.c >> new file mode 100644 >> index 000000000000..5e072d6e743f >> --- /dev/null >> +++ b/nvkm/subdev/instmem/gk20a.c >> @@ -0,0 +1,70 @@ >> +/* >> + * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining a >> + * copy of this software and associated documentation files (the "Software"), >> + * to deal in the Software without restriction, including without limitation >> + * the rights to use, copy, modify, merge, publish, distribute, sublicense, >> + * and/or sell copies of the Software, and to permit persons to whom the >> + * Software is furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice shall be included in >> + * all copies or substantial portions of the Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL >> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER >> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING >> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER >> + * DEALINGS IN THE SOFTWARE. >> + * >> + */ >> + >> +#include "nv50.h" > I'm confused... what exactly depends on nv50_instmem_priv here? Why > not just create a gk20a_instmem_priv and leave the nv50 one alone? You're right. Will fix in the next version. > >> +#include "priv.h" >> + >> +static int >> +gk20a_instmem_fini(struct nouveau_object *object, bool suspend) >> +{ >> + struct nouveau_instmem *imem = (void *)object; >> + >> + return nouveau_subdev_fini(&imem->base, suspend); >> +} >> + >> +static int >> +gk20a_instmem_init(struct nouveau_object *object) >> +{ >> + struct nouveau_instmem *imem = (void *)object; >> + >> + return nouveau_subdev_init(&imem->base); >> +} > I think the style is to just link those up directly in the class > definition when they're trivial like that, i.e. point them at > _nouveau_subdev_init and such. Thanks for the hint. Will fix. :) > >> + >> +static int >> +gk20a_instmem_ctor(struct nouveau_object *parent, struct nouveau_object *engine, >> + struct nouveau_oclass *oclass, void *data, u32 size, >> + struct nouveau_object **pobject) >> +{ >> + struct nv50_instmem_priv *priv; >> + int ret; >> + >> + ret = nouveau_instmem_create(parent, engine, oclass, &priv); >> + *pobject = nv_object(priv); >> + if (ret) >> + return ret; >> + >> + spin_lock_init(&priv->lock); >> + return 0; >> +} >> + >> +struct nouveau_oclass * >> +gk20a_instmem_oclass = &(struct nouveau_instmem_impl) { >> + .base.handle = NV_SUBDEV(INSTMEM, 0x50), >> + .base.ofuncs = &(struct nouveau_ofuncs) { >> + .ctor = gk20a_instmem_ctor, >> + .dtor = _nouveau_instmem_dtor, >> + .init = gk20a_instmem_init, >> + .fini = gk20a_instmem_fini, >> + }, >> + .instobj = &nv50_instobj_oclass.base, >> +}.base; >> -- >> 1.9.1 >> >> _______________________________________________ >> Nouveau mailing list >> Nouveau@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/nouveau -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/