From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Cédric Le Goater" <clg@kaod.org>,
"Peter Maydell" <peter.maydell@linaro.org>
Cc: Andrew Jeffery <andrew@aj.id.au>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org,
Joel Stanley <joel@jms.id.au>
Subject: Re: [Qemu-devel] [PATCH 18/19] aspeed/smc: inject errors in DMA checksum
Date: Thu, 13 Jun 2019 16:31:19 +0200 [thread overview]
Message-ID: <f3b3948f-8d24-fb8c-0b65-8fe08019a077@redhat.com> (raw)
In-Reply-To: <20190525151241.5017-19-clg@kaod.org>
Hi Cédric,
On 5/25/19 5:12 PM, Cédric Le Goater wrote:
> Emulate read errors in the DMA Checksum Register for high frequencies
> and optimistic settings of the Read Timing Compensation Register. This
> will help in tuning the SPI timing calibration algorithm.
>
> The values below are those to expect from the first flash device of
> the FMC controller of a palmetto-bmc machine.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> hw/ssi/aspeed_smc.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
> index 406c30c60b3f..4c162912cf62 100644
> --- a/hw/ssi/aspeed_smc.c
> +++ b/hw/ssi/aspeed_smc.c
> @@ -866,6 +866,30 @@ static void aspeed_smc_dma_calibration(AspeedSMCState *s)
> s->regs[s->r_ctrl0 + cs] |= CE_CTRL_CLOCK_FREQ(hclk_div);
> }
>
Can you add a comment (like the patch description) here?
> +static bool aspeed_smc_inject_read_failure(AspeedSMCState *s)
> +{
> + uint8_t delay =
> + (s->regs[R_DMA_CTRL] >> DMA_CTRL_DELAY_SHIFT) & DMA_CTRL_DELAY_MASK;
> + uint8_t hclk_mask =
> + (s->regs[R_DMA_CTRL] >> DMA_CTRL_FREQ_SHIFT) & DMA_CTRL_FREQ_MASK;
> +
> + /*
> + * Typical values of a palmetto-bmc machine.
> + */
> + switch (aspeed_smc_hclk_divisor(hclk_mask)) {
> + case 4 ... 16:
> + return false;
> + case 3: /* at least one HCLK cycle delay */
> + return (delay & 0x7) < 1;
> + case 2: /* at least two HCLK cycle delay */
> + return (delay & 0x7) < 2;
> + case 1: /* (> 100MHz) is above the max freq of the controller */
> + return true;
> + default:
> + g_assert_not_reached();
> + }
> +}
> +
> /*
> * Accumulate the result of the reads to provide a checksum that will
> * be used to validate the read timing settings.
> @@ -903,6 +927,11 @@ static void aspeed_smc_dma_checksum(AspeedSMCState *s)
> s->regs[R_DMA_FLASH_ADDR] += 4;
> s->regs[R_DMA_LEN] -= 4;
> }
> +
> + if (aspeed_smc_inject_read_failure(s)) {
So this model real world where noise eventually triggers errors. Don't
we want this to be enable by the user (or a QMP command)?
> + s->regs[R_DMA_CHECKSUM] = 0xbadc0de;
> + }
> +
> }
>
> static void aspeed_smc_dma_rw(AspeedSMCState *s)
>
next prev parent reply other threads:[~2019-06-13 15:08 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-25 15:12 [Qemu-devel] [PATCH 00/19] aspeed: machine extensions and fixes Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 01/19] hw/arm/aspeed: Use object_initialize_child for correct ref. counting Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 02/19] aspeed: add a per SoC mapping for the interrupt space Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 03/19] aspeed: add a per SoC mapping for the memory space Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 04/19] hw: timer: Add ASPEED RTC device Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 05/19] hw/arm/aspeed: Add RTC to SoC Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 06/19] aspeed: introduce a configurable number of CPU per machine Cédric Le Goater
2019-06-12 1:32 ` Joel Stanley
2019-06-12 8:03 ` Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 07/19] aspeed: add support for multiple NICs Cédric Le Goater
2019-05-26 1:01 ` Keno Fischer
2019-05-26 17:10 ` Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 08/19] aspeed/timer: Fix behaviour running Linux Cédric Le Goater
2023-09-22 13:21 ` Cédric Le Goater
2023-09-25 7:54 ` Andrew Jeffery
2023-09-25 9:20 ` Cédric Le Goater
2023-09-26 1:37 ` Andrew Jeffery
2023-09-27 2:12 ` Joel Stanley
2023-09-27 5:44 ` Cédric Le Goater
2023-09-27 6:46 ` Markus Armbruster
2019-05-25 15:12 ` [Qemu-devel] [PATCH 09/19] aspeed/timer: Status register contains reload for stopped timer Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 10/19] aspeed/timer: Fix match calculations Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 11/19] aspeed/timer: Provide back-pressure information for short periods Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 12/19] aspeed/timer: Ensure positive muldiv delta Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 13/19] aspeed/smc: add a 'sdram_base' propertie Cédric Le Goater
2019-06-12 1:34 ` Joel Stanley
2019-06-13 14:32 ` Philippe Mathieu-Daudé
2019-06-14 11:49 ` Cédric Le Goater
2019-05-25 15:12 ` [Qemu-devel] [PATCH 14/19] aspeed: remove the "ram" link Cédric Le Goater
2019-06-12 1:35 ` Joel Stanley
2019-05-25 15:12 ` [Qemu-devel] [PATCH 15/19] aspeed: add a RAM memory region container Cédric Le Goater
2019-06-12 1:36 ` Joel Stanley
2019-05-25 15:12 ` [Qemu-devel] [PATCH 16/19] aspeed/smc: add support for DMAs Cédric Le Goater
2019-06-12 1:38 ` Joel Stanley
2019-05-25 15:12 ` [Qemu-devel] [PATCH 17/19] aspeed/smc: add DMA calibration settings Cédric Le Goater
2019-06-12 1:40 ` Joel Stanley
2019-05-25 15:12 ` [Qemu-devel] [PATCH 18/19] aspeed/smc: inject errors in DMA checksum Cédric Le Goater
2019-06-12 1:41 ` Joel Stanley
2019-06-13 14:31 ` Philippe Mathieu-Daudé [this message]
2019-06-14 12:02 ` Cédric Le Goater
2019-06-14 12:35 ` Philippe Mathieu-Daudé
2019-05-25 15:12 ` [Qemu-devel] [PATCH 19/19] aspeed/smc: Calculate checksum on normal DMA Cédric Le Goater
2019-06-12 1:42 ` Joel Stanley
2019-06-07 10:10 ` [Qemu-devel] [PATCH 00/19] aspeed: machine extensions and fixes Peter Maydell
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=f3b3948f-8d24-fb8c-0b65-8fe08019a077@redhat.com \
--to=philmd@redhat.com \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=joel@jms.id.au \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).