From patchwork Thu May 17 15:34:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 915500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="e6ik9PzU"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40mwMz032Nz9s4n for ; Fri, 18 May 2018 01:34:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752162AbeEQPei (ORCPT ); Thu, 17 May 2018 11:34:38 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34848 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751843AbeEQPeh (ORCPT ); Thu, 17 May 2018 11:34:37 -0400 Received: by mail-wm0-f66.google.com with SMTP id o78-v6so9971925wmg.0 for ; Thu, 17 May 2018 08:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jKkpODAH/qa8fKEXR0hEqNqR8rElyel4vHlc3StcyRY=; b=e6ik9PzUDyr6u7pHStolcx/qihulzjqWRGoFLlREqliooOi2bsZedOhlH3ahO6BnAO f37mrO3S5VOsZvuK6CfqPrt8fHntJB4NZ3p9lC+WDvA5IqiZ9ZVgMeFGJ/CJUqZgVK9P RRIxhjFh9HKVoHwve4AhriEWOSxpXOamQ+VzLQMxMOW8fuSbsvwmbZoMRmRSJ2+zcX2R 24VR6tUndFfMYjKBee09fsKzqQupKmt2TTSY191ardVmBBKCjCuvDfgofSKD8c35O2qh hRVDN88s5TJx9nCDjmsZtKZ5ElNJtM/vMp6946qIRbCiLPygwkXPp0cnErInZRvgW1Bt dMOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jKkpODAH/qa8fKEXR0hEqNqR8rElyel4vHlc3StcyRY=; b=K+OZdQyjnXq5XYoqs8AHapbxExFHC/v1ZM8hh2JfoP8IdKaFfQ596f4nAqn8zK60Kq wY9Gd5WqxKv1li1odVCN+/rR/YbU8iVxQa/YW/b64tyiVamaKrfbHijHNSRBOqOIQGiO iuZFMYYNIGGDVWjgffeMuxBgupfVs3Bdw6E8k+GmDpF5b2Y7x1rKAlMtljIWV9NMkjl2 Wc90TrMWssVCYoz/Qj8cX1MtCasI6nG4FaCwkYbzUvwcCtnahUOD7I9o2E33TAZYOaJm xjSeY7pY/S4q0RqzjHnG63UCli9vp5iIeo/EKOmy49338UDGviMBmq6Oy8RuUlnC2M9x c6uA== X-Gm-Message-State: ALKqPwfTkv62Ps2hns8mNZOfKEYWK5GscrmsdH+66OojwgWqRHbKIwR+ mX/yBDmohBSLyvj0yCaW/UE= X-Google-Smtp-Source: AB8JxZqJVJmZN28CsF+gwTwet8LZeWR7fQ+e3hlUODAPGWaIxrFsAq1a0GTjMgMgqxWFo9il3Sqcyw== X-Received: by 2002:a1c:bfd7:: with SMTP id o84-v6mr2231356wmi.157.1526571276743; Thu, 17 May 2018 08:34:36 -0700 (PDT) Received: from localhost (p200300E41F19FC00D958180F3872A5C5.dip0.t-ipconnect.de. [2003:e4:1f19:fc00:d958:180f:3872:a5c5]) by smtp.gmail.com with ESMTPSA id g105-v6sm8391162wrd.45.2018.05.17.08.34.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 May 2018 08:34:35 -0700 (PDT) From: Thierry Reding To: Thierry Reding Cc: Dmitry Osipenko , Mikko Perttunen , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org Subject: [PATCH 2/7] gpu: host1x: Store pointer to client in jobs Date: Thu, 17 May 2018 17:34:25 +0200 Message-Id: <20180517153430.9602-3-thierry.reding@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180517153430.9602-1-thierry.reding@gmail.com> References: <20180517153430.9602-1-thierry.reding@gmail.com> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org From: Thierry Reding Rather than storing some identifier derived from the application context that can't be used concretely anywhere, store a pointer to the client directly so that accesses can be made directly through that client object. Signed-off-by: Thierry Reding Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/drm.c | 5 +++-- drivers/gpu/host1x/cdma.c | 2 +- drivers/gpu/host1x/cdma.h | 2 +- include/linux/host1x.h | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 33e479182773..e92e44e69871 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -317,6 +317,7 @@ int tegra_drm_submit(struct tegra_drm_context *context, struct drm_tegra_submit *args, struct drm_device *drm, struct drm_file *file) { + struct host1x_client *client = &context->client->base; unsigned int num_cmdbufs = args->num_cmdbufs; unsigned int num_relocs = args->num_relocs; struct drm_tegra_cmdbuf __user *user_cmdbufs; @@ -348,8 +349,8 @@ int tegra_drm_submit(struct tegra_drm_context *context, return -ENOMEM; job->num_relocs = args->num_relocs; - job->client = (u32)args->context; - job->class = context->client->base.class; + job->client = client; + job->class = client->class; job->serialize = true; /* diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c index 28541b280739..cb590ba886ec 100644 --- a/drivers/gpu/host1x/cdma.c +++ b/drivers/gpu/host1x/cdma.c @@ -247,7 +247,7 @@ static void cdma_start_timer_locked(struct host1x_cdma *cdma, static void stop_cdma_timer_locked(struct host1x_cdma *cdma) { cancel_delayed_work(&cdma->timeout.wq); - cdma->timeout.client = 0; + cdma->timeout.client = NULL; } /* diff --git a/drivers/gpu/host1x/cdma.h b/drivers/gpu/host1x/cdma.h index 286d49386be9..1825091bc0ed 100644 --- a/drivers/gpu/host1x/cdma.h +++ b/drivers/gpu/host1x/cdma.h @@ -58,7 +58,7 @@ struct buffer_timeout { u32 syncpt_val; /* syncpt value when completed */ ktime_t start_ktime; /* starting time */ /* context timeout information */ - int client; + struct host1x_client *client; }; enum cdma_event { diff --git a/include/linux/host1x.h b/include/linux/host1x.h index f66bece1e1b7..0632010f47fb 100644 --- a/include/linux/host1x.h +++ b/include/linux/host1x.h @@ -202,7 +202,8 @@ struct host1x_job { /* Channel where job is submitted to */ struct host1x_channel *channel; - u32 client; + /* client where the job originated */ + struct host1x_client *client; /* Gathers and their memory */ struct host1x_job_gather *gathers;