qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Joel Stanley" <joel@jms.id.au>, "Thomas Huth" <thuth@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>
Cc: Andrew Jeffery <andrew@aj.id.au>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PATCH v3 1/3] hw: Model ASPEED's Hash and Crypto Engine
Date: Wed, 17 Mar 2021 14:13:30 +0100	[thread overview]
Message-ID: <bc22a53d-f21d-e34e-f075-f8c97fba164d@amsat.org> (raw)
In-Reply-To: <6fcc0cc8-e09d-5390-dc3b-593612e404e6@kaod.org>



On 3/17/21 1:36 PM, Cédric Le Goater wrote:
> On 3/17/21 12:47 PM, Philippe Mathieu-Daudé wrote:
>> On 3/12/21 11:57 AM, Joel Stanley wrote:
>>> The HACE (Hash and Crypto Engine) is a device that offloads MD5, SHA1,
>>> SHA2, RSA and other cryptographic algorithms.
>>>
>>> This initial model implements a subset of the device's functionality;
>>> currently only direct access (non-scatter gather) hashing.
>>>
>>> Signed-off-by: Joel Stanley <joel@jms.id.au>
>>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>>> ---
>>> v3:
>>>  - rebase on upstream to fix meson.build conflict
>>> v2:
>>>  - reorder register defines
>>>  - mask src/dest/len registers according to hardware
>>> ---
>>>  include/hw/misc/aspeed_hace.h |  33 ++++
>>>  hw/misc/aspeed_hace.c         | 312 ++++++++++++++++++++++++++++++++++
>>>  hw/misc/meson.build           |   1 +
>>>  3 files changed, 346 insertions(+)
>>>  create mode 100644 include/hw/misc/aspeed_hace.h
>>>  create mode 100644 hw/misc/aspeed_hace.c

>>> +static int do_hash_operation(AspeedHACEState *s, int algo)
>>> +{
>>> +    hwaddr src, len, dest;
>>> +    uint8_t *digest_buf = NULL;
>>> +    size_t digest_len = 0;
>>> +    char *src_buf;
>>> +    int rc;
>>> +
>>> +    src = 0x80000000 | s->regs[R_HASH_SRC];
>>> +    len = s->regs[R_HASH_SRC_LEN];
>>> +    dest = 0x80000000 | s->regs[R_HASH_DEST];
>>> +
>>> +    src_buf = address_space_map(&s->dram_as, src, &len, false,
>>> +                                MEMTXATTRS_UNSPECIFIED);
>>
>> It seems the Aspeed machines aren't using correctly the AS API...
>> This device shouldn't worry about where it is physically mapped.
>> IOW its AS is too wide.
>>
>> I'm trying to fix this in a series:
>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg791085.html
> 
> The buffers can be anywhere in DRAM

Exactly. This device only requires direct access to DRAM, not the
full bus. Regardless the amount of DRAM available, only the bus
aperture to the DRAM should be passed to this device (MR link),
then this device use an AS view on it, zero-based.

Your device becomes independent to where the DRAM is physically
mapped on the SoC.

> which is mapped at 0x80000000
> on the AST2600. This is correct and very similar to what we do 
> in the Aspeed SMC DMA models.
> 
> I would prefer if we did loads though.
> 
> Cheers,
> 
> C.
> 
> 


  reply	other threads:[~2021-03-17 13:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 10:57 [PATCH v3 0/3] hw/misc: Model ASPEED hash and crypto engine Joel Stanley
2021-03-12 10:57 ` [PATCH v3 1/3] hw: Model ASPEED's Hash and Crypto Engine Joel Stanley
2021-03-17  0:02   ` Andrew Jeffery
2021-03-17  7:24     ` Cédric Le Goater
2021-03-17  8:13   ` Cédric Le Goater
2021-03-17 11:47   ` Philippe Mathieu-Daudé
2021-03-17 12:36     ` Cédric Le Goater
2021-03-17 13:13       ` Philippe Mathieu-Daudé [this message]
2021-03-17 17:03         ` Cédric Le Goater
2021-03-12 10:57 ` [PATCH v3 2/3] aspeed: Integrate HACE Joel Stanley
2021-03-12 10:57 ` [PATCH v3 3/3] tests/qtest: Add test for Aspeed HACE Joel Stanley
2021-03-12 11:28   ` Thomas Huth

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=bc22a53d-f21d-e34e-f075-f8c97fba164d@amsat.org \
    --to=f4bug@amsat.org \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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).