Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp569698iog; Wed, 15 Jun 2022 07:56:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v7xTzPRLgYZ2g/IeGfkG8Bnzk6ckevNIu3OYuYIi8f9tMds/4YYaJ03/8LZWjejJRSVslv X-Received: by 2002:a05:6402:2806:b0:431:87c8:b45e with SMTP id h6-20020a056402280600b0043187c8b45emr186444ede.130.1655304984016; Wed, 15 Jun 2022 07:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655304984; cv=none; d=google.com; s=arc-20160816; b=mGhmD2cHyoEpR8wnU8b/FiijgoIUBagZvBF1SpzAlxhskhXLigB3Fj1YoewRDVaGCV /VhDlnmMt142E80k4Lwd5aRnn/6I323jdiNNktYknNhICgSqdrft7WendWF4CMdCy1jl dszIW+JqcDJcboKg+cgYZrBp0m69aPJmMUcZ4GpXE+p5Tvm5w+eXJ+s48l8JvlNX+oBA 8SHOTKIzBQFIa0WC0jpPNyuqGzturGySyvqGGFFRKrpKQb5eMqPGX1bsmpWG/tmsMGNS L3juSGzNtiAvRq3ViFYyPgv6Z2yc4Yuy8HzVDIzbOj/MFXdcNbirG+Q0ryvzX1PYoQYm MvOQ== 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 :message-id:references:in-reply-to:reply-to:user-agent:subject:cc:to :from:date:dkim-signature; bh=Zqi1npyTba5vA99xAaeJ8hkwGYh+4nM0BlvlcLRn6yM=; b=s55+0RNTjvMGQyIq+kLluRk751Q41E2sqdWmPPkTcnepM2ZSdEnsxGkLil9pgnylKL tPGCHl0a1KtEEdb+nyiARPX8mc2dPoz9GkFOx5ZyjBTaZfR3sPUHQNeXDSLPC749qMpB i9hEiq7XAx6wfaGw/9HW0PfFh7RwXw8NTZU6UPEreeQucIhRKi513ZUDn1gwO0N9E6mA 1XiAhTT62pIhkI5SJ4wDPtueZuIHJWXjqNJ9S3tpvZqBpYSXozKbNsiU37rRROWRqTbb LfSaaqMU/U8WsHf9bzkawR5Adl5zoxHr3ODrjXhKDsCm9HkHRt7HLfGPNy0D9pdqOdAx wt5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=LBoX6PPl; 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 hv19-20020a17090760d300b006efc0b0d8e8si15344611ejc.752.2022.06.15.07.55.57; Wed, 15 Jun 2022 07:56:24 -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; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=LBoX6PPl; 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 S1352845AbiFOOqS (ORCPT + 99 others); Wed, 15 Jun 2022 10:46:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349219AbiFOOqQ (ORCPT ); Wed, 15 Jun 2022 10:46:16 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC57F3B3D3 for ; Wed, 15 Jun 2022 07:46:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1655304367; bh=fO4VIThT2jN8IjrFoYjpk6jSRHO/M4kILno2rNLiA9s=; h=X-UI-Sender-Class:Date:From:To:CC:Subject:Reply-to:In-Reply-To: References; b=LBoX6PPlqH0U18Mip7KIjDPw/rYe0b5zpMbCLpk5xJl/4yq96+tuwPFHye8hKzq8w xNh5Uhh4/PPfvwA5EtY2oENzYnKgshRDs6vmeBx5zJd2qFitHzNfD0/zcjNDC5VaRB ZrugLb/qe1c2R1jPmGuQRRxHTEqQE6zdl9PfYxwY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [127.0.0.1] ([217.61.154.5]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M7b2T-1o4VcZ35bh-00825p; Wed, 15 Jun 2022 16:46:06 +0200 Date: Wed, 15 Jun 2022 16:46:03 +0200 From: Frank Wunderlich To: Christoph Hellwig , Robin Murphy CC: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Marek Szyprowski Subject: Re: helping with remapping vmem for dma User-Agent: K-9 Mail for Android Reply-to: frank-w@public-files.de In-Reply-To: <20220615131700.GA18061@lst.de> References: <6e58b50c-cd05-a37b-07e1-10ee24fb972f@arm.com> <20220615131700.GA18061@lst.de> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:ymi/dNLhID0rFfwSQkIthc5hPryrUBWKoviU/G5LfbZ5hPjWsd8 RBpykFdP3h0tarGpyZzwg4wXqniI7BpoFqquQLQ/Ce/upW6B44LBGnsD0qaENx9jGlnxPbD Ha3g4WzaKMvFvy5NsbcGMPqcWmGqrwoEQdVS/0k9CR0n34CC59yC1JIdW5Te9FhYl7i3gc9 FRVV++YKgk+rotP7WXFiA== X-UI-Out-Filterresults: notjunk:1;V03:K0:E+HnZb1mwbA=:om6cIiNQNYQg16D7bxOOzI VB6RwzUENSUhzyLEDKjpUhL/LmxkOF52F77csv/+3tPBsUPLdp4oyMQYVIHfbk/qRjcbF2nro +UsaGAKdZgKHGE45sSVdmG/E17Z6Kb7eeA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5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,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 Am 15=2E Juni 2022 15:17:00 MESZ schrieb Christoph Hellwig : >On Wed, Jun 15, 2022 at 02:15:33PM +0100, Robin Murphy wrote: >> Put simply, if you want to call dma_map_single() on a buffer, then that= =20 >> buffer needs to be allocated with kmalloc() (or technically alloc_pages= (),=20 >> but then dma_map_page() would make more sense when dealing with entire= =20 >> pages=2E > >Yes=2E It sounds like the memory here comes from the dma coherent >allocator, in which case the code need to use the address returned >by that and not create another mapping=2E As i have not found position where memory is allocated (this is a very hug= e and dirty driver) is it maybe possible to check if buf is such "allready = dma" memory (maybe is_vmalloc_addr) and call dma_single_map only if not (us= ing original buf if yes)? But i guess it should map only a part of available (pre-allocated) memory = and other parts of this are used somewhere else=2E So i can ran into some i= ssues caused by sharing this full block in different functions=2E Hi, Thanks for first suggestions=2E=20 regards Frank