qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 3/9] hw/intc/gic: use MxTxAttrs to divine accessing CPU


From: mads
Subject: Re: [PATCH v1 3/9] hw/intc/gic: use MxTxAttrs to divine accessing CPU
Date: Mon, 26 Sep 2022 12:56:32 +0200


> On 22 Sep 2022, at 16.58, Alex Bennée <alex.bennee@linaro.org> wrote:
> 
> Now that MxTxAttrs encodes a CPU we should use that to figure it out.
> This solves edge cases like accessing via gdbstub or qtest.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/124
> 
> ---
> v2
>  - update for new field
>  - bool asserts
> ---
> hw/intc/arm_gic.c | 39 ++++++++++++++++++++++-----------------
> 1 file changed, 22 insertions(+), 17 deletions(-)
> 
> diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
> index 492b2421ab..b58d3c4a95 100644
> --- a/hw/intc/arm_gic.c
> +++ b/hw/intc/arm_gic.c
> @@ -56,17 +56,22 @@ static const uint8_t gic_id_gicv2[] = {
>     0x04, 0x00, 0x00, 0x00, 0x90, 0xb4, 0x2b, 0x00, 0x0d, 0xf0, 0x05, 0xb1
> };
> 
> -static inline int gic_get_current_cpu(GICState *s)
> +static inline int gic_get_current_cpu(GICState *s, MemTxAttrs attrs)
> {
> -    if (!qtest_enabled() && s->num_cpu > 1) {
> -        return current_cpu->cpu_index;
> -    }
> -    return 0;
> +    /*
> +     * Something other than a CPU accessing the GIC would be a bug as
> +     * would a CPU index higher than the GICState expects to be
> +     * handling
> +     */
> +    g_assert(attrs.requester_is_cpu);
> +    g_assert(attrs.cpu_index < s->num_cpu);
> +
> +    return attrs.requester_id;
> }

The asserts here abort on macOS, with HVF accelerator:

ERROR:../hw/intc/arm_gic.c:66:gic_get_current_cpu: assertion failed: 
(attrs.requester_is_cpu)
Bail out! ERROR:../hw/intc/arm_gic.c:66:gic_get_current_cpu: assertion failed: 
(attrs.requester_is_cpu)

If I revert the changes inside this function, it seemingly works again.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]