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: 100074 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp634442qge; Thu, 18 May 2017 02:47:52 -0700 (PDT) X-Received: by 10.99.173.12 with SMTP id g12mr3364650pgf.225.1495100872710; Thu, 18 May 2017 02:47:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495100872; cv=none; d=google.com; s=arc-20160816; b=imXmHgp5G9We+hjYbgNtQDve6gLqCaGtqI+xlor9JYg9C/WYjBdoj98dUWIoalUHCK RW4KHIml6FWNxe+gVqaZsEcGKpPYZXJ5yEw6hLtSh7X5xRU8Wn1diiA4CJntRj4uFMGA 6jp+H0R65VkMP0+4MqVlEYxpKmHiovf/YJevs9FXe2lPXlkbLhCM6K5R63Q7nNNNRteX GmAwkZ5NS9I5UamO4hQbm61AGnFnuEXIo5Y7RY/oM5K4OIaUAo4/E0Z5Lb2EI1Mek0oM UWgd6gQb4MfBxg1dz+6pKcQOY0K7kpq0cGb7WRql3WkvXkqj7TRcX03aiijKt5P/kdUG GyRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=+l2eDeYQRBSHmiv6JZQRzqPo5IYD0EKoP4jYyMv0IGw=; b=SibJC2aDcAAG3bQmXIYoVI+5p75UPgu6AP956fJVeWB29eT+g+f/fpOhzs6m2AywTR ne9FcvUQ6P7jTh3eyam/Hq3c7h90M7DJkMrhIuEee5w7JlA9mtNscSsNHSGKvovvufnk Slwk/y1DZEdQpDPX7Wd0cnZMSOXL7E5B+C+ouQSP8hK5sppqJV+MQL8Pk3MPKsnMkhsV LMp8lIW/vpiR8rPj30XlAiKcxVbJl2wV7IMtFaHFhPspK88snkYUNhKVmCPTQiZgTKMn uDUlcRczf/2Q75np16hvPL+kjJxWbWGU4wjZZq/CwbRda3cdn1saXbVNA4KJ+5i+YEO2 AdtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i35si4751361plg.102.2017.05.18.02.47.52; Thu, 18 May 2017 02:47:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755160AbdERJru (ORCPT + 6 others); Thu, 18 May 2017 05:47:50 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:35926 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754890AbdERJrm (ORCPT ); Thu, 18 May 2017 05:47:42 -0400 Received: by mail-wm0-f47.google.com with SMTP id 70so40077465wmq.1 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=CguOdjyuGWRr1wmbcqUi+jr/Glq/DDSQ8JON90VMOA4TJvTVaiDeX61umih8HKk1UO Sp5xZsN9c1oCrQyXja5hJnKjEf6bsAdaPYv+grJwjJAQibiLell1Qfo+ZtxKUXwVlA7P vhIkHxuEJslTpmTb+kLBgbpBveJOxZnx98g1tULeSO2/A5WNM3U0CPJMdZ3y8+Icvpou 8f/fvMq6tjPSVxVTIREiU7LnmCzrMGsR5qLF/2uUoguJMk+9/yJ71AbL4VIA2OWJCWhF kKUhjf8+8gW3V59+pUJKv2KjzbkJZynU/3MQvcmleyx+JV5RV5RbEDgShb7CWWT4jjTd 0VRQ== X-Gm-Message-State: AODbwcBdGIUSV+KGP6BeFuCqG0XRL9mR4HxOKENNXO33rhfmriYY/V1W 2G+20/AZYRZN0QX0 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?b?UmFkaW0gS3LEjW3DocWZ?= 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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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(+) -- 2.9.0 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;