Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3346340imm; Tue, 17 Jul 2018 03:18:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcZklmb/IXG7T6Ja1+XsVV4Abq4307xR3sAJOvnCc1qvjr/0G0CE8AYjGghqQztdoUZ+naM X-Received: by 2002:a17:902:b20d:: with SMTP id t13-v6mr1036842plr.121.1531822718713; Tue, 17 Jul 2018 03:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531822718; cv=none; d=google.com; s=arc-20160816; b=Bjrp93/CNQ91K/7Fl4JRQIS/swY5CskT3tibFMEmnHPz09vOTdQ/AsKDZMid+TPL7/ jQ8/n4GeNMNo+g732ZGABFi3CT+n4WXgvBFC77e9I89FTzjMh8vB4+eLvcPykkdvjBxw p0LzFb2gsBydd5TkZMtcjl87ppaaPvOL39XPcNKPuiRZivrykWzqtmXxO6O/DMNvLIth /8hTaZpyxcCl9HktthSQNKNYkCPYZcwyXuCBcnWJTeMe4ECc+iDWTaEplsaa+/KbTmUm jJvfXuMfPub6NnUusgoY5myeTOwhNI1dSyHtv9PYeKlkLMyOQPF//mkHLsdLbJ0uWsMf e6HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:arc-authentication-results; bh=MRmHrx9fuXtLhaICeOZwSoVOm0DETO90I4BgY8rHQs8=; b=u3JgMCApkxisbfoaCtfjmG3IK8dw22V876C693izuZpcUMsjM2BSDFzxmrs9BxYUBY U+yD9fs/NjtF6PZkLrO+hIVbi0cuLg5wGyDtr/qoDVKw2LMkh2l2EzlGkxFvfWsZN38+ VJee5J95swyZquOXNo6UFpFkj9cO03tI42gpFGGFsEx0H5JdAqD0Ps5cFXgQLa0IcGDP Q1r2E4KtK77WlKY3JZIs4tA4nJgQ0/zKuMCjpnbKV9xbJYz6ZlS3dtbv5uT2tZD8he+T Fg0eBZIpfGLItrQjIwivqY6ixN9zu9Liip1ljfGWRAQTnLwWGH7HRTk1OrYxDNXAVzBq mHRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15-v6si571038pgh.418.2018.07.17.03.18.23; Tue, 17 Jul 2018 03:18:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730116AbeGQKtS (ORCPT + 99 others); Tue, 17 Jul 2018 06:49:18 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:56021 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729724AbeGQKtS (ORCPT ); Tue, 17 Jul 2018 06:49:18 -0400 Received: by mail-wm0-f65.google.com with SMTP id f21-v6so908415wmc.5 for ; Tue, 17 Jul 2018 03:17:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=MRmHrx9fuXtLhaICeOZwSoVOm0DETO90I4BgY8rHQs8=; b=AcUVFLiCZp2kiVDCa1Ocxkm3ZRcMoPnx2W20j+AnasHBZMsdMpW1EXV3VfQuCpxOkZ YRdw965X68Oa/40jPipZEHDnHeCfg4o/IKYXsIPqOj/Mw0W/F/2wL+muuJBW2lRQ6Bd8 jFpaFTYNVKlJMoJ9SEvfNW3EU6CGXg6WcvDdXGQExXWRiy9BCRkci87IQHQXoPksHps2 nYnMg0NyBOaC9BiHwct8jBoEkxPuABCqLnvjm/Ib9OGwa/NDLac5nNI1tqpg/drKrEHw FPwvhQIz9WFMAHotkoU3Jg5cVNfG+4NgNmVrwtGdHjm1v+NWuMW9ofEQRkeSl3h91e69 b3jQ== X-Gm-Message-State: AOUpUlGvc2p/BnlF2G2FSftfqYzvdUDGiKqgFUWF4aRuZEGk3WTjCVUu R5nW0Tg8ZxnHyDNSAAALdCkkvrz1XCcU0JuTvSypOQ== X-Received: by 2002:a1c:7408:: with SMTP id p8-v6mr907560wmc.118.1531822643811; Tue, 17 Jul 2018 03:17:23 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:28c2:0:0:0:0:0 with HTTP; Tue, 17 Jul 2018 03:17:23 -0700 (PDT) In-Reply-To: <20180716235936.11268-5-lyude@redhat.com> References: <20180716235936.11268-1-lyude@redhat.com> <20180716235936.11268-5-lyude@redhat.com> From: Karol Herbst Date: Tue, 17 Jul 2018 12:17:23 +0200 Message-ID: Subject: Re: [Nouveau] [PATCH 4/5] drm/nouveau: Grab RPM ref when i2c bus is in use To: Lyude Paul Cc: nouveau , David Airlie , LKML , dri-devel , stable@vger.kernel.org, Ben Skeggs Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mhh, we shouldn't call to Linux APIs from within of nvkm. Rather gaurd the Linux glue code to the i2c stuff instead, but this is all done from inside of nvkm. I think we should move it out into drm/nouveau/nouveau_i2c.c and do the handling there. On Tue, Jul 17, 2018 at 1:59 AM, Lyude Paul wrote: > The i2c bus can be both accessed by DRM itself, along with any of it's > devnodes (/sys/class/i2c). So, we need to make sure that all codepaths > using the i2c bus keep the GPU resumed. > > Signed-off-by: Lyude Paul > Cc: Karol Herbst > Cc: stable@vger.kernel.org > --- > drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c > index 807a2b67bd64..1de48c990b80 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.c > @@ -119,18 +119,28 @@ nvkm_i2c_bus_release(struct nvkm_i2c_bus *bus) > BUS_TRACE(bus, "release"); > nvkm_i2c_pad_release(pad); > mutex_unlock(&bus->mutex); > + pm_runtime_put_autosuspend(pad->i2c->subdev.device->dev); > } > > int > nvkm_i2c_bus_acquire(struct nvkm_i2c_bus *bus) > { > struct nvkm_i2c_pad *pad = bus->pad; > + struct device *dev = pad->i2c->subdev.device->dev; > int ret; > + > BUS_TRACE(bus, "acquire"); > + > + ret = pm_runtime_get_sync(dev); > + if (ret < 0 && ret != -EACCES) > + return ret; > + > mutex_lock(&bus->mutex); > ret = nvkm_i2c_pad_acquire(pad, NVKM_I2C_PAD_I2C); > - if (ret) > + if (ret) { > mutex_unlock(&bus->mutex); > + pm_runtime_put_autosuspend(dev); > + } > return ret; > } > > -- > 2.17.1 > > _______________________________________________ > Nouveau mailing list > Nouveau@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau