linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: Document workaround for Cortex-A72 erratum #853709
@ 2016-08-16 14:03 Marc Zyngier
  2016-08-16 14:03 ` [PATCH] KVM: arm/arm64: timer: Workaround misconfigured timer interrupt Marc Zyngier
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2016-08-16 14:03 UTC (permalink / raw)
  To: linux-arm-kernel

We already have a workaround for Cortex-A57 erratum #852523,
but Cortex-A72 r0p0 to r0p2 do suffer from the same issue
(known as erratum #853709).

Let's document the fact that we already handle this.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 Documentation/arm64/silicon-errata.txt | 1 +
 arch/arm64/kvm/hyp/switch.c            | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt
index 4da60b4..ccc6032 100644
--- a/Documentation/arm64/silicon-errata.txt
+++ b/Documentation/arm64/silicon-errata.txt
@@ -53,6 +53,7 @@ stable kernels.
 | ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075    |
 | ARM            | Cortex-A57      | #852523         | N/A                     |
 | ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220    |
+| ARM            | Cortex-A72      | #853709         | N/A                     |
 | ARM            | MMU-500         | #841119,#826419 | N/A                     |
 |                |                 |                 |                         |
 | Cavium         | ThunderX ITS    | #22375, #24313  | CAVIUM_ERRATUM_22375    |
diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
index ae7855f..5a84b45 100644
--- a/arch/arm64/kvm/hyp/switch.c
+++ b/arch/arm64/kvm/hyp/switch.c
@@ -256,7 +256,7 @@ static int __hyp_text __guest_run(struct kvm_vcpu *vcpu)
 
 	/*
 	 * We must restore the 32-bit state before the sysregs, thanks
-	 * to Cortex-A57 erratum #852523.
+	 * to erratum #852523 (Cortex-A57) or #853709 (Cortex-A72).
 	 */
 	__sysreg32_restore_state(vcpu);
 	__sysreg_restore_guest_state(guest_ctxt);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] KVM: arm/arm64: timer: Workaround misconfigured timer interrupt
  2016-08-16 14:03 [PATCH] arm64: Document workaround for Cortex-A72 erratum #853709 Marc Zyngier
@ 2016-08-16 14:03 ` Marc Zyngier
  2016-08-17 10:21   ` Christoffer Dall
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Zyngier @ 2016-08-16 14:03 UTC (permalink / raw)
  To: linux-arm-kernel

Similarily to f005bd7e3b84 ("clocksource/arm_arch_timer: Force
per-CPU interrupt to be level-triggered"), make sure we can
survive an interrupt that has been misconfigured as edge-triggered
by forcing it to be level-triggered (active low is assumed, but
the GIC doesn't really care whether this is high or low).

Hopefully, the amount of shouting in the kernel log will convince
the user to do something about their firmware.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 virt/kvm/arm/arch_timer.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 4fde8c7..77e6ccf 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -33,6 +33,7 @@
 static struct timecounter *timecounter;
 static struct workqueue_struct *wqueue;
 static unsigned int host_vtimer_irq;
+static u32 host_vtimer_irq_flags;
 
 void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu)
 {
@@ -365,7 +366,7 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu)
 
 static void kvm_timer_init_interrupt(void *info)
 {
-	enable_percpu_irq(host_vtimer_irq, 0);
+	enable_percpu_irq(host_vtimer_irq, host_vtimer_irq_flags);
 }
 
 int kvm_arm_timer_set_reg(struct kvm_vcpu *vcpu, u64 regid, u64 value)
@@ -432,6 +433,14 @@ int kvm_timer_hyp_init(void)
 	}
 	host_vtimer_irq = info->virtual_irq;
 
+	host_vtimer_irq_flags = irq_get_trigger_type(host_vtimer_irq);
+	if (host_vtimer_irq_flags != IRQF_TRIGGER_HIGH &&
+	    host_vtimer_irq_flags != IRQF_TRIGGER_LOW) {
+		kvm_err("Invalid trigger for IRQ%d, assuming level low\n",
+			host_vtimer_irq);
+		host_vtimer_irq_flags = IRQF_TRIGGER_LOW;
+	}
+
 	err = request_percpu_irq(host_vtimer_irq, kvm_arch_timer_handler,
 				 "kvm guest timer", kvm_get_running_vcpus());
 	if (err) {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] KVM: arm/arm64: timer: Workaround misconfigured timer interrupt
  2016-08-16 14:03 ` [PATCH] KVM: arm/arm64: timer: Workaround misconfigured timer interrupt Marc Zyngier
@ 2016-08-17 10:21   ` Christoffer Dall
  0 siblings, 0 replies; 3+ messages in thread
From: Christoffer Dall @ 2016-08-17 10:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 16, 2016 at 03:03:02PM +0100, Marc Zyngier wrote:
> Similarily to f005bd7e3b84 ("clocksource/arm_arch_timer: Force
> per-CPU interrupt to be level-triggered"), make sure we can
> survive an interrupt that has been misconfigured as edge-triggered
> by forcing it to be level-triggered (active low is assumed, but
> the GIC doesn't really care whether this is high or low).
> 
> Hopefully, the amount of shouting in the kernel log will convince
> the user to do something about their firmware.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  virt/kvm/arm/arch_timer.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
> index 4fde8c7..77e6ccf 100644
> --- a/virt/kvm/arm/arch_timer.c
> +++ b/virt/kvm/arm/arch_timer.c
> @@ -33,6 +33,7 @@
>  static struct timecounter *timecounter;
>  static struct workqueue_struct *wqueue;
>  static unsigned int host_vtimer_irq;
> +static u32 host_vtimer_irq_flags;
>  
>  void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu)
>  {
> @@ -365,7 +366,7 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu)
>  
>  static void kvm_timer_init_interrupt(void *info)
>  {
> -	enable_percpu_irq(host_vtimer_irq, 0);
> +	enable_percpu_irq(host_vtimer_irq, host_vtimer_irq_flags);
>  }
>  
>  int kvm_arm_timer_set_reg(struct kvm_vcpu *vcpu, u64 regid, u64 value)
> @@ -432,6 +433,14 @@ int kvm_timer_hyp_init(void)
>  	}
>  	host_vtimer_irq = info->virtual_irq;
>  
> +	host_vtimer_irq_flags = irq_get_trigger_type(host_vtimer_irq);
> +	if (host_vtimer_irq_flags != IRQF_TRIGGER_HIGH &&
> +	    host_vtimer_irq_flags != IRQF_TRIGGER_LOW) {
> +		kvm_err("Invalid trigger for IRQ%d, assuming level low\n",
> +			host_vtimer_irq);
> +		host_vtimer_irq_flags = IRQF_TRIGGER_LOW;
> +	}
> +
>  	err = request_percpu_irq(host_vtimer_irq, kvm_arch_timer_handler,
>  				 "kvm guest timer", kvm_get_running_vcpus());
>  	if (err) {
> -- 
> 2.1.4
> 

Looks good to me.  Applied.
-Christoffer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-17 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-16 14:03 [PATCH] arm64: Document workaround for Cortex-A72 erratum #853709 Marc Zyngier
2016-08-16 14:03 ` [PATCH] KVM: arm/arm64: timer: Workaround misconfigured timer interrupt Marc Zyngier
2016-08-17 10:21   ` Christoffer Dall

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).