lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a189444b-15c9-8069-901d-8cdf9af7fc3c@linux.intel.com>
Date:   Thu, 25 Apr 2019 10:07:19 +0800
From:   Lu Baolu <baolu.lu@...ux.intel.com>
To:     Christoph Hellwig <hch@....de>
Cc:     baolu.lu@...ux.intel.com, David Woodhouse <dwmw2@...radead.org>,
        Joerg Roedel <joro@...tes.org>, ashok.raj@...el.com,
        jacob.jun.pan@...el.com, alan.cox@...el.com, kevin.tian@...el.com,
        mika.westerberg@...ux.intel.com, pengfei.xu@...el.com,
        Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Robin Murphy <robin.murphy@....com>,
        iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 02/10] swiotlb: Factor out slot allocation and free

Hi,

On 4/24/19 10:45 PM, Christoph Hellwig wrote:
> On Tue, Apr 23, 2019 at 03:32:16PM +0800, Lu Baolu wrote:
>> When we add the bounce buffer between IOVA and physical buffer, the
>> bounced buffer must starts from the same offset in a page, otherwise,
>> IOMMU can't work here.
> 
> Why?  Even with the odd hardware descriptors typical in Intel land that
> only allow offsets in the first page, not the following ones, having
> a zero offset where we previously had one should be fine.
> 

This is not VT-d specific. It's just how generic IOMMU works.

Normally, IOMMU works in paging mode. So if a driver issues DMA with
IOVA  0xAAAA0123, IOMMU can remap it with a physical address 0xBBBB0123.
But we should never expect IOMMU to remap 0xAAAA0123 with physical
address of 0xBBBB0000. That's the reason why I said that IOMMU will not
work there.

                                 swiotlb                  System
                 IOVA          bounce page                Memory
              .---------.      .---------.             .---------.
              |         |      |         |             |         |
              |         |      |         |             |         |
buffer_start .---------.      .---------.buffer_start .---------.
              |         |----->|         |             |         |
              |         |      |         |************>|         |
              |         |      |         |   swiotlb   |         |
  IOMMU Page  '---------'      '---------'   mapping   '---------'
   Boundary   |         |                              |         |
              |         |                              |         |
              |         |                              |         |
              |         |----------------------------->|         |
              |         |        IOMMU mapping         |         |
              |         |                              |         |
  IOMMU Page  .---------.                              .---------.
   Boundary   |         |                              |         |
              |         |                              |         |
              |         |----------------------------->|         |
              |         |         IOMMU mapping        |         |
              |         |                              |         |
              |         |                              |         |
  IOMMU Page  .---------.      .---------.             .---------.
   Boundary   |         |      |         |             |         |
              |         |      |         |************>|         |
              |         |----->|         |   swiotlb   |         |
   buffer_end '---------'      '---------'   mapping   '---------'
              |         |      |         |             |         |
              |         |      |         |             |         |
              '---------'      '---------'             '---------'


This is the whole view of iommu bounce page. I expect the buffer_start
returned by swiotlb_tbl_map_single() starts from the same page_offset as
the buffer_start in IOVA.

Best regards,
Lu Baolu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ