From patchwork Mon Aug 26 22:33:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 172220 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp4965354ily; Mon, 26 Aug 2019 15:33:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKYHupu3ZMLMY20IWI05nZJrVKE5aQWMhWgv6O+3Q0LnUnevfFTg7Y61eqUJeVXU1CaX/L X-Received: by 2002:a17:90a:36ad:: with SMTP id t42mr21919230pjb.21.1566858806695; Mon, 26 Aug 2019 15:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566858806; cv=none; d=google.com; s=arc-20160816; b=QJ11myj2bVQBCo+/tgUtTRnxF+D6LAbCKkkDb1kwQSBQFigqhNdOFCfgMHhTAebLga 8JxP1KQaflzCHJ4YuHoOCNwkO0oNhbFEiqwrOPaERZP6BlnLKFPYd0GgH4sfrxkUYbcH f3CmHDGuyY9jnjhmyyaR4PaMNLFQq7KZeGM3OdxKeJsRYAV7Cvn04QsELcn0ap2utFIn fnO19fBeUhtcMCwDL9L82hy5Qk3Yd9zoDWZmpxBm33PgvuzXGFx5ivQgxp96NuKlk4/X 0rr5q+PmYH2BMO/J3C7MYbn867GTc0AXQq5nCn8IfeL8CB8paQkl11QTd2O3kXYsa790 B05g== 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=E2GLGDHyUIxmhRZ/soSFj+eCp+4x3EhognH3kgRLktA=; b=fym/owRLrP85tcdSkpJC0Un8S/fF+PaD8OT5fDUKIPVeYaTFxlNYgXM+LXZtdKC3B7 IwH0DBb0ZYxWHGeO6IPkfFtRuHhZhm+vn/hvxYbeALShrWSatmim/czp1hDaBIFC1/b3 XtnDc9X4aGhxfH/E/13WdoT3zOt3KZHQ54bixTdnMcBy//v72a2gTlQ5M0gyx+9LMXXg yJS4Fn6QCQB1d/BHKzezd2i99pGVsra9B5RJGvt7IiDx6ss2AxfpfWNYgV+tJX+CehLN gnWSmY1uXE2FNSJwaqg6WzGELphuL4OfK3AdpmIPSEdrYxUbY1uR2Bw6MJwCDvWMFz5f dHbA== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id e129si10350939pgc.344.2019.08.26.15.33.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Aug 2019 15:33:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 2243089CC9; Mon, 26 Aug 2019 22:33:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD33A89CA8 for ; Mon, 26 Aug 2019 22:33:22 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id j7so16796116ota.9 for ; Mon, 26 Aug 2019 15:33:22 -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=Lr1R889MqE/Qh3k6PKpRAd6kdNCwcusZ5h2myFtwlCQ=; b=SJjEmL4vkkgVQ57j1c+9dJBagBCibBszmKIfAbQGjKzAyQXOI9YE/PPXHGCx/ZXd40 rZD0VrBCVcOQwo5jynitTxcZKasgVK8HBUdPDkU1OQErGidl1ej4NMt77597dMiKWhh9 RIjk4W9vghNfNcdOyeBD0EuieVQ0UNLJk7euhamdzlsio6MzO9wEGzdLT4dVNusyycnO XjSzy9vtOzQA0hhEk3XiA3qC5JmgqT7KFGTGkydW3HxBg6wChQ1uLVRiQhoi1yCbGPJF U+qT511W53Y3tsQfQhVvd9G5/wuDXUEFXRDOaY+SK7F8aYwJTBMEOzE6s/AoyB5Odw7V 2k/Q== X-Gm-Message-State: APjAAAXLQQw8tJhkga6Q0N4lRATLnofOWa45SEB0OnfdriezBXN6ovdR VFINlWxsnWlMlBrMUHCcB1NbFt0= X-Received: by 2002:a9d:7356:: with SMTP id l22mr9274009otk.31.1566858801827; Mon, 26 Aug 2019 15:33:21 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 15:33:21 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 3/8] drm/panfrost: Remove unnecessary mmu->lock mutex Date: Mon, 26 Aug 2019 17:33:12 -0500 Message-Id: <20190826223317.28509-4-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" There's no need to serialize io-pgtable calls and the as_lock is sufficient to serialize flush operations, so we can remove the per page table lock. Fixes: 7282f7645d06 ("drm/panfrost: Implement per FD address spaces") Suggested-by: Robin Murphy Cc: Tomeu Vizoso Cc: Steven Price Cc: Alyssa Rosenzweig Cc: David Airlie Cc: Daniel Vetter Signed-off-by: Rob Herring Reviewed-by: Robin Murphy Reviewed-by: Steven Price --- v3: - new patch drivers/gpu/drm/panfrost/panfrost_device.h | 1 - drivers/gpu/drm/panfrost/panfrost_mmu.c | 9 --------- 2 files changed, 10 deletions(-) -- 2.20.1 diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index f503c566e99f..b7fa08ed3a23 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -104,7 +104,6 @@ struct panfrost_device { struct panfrost_mmu { struct io_pgtable_cfg pgtbl_cfg; struct io_pgtable_ops *pgtbl_ops; - struct mutex lock; int as; atomic_t as_count; struct list_head list; diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c index 842bdd7cf6be..3a8bcfa7e7b6 100644 --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c @@ -228,8 +228,6 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu, struct io_pgtable_ops *ops = mmu->pgtbl_ops; u64 start_iova = iova; - mutex_lock(&mmu->lock); - for_each_sg(sgt->sgl, sgl, sgt->nents, count) { unsigned long paddr = sg_dma_address(sgl); size_t len = sg_dma_len(sgl); @@ -249,8 +247,6 @@ static int mmu_map_sg(struct panfrost_device *pfdev, struct panfrost_mmu *mmu, mmu_hw_do_operation(pfdev, mmu, start_iova, iova - start_iova, AS_COMMAND_FLUSH_PT); - mutex_unlock(&mmu->lock); - return 0; } @@ -304,8 +300,6 @@ void panfrost_mmu_unmap(struct panfrost_gem_object *bo) if (ret < 0) return; - mutex_lock(&bo->mmu->lock); - while (unmapped_len < len) { size_t unmapped_page; size_t pgsize = get_pgsize(iova, len - unmapped_len); @@ -321,8 +315,6 @@ void panfrost_mmu_unmap(struct panfrost_gem_object *bo) mmu_hw_do_operation(pfdev, bo->mmu, bo->node.start << PAGE_SHIFT, bo->node.size << PAGE_SHIFT, AS_COMMAND_FLUSH_PT); - mutex_unlock(&bo->mmu->lock); - pm_runtime_mark_last_busy(pfdev->dev); pm_runtime_put_autosuspend(pfdev->dev); bo->is_mapped = false; @@ -356,7 +348,6 @@ int panfrost_mmu_pgtable_alloc(struct panfrost_file_priv *priv) struct panfrost_mmu *mmu = &priv->mmu; struct panfrost_device *pfdev = priv->pfdev; - mutex_init(&mmu->lock); INIT_LIST_HEAD(&mmu->list); mmu->as = -1;