From: Becky Bruce <beckyb@kernel.crashing.org>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
ian.campbell@citrix.com, jeremy@goop.org
Subject: Re: [PATCH 3/5] swiotlb: swiotlb_bus_to_virt/phys prototype changes
Date: Tue, 24 Mar 2009 22:54:12 -0500 [thread overview]
Message-ID: <DE550DFB-AD1F-49A2-8100-4B3234427163@kernel.crashing.org> (raw)
In-Reply-To: <20090325115616I.fujita.tomonori@lab.ntt.co.jp>
On Mar 24, 2009, at 9:58 PM, FUJITA Tomonori wrote:
> On Tue, 24 Mar 2009 16:28:44 -0500
> Becky Bruce <beckyb@kernel.crashing.org> wrote:
>
>> Make these functions take the hwdev as an argument because on some
>> platforms it contains a per-device offset that is used to convert
>> from bus addresses to/from other types of addresses.
>>
>> Also, make these weak so architectures can override the default
>> behavior (for example, by adding an offset in the hwdev).
>>
>> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
>> ---
>> arch/x86/kernel/pci-swiotlb.c | 2 +-
>> include/linux/swiotlb.h | 4 +++-
>> lib/swiotlb.c | 31 +++++++++++++++++++------------
>> 3 files changed, 23 insertions(+), 14 deletions(-)
>
>> @@ -847,10 +847,14 @@ swiotlb_unmap_sg_attrs(struct device *hwdev,
>> struct scatterlist *sgl,
>>
>> for_each_sg(sgl, sg, nelems, i) {
>> if (sg->dma_address != swiotlb_phys_to_bus(hwdev, sg_phys(sg)))
>> - unmap_single(hwdev, swiotlb_bus_to_virt(sg->dma_address),
>> - sg->dma_length, dir);
>> + unmap_single(
>> + hwdev,
>> + swiotlb_bus_to_virt(hwdev, sg->dma_address),
>> + sg->dma_length, dir);
>> else if (dir == DMA_FROM_DEVICE)
>> - dma_mark_clean(swiotlb_bus_to_virt(sg->dma_address), sg-
>> >dma_length);
>> + dma_mark_clean(
>> + swiotlb_bus_to_virt(hwdev, sg->dma_address),
>> + sg->dma_length);
>> }
>
> The coding style looks a bit odd to me. How about something like this?
>
>
> for_each_sg(sgl, sg, nelems, i) {
> void *virt = swiotlb_bus_to_virt(hwdev, sg->dma_address),
> if (sg->dma_address != swiotlb_phys_to_bus(hwdev, sg_phys(sg)))
> unmap_single(hwdev, virt, sg->dma_length, dir);
> else if (dir == DMA_FROM_DEVICE)
> dma_mark_clean(virt, sg->dma_length);
Heh, I was trying to avoid > 80 character lines there, and it ended up
looking a bit gross. I originally had *exactly* what you suggest in
my tree, but changed it, so I'm more than happy to change this back.
>
>
>
>> }
>> EXPORT_SYMBOL(swiotlb_unmap_sg_attrs);
>> @@ -881,10 +885,13 @@ swiotlb_sync_sg(struct device *hwdev, struct
>> scatterlist *sgl,
>>
>> for_each_sg(sgl, sg, nelems, i) {
>> if (sg->dma_address != swiotlb_phys_to_bus(hwdev, sg_phys(sg)))
>> - sync_single(hwdev, swiotlb_bus_to_virt(sg->dma_address),
>> + sync_single(hwdev,
>> + swiotlb_bus_to_virt(hwdev, sg->dma_address),
>> sg->dma_length, dir, target);
>> else if (dir == DMA_FROM_DEVICE)
>> - dma_mark_clean(swiotlb_bus_to_virt(sg->dma_address), sg-
>> >dma_length);
>> + dma_mark_clean(
>> + swiotlb_bus_to_virt(hwdev, sg->dma_address),
>> + sg->dma_length);
>> }
>
> Ditto.
>
>
> The rest looks fine to me.
Thanks for the review!
Cheers,
-Becky
next prev parent reply other threads:[~2009-03-25 3:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-24 21:28 [PATCH 0/5] swiotlb: changes for powerpc/highmem Becky Bruce
2009-03-24 21:28 ` [PATCH 1/5] swiotlb: comment corrections (no code changes) Becky Bruce
2009-03-24 21:28 ` [PATCH 2/5] swiotlb: fix compile warning Becky Bruce
2009-03-24 21:28 ` [PATCH 3/5] swiotlb: swiotlb_bus_to_virt/phys prototype changes Becky Bruce
2009-03-24 21:28 ` [PATCH 4/5] swiotlb: map_page fix for highmem systems Becky Bruce
2009-03-24 21:28 ` [PATCH 5/5] swiotlb: Allow arch override of address_needs_mapping Becky Bruce
2009-03-25 2:58 ` FUJITA Tomonori
2009-03-25 2:58 ` [PATCH 4/5] swiotlb: map_page fix for highmem systems FUJITA Tomonori
2009-03-25 2:58 ` [PATCH 3/5] swiotlb: swiotlb_bus_to_virt/phys prototype changes FUJITA Tomonori
2009-03-25 3:54 ` Becky Bruce [this message]
2009-03-25 12:44 ` Ingo Molnar
2009-03-25 2:58 ` [PATCH 2/5] swiotlb: fix compile warning FUJITA Tomonori
2009-03-25 3:42 ` Becky Bruce
2009-03-25 3:52 ` FUJITA Tomonori
2009-03-25 12:45 ` Ingo Molnar
2009-03-25 13:03 ` Becky Bruce
2009-03-27 17:13 ` [PATCH 0/5] swiotlb: changes for powerpc/highmem Jeremy Fitzhardinge
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=DE550DFB-AD1F-49A2-8100-4B3234427163@kernel.crashing.org \
--to=beckyb@kernel.crashing.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=ian.campbell@citrix.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®