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: 9733097 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 C77AD601A1 for ; Thu, 18 May 2017 09:50:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B21FD285F7 for ; Thu, 18 May 2017 09:50:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A526E2860A; Thu, 18 May 2017 09:50:33 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 36460285F7 for ; Thu, 18 May 2017 09:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=pLIRaVIezCxEEhTsbZPNAVx/3BiD48E3yeQXoPqbT5w=; b=mX6mdIIHteDKF/tx0pPxVUlhhE rw/YkD9IkVqh7U64vfolU9md6OLLJZwJ6I2H57hxBnW5jeexHNexT/pJi6z+dDfj6fo8VYYmjgfE+ gon2gD+RJvASevSgm0bUuHTfs0mYoqbuk+m4kiLsY2DO/llztaeHriqmjAZql8cGXGHOlwkv+LrFl xth4Ny8XESPqQFWPyZSLbhaHQ5XB5b61POUM4X9sdHCIY1m27B9ghAtkii+MXtwNEwCorysrOmL/3 aclZH8LRs8DetbT1K4vXakilmd5e9ZYdjTgoBlafCUci3tWd9vcdNvp/yCLQ7+PTx45GFHH7DT2FS A0Q15qCg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dBI4l-0000We-L9; Thu, 18 May 2017 09:50:31 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dBI2M-0005Kn-Hc for linux-arm-kernel@lists.infradead.org; Thu, 18 May 2017 09:48:05 +0000 Received: by mail-wm0-x230.google.com with SMTP id d127so45807982wmf.0 for ; Thu, 18 May 2017 02:47:42 -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=YCSZI4ZaE655xnnCraFSQ/+pFswG3IdaeeoMS5nTHQRRSc1eIMr3YzlNpgVEegoLib QSHQJCqHB5YHsFkAJJSfjEe4VEYnH4mz3HpP1p1cKD8Vl1gC2w4+aA3kxkLkex0iHrrZ i6geN5QrZLgqHmsx89ghpMMcfKCXVvkK5e2DSy/zRrERXV9cqXKVpyeNSdC9erX6OMTQ ZQW9ItAWk7eVH9mwtkMe8zHxGiOT6u833KU3CQ+SN2TeffGRG2eKkx5xkCmhsbAolU+d ED7pf0wFl/wdI/roHrUfZq4GZ1y43F8qrsr4zzgxB1+Ph3wAb2OGSlJ7/H4ychDDC2mQ Nm5g== X-Gm-Message-State: AODbwcDk9QEGv+sbMmgddpmeXJ9a/7MO4TUPlpbGgkgwQfu87ZMdIVNC owAJj6y+CvK0grYj 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?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170518_024802_914596_465572DE X-CRM114-Status: GOOD ( 11.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christoffer Dall , kvm@vger.kernel.org, Marc Zyngier , stable@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;