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: <43ec9dd6-12c0-98ec-8d5d-b2904292721e@quicinc.com>
Date:   Thu, 24 Jun 2021 10:10:51 -0400
From:   Qian Cai <quic_qiancai@...cinc.com>
To:     Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>
CC:     Claire Chang <tientzu@...omium.org>,
        Christoph Hellwig <hch@....de>,
        Rob Herring <robh+dt@...nel.org>, <mpe@...erman.id.au>,
        Joerg Roedel <joro@...tes.org>,
        Frank Rowand <frowand.list@...il.com>,
        Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
        <boris.ostrovsky@...cle.com>, <jgross@...e.com>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        <heikki.krogerus@...ux.intel.com>,
        <thomas.hellstrom@...ux.intel.com>, <peterz@...radead.org>,
        <benh@...nel.crashing.org>, <joonas.lahtinen@...ux.intel.com>,
        <dri-devel@...ts.freedesktop.org>, <chris@...is-wilson.co.uk>,
        <grant.likely@....com>, <paulus@...ba.org>, <mingo@...nel.org>,
        Jianxiong Gao <jxgao@...gle.com>,
        Stefano Stabellini <sstabellini@...nel.org>,
        Saravana Kannan <saravanak@...gle.com>, <xypron.glpk@....de>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        <bskeggs@...hat.com>, <linux-pci@...r.kernel.org>,
        <xen-devel@...ts.xenproject.org>,
        Thierry Reding <treding@...dia.com>,
        <intel-gfx@...ts.freedesktop.org>, <matthew.auld@...el.com>,
        linux-devicetree <devicetree@...r.kernel.org>,
        Daniel Vetter <daniel@...ll.ch>, <airlied@...ux.ie>,
        <maarten.lankhorst@...ux.intel.com>,
        <linuxppc-dev@...ts.ozlabs.org>, <jani.nikula@...ux.intel.com>,
        Nicolas Boichat <drinkcat@...omium.org>,
        <rodrigo.vivi@...el.com>, Bjorn Helgaas <bhelgaas@...gle.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Greg KH <gregkh@...uxfoundation.org>,
        Randy Dunlap <rdunlap@...radead.org>,
        lkml <linux-kernel@...r.kernel.org>,
        "list@....net:IOMMU DRIVERS" <iommu@...ts.linux-foundation.org>,
        Jim Quinlan <james.quinlan@...adcom.com>,
        Tom Lendacky <thomas.lendacky@....com>,
        <bauerman@...ux.ibm.com>
Subject: Re: [PATCH v14 06/12] swiotlb: Use is_swiotlb_force_bounce for
 swiotlb data bouncing



On 6/24/2021 7:48 AM, Will Deacon wrote:
> Ok, diff below which attempts to tackle the offset issue I mentioned as
> well. Qian Cai -- please can you try with these changes?

This works fine.

> 
> Will
> 
> --->8
> 
> diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
> index 175b6c113ed8..39284ff2a6cd 100644
> --- a/include/linux/swiotlb.h
> +++ b/include/linux/swiotlb.h
> @@ -116,7 +116,9 @@ static inline bool is_swiotlb_buffer(struct device *dev, phys_addr_t paddr)
>  
>  static inline bool is_swiotlb_force_bounce(struct device *dev)
>  {
> -       return dev->dma_io_tlb_mem->force_bounce;
> +       struct io_tlb_mem *mem = dev->dma_io_tlb_mem;
> +
> +       return mem && mem->force_bounce;
>  }
>  
>  void __init swiotlb_exit(void);
> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
> index 44be8258e27b..0ffbaae9fba2 100644
> --- a/kernel/dma/swiotlb.c
> +++ b/kernel/dma/swiotlb.c
> @@ -449,6 +449,7 @@ static int swiotlb_find_slots(struct device *dev, phys_addr_t orig_addr,
>                 dma_get_min_align_mask(dev) & ~(IO_TLB_SIZE - 1);
>         unsigned int nslots = nr_slots(alloc_size), stride;
>         unsigned int index, wrap, count = 0, i;
> +       unsigned int offset = swiotlb_align_offset(dev, orig_addr);
>         unsigned long flags;
>  
>         BUG_ON(!nslots);
> @@ -497,7 +498,7 @@ static int swiotlb_find_slots(struct device *dev, phys_addr_t orig_addr,
>         for (i = index; i < index + nslots; i++) {
>                 mem->slots[i].list = 0;
>                 mem->slots[i].alloc_size =
> -                       alloc_size - ((i - index) << IO_TLB_SHIFT);
> +                       alloc_size - (offset + ((i - index) << IO_TLB_SHIFT));
>         }
>         for (i = index - 1;
>              io_tlb_offset(i) != IO_TLB_SEGSIZE - 1 &&
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ