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 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 86D3EC61DA4 for ; Mon, 13 Mar 2023 12:31:12 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.96) (envelope-from ) id 1pbhIO-0003FS-2d; Mon, 13 Mar 2023 08:28:56 -0400 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (Exim 4.96) (envelope-from ) id 1pbhIG-0003FC-2S for kernelnewbies@kernelnewbies.org; Mon, 13 Mar 2023 08:28:54 -0400 Received: from unknown (HELO send001-relay.gov-dooray.com) (211.180.235.152) by 129.254.9.16 with ESMTP; 13 Mar 2023 21:28:28 +0900 X-Original-SENDERIP: 211.180.235.152 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: kernelnewbies@kernelnewbies.org Received: from [10.162.225.112] (HELO smtp002-imp.gov-dooray.com) ([10.162.225.112]) by send001-relay.gov-dooray.com with SMTP id f8c6ab59640f16ec; Mon, 13 Mar 2023 21:28:28 +0900 DKIM-Signature: a=rsa-sha256; b=lAm257PjPS8mdote9JsKLcAHJW3TnSRzTNO5es0IvH3v7uAWEdnxcDmdij6Hk+3vKmHSJwgu9O ypgu30Q4xHCkEuOvbhkevzkkUoNyxryHkR0oznnlONnmocbKMAaTeUWKvwyLSvkBIkFwvfdcV7fS t6BYSYAIRWqu9eEFsoIq3nI/mW19XDNR6BC/7UYk++8Bt1NtEMudmc8qu/k5k+AX1dXE2VvgeRy6 3HZIDRwqw63kwCrlkVZiD/Vp2JDYbLFPfoFii5HRsoGRCgUEe/Mu4NTsmYwjGOdMhgFKlEUiYoax E7zEFsXBDtBH9mKAJMIiqz39q2T5nrIwZVuWE2cQ==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=/iihwBDutqnEhkaJwu4bgm+iaRUxiyOJ4U6EMUY6Yoc=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp002-imp.gov-dooray.com with SMTP id 59e18e56640f16ec; Mon, 13 Mar 2023 21:28:28 +0900 From: "Chan Kim" To: Subject: returned dma address value of dma_alloc_coherent, is it always in the lower 4GB range? Date: Mon, 13 Mar 2023 21:28:28 +0900 Message-ID: <034901d955a7$50a377d0$f1ea6770$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Content-Language: ko Thread-Index: AdlVpvH4SM3THAYUQZGdDLoM2HVmIg== X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org Hello experts, I was reading the well known DMA-API-HOWTO document (https://www.kernel.org/doc/Documentation/DMA-API-HOWTO.txt), (I've read this document a couple of times before in the past.) In the " Using Consistent DMA mappings" section it says : ----------------------------- dma_addr_t dma_handle; cpu_addr = dma_alloc_coherent(dev, size, &dma_handle, gfp); ... The consistent DMA mapping interfaces, will by default return a DMA address which is 32-bit addressable. Even if the device indicates (via the DMA mask) that it may address the upper 32-bits, consistent allocation will only return > 32-bit addresses for DMA if the consistent DMA mask has been explicitly changed via dma_set_coherent_mask(). This is true of the dma_pool interface as well. ------------------------------ I understand by 'DMA address', it means dma_handle (the address the device will use for DMA). I can't understand the expression "consistent allocation will only return > 32-bit addresses". Does it mean that when the driver sets the coherent_dma_mask, for example, to DMA_BIT_MAST(64) and it was successful, does it return the dma_handle in lower 32 bit address? What does "return > 32-bit addresses" mean? The ">" syntax here is so obscure with no clear definition of usage. By context I guess it returns the address in lower 32bit address range even it the coherent_dma_mask is set to some bigger value. (And I know generally, dma address(= bus address) is not equal to the physical address and is assigned by the OS for convenience) Thank you. Chan Kim _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies