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] [day] [month] [year] [list]
Message-ID: <002401d7457b$75171560$5f454020$@samsung.com>
Date:   Mon, 10 May 2021 18:04:17 +0900
From:   "Chanho Park" <chanho61.park@...sung.com>
To:     "'Christoph Hellwig'" <hch@....de>
Cc:     "'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>,
        "'Bumyong Lee'" <bumyong.lee@...sung.com>
Subject: RE: [PATCH] swiotlb: manipulate orig_addr when tlb_addr has offset

(RESEND due to wrong encrypted message setting)

Hi,

> On Mon, May 10, 2021 at 05:30:57PM +0900, Chanho Park wrote:
> > +static unsigned int swiotlb_align_offset(struct device *dev, u64
> > +addr);
> 
> Please just move swiotlb_align_offset up to avoid the forward declaration.

Okay. I'll move the position of the function next patch.

> 
> >  /*
> >   * Bounce: copy the swiotlb buffer from or back to the original dma
> location
> >   */
> > @@ -346,10 +347,17 @@ static void swiotlb_bounce(struct device *dev,
> phys_addr_t tlb_addr, size_t size
> >  	size_t alloc_size = mem->slots[index].alloc_size;
> >  	unsigned long pfn = PFN_DOWN(orig_addr);
> >  	unsigned char *vaddr = phys_to_virt(tlb_addr);
> > +	unsigned int tlb_offset;
> >
> >  	if (orig_addr == INVALID_PHYS_ADDR)
> >  		return;
> >
> > +	tlb_offset = (unsigned int)tlb_addr & (IO_TLB_SIZE - 1);
> > +	tlb_offset -= swiotlb_align_offset(dev, orig_addr);
> 
> Nit: I'd write this as:
> 
> 	tlb_offset = (tlb_addr & (IO_TLB_SIZE - 1)) -
> 			swiotlb_align_offset(dev, orig_addr);
> 
> as there is no need for the cast, and just having a single assignment is
> easier to follow.

Great. It can be a single assignment as you suggested.

Best Regards,
Chanho Park

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ