From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PULL 7/8] KVM: arm/arm64: vgic-its: Check CBASER/BASER validity before enabling the ITS
Date: Mon, 30 Oct 2017 03:56:02 +0100 [thread overview]
Message-ID: <20171030025603.23550-8-christoffer.dall@linaro.org> (raw)
In-Reply-To: <20171030025603.23550-1-christoffer.dall@linaro.org>
From: Eric Auger <eric.auger@redhat.com>
The spec says it is UNPREDICTABLE to enable the ITS
if any of the following conditions are true:
- GITS_CBASER.Valid == 0.
- GITS_BASER<n>.Valid == 0, for any GITS_BASER<n> register
where the Type field indicates Device.
- GITS_BASER<n>.Valid == 0, for any GITS_BASER<n> register
where the Type field indicates Interrupt Collection and
GITS_TYPER.HCC == 0.
In that case, let's keep the ITS disabled.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reported-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
virt/kvm/arm/vgic/vgic-its.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
index 6a715a6ec64e..e69ef7d27fde 100644
--- a/virt/kvm/arm/vgic/vgic-its.c
+++ b/virt/kvm/arm/vgic/vgic-its.c
@@ -1466,6 +1466,16 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its,
{
mutex_lock(&its->cmd_lock);
+ /*
+ * It is UNPREDICTABLE to enable the ITS if any of the CBASER or
+ * device/collection BASER are invalid
+ */
+ if (!its->enabled && (val & GITS_CTLR_ENABLE) &&
+ (!(its->baser_device_table & GITS_BASER_VALID) ||
+ !(its->baser_coll_table & GITS_BASER_VALID) ||
+ !(its->cbaser & GITS_CBASER_VALID)))
+ goto out;
+
its->enabled = !!(val & GITS_CTLR_ENABLE);
/*
@@ -1474,6 +1484,7 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its,
*/
vgic_its_process_commands(kvm, its);
+out:
mutex_unlock(&its->cmd_lock);
}
--
2.14.2
next prev parent reply other threads:[~2017-10-30 2:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-30 2:55 [PULL 0/8] KVM/ARM Fixes for v4.14 Christoffer Dall
2017-10-30 2:55 ` [PULL 1/8] KVM: arm64: its: Fix missing dynamic allocation check in scan_its_table Christoffer Dall
2017-10-30 2:55 ` [PULL 2/8] arm/arm64: KVM: set right LR register value for 32 bit guest when inject abort Christoffer Dall
2017-10-30 2:55 ` [PULL 3/8] arm/arm64: kvm: Move initialization completion message Christoffer Dall
2017-10-30 2:55 ` [PULL 4/8] arm/arm64: kvm: Disable branch profiling in HYP code Christoffer Dall
2017-10-30 2:56 ` [PULL 5/8] KVM: arm/arm64: vgic-its: Fix return value for device table restore Christoffer Dall
2017-10-30 2:56 ` [PULL 6/8] KVM: arm/arm64: vgic-its: Fix vgic_its_restore_collection_table returned value Christoffer Dall
2017-10-30 2:56 ` Christoffer Dall [this message]
2017-10-30 2:56 ` [PULL 8/8] KVM: arm/arm64: vgic-its: Check GITS_BASER Valid bit before saving tables Christoffer Dall
2017-11-02 17:38 ` [PULL 0/8] KVM/ARM Fixes for v4.14 Paolo Bonzini
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=20171030025603.23550-8-christoffer.dall@linaro.org \
--to=christoffer.dall@linaro.org \
--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).