From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm <qemu-arm@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH 06/16] target/arm: Add sve infrastructure for page lookup
Date: Fri, 17 Apr 2020 20:11:35 -0700 [thread overview]
Message-ID: <2f954cef-763a-592d-28d8-750959f3a43e@linaro.org> (raw)
In-Reply-To: <CAFEAcA8F2Qmdh=9RXFhN9_WPjhjhai9iO2Cn0dL5UAGV_r4AGw@mail.gmail.com>
On 4/16/20 6:03 AM, Peter Maydell wrote:
>> +#ifdef CONFIG_USER_ONLY
>> + memset(&info->attrs, 0, sizeof(info->attrs));
>
> Could just write "info->attrs = {};" ?
Not quite. Correct syntax would be attrs = (MemTxAttrs){ }.
I don't see that as an improvement over memset though.
>> + int16_t mem_off_first[2];
>> + int16_t reg_off_first[2];
>> + int16_t reg_off_last[2];
>
> It would be helpful to document what these actually are,
> and in particular what the behaviour is if the whole thing
> fits in a single page. (Judging by the code, the elements
> at index 1 for the 2nd page are set to -1 ?)
Yes, that's right. I've added some more detail here.
>> + intptr_t reg_off_first = -1, reg_off_last = -1, reg_off_split;
>> + intptr_t mem_off_last, mem_off_split;
>> + intptr_t page_split, elt_split;
>> + intptr_t i;
>
> intptr_t seems like a funny type to be using here, since these
> aren't actually related to pointers as far as I can tell.
They're used as array indexes. If we use "int", the compiler keeps
re-extending the value.
>> + memset(info, -1, offsetof(SVEContLdSt, page));
>
> I guess this isn't conceptually much different from zeroing
> out integer struct fields, but it feels a bit less safe somehow.
It seems easier than setting 9 fields separately...
>> + page_split = -(addr | TARGET_PAGE_MASK);
>
> What is the negation for ?
Computation of remaining bytes in the page:
-(x | TARGET_PAGE_MASK)
= -(x | -TARGET_PAGE_SIZE)
= TARGET_PAGE_SIZE - (x & -TARGET_PAGE_SIZE)
We use this all over qemu.
r~
next prev parent reply other threads:[~2020-04-18 3:13 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 6:44 [PATCH 00/16] target/arm: sve load/store improvements Richard Henderson
2020-03-11 6:44 ` [PATCH 01/16] accel/tcg: Add block comment for probe_access Richard Henderson
2020-04-16 11:50 ` Peter Maydell
2020-03-11 6:44 ` [PATCH 02/16] accel/tcg: Add probe_access_flags Richard Henderson
2020-03-12 4:33 ` [PATCH v2 " Richard Henderson
2020-04-16 11:54 ` Peter Maydell
2020-04-18 0:05 ` Richard Henderson
2020-03-12 4:38 ` [PATCH " Richard Henderson
2020-03-11 6:44 ` [PATCH 03/16] exec: Add cpu_probe_watchpoint Richard Henderson
2020-04-16 12:08 ` Peter Maydell
2020-04-18 2:14 ` Richard Henderson
2020-03-11 6:44 ` [PATCH 04/16] target/arm: Use cpu_*_data_ra for sve_ldst_tlb_fn Richard Henderson
2020-04-16 12:19 ` Peter Maydell
2020-04-18 2:16 ` Richard Henderson
2020-03-11 6:44 ` [PATCH 05/16] target/arm: Drop manual handling of set/clear_helper_retaddr Richard Henderson
2020-04-16 12:23 ` Peter Maydell
2020-03-11 6:44 ` [PATCH 06/16] target/arm: Add sve infrastructure for page lookup Richard Henderson
2020-04-16 13:03 ` Peter Maydell
2020-04-18 3:11 ` Richard Henderson [this message]
2020-03-11 6:44 ` [PATCH 07/16] target/arm: Adjust interface of sve_ld1_host_fn Richard Henderson
2020-04-16 13:16 ` Peter Maydell
2020-03-11 6:44 ` [PATCH 08/16] target/arm: Use SVEContLdSt in sve_ld1_r Richard Henderson
2020-04-16 13:26 ` Peter Maydell
2020-04-18 3:41 ` Richard Henderson
2020-03-11 6:44 ` [PATCH 09/16] target/arm: Handle watchpoints " Richard Henderson
2020-04-16 13:29 ` Peter Maydell
2020-03-11 6:44 ` [PATCH 10/16] target/arm: Use SVEContLdSt for multi-register contiguous loads Richard Henderson
2020-04-16 13:35 ` Peter Maydell
2020-04-18 3:26 ` Richard Henderson
2020-03-11 6:44 ` [PATCH 11/16] target/arm: Update contiguous first-fault and no-fault loads Richard Henderson
2020-04-16 14:15 ` Peter Maydell
2020-04-18 3:36 ` Richard Henderson
2020-03-11 6:44 ` [PATCH 12/16] target/arm: Use SVEContLdSt for contiguous stores Richard Henderson
2020-04-16 14:18 ` Peter Maydell
2020-03-11 6:44 ` [PATCH 13/16] target/arm: Reuse sve_probe_page for gather first-fault loads Richard Henderson
2020-04-16 14:23 ` Peter Maydell
2020-03-11 6:44 ` [PATCH 14/16] target/arm: Reuse sve_probe_page for scatter stores Richard Henderson
2020-04-16 14:25 ` Peter Maydell
2020-03-11 6:44 ` [PATCH 15/16] target/arm: Reuse sve_probe_page for gather loads Richard Henderson
2020-04-16 14:21 ` Peter Maydell
2020-03-11 6:44 ` [PATCH 16/16] target/arm: Remove sve_memopidx Richard Henderson
2020-04-16 14:27 ` Peter Maydell
2020-03-11 7:10 ` [PATCH 00/16] target/arm: sve load/store improvements no-reply
2020-04-16 14:28 ` 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=2f954cef-763a-592d-28d8-750959f3a43e@linaro.org \
--to=richard.henderson@linaro.org \
--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).