Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp486357iog; Wed, 15 Jun 2022 06:24:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1udlHbthdpj1Cb/7ccn45aSw7FKKV49eh/3meuGFhbS9PdwfusJqWlFFL+DOkeLXQtpoAe3 X-Received: by 2002:a05:6a00:21c8:b0:4fd:f89f:ec0e with SMTP id t8-20020a056a0021c800b004fdf89fec0emr9724542pfj.83.1655299490571; Wed, 15 Jun 2022 06:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655299490; cv=none; d=google.com; s=arc-20160816; b=0SruNU6TZmcXCLz3cZVq2yhQgz1m2wimIfLA47T2zG7MzDzlG7ZpL1qxrdAB79Sc1F w75yknFja0Z8bLBF11gCS1QrAtRwf2i+H7sPLif4zzCH1CieLmkf5bW7doXG2Xvv3G0o QSQ92nd5meD5kWcXJO0gwZNF2K0kpgDpNZr78lx6SaHjzhr4Efe11PxA/UoKLWWn7Qwa GvF1GunPCAth69wLzBs3Quh3jGUpq+EauunaMybZAqI29JZVvLHMp5lkdhUIgY0YVFsa 8I9zk+nsDY3ANOqoC9JBy4hqubnXCXjMhAv/nXYzYeIeiMzXZX4nAPsa8Y171P4oIsjG CHLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=mLor0QKAgWncryyTeoYtmYIf65gEDgw9tIZzez7vY3w=; b=Yt6xC1xSsiXDK5qvvORR8i/wVggnzYRBrZb+6xGm4zAhnbPrK3F/NhB+GPjyByFrpF LjLTG/4TBc2w1O+piMh9Jx6EgMvC2eMztnOUUexqCZt1n6xD4PYk8/venDZ4IFOhUcsD 3WfRvtRVpaW7nrqyeqBoPNoDLqhQDMBiyQ9X6THWQR2RRs+ePqEq46wV4MIU5vZV3u1T 2V2qdFz8WJnq9rmTqvPp0aOvTPXSV0EErKxpfW/geHBRAGAydgHDOZWli5yVN/3WLUkJ gGC/lCFCP3IhdUvOpnrkwCFGUx74+/ZVDfpkyAeCSIPJijTVpwAFGwZukBQysvMaRu4K MrCQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m3-20020a170902f64300b0016184b32d35si17558480plg.174.2022.06.15.06.24.34; Wed, 15 Jun 2022 06:24:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241575AbiFONPs (ORCPT + 99 others); Wed, 15 Jun 2022 09:15:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347332AbiFONPq (ORCPT ); Wed, 15 Jun 2022 09:15:46 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 011702A27B for ; Wed, 15 Jun 2022 06:15:39 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DC9BA139F; Wed, 15 Jun 2022 06:15:39 -0700 (PDT) Received: from [10.57.82.209] (unknown [10.57.82.209]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EC6C03F66F; Wed, 15 Jun 2022 06:15:38 -0700 (PDT) Message-ID: <6e58b50c-cd05-a37b-07e1-10ee24fb972f@arm.com> Date: Wed, 15 Jun 2022 14:15:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: helping with remapping vmem for dma Content-Language: en-GB To: Frank Wunderlich , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Marek Szyprowski , Christoph Hellwig References: From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,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 On 2022-06-15 13:11, Frank Wunderlich wrote: > Hi, > > i have upported a wifi-driver (mt6625l for armhf) for some time and fall now (at least 5.18) in the > "rejecting DMA map of vmalloc memory" error [1]. > > maybe anybody here can guide me on how to nail it down and maybe fix it. > > as far as i have debugged it, it uses dma_map_single [2] to get dma memory from a previous > allocated memory region. > > this function "kalDevPortRead" in [2] is used via macro HAL_PORT_RD [3] (used in HAL_READ_RX_PORT > and HAL_READ_INTR_STATUS in same hal.h file) > > HAL_READ_INTR_STATUS is always called with an empty int array as buf which i guess is not the problem. > I think the issue is using the use with an preallocated prSDIOCtrl struct (have not completely traced > it back where it is allocated). Put simply, if you want to call dma_map_single() on a buffer, then that buffer needs to be allocated with kmalloc() (or technically alloc_pages(), but then dma_map_page() would make more sense when dealing with entire pages. Robin. > calls of HAL_PORT_RD/HAL_READ_RX_PORT are in nic{,_rx}.c (with sdio-struct) ([4] as example) > > maybe there is a simple way to get an address in preallocated memory as replacement for the dma_map_simple call (and the unmap of course). > > regards Frank > > [1] https://elixir.bootlin.com/linux/latest/source/include/linux/dma-mapping.h#L327 > [2] https://github.com/frank-w/BPI-R2-4.14/blob/5.18-main/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/hif/ahb/ahb.c#L940 > [3] https://github.com/frank-w/BPI-R2-4.14/blob/5.18-main/drivers/misc/mediatek/connectivity/wlan/gen2/include/nic/hal.h#L176 > [4] https://github.com/frank-w/BPI-R2-4.14/blob/5.18-main/drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c#L3604