From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE81BC433DB for ; Fri, 29 Jan 2021 08:12:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 64A4A64E0A for ; Fri, 29 Jan 2021 08:12:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64A4A64E0A Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 32E816EA91; Fri, 29 Jan 2021 08:11:39 +0000 (UTC) Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26E7B6E2E6 for ; Fri, 29 Jan 2021 01:23:25 +0000 (UTC) Received: by mail-vs1-xe36.google.com with SMTP id n18so4055403vsa.12 for ; Thu, 28 Jan 2021 17:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sjkb6yXWtZ9Sxv1/gNdqQbGBoN1+dPLaicMA2ZT6rNM=; b=iCLYU3fuPsvJZltkAom5unfVux3qbx/84SoQSmqh5RtsiImcrCdGMT31C6+1ENMBLS 0+LRiLAsmRhmOFQ5Q3GHbyu5aZ74aQkQRyaA63MegeLEXfmWLspArV+SQzI3/B/1cGxJ 1rQ42u/3utf0mvm4yEsRiVY+BSTy3WgKy9UUCY1jQR27gxY3lKBZJ2MjQvlH/Y3jc8R5 O3KBn5Wfuxbpq3cWKoGssSVuk/IPGSipcB70yiVvVwUkdP1OYGYUTRRJlSo87uQH/33A B+txLKIct1lZEOxXRo12HH2AlAlcCOCVY8UJXBD8D02HEcysxUof5gYWcOYymjgwUMGv a2ew== 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=sjkb6yXWtZ9Sxv1/gNdqQbGBoN1+dPLaicMA2ZT6rNM=; b=Ji+1X3BviV3i/edJpRlQX9Swl+PWX2YS65WU7+s2zcHJKs9lFNq0tp+E7d7hfS9MnK /icKeLcxlEARZjCAPANZYBvqjLKkogt1zjXmsan32frkY3bJBt0JDfIrqrcvxsA/wk91 79gGps7yHhBJwzxmVhSRLLpIhfi9Z78oJ4H/z/+O2z15qWUjT7fHfpONvH0c9owteCfg ttqJgxWFHfmsZLVFLRzd6CLzDp+kAcRibiuEi6pp5y3X6Y3UpUk6WqhPGV3dr7ecVQ0E 5RPpyHdCm6u0VFQ3pOyijc8u4sA7JoHQh50hPGqsHFgUUdHBpFFK1xKtj9IMf+2oxv6T 96wA== X-Gm-Message-State: AOAM530P9QqZEdfaWit24q3+py2OVgNRiZz8tkIxnvkVnqI8pqFqJbHR H/z8nDHzTEYiwnlHfSGmCiIXJhlu/J69c63hBQgBRQ== X-Google-Smtp-Source: ABdhPJzvSoHd4aqU6Cv8LKu9Sl0lIJ7bapX7TwH6WxQlYBY8b93nG65hR4r/fmD0J1GnGIrVHo0uyX2Ku496O34Z6ik= X-Received: by 2002:a67:f810:: with SMTP id l16mr1395266vso.41.1611883403850; Thu, 28 Jan 2021 17:23:23 -0800 (PST) MIME-Version: 1.0 References: <20201003040257.62768-1-john.stultz@linaro.org> <20201003040257.62768-8-john.stultz@linaro.org> <20201008115101.4qi6wh3hhkb6krg5@DESKTOP-E1NTVVP.localdomain> In-Reply-To: From: Daniel Mentz Date: Thu, 28 Jan 2021 17:23:12 -0800 Message-ID: Subject: Re: [PATCH v3 7/7] dma-buf: system_heap: Add a system-uncached heap re-using the system heap To: John Stultz X-Mailman-Approved-At: Fri, 29 Jan 2021 08:11:32 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sandeep Patil , dri-devel , Ezequiel Garcia , Robin Murphy , James Jones , lkml , Liam Mark , Laura Abbott , Chris Goldsworthy , Hridya Valsaraju , =?UTF-8?Q?=C3=98rjan_Eide?= , nd , Suren Baghdasaryan , linux-media Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Oct 16, 2020 at 12:04 PM John Stultz wrote: > > On Thu, Oct 8, 2020 at 4:51 AM Brian Starkey wrote: > > On Sat, Oct 03, 2020 at 04:02:57AM +0000, John Stultz wrote: > > > @@ -393,6 +424,16 @@ static int system_heap_allocate(struct dma_heap *heap, > > > /* just return, as put will call release and that will free */ > > > return ret; > > > } > > > + > > > + /* > > > + * For uncached buffers, we need to initially flush cpu cache, since > > > + * the __GFP_ZERO on the allocation means the zeroing was done by the > > > + * cpu and thus it is likely cached. Map (and implicitly flush) it out > > > + * now so we don't get corruption later on. > > > + */ > > > + if (buffer->uncached) > > > + dma_map_sgtable(dma_heap_get_dev(heap), table, DMA_BIDIRECTIONAL, 0); > > > > Do we have to keep this mapping around for the entire lifetime of the > > buffer? > > Yea, I guess we can just map and unmap it right there. It will look a > little absurd, but that sort of aligns with your next point. > > > Also, this problem (and solution) keeps lingering around. It really > > feels like there should be a better way to solve "clean the linear > > mapping all the way to DRAM", but I don't know what that should be. > > Yea, something better here would be nice... In ION, we had a little helper function named ion_buffer_prep_noncached that called arch_dma_prep_coherent() on all sg entries like so for_each_sg(table->sgl, sg, table->orig_nents, i) arch_dma_prep_coherent(sg_page(sg), sg->length); Would that help? _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel