From patchwork Thu May 18 09:47:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9733061 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 25E75601A1 for ; Thu, 18 May 2017 09:47:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 111062878C for ; Thu, 18 May 2017 09:47:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05CA5287B7; Thu, 18 May 2017 09:47:51 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 A642A2860F for ; Thu, 18 May 2017 09:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755300AbdERJrs (ORCPT ); Thu, 18 May 2017 05:47:48 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:34854 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751486AbdERJrm (ORCPT ); Thu, 18 May 2017 05:47:42 -0400 Received: by mail-wm0-f47.google.com with SMTP id b84so195117861wmh.0 for ; Thu, 18 May 2017 02:47:41 -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=+l2eDeYQRBSHmiv6JZQRzqPo5IYD0EKoP4jYyMv0IGw=; b=S186RXDBBpbdEVDZK47FZ6qRCyhOHFUnjbGoHYvaJJQuwJbMIBwHzVLqV36g435+wX luE5dAAqicz4PTLdZ6c5MTPkr/UkGyhXgnjnFVsO3l3HUoXt61+Apjf04XGjmvu6suXl FbFMZOTGFQ4rQeOsfPwOapCdXrO+xP5iMFTPw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+l2eDeYQRBSHmiv6JZQRzqPo5IYD0EKoP4jYyMv0IGw=; b=GO+n8i7Xr+wLoaS6toledQKj5TNln/6X3M/+mtqKn3VByEAH1akBWMON614BSvm26X bzr1YBfdy0GleQ839z7DLiTzmdTsvVWJF1/Zlcnxf8njHE/RuQtAEpZdFKeh8nBKkB0G fRhmCcPMDvuBxQpP6hHLgbrJ1gb0ZKwkhmMszkT64kOv3AMnza0XNwjuhMMKUKZTZa3b 862/KajeJTCI7LvPVBktJYah59TrB7x3xdJ5LKuJS/+bfPXOF0yTzoJFUAoMvo7oVwrt lqs49DskUGtliA0bYJKG3neLcTj17AcR3mt9njfpi67Uof9FLptSfnOEDyY5TBnrmz6d FwTA== X-Gm-Message-State: AODbwcBwoZflT/OfPYCOqdQ87rLCajwulCcfU8Cejv4dp4O1rcgOmh5X WSu77uYoI5l4AWmD X-Received: by 10.80.184.226 with SMTP id l89mr2571517ede.137.1495100860808; Thu, 18 May 2017 02:47:40 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id w15sm2377437edw.27.2017.05.18.02.47.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 May 2017 02:47:40 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org, Christoffer Dall Subject: [PULL 04/13] KVM: arm/arm64: vgic-v2: Do not use Active+Pending state for a HW interrupt Date: Thu, 18 May 2017 11:47:13 +0200 Message-Id: <20170518094722.9926-5-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170518094722.9926-1-cdall@linaro.org> References: <20170518094722.9926-1-cdall@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 an interrupt is injected with the HW bit set (indicating that deactivation should be propagated to the physical distributor), special care must be taken so that we never mark the corresponding LR with the Active+Pending state (as the pending state is kept in the physycal distributor). Cc: stable@vger.kernel.org Fixes: 140b086dd197 ("KVM: arm/arm64: vgic-new: Add GICv2 world switch backend") Signed-off-by: Marc Zyngier Reviewed-by: Christoffer Dall Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-v2.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c index a65757a..504b4bd 100644 --- a/virt/kvm/arm/vgic/vgic-v2.c +++ b/virt/kvm/arm/vgic/vgic-v2.c @@ -149,6 +149,13 @@ void vgic_v2_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr) if (irq->hw) { val |= GICH_LR_HW; val |= irq->hwintid << GICH_LR_PHYSID_CPUID_SHIFT; + /* + * Never set pending+active on a HW interrupt, as the + * pending state is kept at the physical distributor + * level. + */ + if (irq->active && irq_is_pending(irq)) + val &= ~GICH_LR_PENDING_BIT; } else { if (irq->config == VGIC_CONFIG_LEVEL) val |= GICH_LR_EOI;