From patchwork Mon Aug 26 22:33:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 172227 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp4965757ily; Mon, 26 Aug 2019 15:33:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxp8GpW+6MbtS15/y5Jl+MQRLIVA1d3bv100LcUzgnozrIkL5bTsDBclH4SkA5ugMpX5QLL X-Received: by 2002:a17:902:bcc2:: with SMTP id o2mr21429515pls.127.1566858832665; Mon, 26 Aug 2019 15:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566858832; cv=none; d=google.com; s=arc-20160816; b=jbLgtTRsE2XbQArap5nSdsinJB0WUKL3aSty1UPhqFy2bUG1xaAQCE+86kEytG3Ssj 6ttC6FjmT9ItRb3dyuzlKAoMq2fWIFDL51u+uof09pIaouNXAlogYHW24FqR2WV1/7Hc sXwKarvwVkZYvVA4UEWeHnzR00CqWhfpuwCs5AjVgb2xkhHVVEfJAF+ZXV5PQLvazCLt JIAMNgBucpwsQ2tbqIHJSjSaYqYlK0QRe2nIsNtFyUTE++sX8KoR1a+s/d/5jVbUQ5i5 YNaAZDmV2PQZFAAeCN6UELtB8OfKq50vqRtN50wSaV0z1Crm+I83CYCwzGNRbrITeuYj kdSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=6wZ9gDkyNEao947tYdhIE9hBajC+mMmla4Nu4ns3XMg=; b=jDbRLG+ep8Nq42buuqFFu0WHY8hE+SqoMCIkeaskd8mknDwTC4t1T5IEd9n64j+a2e 9vrgGYHwMqjPUKgQqISFRpOoI5LFJJJMX2DQFveB4Ytnje4xKRbYXgIqGptPrvSGSsAA yLmYKgKdE+w3ftspPdTOQwMDZHCE828kPoXiGJ+9LfJK4Lg/Le9EdTR2M66YnZ/Zg0i+ 7uv7n/JfQnPonp0hk+jnve0nGzo654jymRDMUMlQ8rDabWG08mY7QGo6cQ9o1k920fXQ fLnsD+b0R5u5CQIUE5Jp9zkpdRdracKF9a802ImAyM3PIFjEQ2+HIMq7PWPBLLnxRXJK o/Bw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id t184si10221149pgd.211.2019.08.26.15.33.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Aug 2019 15:33:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B781D6E31E; Mon, 26 Aug 2019 22:33:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oi1-f194.google.com (mail-oi1-f194.google.com [209.85.167.194]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BFA189CA8 for ; Mon, 26 Aug 2019 22:33:25 +0000 (UTC) Received: by mail-oi1-f194.google.com with SMTP id q8so13141005oij.5 for ; Mon, 26 Aug 2019 15:33:25 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=R4jGmh892Y2Plh7rZR/Jz0sf/VgHSWV3z2nnmBNkYNk=; b=Ks3kMswmqfAqifmPDMBn1JhSFXjLOjMAzZpKKnfnKYE5WL3oFwwbSIZC+WcVkO8vGp dkA4BKt2eprVnWIalTWETa5vAQpS60c7GkeyxEihQF2kLccsbSQNX+wdsgFmWqFGnIjq IrXXz9S6EgeZrMUG6W7nE7FYW8BQvzRUhEcJOGa6QuroZnoKs+RyHG5tOm/GQeD9CQ9o izDDwO/vI1CtKkoVE2QRb+uusCZxLGp1SfJFmvGVj32vPNxN7GZ1auydXQIIwr0wkeVG al3lmCm4CqJb5hKXbGpAIP230z4aCZsdPjRlFqQyIxs4Kyi4seyYehruAcH0R0aRgTkV 1Y0w== X-Gm-Message-State: APjAAAVVzbvZmoZfRuxwTCIYTl8L9tJWQtcZR4bVKQaAUJsZFsB5rOHL KJs8X/cVUQXmDfnf3eXusoysZI4= X-Received: by 2002:aca:55d6:: with SMTP id j205mr13622153oib.63.1566858804055; Mon, 26 Aug 2019 15:33:24 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id e22sm3668959oii.7.2019.08.26.15.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 15:33:23 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 5/8] drm/panfrost: Split mmu_hw_do_operation into locked and unlocked version Date: Mon, 26 Aug 2019 17:33:14 -0500 Message-Id: <20190826223317.28509-6-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190826223317.28509-1-robh@kernel.org> References: <20190826223317.28509-1-robh@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomeu Vizoso , David Airlie , Steven Price , Alyssa Rosenzweig , Robin Murphy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In preparation to call mmu_hw_do_operation with the as_lock already held, Add a mmu_hw_do_operation_locked function. Fixes: 7282f7645d06 ("drm/panfrost: Implement per FD address spaces") Cc: Tomeu Vizoso Cc: Steven Price Cc: Alyssa Rosenzweig Cc: David Airlie Cc: Daniel Vetter Signed-off-by: Rob Herring Reviewed-by: Steven Price --- v3: - new patch drivers/gpu/drm/panfrost/panfrost_mmu.c | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 2.20.1 diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c index 2204e60f7808..3407b00d0a3a 100644 --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c @@ -80,19 +80,11 @@ static void lock_region(struct panfrost_device *pfdev, u32 as_nr, } -static int mmu_hw_do_operation(struct panfrost_device *pfdev, - struct panfrost_mmu *mmu, - u64 iova, size_t size, u32 op) +static int mmu_hw_do_operation_locked(struct panfrost_device *pfdev, int as_nr, + u64 iova, size_t size, u32 op) { - int ret, as_nr; - - spin_lock(&pfdev->as_lock); - as_nr = mmu->as; - - if (as_nr < 0) { - spin_unlock(&pfdev->as_lock); + if (as_nr < 0) return 0; - } if (op != AS_COMMAND_UNLOCK) lock_region(pfdev, as_nr, iova, size); @@ -101,10 +93,18 @@ static int mmu_hw_do_operation(struct panfrost_device *pfdev, write_cmd(pfdev, as_nr, op); /* Wait for the flush to complete */ - ret = wait_ready(pfdev, as_nr); + return wait_ready(pfdev, as_nr); +} - spin_unlock(&pfdev->as_lock); +static int mmu_hw_do_operation(struct panfrost_device *pfdev, + struct panfrost_mmu *mmu, + u64 iova, size_t size, u32 op) +{ + int ret; + spin_lock(&pfdev->as_lock); + ret = mmu_hw_do_operation_locked(pfdev, mmu->as, iova, size, op); + spin_unlock(&pfdev->as_lock); return ret; }