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: 9733139 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 5A74B600CC for ; Thu, 18 May 2017 10:01:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 457DE286B6 for ; Thu, 18 May 2017 10:01:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A2CD286CA; Thu, 18 May 2017 10:01:55 +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 AD796286B6 for ; Thu, 18 May 2017 10:01:54 +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=jWw2zqQnns3rKULNoB4nBGWubKMiGS4JCQHRhVG4Cbg=; b=ikuJvxG3NXd5so+NBV4ulP9Fv3 0GID0yyucsm9uoT4aPCRC7kugmVoA+MAqFYIS9uTUe1J9mT19KmDoBw3toZSe0sd1kpDl9gIVQUTb zSjrlUDQRYz2MGPS0Y++gbUipLcp2MD070Dg7pWjhmnkDCmFCABKa6eoHEjc2lLZsIgpj27dSprYr tPbmg4TbPYLctlM+V04KDopq7nsu25B3GvzGroz/++QMQmLdTxaWzHPJjbtH4GkjDlnuCTgpiOkBd BKdlR11D5bEWbKxEvtl5+oU5l0VLZSNO6zQBmwsei0hHJWuC9SmzBPUWye2xJ222q67LPYHDvLwdV oTk+JJTQ==; 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 1dBIFj-0006wA-Gj; Thu, 18 May 2017 10:01:51 +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-0005L0-HS 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 v15so10328849wmv.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=Fbt9pdSiGbDw6d5CLjCAvo3BvsU73LUGouVYUTLpucjCcqhYkDN+uuyOd2FQa8QQAc US8bZeKCXlItuvgkPgD1V5wjJpKoto8Jc14FbFXT8FV8w3HcKTNoT0o8yZRPau1nGM6c 7FZL2KPDOSMmPdeap2+4wb/BlVQfZbbo9somDXjE4UgKG/1HyTGkk3/+dHv6hhfaC+CJ vimuvaEtg086ecXHrTTMqt+8qvpyewiYIrUpCneDqmOdlpO5IslUt7+WOj5bmeQtp571 WRcbfVaPO+7bmoSD9GuV84NLW7Bmm/R2Zc5VJEWRPBEgf/JYitIiwSXAbKKO2WcV6Bvk F5Aw== X-Gm-Message-State: AODbwcCAoQGMSxHUtpyY2DRXgb+qAOBDW77CIVUuRemJaVLXo3gNlIN8 uZLe5jSqZRZgcAEU 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?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170518_024802_924753_C08F61D2 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: 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(+) 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;