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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0025C433EF for ; Thu, 30 Sep 2021 06:54:48 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EA92761528 for ; Thu, 30 Sep 2021 06:54:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EA92761528 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=etri.re.kr Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1mVpxg-0007Gs-Gv; Thu, 30 Sep 2021 02:54:32 -0400 Received: from mscreen.etri.re.kr ([129.254.9.16]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (Exim 4.94.2) (envelope-from ) id 1mVpxc-0007Fq-Al for kernelnewbies@kernelnewbies.org; Thu, 30 Sep 2021 02:54:29 -0400 Received: from unknown (HELO send001-relay.gov-dooray.com) (211.180.235.152) by 129.254.9.16 with ESMTP; 30 Sep 2021 15:54:20 +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 371de7d061555f1c; Thu, 30 Sep 2021 15:54:20 +0900 DKIM-Signature: a=rsa-sha256; b=IkZzPyA4/LTQDt0ip4G2tjoNe3m9uarZdqCQ/GzOEVpy1bffKTLUU9h7rdjOe7glWPwV0Cr5Bc RBM99A1oEx2y73klAZpCMVhrZcZ37R4T5wQqqnJLEQK0Yd2IRXJ5ua+dzoVcTRGiLCtzo6deL0H+ phfa9KEIgXVvbupinDw4RzU84gwLHeRtNGPFKnBe2gEeEvJBK8+kJzVgKMbLJxVfgjl9PxYzdYgI 7Mhfqfx5ebRvZYOSTBoGabACKt93xvLdqX/x8Ypf7uinGpMsrr3witFQCS7u5w5jKSZqxxUZWkaH 1QginnrFhnDpSn8FO9/xuuh2K9dX81h0M2pTgyGw==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=i2+giriYUY/fOC00nTg8G/eG92fMFDgLGm/5qZai6PY=; 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 b9a6bdf561555f1b; Thu, 30 Sep 2021 15:54:20 +0900 From: To: Subject: Can register addresses conversion go through iommu too? probably not.. Date: Thu, 30 Sep 2021 15:54:17 +0900 Message-ID: <00ec01d7b5c7$fcfeb7f0$f6fc27d0$@etri.re.kr> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: Ade1x/cHZnRStDVaQAmlRb6mtqIwJA== Content-Language: ko 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: multipart/mixed; boundary="===============1735402073277647922==" Errors-To: kernelnewbies-bounces@kernelnewbies.org This is a multipart message in MIME format. --===============1735402073277647922== Content-Type: multipart/alternative; boundary="----=_NextPart_000_00ED_01D7B613.6CE6AE10" Content-Language: ko This is a multipart message in MIME format. ------=_NextPart_000_00ED_01D7B613.6CE6AE10 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello all, I know when a device does dma to memory, we use functions like dma_alloc_coherent to allocate a memory region for the dma and we get the kernel virtual address and device virtual address at the same time. The iommu hardware converts the device virtual address to physical address reducing the processing time. I have a question (to make sure my understanding is correct). To use registers in the device driver, we use ioremap function to get the kernel virtual address for the device registers. If the OS is running in virtualized environment (a hypervisor under it), this kernel virtual address should go under conversion twice 1. virtual to physical by OS (this physical is not actually physical, an intermediate physical?) 2. intermediate physical to real physical I thought these two conversions are done by kernel or hypervisor software because iommu is for address translation for the addresses that the device "uses(or generates)", not for the kernel to access the device itself. Is my understanding correct? Any help will be appreciated. Thank you! Chan Kim ------=_NextPart_000_00ED_01D7B613.6CE6AE10 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hello all,

I know when a device does dma to = memory, we use functions like dma_alloc_coherent to allocate a memory = region for the dma and we get the kernel virtual address and device = virtual address at the same time. The iommu hardware converts the device = virtual address to physical address reducing the processing time.  =

 

I have a question (to make sure my understanding is = correct).

To use registers in the device driver, we use ioremap = function to get the kernel virtual address for the device registers. If = the OS is running in virtualized environment (a hypervisor under it), = this kernel virtual address should go under conversion twice  =

1. virtual = to physical by OS  (this physical is not actually physical, an = intermediate physical?)

2. intermediate physical to real = physical

I = thought these two conversions are done by kernel or hypervisor software = because iommu is for address translation for the addresses that the = device “uses(or generates)”, not for the kernel to access = the device itself.

Is my understanding correct?

Any help will be = appreciated.

Thank you!

Chan Kim

 

------=_NextPart_000_00ED_01D7B613.6CE6AE10-- --===============1735402073277647922== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============1735402073277647922==--