[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [kvm-unit-tests PATCH v2 09/16] arm/arm64: ITS: Enable/Disable LPIs
From: |
Andrew Jones |
Subject: |
Re: [kvm-unit-tests PATCH v2 09/16] arm/arm64: ITS: Enable/Disable LPIs at re-distributor level |
Date: |
Mon, 13 Jan 2020 18:44:57 +0100 |
On Fri, Jan 10, 2020 at 03:54:05PM +0100, Eric Auger wrote:
> This helper function enables or disables the signaling of LPIs
> at redistributor level.
>
> Signed-off-by: Eric Auger <address@hidden>
> ---
> lib/arm/asm/gic-v3-its.h | 1 +
> lib/arm/gic-v3-its.c | 18 ++++++++++++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/lib/arm/asm/gic-v3-its.h b/lib/arm/asm/gic-v3-its.h
> index 93814f7..d2db292 100644
> --- a/lib/arm/asm/gic-v3-its.h
> +++ b/lib/arm/asm/gic-v3-its.h
> @@ -99,6 +99,7 @@ extern struct its_baser *its_lookup_baser(int type);
> extern void set_lpi_config(int n, u8 val);
> extern u8 get_lpi_config(int n);
> extern void set_pending_table_bit(int rdist, int n, bool set);
> +extern void gicv3_rdist_ctrl_lpi(u32 redist, bool set);
>
> #endif /* !__ASSEMBLY__ */
> #endif /* _ASMARM_GIC_V3_ITS_H_ */
> diff --git a/lib/arm/gic-v3-its.c b/lib/arm/gic-v3-its.c
> index 3037c84..c7c6f80 100644
> --- a/lib/arm/gic-v3-its.c
> +++ b/lib/arm/gic-v3-its.c
> @@ -199,3 +199,21 @@ void init_cmd_queue(void)
> its_data.cmd_write = its_data.cmd_base;
> writeq(0, its_data.base + GITS_CWRITER);
> }
> +
> +void gicv3_rdist_ctrl_lpi(u32 redist, bool set)
> +{
> + void *ptr;
> + u64 val;
> +
> + if (redist >= nr_cpus)
> + report_abort("%s redist=%d >= cpu_count=%d\n",
> + __func__, redist, nr_cpus);
I'd use {} here because of the multiline call. But, we don't
use the report API in common code. Well, apparently s390 has
report calls in lib/s390x/interrupt.c, but I don't really
agree with that. IMO, common code failures should always
be unexpected and just assert/assert_msg.
> +
> + ptr = gicv3_data.redist_base[redist];
> + val = readl(ptr + GICR_CTLR);
> + if (set)
> + val |= GICR_CTLR_ENABLE_LPIS;
> + else
> + val &= ~GICR_CTLR_ENABLE_LPIS;
> + writel(val, ptr + GICR_CTLR);
> +}
> --
> 2.20.1
>
Also, you can squash this patch into whatever is going to make use
of this new helper.
Thanks,
drew
- Re: [kvm-unit-tests PATCH v2 05/16] arm/arm64: ITS: Introspection tests, (continued)
- [kvm-unit-tests PATCH v2 06/16] arm/arm64: ITS: Test BASER, Eric Auger, 2020/01/10
- [kvm-unit-tests PATCH v2 07/16] arm/arm64: ITS: Set the LPI config and pending tables, Eric Auger, 2020/01/10
- [kvm-unit-tests PATCH v2 08/16] arm/arm64: ITS: Init the command queue, Eric Auger, 2020/01/10
- [kvm-unit-tests PATCH v2 09/16] arm/arm64: ITS: Enable/Disable LPIs at re-distributor level, Eric Auger, 2020/01/10
- Re: [kvm-unit-tests PATCH v2 09/16] arm/arm64: ITS: Enable/Disable LPIs at re-distributor level,
Andrew Jones <=
- [kvm-unit-tests PATCH v2 10/16] arm/arm64: ITS: its_enable_defaults, Eric Auger, 2020/01/10
- [kvm-unit-tests PATCH v2 11/16] arm/arm64: ITS: Device and collection Initialization, Eric Auger, 2020/01/10
- [kvm-unit-tests PATCH v2 12/16] arm/arm64: ITS: commands, Eric Auger, 2020/01/10
- [kvm-unit-tests PATCH v2 13/16] arm/arm64: ITS: INT functional tests, Eric Auger, 2020/01/10