From patchwork Thu May 18 09:47:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 100073 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp634425qge; Thu, 18 May 2017 02:47:50 -0700 (PDT) X-Received: by 10.99.96.70 with SMTP id u67mr3565233pgb.101.1495100870497; Thu, 18 May 2017 02:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495100870; cv=none; d=google.com; s=arc-20160816; b=k4X0EgUW4wNXH4oTj0H9ZSP+1zpMLT0SaxPkiwNId9OpNPJuIkJ12WO5r3Y2hgc3K4 9gBIwWfqtGO1V4VA/T4EDTYCE0Uli6NgamWt2AprkqVF8EsnIofqb+R3XeskUBQotgyL Hrcl+yzrseKNVRcRCUPrGIPqdBWLhvNtHJIZwaDo6oOJoNoVt6V8Gu5wRMJI1YpDqWnS SuyhvnTh24DauGiPVsd+pWAcgPyUddJj/BdHgEca+FSDjxOOEfiJvPr81lpMTb4lSLH3 Mk0XASdEGutS1Wda19WRwbsn6g/bIF3AZ+2CY1y8tIe4BR8r3LPBr2sVUAroJPJO3Dby u2ag== 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=LcR5X+/y65yXGW3Z3jUfDsouRSLk6Wp0VA+ixUPV3zY=; b=OPDUVcoJ81l03EEINoAV0DArGzGtcB9yq6zceDlNpY6AlMwZPiVP7P5TS9S5BxeEIm Ba+d7A6Q/L0RYx8FcySSrLy23grLgnyL5jUkViIaPgslRzdRvC6jrn+5zNaZamBq2vN5 2rq9YB58W8QGl8nzI2fImpYQopdVBgLCcacRwqXKKB0xatbr7Pkmy1NzKkKyM51xrNXA 7dfNWU7AISCsfg6E78QpJt3WoQcg3KvQUp/aLt2Xbod6QXbne6vM7amMUpFe2s+q2/IC IBFX251CWtKHsqIbzD0e06vL3w9L1ayFLm9Rjc87OClK2vhmy9cfGA1XFcDcWzv+wYTT dkHw== 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.50; Thu, 18 May 2017 02:47:50 -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 S1755298AbdERJrr (ORCPT + 6 others); Thu, 18 May 2017 05:47:47 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:34878 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753743AbdERJrn (ORCPT ); Thu, 18 May 2017 05:47:43 -0400 Received: by mail-wm0-f47.google.com with SMTP id b84so195118414wmh.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=LcR5X+/y65yXGW3Z3jUfDsouRSLk6Wp0VA+ixUPV3zY=; b=ktXwPtSbNtZYQiuRWXqLgCufO+PmpGZsDUDQ92He3VxHWEdoT2EGm8QsOAbWqsdPsH Fbo+U/QkBe4ZuGF+eYW0GGiPa2u6DAJXZ86YSQCeLCFOdtaN5HP8Yqmo9v39l8LXgM0Q RhYVlCjOrOIVLsyUlBsTGW2PXEalmNIq+F9bk= 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=LcR5X+/y65yXGW3Z3jUfDsouRSLk6Wp0VA+ixUPV3zY=; b=jgqXC7l6wbhdpg2lhH9mknjAnH1O46/7JyIt8Y6QB2/Pihbt+qnb97VN/q+DXLAi1n iJmSfQvkBPEdReGUT+V9C3brTI5TlK/ys9a5PFqoFpb8Tbgfp/yD6KxOH3MkuAZXX994 LU9YCM2ZoRIOBHbbBH3XsYLOiwEZs7uy2y4VsyGxmuWoiaBL394W3BO8siNFGkI3DdQN SnJvZN/idqFoI0TAROfaKlEeD1PZIpJd+MLKZ/1DAk/981mWp5zYQiwoO05mpoQ4LCe1 kFTfukjBRyXv27bQIOu9KPrMeJEVnNx77tcATPJ0kZnAySchuJ97dVsYtRSb6GNhnzMm gsAw== X-Gm-Message-State: AODbwcBKaMk7QhLJsOl36DXc2e1mYNW0AesxknZvZHttlY4g+GWSDP2I h4DbsPbLeTkzgvjP X-Received: by 10.80.175.34 with SMTP id g31mr2588010edd.24.1495100861743; Thu, 18 May 2017 02:47:41 -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.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 May 2017 02:47:41 -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 05/13] KVM: arm/arm64: vgic-v3: Do not use Active+Pending state for a HW interrupt Date: Thu, 18 May 2017 11:47:14 +0200 Message-Id: <20170518094722.9926-6-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: 59529f69f504 ("KVM: arm/arm64: vgic-new: Add GICv3 world switch backend") Signed-off-by: Marc Zyngier Reviewed-by: Christoffer Dall Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-v3.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.9.0 diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c index 8fa737e..6fe3f00 100644 --- a/virt/kvm/arm/vgic/vgic-v3.c +++ b/virt/kvm/arm/vgic/vgic-v3.c @@ -127,6 +127,13 @@ void vgic_v3_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr) if (irq->hw) { val |= ICH_LR_HW; val |= ((u64)irq->hwintid) << ICH_LR_PHYS_ID_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 &= ~ICH_LR_PENDING_BIT; } else { if (irq->config == VGIC_CONFIG_LEVEL) val |= ICH_LR_EOI;