All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu: aspeed_smc: Calculate checksum on normal DMA
@ 2018-11-12 14:22 Christian Svensson
  2018-11-12 14:39 ` Cédric Le Goater
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Svensson @ 2018-11-12 14:22 UTC (permalink / raw)
  To: openbmc; +Cc: blue, joel, andrew, clg, Christian Svensson

This patch adds the missing checksum calculation on normal DMA transfer.
According to the datasheet this is how the SMC should behave.

Verified on AST1250 that the hardware matches the behaviour.

Signed-off-by: Christian Svensson <bluecmd@google.com>
---
 hw/ssi/aspeed_smc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
index 55ceffe100..0dc22e44cf 100644
--- a/hw/ssi/aspeed_smc.c
+++ b/hw/ssi/aspeed_smc.c
@@ -871,6 +871,7 @@ static void aspeed_smc_dma_rw(AspeedSMCState *s)
         s->regs[R_DMA_FLASH_ADDR] += 4;
         s->regs[R_DMA_DRAM_ADDR] += 4;
         s->regs[R_DMA_LEN] -= 4;
+        s->regs[R_DMA_CHECKSUM] += data;
     }
 }
 
-- 
2.19.1.930.g4563a0d9d0-goog

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] qemu: aspeed_smc: Calculate checksum on normal DMA
  2018-11-12 14:22 [PATCH] qemu: aspeed_smc: Calculate checksum on normal DMA Christian Svensson
@ 2018-11-12 14:39 ` Cédric Le Goater
  2018-11-12 14:52   ` Christian Svensson
  0 siblings, 1 reply; 5+ messages in thread
From: Cédric Le Goater @ 2018-11-12 14:39 UTC (permalink / raw)
  To: Christian Svensson, openbmc; +Cc: blue, joel, andrew

Hello Christian,

On 11/12/18 3:22 PM, Christian Svensson wrote:
> This patch adds the missing checksum calculation on normal DMA transfer.
> According to the datasheet this is how the SMC should behave.

The datasheet is not very clear on the topic. 

Bit 2 of FMC80 says :

	CheckSum Calculation Only
	0: Normal DMA operation
	1: Checksum accumulation only
	This bit is valid only when the DMA direction = 0
 
and one could understand that under Normal DMA operation, there is 
no Checksum accumulation. 

Anyhow, I am ok for adding the change. 

> Verified on AST1250 that the hardware matches the behaviour.

Did you check under u-boot, did you add DMA support to the Linux driver ? 
do you have a firmware doing so you could share ? I would like to check
for the ast2500.

Thanks,

C. 


> Signed-off-by: Christian Svensson <bluecmd@google.com>
> ---
>  hw/ssi/aspeed_smc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
> index 55ceffe100..0dc22e44cf 100644
> --- a/hw/ssi/aspeed_smc.c
> +++ b/hw/ssi/aspeed_smc.c
> @@ -871,6 +871,7 @@ static void aspeed_smc_dma_rw(AspeedSMCState *s)
>          s->regs[R_DMA_FLASH_ADDR] += 4;
>          s->regs[R_DMA_DRAM_ADDR] += 4;
>          s->regs[R_DMA_LEN] -= 4;
> +        s->regs[R_DMA_CHECKSUM] += data;
>      }
>  }
>  
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] qemu: aspeed_smc: Calculate checksum on normal DMA
  2018-11-12 14:39 ` Cédric Le Goater
@ 2018-11-12 14:52   ` Christian Svensson
  2019-01-11 12:30     ` Christian Svensson
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Svensson @ 2018-11-12 14:52 UTC (permalink / raw)
  To: clg
  Cc: Christian Svensson, openbmc @ lists . ozlabs . org, Joel Stanley, andrew

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

Hi,

Thanks for the review.

On Mon, Nov 12, 2018 at 3:39 PM Cédric Le Goater <clg@kaod.org> wrote:
> The datasheet is not very clear on the topic.

I won't argue there.

> and one could understand that under Normal DMA operation, there is
> no Checksum accumulation.

Indeed, that's what I thought as well. Then my question to myself was that
since that means that you can either 1) transfer data or 2) calculate the
checksum it seems like a pretty useless feature.

If you look at 8.6.2 DMA CheckSum Calculation Mode (for ast2400 at least)
you
see the sentence:
> 5. FMC80[2] is set when only checksum calculation is necessary, no data
movement

Which I take to read that you can execute the whole section and you will
get a checksum + data transfer, but if you set FMC80[2] then you get the
checksum, but no data movement.

> do you have a firmware doing so you could share ? I would like to check
> for the ast2500.

I have my own firmware here:
https://github.com/u-root/u-bmc/blob/07979a696df4351ec6dbb424ca80a5ebcc2eda1d/platform/ast2400/boot/main.S

Cheers,

[-- Attachment #2: Type: text/html, Size: 1615 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] qemu: aspeed_smc: Calculate checksum on normal DMA
  2018-11-12 14:52   ` Christian Svensson
@ 2019-01-11 12:30     ` Christian Svensson
  2019-01-11 12:55       ` Cédric Le Goater
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Svensson @ 2019-01-11 12:30 UTC (permalink / raw)
  To: clg
  Cc: Christian Svensson, openbmc @ lists . ozlabs . org, Joel Stanley,
	Andrew Jeffery

[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]

Ping. What's left to be done here?


On Mon, Nov 12, 2018 at 3:52 PM Christian Svensson <blue@cmd.nu> wrote:

> Hi,
>
> Thanks for the review.
>
> On Mon, Nov 12, 2018 at 3:39 PM Cédric Le Goater <clg@kaod.org> wrote:
> > The datasheet is not very clear on the topic.
>
> I won't argue there.
>
> > and one could understand that under Normal DMA operation, there is
> > no Checksum accumulation.
>
> Indeed, that's what I thought as well. Then my question to myself was that
> since that means that you can either 1) transfer data or 2) calculate the
> checksum it seems like a pretty useless feature.
>
> If you look at 8.6.2 DMA CheckSum Calculation Mode (for ast2400 at least)
> you
> see the sentence:
> > 5. FMC80[2] is set when only checksum calculation is necessary, no data
> movement
>
> Which I take to read that you can execute the whole section and you will
> get a checksum + data transfer, but if you set FMC80[2] then you get the
> checksum, but no data movement.
>
> > do you have a firmware doing so you could share ? I would like to check
> > for the ast2500.
>
> I have my own firmware here:
>
> https://github.com/u-root/u-bmc/blob/07979a696df4351ec6dbb424ca80a5ebcc2eda1d/platform/ast2400/boot/main.S
>
> Cheers,
>

[-- Attachment #2: Type: text/html, Size: 2043 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] qemu: aspeed_smc: Calculate checksum on normal DMA
  2019-01-11 12:30     ` Christian Svensson
@ 2019-01-11 12:55       ` Cédric Le Goater
  0 siblings, 0 replies; 5+ messages in thread
From: Cédric Le Goater @ 2019-01-11 12:55 UTC (permalink / raw)
  To: Christian Svensson
  Cc: Christian Svensson, openbmc @ lists . ozlabs . org, Joel Stanley,
	Andrew Jeffery

On 1/11/19 1:30 PM, Christian Svensson wrote:
> Ping. What's left to be done here?

Nothing. I have merged the update in my patch.

Thanks,

C.

> On Mon, Nov 12, 2018 at 3:52 PM Christian Svensson <blue@cmd.nu <mailto:blue@cmd.nu>> wrote:
> 
>     Hi,
> 
>     Thanks for the review.
> 
>     On Mon, Nov 12, 2018 at 3:39 PM Cédric Le Goater <clg@kaod.org <mailto:clg@kaod.org>> wrote:
>     > The datasheet is not very clear on the topic.
> 
>     I won't argue there.
> 
>     > and one could understand that under Normal DMA operation, there is
>     > no Checksum accumulation.
> 
>     Indeed, that's what I thought as well. Then my question to myself was that
>     since that means that you can either 1) transfer data or 2) calculate the
>     checksum it seems like a pretty useless feature.
> 
>     If you look at 8.6.2 DMA CheckSum Calculation Mode (for ast2400 at least) you
>     see the sentence:
>     > 5. FMC80[2] is set when only checksum calculation is necessary, no data movement
> 
>     Which I take to read that you can execute the whole section and you will
>     get a checksum + data transfer, but if you set FMC80[2] then you get the
>     checksum, but no data movement.
> 
>     > do you have a firmware doing so you could share ? I would like to check
>     > for the ast2500.
> 
>     I have my own firmware here:
>     https://github.com/u-root/u-bmc/blob/07979a696df4351ec6dbb424ca80a5ebcc2eda1d/platform/ast2400/boot/main.S
> 
>     Cheers,
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-11 13:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 14:22 [PATCH] qemu: aspeed_smc: Calculate checksum on normal DMA Christian Svensson
2018-11-12 14:39 ` Cédric Le Goater
2018-11-12 14:52   ` Christian Svensson
2019-01-11 12:30     ` Christian Svensson
2019-01-11 12:55       ` Cédric Le Goater

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.