Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3433288imm; Tue, 17 Jul 2018 04:56:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdfQMK6IwKqH5U6Ab5Q9nJhkG3hEFgZVBaRz1JH9AFT5r88jJVhvRPjamMtVWY/NlOmwNzq X-Received: by 2002:a62:5613:: with SMTP id k19-v6mr377454pfb.212.1531828583782; Tue, 17 Jul 2018 04:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531828583; cv=none; d=google.com; s=arc-20160816; b=mRKgD2p5LqP/ligAGzpEl4Z/jr05j0ZDsxe5IJuQpOQmpfriOzBq5nw/6Z6YeyeneK njwhKAyXl02boNpdOU/Mg+WCuKlbl2I5Z/NJyUiTM8fJX3FLutAnll2R+RvYzvTs54Nl uS1t8/dGAdLFsT60hBR/GwvUnE5Hq8cxDNLumgiwF1OvcXvHJqxKGQkJw4PmcuLU166D FwgPa1egaz0RVldthAfX34WjrRBlDQxr5prjUnvPlQCpPaU6XFoLHh8vV6hfgUKhZZ1v TrIwJLbuzv4lf3MRiFvvfUbUpcEoPr2QVoblb7FbIEf7e4qAUwCa/f+EYY+8APzrLkMP 3Yog== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=VcyY5bNhPqNiJOLsmcLVEFfrqVl3klrh7MTk9oYxeYQ=; b=0/xjjfblAze0RhPEeB2oTdUZWXSp47mNGvPYEav4MRukww0LJMot9ID6bqdOHFGtaW KAas7Ljpbp8k81WW5avM2FYhFVf9g+m6krVc0E8qFZKQVlHPngUsLOaiNl6hYxRBlVE3 gaXmq+WNcTkru2WtLh0d/UHbWSkFj+LaPrucoCiGAEpF53AbPjRq0kDS4HSVwtzfChdg 6sF2tSuq2TLVSu1bul9q0+cqJZzWrQP9iOEYWg8kDhZcmp8ooWz5Jym+5vraAnBcByJC yBIA83zWm0Rjri8ULCWNq6Kuc8PPBPweCaq9ITyHxaCEJLKbl4c3BeNrMUTkblLv6F8k XZ3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Zok+z77y; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2-v6si692850plt.302.2018.07.17.04.56.08; Tue, 17 Jul 2018 04:56:23 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Zok+z77y; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731242AbeGQM1I (ORCPT + 99 others); Tue, 17 Jul 2018 08:27:08 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:42458 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731012AbeGQM1I (ORCPT ); Tue, 17 Jul 2018 08:27:08 -0400 Received: by mail-ua0-f196.google.com with SMTP id w7-v6so471315uan.9; Tue, 17 Jul 2018 04:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VcyY5bNhPqNiJOLsmcLVEFfrqVl3klrh7MTk9oYxeYQ=; b=Zok+z77yEch/vtaBwykWsl39Kb74/7kKhCcp8hLgUY9x8FrNHV6Kl7PKNd4GxRnilo g8Acu5NEQ/CY76RsUBVtIk1hRtTPHec38zmvVI40BTMLKiTpr5nlEDLA+9ItDk1PpkUY U/1lR6ytsDcv0ezM9e+NRMhJi/Ms5XtAvTHac5o1HiaFCdEYf8r3r9NwzxAEqkYfSglF /KWoAi7QXLqFrJ2dyz+im/6VMtyf35a9fLQh/yfPw9YH9Ke9PDfuN1JvF5Lfjg8v4P2z GuqrPwfsG5c9x538XluKRua6WTO71mC0HKSO4VTMxpA2+xWCT4pe+zjbY33RQ/Yf71Ii sXGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VcyY5bNhPqNiJOLsmcLVEFfrqVl3klrh7MTk9oYxeYQ=; b=MWThU3WE2AC2jV8/G/KTuHR+TRN7E3Kdt1oWsdrLq7UnXJH+S3EWoee7XTM9jPoXhh 5jdfpREHanXEdLdVgkuTsWRZxxljroWR1rhRcyYZ+k0I2DjNXkyD6JtGjM4jQNrodsEo FRnyXF6vyezsHzdyZ10FD6EDmSGo4BcKbgyFE/caw5PNeccxhtTSZF6P5V6KJOUVdUQn NafnTd2vGX3cbVI5L/1l4rfKeKxXC1M7qrXZVjW3MtOsx4VeNgFAYtOkClNqofEtWvTL 4Q6DQweemn0RlWD4fnf/djJkmkmhRJ/PpVs6eqpr6lwa8tfHT/Q85sJjZGnUNOcDtQMY URaA== X-Gm-Message-State: AOUpUlHwFlTcU13xJVWU4rjWUF4RFgtrCh8jhmhgMm62WYZuxVbvJbv1 oxqDmtsmuPdEAFvlSNDCK0XQfoVRKYMelKf2xBw= X-Received: by 2002:ab0:10cc:: with SMTP id x12-v6mr782099uab.55.1531828490342; Tue, 17 Jul 2018 04:54:50 -0700 (PDT) MIME-Version: 1.0 References: <20180716235936.11268-1-lyude@redhat.com> <20180716235936.11268-5-lyude@redhat.com> In-Reply-To: From: Ben Skeggs Date: Tue, 17 Jul 2018 21:54:37 +1000 Message-ID: Subject: Re: [Nouveau] [PATCH 4/5] drm/nouveau: Grab RPM ref when i2c bus is in use To: Karol Herbst Cc: lyude@redhat.com, Dave Airlie , nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, dri-devel@lists.freedesktop.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 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. > > 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