From: Steven Lee <steven_lee@aspeedtech.com>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: Laurent Vivier <lvivier@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Thomas Huth <thuth@redhat.com>,
Jamin Lin <jamin_lin@aspeedtech.com>,
Andrew Jeffery <andrew@aj.id.au>,
Troy Lee <troy_lee@aspeedtech.com>,
"open list:All patches CC here" <qemu-devel@nongnu.org>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
Joel Stanley <joel@jms.id.au>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v5 2/3] aspeed/hace: Support AST2600 HACE
Date: Tue, 26 Apr 2022 09:42:32 +0800 [thread overview]
Message-ID: <20220426014230.GA2615@aspeedtech.com> (raw)
In-Reply-To: <17d96382-de18-986e-877c-d87092c0816d@kaod.org>
The 04/25/2022 21:46, Cédric Le Goater wrote:
> On 4/22/22 07:19, Steven Lee wrote:
> > +/**
> > + * Check whether the request contains padding message.
> > + *
> > + * @param s aspeed hace state object
> > + * @param iov iov of current request
> > + * @param req_len length of the current request
> > + * @param total_msg_len length of all acc_mode requests(excluding padding msg)
> > + * @param pad_offset start offset of padding message
> > + */
> > +static bool has_padding(AspeedHACEState *s, struct iovec *iov,
> > + hwaddr req_len, uint32_t *total_msg_len,
> > + uint32_t *pad_offset)
> > +{
> > + *total_msg_len = (uint32_t)(ldq_be_p(iov->iov_base + req_len - 8) / 8);
> > + /*
> > + * SG_LIST_LEN_LAST asserted in the request length doesn't mean it is the
> > + * last request. The last request should contain padding message.
> > + * We check whether message contains padding by
> > + * 1. Get total message length. If the current message contains
> > + * padding, the last 8 bytes are total message length.
> > + * 2. Check whether the total message length is valid.
> > + * If it is valid, the value should less than or equal to
> > + * total_req_len.
> > + * 3. Current request len - padding_size to get padding offset.
> > + * The padding message's first byte should be 0x80
> > + */
> > + if (*total_msg_len <= s->total_req_len) {
> > + uint32_t padding_size = s->total_req_len - *total_msg_len;
> > + uint8_t *padding = iov->iov_base;
> > + *pad_offset = req_len - padding_size;
> > + if (padding[*pad_offset] == 0x80) {
> > + return true;
> > + }
> > + }
> > +
> > + return false;
> > +}
> > +
> > +static int reconstruct_iov(AspeedHACEState *s, struct iovec *iov, int id,
> > + uint32_t *pad_offset)
> > +{
> > + int i, iov_count;
> > + if (pad_offset != 0) {
>
> pad_offset can not be NULL. or may be you meant *pad_offset ?
>
> Thanks,
>
> C.
>
>
Yes, it should be *pad_offset, I will fix it.
Thanks,
Steven
> > + s->iov_cache[s->iov_count].iov_base = iov[id].iov_base;
> > + s->iov_cache[s->iov_count].iov_len = *pad_offset;
> > + ++s->iov_count;
>
>
> > + }
> > + for (i = 0; i < s->iov_count; i++) {
> > + iov[i].iov_base = s->iov_cache[i].iov_base;
> > + iov[i].iov_len = s->iov_cache[i].iov_len;
> > + }
> > + iov_count = s->iov_count;
> > + s->iov_count = 0;
> > + s->total_req_len = 0;
> > + return iov_count;
> > +}
> > +
>
next prev parent reply other threads:[~2022-04-26 1:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-22 5:19 [PATCH v5 0/3] aspeed/hace: Support AST2600 HACE Steven Lee
2022-04-22 5:19 ` [PATCH v5 1/3] aspeed/hace: Support HMAC Key Buffer register Steven Lee
2022-04-22 5:19 ` [PATCH v5 2/3] aspeed/hace: Support AST2600 HACE Steven Lee
2022-04-25 13:46 ` Cédric Le Goater
2022-04-26 1:42 ` Steven Lee [this message]
2022-04-22 5:19 ` [PATCH v5 3/3] tests/qtest: Add test for Aspeed HACE accumulative mode Steven Lee
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=20220426014230.GA2615@aspeedtech.com \
--to=steven_lee@aspeedtech.com \
--cc=andrew@aj.id.au \
--cc=clg@kaod.org \
--cc=jamin_lin@aspeedtech.com \
--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 \
--cc=troy_lee@aspeedtech.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 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.