From: "Jayachandran C." <jchandra@broadcom.com>
To: ralf@linux-mips.org
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: mm: Move some checks out of 'for' loop in DMA operations
Date: Thu, 26 Sep 2013 16:06:52 +0530 [thread overview]
Message-ID: <20130926103651.GL24359@jayachandranc.netlogicmicro.com> (raw)
In-Reply-To: <1380114065-9761-1-git-send-email-jchandra@broadcom.com>
On Wed, Sep 25, 2013 at 06:31:05PM +0530, Jayachandran C wrote:
The patch was missing the required Signed-off-by, added below.
> The check cpu_needs_post_dma_flush() in mips_dma_sync_sg_for_cpu() and
> the check !plat_device_is_coherent() in mips_dma_sync_sg_for_device()
> can be moved outside the for loop.
>
> As a side effect, this also avoids a GCC bug that caused kernel compile
> to fail with the error:
>
> arch/mips/mm/dma-default.c: In function 'mips_dma_sync_sg_for_cpu':
> arch/mips/mm/dma-default.c:316:1: internal compiler error: in add_insn_before, at emit-rtl.c:3852
>
> This gcc failure is seen in Code Sourcery toolchains [e.g. gcc version
> 4.7.2 (Sourcery CodeBench Lite 2012.09-99)] after commit "MIPS: Optimize
> current_cpu_type() for better code."
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
> ---
> arch/mips/mm/dma-default.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
> index e45e4b0..2e94185 100644
> --- a/arch/mips/mm/dma-default.c
> +++ b/arch/mips/mm/dma-default.c
> @@ -307,12 +307,10 @@ static void mips_dma_sync_sg_for_cpu(struct device *dev,
> {
> int i;
>
> - /* Make sure that gcc doesn't leave the empty loop body. */
> - for (i = 0; i < nelems; i++, sg++) {
> - if (cpu_needs_post_dma_flush(dev))
> + if (cpu_needs_post_dma_flush(dev))
> + for (i = 0; i < nelems; i++, sg++)
> __dma_sync(sg_page(sg), sg->offset, sg->length,
> direction);
> - }
> }
>
> static void mips_dma_sync_sg_for_device(struct device *dev,
> @@ -320,12 +318,10 @@ static void mips_dma_sync_sg_for_device(struct device *dev,
> {
> int i;
>
> - /* Make sure that gcc doesn't leave the empty loop body. */
> - for (i = 0; i < nelems; i++, sg++) {
> - if (!plat_device_is_coherent(dev))
> + if (!plat_device_is_coherent(dev))
> + for (i = 0; i < nelems; i++, sg++)
> __dma_sync(sg_page(sg), sg->offset, sg->length,
> direction);
> - }
> }
>
> int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
JC.
next prev parent reply other threads:[~2013-09-26 10:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 13:01 [PATCH] MIPS: mm: Move some checks out of 'for' loop in DMA operations Jayachandran C
2013-09-25 13:19 ` Markos Chandras
2013-09-25 13:19 ` Markos Chandras
2013-09-26 10:36 ` Jayachandran C. [this message]
2013-09-26 14:15 ` Ralf Baechle
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=20130926103651.GL24359@jayachandranc.netlogicmicro.com \
--to=jchandra@broadcom.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/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