Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp40715rwr; Wed, 19 Apr 2023 03:08:15 -0700 (PDT) X-Google-Smtp-Source: AKy350Z8I0AT1CcTKwhWhI4BWDjy99z1/U9wysUO59PhoZeQgDrS10dRz5llzKYmpMnBDkvp5AZg X-Received: by 2002:a05:6a20:3d87:b0:ef:53b6:8fda with SMTP id s7-20020a056a203d8700b000ef53b68fdamr3112516pzi.48.1681898895156; Wed, 19 Apr 2023 03:08:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681898895; cv=none; d=google.com; s=arc-20160816; b=Jf5L7ALmmRxw/TOMwnGm0nQcE5Xc04/XXxQ5yzhdfuKUtN5EEY+4UsQ58P9S/rXsfP 16cLjo/68HXW0U9ylT2RNjdBKf1RfBXYwg4wqnRp5UpCqu7zsXmmbq/s8MBiCrGekX/G BDOumQU4IaKYE5XkP4R/8GaK92GGR+zhMhGlhlIyzDar/AUggeaAjiwXOt/0aPbpULzt t8OXtc6O9xlof0olUBNqHlxjxL5LZkIOSFSiTejnIuHhS72AaZIbwiN+GYZWsbG4qgHt kwtaSbdJEvUT58zO/MscPL8L6L/HBald69Kza/Lbip1+iwXgm0nP19Y2dmD+EG3+LZOy 8C/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dsfei6RIDqaRKOiTQmd6lsGkK/Y7dA2m2bM55k3pgpo=; b=jNderZTTUajai542fUk9gx+gmj1YsPSZkyApMNCxj9/MnLaj3JceibPRqn74lVUcBd +EQgir0EbmmQWbTR9qEPq6J9KxB7RZ6AR3cgVOp7DCBxK+v1oygznFMAoaIFgJm6xkFi SCTUr6U3u9mgU+sXUNtTQSw1Oszep2F1M9mAZaB0MUDiTw7nA48+RQ51Z16MxyXPWJR5 ffp7mA3lDD0V7tasHC8m/7K2QYkF+fVYU686ljdzT/UfMQ2cIrEPqkSMDsON/higdVIV n+/NTL7dlrVYzh4JfhgxIIs5nhcQCppIuyMmDnZIgySoTukjJEl+l5wDXrBSkHVUiniQ PaYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g32-20020a635660000000b0050beec91e30si16320480pgm.768.2023.04.19.03.08.01; Wed, 19 Apr 2023 03:08:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232356AbjDSKHq (ORCPT + 99 others); Wed, 19 Apr 2023 06:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233049AbjDSKHN (ORCPT ); Wed, 19 Apr 2023 06:07:13 -0400 Received: from frasgout12.his.huawei.com (frasgout12.his.huawei.com [14.137.139.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1BDB1445D; Wed, 19 Apr 2023 03:07:08 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.18.147.228]) by frasgout12.his.huawei.com (SkyGuard) with ESMTP id 4Q1bm5169Xz9xFm3; Wed, 19 Apr 2023 17:56:37 +0800 (CST) Received: from A2101119013HW2.china.huawei.com (unknown [10.45.152.239]) by APP1 (Coremail) with SMTP id LxC2BwAXi_aYvD9k7TY6Ag--.1944S8; Wed, 19 Apr 2023 11:06:23 +0100 (CET) From: Petr Tesarik To: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Borislav Petkov , "Paul E. McKenney" , Catalin Marinas , Will Deacon , Zhen Lei , Randy Dunlap , Damien Le Moal , Kim Phillips , "Steven Rostedt (Google)" , Muchun Song , Ondrej Zary , "Jason A. Donenfeld" , Petr Tesarik , Hans de Goede , Dan Williams , Andy Shevchenko , Kees Cook , Thomas Gleixner , Won Chung , linux-doc@vger.kernel.org (open list:DOCUMENTATION), linux-kernel@vger.kernel.org (open list), dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), iommu@lists.linux.dev (open list:DMA MAPPING HELPERS) Cc: Roberto Sassu , Kefeng Wang , petr@tesarici.cz Subject: [PATCH v2 6/7] drm: Use DMA_ATTR_MAY_SLEEP from process context Date: Wed, 19 Apr 2023 12:03:58 +0200 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: LxC2BwAXi_aYvD9k7TY6Ag--.1944S8 X-Coremail-Antispam: 1UD129KBjvJXoW7ZF4kXFWDJF1Duw1rGFWrGrg_yoW8XFWkpF 4xAFyqvr40qFZYv39rZ3WkZasxua12qFWxua4UJws5u3WYyF9F9ryYyFW2vrWDAr97Xr4f tr9FyryUAry2kFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUmEb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAV Cq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267 AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv6xkF7I0E 14v26r4UJVWxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrV C2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE 7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACI402YVCY1x02628vn2kIc2xKxwCY1x0262 kKe7AKxVWUtVW8ZwCY1x0264kExVAvwVAq07x20xyl42xK82IYc2Ij64vIr41l4I8I3I0E 4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGV WUWwC2zVAF1VAY17CE14v26rWY6r4UJwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v2 6r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UMIIF0xvE42xK8VAvwI8IcI k0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4U JVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7IU8yxR3UUUUU== X-CM-SenderInfo: hshw23xhvd2x3n6k3tpzhluzxrxghudrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Petr Tesarik These mappings are never done from atomic context. If a dynamically allocated bounce buffer is used for the mapping, this change allows to allocate from CMA. Signed-off-by: Petr Tesarik --- drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +- drivers/gpu/drm/drm_prime.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 2b2163c8138e..b5bb4f9c130a 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -702,7 +702,7 @@ static struct sg_table *drm_gem_shmem_get_pages_sgt_locked(struct drm_gem_shmem_ goto err_put_pages; } /* Map the pages for use by the h/w. */ - ret = dma_map_sgtable(obj->dev->dev, sgt, DMA_BIDIRECTIONAL, 0); + ret = dma_map_sgtable(obj->dev->dev, sgt, DMA_BIDIRECTIONAL, DMA_ATTR_MAY_SLEEP); if (ret) goto err_free_sgt; diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index f924b8b4ab6b..f32e12445570 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -635,7 +635,7 @@ struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, return sgt; ret = dma_map_sgtable(attach->dev, sgt, dir, - DMA_ATTR_SKIP_CPU_SYNC); + DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_MAY_SLEEP); if (ret) { sg_free_table(sgt); kfree(sgt); -- 2.25.1