Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3450702imm; Tue, 17 Jul 2018 05:11:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpefZrxpgoPX1g69CdKEap9xPj6oKvzHGLWznOFMDiTls9Ul/YtfesWFtjPrBoyDsiDDRmYf X-Received: by 2002:a62:c218:: with SMTP id l24-v6mr404310pfg.185.1531829474738; Tue, 17 Jul 2018 05:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531829474; cv=none; d=google.com; s=arc-20160816; b=wVAF8w6UxsmAg+t2RfCkrE4pVb+b8/Qg8svOvwt7zVdq3/A/COKTQISmVZOM8SOn7A fWDEq2VVs43pF1pAaN8jItxTRVtWdpngbpohPBpEPBr73UYcTe/qs43AsPBcqTTCiNvY tUYvW1chq2zUZyS8fK7L8Cpihk5Arm0NAhnXkrEC4Z6gNdOt0Pzxk7q6Z4rFBjUVum9q vCKsT+3LD8K6wvxyG9dwCgVcB8ZfW9JHgiDX0tQUTuK1caK9NgNPd6TUmuMRiNO1nk0l z/mF17DK9J9rvcaCzbsomvK+//J4yRTrOKA5f6r7f5fhdZtCAifUPHk1RcgvuyXLJ4uV 1qFw== 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=aJ3WmcTuIZHUvZFqzzBPMi3u/VRKHjLVLnRKI8s2avU=; b=dkJFDyUiK68e09npVzgPGbCr8nkUktN3WMT7kLu6wo6W57zplsFVwew3I78khJupZw F4JqX6zK7p1O9u0uPymD1+J5SMEiVzZ0MHUNMd+06xsAgeV+fXMsvutR47pPm0reyNhB QPEdCiBkZcv+ixAtFdLAWh8u2mNB0epqMxhIDqNGIOSbr0eVBGq+ZsaePlQC59wHRlKl mXeAwmzUt7nWrud6nbH8mE9pDS7yAcw1/nj8/SV/0BK1fPGdOf95O7NhoBFlIZql89r9 HuJEjf0qhmb9AN9/N9ezDSfpjdagaMNOxcjxF32R8AhIgZzGvJIe9hCN7tui9HANeuna JLFQ== 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 u21-v6si717506pgm.230.2018.07.17.05.10.59; Tue, 17 Jul 2018 05:11:14 -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 S1731532AbeGQMml (ORCPT + 99 others); Tue, 17 Jul 2018 08:42:41 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55966 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731219AbeGQMml (ORCPT ); Tue, 17 Jul 2018 08:42:41 -0400 Received: by mail-wm0-f66.google.com with SMTP id f21-v6so1247231wmc.5 for ; Tue, 17 Jul 2018 05:10:19 -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=aJ3WmcTuIZHUvZFqzzBPMi3u/VRKHjLVLnRKI8s2avU=; b=JelZKxlKk6LMRkzDqQ5j0je95RzYDvwIsxVZklL8dSSJag8VBODRaHSeUSjrBht4eY 8sdPZYQUiN2P/ewqFdgOq0QK/nNPffiCy0wh/qHoqjkUAO7idTcgQy/X+3/hItQppqZJ vKmWfLiMGN0vM2qcuHVr1EZLbIwYshRjr+DnsZ9e5nBOp/GqtyrjVT39jjYep5U7X4zI 9rfDmU9Ky2OSXJE0uzxnQyx2g8FOJMclYhke9nf58TL2FG8Pfk/87Fx8Unf+hnBnwE0Y PIG1Ox6aWFN6XGypZx2n9fBD4kY6z+zssBXEEVZK66zGThKMvbrYzqfGnwya6bfwbgLC C/UQ== X-Gm-Message-State: AOUpUlHqJTN+H4zu0j8S59JVw+AWMpdenIbgNB7v28NhWiodVkhXBWDW 3u4V2qfih1I2xQ+YDtc8si7yvrrAVFybhztq40HB0g== X-Received: by 2002:a1c:be13:: with SMTP id o19-v6mr1134413wmf.1.1531829418423; Tue, 17 Jul 2018 05:10:18 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1c:28c2:0:0:0:0:0 with HTTP; Tue, 17 Jul 2018 05:10:17 -0700 (PDT) In-Reply-To: References: <20180716235936.11268-1-lyude@redhat.com> <20180716235936.11268-5-lyude@redhat.com> From: Karol Herbst Date: Tue, 17 Jul 2018 14:10:17 +0200 Message-ID: Subject: Re: [Nouveau] [PATCH 4/5] drm/nouveau: Grab RPM ref when i2c bus is in use To: Ben Skeggs Cc: Lyude Paul , Dave Airlie , nouveau , LKML , stable@vger.kernel.org, dri-devel , 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 On Tue, Jul 17, 2018 at 1:54 PM, Ben Skeggs wrote: > On Tue, 17 Jul 2018 at 20:18, Karol Herbst wrote: >> >> 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. > Huh? No, this is completely fine. > okay, then the the two patches adding that guard code is reviewed-by me >> >> 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 >> _______________________________________________ >> Nouveau mailing list >> Nouveau@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/nouveau