From patchwork Mon Nov 13 09:17:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10055315 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 03BAF60586 for ; Mon, 13 Nov 2017 09:18:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07620291B9 for ; Mon, 13 Nov 2017 09:18:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0683291D6; Mon, 13 Nov 2017 09:18:18 +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 96CF3291B9 for ; Mon, 13 Nov 2017 09:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752358AbdKMJSP (ORCPT ); Mon, 13 Nov 2017 04:18:15 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:50662 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752237AbdKMJSM (ORCPT ); Mon, 13 Nov 2017 04:18:12 -0500 Received: by mail-wr0-f193.google.com with SMTP id p96so13755423wrb.7 for ; Mon, 13 Nov 2017 01:18:11 -0800 (PST) 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=mpL61XALx/f+Z4yghBc6s4F2PhCiXooI7m0GPbVsdYw=; b=LQVWQgSKW5Yvb1KdG+oYsk75HN5BLet1DHu/7q/epsg9eKb1o6B20DnmR02Lnf+c+e Dy0jYJoGKjHbPD6SCMkEV7QjU8mjj8KJBlqPC2OGXbOAseUoxuhGPZ3nWrMvRmcX09gL Rppjbww6/3qiv8n5s2lEN82TUaeZG8KN32xrg= 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=mpL61XALx/f+Z4yghBc6s4F2PhCiXooI7m0GPbVsdYw=; b=BDcNhKRw95QG3nfbMDrAwd8jtQ1rSEYsYxfqk/AbM/9uN+v6l77wGeST8MJlMjyOra Dgn97WXipCZKDArDCRGIfhAhfISAptX9NNn+bx1ghgpW1QgjXjqwuUWbRhWpLIQbmB6/ mX+o1qMFIRKtknIn/TMp3TC4szo7p5xEoxB8v+hM60j5C/gJU4/yaPtQu/qdjESsCYXI pkbTtQ4Pmi9UdBMMzzWgDuSeawFAeNgTN+9VE0DtfPuGdWULDSxtxlj7ywkAb6OZdkCV HZENarsBD5bnKyZeSOfD/BkGFeynuKz8KnEofMkuIRCck4Zijdy+40gE9VuKF6sieVmM VAHg== X-Gm-Message-State: AJaThX6/PZe5Z31Tw/Im06MkppRn2tx0BaQzxGhTNJSSQz8WRu2BiQ/V cq+PhoErjy9D49Hes8tnEuX7CQ== X-Google-Smtp-Source: AGs4zMas3MBD4rLA5uruaCMesCIAde0qF3r9kN2bmdOYO1KRxLnCW1HY7jvM990GbEgi8fgqGCN8oQ== X-Received: by 10.223.130.56 with SMTP id 53mr3615017wrb.131.1510564690966; Mon, 13 Nov 2017 01:18:10 -0800 (PST) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id x63sm9651399wma.39.2017.11.13.01.18.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Nov 2017 01:18:10 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Christoffer Dall Subject: [PULL 12/27] KVM: arm/arm64: GICv4: Propagate affinity changes to the physical ITS Date: Mon, 13 Nov 2017 10:17:37 +0100 Message-Id: <20171113091752.10663-13-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171113091752.10663-1-christoffer.dall@linaro.org> References: <20171113091752.10663-1-christoffer.dall@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 the guest issues an affinity change, we need to tell the physical ITS that we're now targetting a new vcpu. This is done by extracting the current mapping, updating the target, and reapplying the mapping. Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-its.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index ad14af8a4412..80bea7021e2e 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -338,11 +338,25 @@ static int vgic_copy_lpi_list(struct kvm_vcpu *vcpu, u32 **intid_ptr) static int update_affinity(struct vgic_irq *irq, struct kvm_vcpu *vcpu) { + int ret = 0; + spin_lock(&irq->irq_lock); irq->target_vcpu = vcpu; spin_unlock(&irq->irq_lock); - return 0; + if (irq->hw) { + struct its_vlpi_map map; + + ret = its_get_vlpi(irq->host_irq, &map); + if (ret) + return ret; + + map.vpe = &vcpu->arch.vgic_cpu.vgic_v3.its_vpe; + + ret = its_map_vlpi(irq->host_irq, &map); + } + + return ret; } /*