From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Alexander Duyck <alexander.h.duyck@linux.intel.com>
Cc: Rosen Penev <rosenp@gmail.com>, Joerg Roedel <joro@8bytes.org>,
Lorenzo Bianconi <lorenzo.bianconi@redhat.com>,
linux-wireless <linux-wireless@vger.kernel.org>,
Samuel Sieb <samuel@sieb.net>,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, jan.viktorin@gmail.com
Subject: Re: [PATCH] iommu/amd: fix sg->dma_address for sg->offset bigger than PAGE_SIZE
Date: Tue, 12 Mar 2019 08:08:33 +0100 [thread overview]
Message-ID: <20190312070832.GA2483@redhat.com> (raw)
In-Reply-To: <e0630ae9d9bee73d8a1ce3499ea9f77900e9cdfa.camel@linux.intel.com>
On Mon, Mar 11, 2019 at 08:47:44AM -0700, Alexander Duyck wrote:
> > drivers/iommu/amd_iommu.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> > index 6b0760dafb3e..949621f33624 100644
> > --- a/drivers/iommu/amd_iommu.c
> > +++ b/drivers/iommu/amd_iommu.c
> > @@ -2604,7 +2604,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
> >
> > /* Everything is mapped - write the right values into s->dma_address */
> > for_each_sg(sglist, s, nelems, i) {
> > - s->dma_address += address + s->offset;
> > + s->dma_address += address + (s->offset & ~PAGE_MASK);
> > s->dma_length = s->length;
> > }
> >
>
> You should add a comment calling out that this is needed because the
> sg_phys(s) call above this is masked with PAGE_MASK. Then this makes
> much more sense. Otherwise I would have assumed you needed either the
> full offset or none.
Would something like this
/*
* Everything is mapped - write the right values into s->dma_address.
* Take into account s->offset can be bigger than page size and sg_phys(s)
* address has to be aligned to page granularity.
*/
be appropriate ?
Stanislaw
WARNING: multiple messages have this Message-ID (diff)
From: sgruszka@redhat.com (Stanislaw Gruszka)
Subject: [PATCH] iommu/amd: fix sg->dma_address for sg->offset bigger than PAGE_SIZE
Date: Tue, 12 Mar 2019 08:08:33 +0100 [thread overview]
Message-ID: <20190312070832.GA2483@redhat.com> (raw)
In-Reply-To: <e0630ae9d9bee73d8a1ce3499ea9f77900e9cdfa.camel@linux.intel.com>
On Mon, Mar 11, 2019@08:47:44AM -0700, Alexander Duyck wrote:
> > drivers/iommu/amd_iommu.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> > index 6b0760dafb3e..949621f33624 100644
> > --- a/drivers/iommu/amd_iommu.c
> > +++ b/drivers/iommu/amd_iommu.c
> > @@ -2604,7 +2604,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
> >
> > /* Everything is mapped - write the right values into s->dma_address */
> > for_each_sg(sglist, s, nelems, i) {
> > - s->dma_address += address + s->offset;
> > + s->dma_address += address + (s->offset & ~PAGE_MASK);
> > s->dma_length = s->length;
> > }
> >
>
> You should add a comment calling out that this is needed because the
> sg_phys(s) call above this is masked with PAGE_MASK. Then this makes
> much more sense. Otherwise I would have assumed you needed either the
> full offset or none.
Would something like this
/*
* Everything is mapped - write the right values into s->dma_address.
* Take into account s->offset can be bigger than page size and sg_phys(s)
* address has to be aligned to page granularity.
*/
be appropriate ?
Stanislaw
next prev parent reply other threads:[~2019-03-12 7:08 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 22:55 MT76x2U crashes XHCI driver on AMD Ryzen system Rosen Penev
2019-01-11 17:29 ` Lorenzo Bianconi
2019-01-11 19:01 ` Rosen Penev
2019-01-13 13:33 ` Lorenzo Bianconi
[not found] ` <1547404075.1582.0@smtp.gmail.com>
2019-01-13 19:00 ` Lorenzo Bianconi
2019-01-14 2:20 ` Rosen Penev
2019-01-14 3:13 ` Samuel Sieb
2019-01-14 9:18 ` Lorenzo Bianconi
2019-01-14 9:22 ` Tom Psyborg
2019-01-14 20:06 ` Rosen Penev
2019-01-15 9:04 ` Lorenzo Bianconi
[not found] ` <20190115090400.GA2267-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2019-02-18 14:37 ` Stanislaw Gruszka
2019-02-18 14:37 ` Stanislaw Gruszka
[not found] ` <20190218143742.GA11872-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-02-18 15:15 ` Lorenzo Bianconi
2019-02-18 15:15 ` Lorenzo Bianconi
2019-02-26 10:05 ` Joerg Roedel
2019-02-26 10:05 ` Joerg Roedel
2019-02-26 10:34 ` Stanislaw Gruszka
2019-02-26 10:44 ` Joerg Roedel
2019-02-26 11:24 ` Stanislaw Gruszka
2019-02-28 9:04 ` Stanislaw Gruszka
2019-02-28 10:42 ` Stanislaw Gruszka
2019-02-28 12:19 ` Stanislaw Gruszka
2019-02-28 13:40 ` Joerg Roedel
2019-03-04 7:10 ` Stanislaw Gruszka
2019-03-04 7:20 ` Rosen Penev
[not found] ` <CAKxU2N-k-9DCYBv6W3CohL963dr3AeY3VHyt8FrUuo=BfacDsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-11 8:43 ` Stanislaw Gruszka
2019-03-11 8:43 ` Stanislaw Gruszka
2019-03-11 8:43 ` Stanislaw Gruszka
2019-03-11 9:03 ` [PATCH] iommu/amd: fix sg->dma_address for sg->offset bigger than PAGE_SIZE Stanislaw Gruszka
2019-03-11 9:03 ` Stanislaw Gruszka
2019-03-11 9:03 ` Stanislaw Gruszka
2019-03-11 15:47 ` Alexander Duyck
2019-03-11 15:47 ` Alexander Duyck
2019-03-11 15:47 ` Alexander Duyck
2019-03-12 7:08 ` Stanislaw Gruszka [this message]
2019-03-12 7:08 ` Stanislaw Gruszka
[not found] ` <20190312070832.GA2483-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-03-12 15:18 ` Alexander Duyck
2019-03-12 15:18 ` Alexander Duyck
2019-03-12 15:18 ` Alexander Duyck
2019-03-13 9:03 ` [PATCH v2] " Stanislaw Gruszka
2019-03-13 9:03 ` Stanislaw Gruszka
2019-03-13 9:03 ` Stanislaw Gruszka
2019-03-18 10:17 ` Joerg Roedel
2019-03-18 10:17 ` Joerg Roedel
[not found] ` <20190311084319.GA3310-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-03-12 7:13 ` MT76x2U crashes XHCI driver on AMD Ryzen system Stanislaw Gruszka
2019-03-12 7:13 ` Stanislaw Gruszka
2019-03-12 7:13 ` Stanislaw Gruszka
2019-02-18 17:01 ` Robin Murphy
[not found] ` <2cc5674a-a3a0-d8fe-65f5-4357da9b85d3-5wv7dgnIgG8@public.gmane.org>
2019-02-19 11:08 ` Stanislaw Gruszka
2019-02-19 11:08 ` Stanislaw Gruszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190312070832.GA2483@redhat.com \
--to=sgruszka@redhat.com \
--cc=alexander.h.duyck@linux.intel.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jan.viktorin@gmail.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=rosenp@gmail.com \
--cc=samuel@sieb.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.