[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v14 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing
- To: Qian Cai <quic_qiancai@xxxxxxxxxxx>
- From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
- Date: Thu, 24 Jun 2021 11:55:19 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RNYw98/G7tITOD2JUar0dJNWfAGLFBejbGFGi7BFxgQ=; b=WGHZouTD0dBnGgiqwn40+bzGuLU6p1CWMn6EExAKVsxFXkLy8h0mVXFktwuN77Sc0aQ9plxHvEOyVT1kwjoQAui3vykvm7QFkfJzMWXQwqLhK1xevJEdYKtVjmNkvQ4OqawI708Kh5cS06l7TuvyBqhWyGQn4m81IzftzVurnsj+jQ/YaeF1+8kQfXStOvUudGWpBdqbJqSyHc98vtbbRdrMZLQvdP0KeFJVP0RgzdsbdtM0ZVz+1Dn+CjkqbJpUk1ZhbvyuuCYX6lYDY6rgBfP0FDaKBS46FKyUj/IlLK7L/ppaqHti1FvQjI5/7e/jf6hWYSZR0Sv9CbtPeMBGzA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LM8WdCAKxMuFmxRPdPWYfm6JwwLhm1EY+o1dOG6Omv7D9qMZiMQaefpWR/bF4JgkKwjVnExBGL/J+fF4S95dogPEHJU1EpiQjI2PXoOMSp7OQRckAKQDeQidnCG3UAm/5I7dwqxKMSf9qS5LIDmZx0J18vw7FoSYHNc0bkoWOFIry4SpJKI4dUtlMv/QdH/wp+LlSqia3OOoPIqoHC+onGIhoWWo+QsIHEvYujOX1AamdzODyJe1mWWlNrlDkenIFvJMY7Fsy4y9RJR/PGGzbIWJhyv+UPAPsxnYhjGpMOqqpvgl8Xg3lrC66nUP/ru3vdlVSUh7T/xj9+U2fajsWA==
- Authentication-results: quicinc.com; dkim=none (message not signed) header.d=none;quicinc.com; dmarc=none action=none header.from=oracle.com;
- Cc: Will Deacon <will@xxxxxxxxxx>, Robin Murphy <robin.murphy@xxxxxxx>, Claire Chang <tientzu@xxxxxxxxxxxx>, Christoph Hellwig <hch@xxxxxx>, Rob Herring <robh+dt@xxxxxxxxxx>, mpe@xxxxxxxxxxxxxx, Joerg Roedel <joro@xxxxxxxxxx>, Frank Rowand <frowand.list@xxxxxxxxx>, boris.ostrovsky@xxxxxxxxxx, jgross@xxxxxxxx, Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>, heikki.krogerus@xxxxxxxxxxxxxxx, thomas.hellstrom@xxxxxxxxxxxxxxx, peterz@xxxxxxxxxxxxx, benh@xxxxxxxxxxxxxxxxxxx, joonas.lahtinen@xxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx, chris@xxxxxxxxxxxxxxxxxx, grant.likely@xxxxxxx, paulus@xxxxxxxxx, mingo@xxxxxxxxxx, Jianxiong Gao <jxgao@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Saravana Kannan <saravanak@xxxxxxxxxx>, xypron.glpk@xxxxxx, "Rafael J . Wysocki" <rafael.j.wysocki@xxxxxxxxx>, Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>, bskeggs@xxxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Thierry Reding <treding@xxxxxxxxxx>, intel-gfx@xxxxxxxxxxxxxxxxxxxxx, matthew.auld@xxxxxxxxx, linux-devicetree <devicetree@xxxxxxxxxxxxxxx>, Daniel Vetter <daniel@xxxxxxxx>, airlied@xxxxxxxx, maarten.lankhorst@xxxxxxxxxxxxxxx, linuxppc-dev@xxxxxxxxxxxxxxxx, jani.nikula@xxxxxxxxxxxxxxx, Nicolas Boichat <drinkcat@xxxxxxxxxxxx>, rodrigo.vivi@xxxxxxxxx, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>, Randy Dunlap <rdunlap@xxxxxxxxxxxxx>, lkml <linux-kernel@xxxxxxxxxxxxxxx>, "list@xxxxxxx:IOMMU DRIVERS" <iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx>, Jim Quinlan <james.quinlan@xxxxxxxxxxxx>, Tom Lendacky <thomas.lendacky@xxxxxxx>, bauerman@xxxxxxxxxxxxx
- Delivery-date: Thu, 24 Jun 2021 15:57:04 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Thu, Jun 24, 2021 at 10:10:51AM -0400, Qian Cai wrote:
>
>
> 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.
Cool. Let me squash this patch in #6 and rebase the rest of them.
Claire, could you check the devel/for-linus-5.14 say by end of today to
double check that I didn't mess anything up please?
Will,
Thank you for generating the fix! I am going to run it on x86 and Xen
to make sure all is good (granted last time I ran devel/for-linus-5.14
on that setup I didn't see any errors so I need to double check
I didn't do something silly like run a wrong kernel).
>
> >
> > 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 &&
> >
|