From: christoffer.dall@arm.com (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] KVM: arm64: vgic-v3: Add support for ICC_SGI0R_EL1 and ICC_ASGI1R_EL1 accesses
Date: Thu, 9 Aug 2018 09:41:26 +0200 [thread overview]
Message-ID: <20180809074126.GD20606@e113682-lin.lund.arm.com> (raw)
In-Reply-To: <20180808131501.584-4-marc.zyngier@arm.com>
On Wed, Aug 08, 2018 at 02:15:00PM +0100, Marc Zyngier wrote:
> In order to generate Group0 SGIs, let's add some decoding logic to
> access_gic_sgi(), and pass the generating group accordingly.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> arch/arm64/include/asm/sysreg.h | 2 ++
> arch/arm64/kvm/sys_regs.c | 41 +++++++++++++++++++++++++++++++--
> 2 files changed, 41 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
> index 98af0b37fb31..b0d2a52a71a3 100644
> --- a/arch/arm64/include/asm/sysreg.h
> +++ b/arch/arm64/include/asm/sysreg.h
> @@ -314,6 +314,8 @@
> #define SYS_ICC_DIR_EL1 sys_reg(3, 0, 12, 11, 1)
> #define SYS_ICC_RPR_EL1 sys_reg(3, 0, 12, 11, 3)
> #define SYS_ICC_SGI1R_EL1 sys_reg(3, 0, 12, 11, 5)
> +#define SYS_ICC_ASGI1R_EL1 sys_reg(3, 0, 12, 11, 6)
> +#define SYS_ICC_SGI0R_EL1 sys_reg(3, 0, 12, 11, 7)
> #define SYS_ICC_IAR1_EL1 sys_reg(3, 0, 12, 12, 0)
> #define SYS_ICC_EOIR1_EL1 sys_reg(3, 0, 12, 12, 1)
> #define SYS_ICC_HPPIR1_EL1 sys_reg(3, 0, 12, 12, 2)
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index a09139b97e81..b09eac49e1ac 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -252,10 +252,43 @@ static bool access_gic_sgi(struct kvm_vcpu *vcpu,
> struct sys_reg_params *p,
> const struct sys_reg_desc *r)
> {
> + int group;
> +
> if (!p->is_write)
> return read_from_write_only(vcpu, p, r);
>
> - vgic_v3_dispatch_sgi(vcpu, p->regval, 1);
> + /*
> + * In a system where GICD_CTLR.DS=1, a ICC_SGI0R_EL1 access generates
> + * Group0 SGIs only, while ICC_SGI1R_EL1 can generate either group,
> + * depending on the SGI configuration. ICC_ASGI1R_EL1 is effectively
> + * equivalent to ICC_SGI0R_EL1, as there is no "alternative" secure
> + * group.
> + */
> + if (p->is_aarch32) {
> + switch (p->Op1) {
> + default: /* Keep GCC quiet */
> + case 0: /* ICC_SGI1R */
> + group = 1;
> + break;
> + case 1: /* ICC_ASGI1R */
> + case 2: /* ICC_SGI0R */
> + group = 0;
> + break;
> + }
> + } else {
> + switch (p->Op2) {
> + default: /* Keep GCC quiet */
> + case 5: /* ICC_SGI1R_EL1 */
> + group = 1;
> + break;
> + case 6: /* ICC_ASGI1R_EL1 */
> + case 7: /* ICC_SGI0R_EL1 */
> + group = 0;
> + break;
> + }
> + }
> +
> + vgic_v3_dispatch_sgi(vcpu, p->regval, group);
>
> return true;
> }
> @@ -1312,6 +1345,8 @@ static const struct sys_reg_desc sys_reg_descs[] = {
> { SYS_DESC(SYS_ICC_DIR_EL1), read_from_write_only },
> { SYS_DESC(SYS_ICC_RPR_EL1), write_to_read_only },
> { SYS_DESC(SYS_ICC_SGI1R_EL1), access_gic_sgi },
> + { SYS_DESC(SYS_ICC_ASGI1R_EL1), access_gic_sgi },
> + { SYS_DESC(SYS_ICC_SGI0R_EL1), access_gic_sgi },
> { SYS_DESC(SYS_ICC_IAR1_EL1), write_to_read_only },
> { SYS_DESC(SYS_ICC_EOIR1_EL1), read_from_write_only },
> { SYS_DESC(SYS_ICC_HPPIR1_EL1), write_to_read_only },
> @@ -1744,8 +1779,10 @@ static const struct sys_reg_desc cp15_regs[] = {
> static const struct sys_reg_desc cp15_64_regs[] = {
> { Op1( 0), CRn( 0), CRm( 2), Op2( 0), access_vm_reg, NULL, c2_TTBR0 },
> { Op1( 0), CRn( 0), CRm( 9), Op2( 0), access_pmu_evcntr },
> - { Op1( 0), CRn( 0), CRm(12), Op2( 0), access_gic_sgi },
> + { Op1( 0), CRn( 0), CRm(12), Op2( 0), access_gic_sgi }, /* ICC_SGI1R */
> { Op1( 1), CRn( 0), CRm( 2), Op2( 0), access_vm_reg, NULL, c2_TTBR1 },
> + { Op1( 1), CRn( 0), CRm(12), Op2( 0), access_gic_sgi }, /* ICC_ASGI1R */
> + { Op1( 2), CRn( 0), CRm(12), Op2( 0), access_gic_sgi }, /* ICC_SGI0R */
> { Op1( 2), CRn( 0), CRm(14), Op2( 0), access_cntp_cval },
> };
>
> --
> 2.18.0
>
Reviewed-by: Christoffer Dall <christoffer.dall@arm.com>
next prev parent reply other threads:[~2018-08-09 7:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-08 13:14 [PATCH 0/4] KVM: arm/arm64: vgic-v3: Group0 SGI support Marc Zyngier
2018-08-08 13:14 ` [PATCH 1/4] KVM: arm64: Remove non-existent AArch32 ICC_SGI1R encoding Marc Zyngier
2018-08-09 7:41 ` Christoffer Dall
2018-08-08 13:14 ` [PATCH 2/4] KVM: arm/arm64: vgic-v3: Add core support for Group0 SGIs Marc Zyngier
2018-08-09 7:40 ` Christoffer Dall
2018-08-09 11:59 ` Marc Zyngier
2018-08-08 13:15 ` [PATCH 3/4] KVM: arm64: vgic-v3: Add support for ICC_SGI0R_EL1 and ICC_ASGI1R_EL1 accesses Marc Zyngier
2018-08-09 7:41 ` Christoffer Dall [this message]
2018-08-08 13:15 ` [PATCH 4/4] KVM: arm: vgic-v3: Add support for ICC_SGI0R and ICC_ASGI1R accesses Marc Zyngier
2018-08-09 7:41 ` Christoffer Dall
2018-08-09 11:51 ` [PATCH 0/4] KVM: arm/arm64: vgic-v3: Group0 SGI support Auger Eric
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=20180809074126.GD20606@e113682-lin.lund.arm.com \
--to=christoffer.dall@arm.com \
--cc=linux-arm-kernel@lists.infradead.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).