From patchwork Thu Jun 2 10:20:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9149733 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E12A36074E for ; Thu, 2 Jun 2016 10:21:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D454C2679B for ; Thu, 2 Jun 2016 10:21:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C91BC27D45; Thu, 2 Jun 2016 10:21:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A6EE271FD for ; Thu, 2 Jun 2016 10:21:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932681AbcFBKVT (ORCPT ); Thu, 2 Jun 2016 06:21:19 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:38394 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932078AbcFBKVQ (ORCPT ); Thu, 2 Jun 2016 06:21:16 -0400 Received: by mail-wm0-f48.google.com with SMTP id a20so61038316wma.1 for ; Thu, 02 Jun 2016 03:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0eVBuXfUuOzH/APgP/VeNUh/MF7EyqMVwfxumYMlc6Q=; b=QR5YqAG7mlvKgQtS/rssjl4mNkjJw1mVTwIaM2Rn7uUS+JybgjhjklnAeo95b4mQ0M UPuz9B3mg6OWrNLP4eRQccR9CQQsTTU9a6tgbuXtp12PAAslnbZHZ6PxNMvqMiWqNre7 9RQA3AbGSNjDWZMfPWCwtr7etYLTsIUa+Vd4A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0eVBuXfUuOzH/APgP/VeNUh/MF7EyqMVwfxumYMlc6Q=; b=P6gvft7dzVQFf+hKDArVCzudmbI4lg5+DmXxqbEqmIStIUcFGvZRiGygfyCT9C+jC9 r76R8B1zH+wf0U62YHJe1oM5QgIf4kaiu42nilKy8LAfelPnUM3U2LNPHQRO9O7cJ6qY aUYiUukehzZ+hJLXdJhDG4LB1np1i4fVpZtr6bDzxKKwu7ZxuJyVj3s14urB7MNSyY6M a49WpfVgemSmIUfkDG7m2LyFquxVEX7e9JdiDEQHYtrdlXYgvFVIs9K/LIn9YL8t6Yea 0FIifnC+IkWSsglIYcrucvK0LNLgbDQc8L4Kdvt3Q6CVFW5S/UPkz/sQ6u3UOxrTB/un n73A== X-Gm-Message-State: ALyK8tI/73qih287RPhpEIWYVjN+JPHZofYvtugcj7Taql/9HhtVOF2NmZ2TG1MX+1m/Lbuq X-Received: by 10.194.84.39 with SMTP id v7mr6727956wjy.74.1464862875359; Thu, 02 Jun 2016 03:21:15 -0700 (PDT) Received: from localhost.localdomain ([94.18.191.146]) by smtp.gmail.com with ESMTPSA id o129sm39552254wmb.17.2016.06.02.03.21.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Jun 2016 03:21:14 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Marc Zyngier , Christoffer Dall Subject: [PULL 4/8] KVM: arm/arm64: vgic-v3: Always resample level interrupts Date: Thu, 2 Jun 2016 12:20:56 +0200 Message-Id: <1464862860-1183-5-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.1.2.330.g565301e.dirty In-Reply-To: <1464862860-1183-1-git-send-email-christoffer.dall@linaro.org> References: <1464862860-1183-1-git-send-email-christoffer.dall@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marc Zyngier When reading back from the list registers, we need to perform two actions for level interrupts: 1) clear the soft-pending bit if the interrupt is not pending anymore *in the list register* 2) resample the line level and propagate it to the pending state But these two actions shouldn't be linked, and we should *always* resample the line level, no matter what state is in the list register. Otherwise, we may end-up injecting spurious interrupts that have been already retired. Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-v3.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c index 336a461..346b4ad 100644 --- a/virt/kvm/arm/vgic/vgic-v3.c +++ b/virt/kvm/arm/vgic/vgic-v3.c @@ -101,11 +101,15 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu) } } - /* Clear soft pending state when level irqs have been acked */ - if (irq->config == VGIC_CONFIG_LEVEL && - !(val & ICH_LR_PENDING_BIT)) { - irq->soft_pending = false; - irq->pending = irq->line_level; + /* + * Clear soft pending state when level irqs have been acked. + * Always regenerate the pending state. + */ + if (irq->config == VGIC_CONFIG_LEVEL) { + if (!(val & ICH_LR_PENDING_BIT)) + irq->soft_pending = false; + + irq->pending = irq->line_level || irq->soft_pending; } spin_unlock(&irq->irq_lock);