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: 10055397 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 6367660586 for ; Mon, 13 Nov 2017 09:27:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 534EE29333 for ; Mon, 13 Nov 2017 09:27:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4834B2933C; Mon, 13 Nov 2017 09:27:07 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED 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 D792129333 for ; Mon, 13 Nov 2017 09:27:06 +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=M3j7qxDxJ3i3tDE3hCyeTKfLysaARaYXQfdeSLAtdHs=; b=Mj8ugBPdnaXlsR2Q/BZ2qFbMEl 2sGCRpXicftVMbEev+7v5ESqlS25P7iURi8hDyNF1GyyO7mhlhuxdP96Eyqsyhhc8W7PM5OxXNfLF 04g+9utNac074gprEllrXvOAbi8oVhFSlLRaYE3h1wAKS/NF91P9A21ca7CHybere5rlTfATT+32P 6Yfl64B6MaXjH+mZNXdiMuZjcn4I8l4d/eoXFsguXgFxA/p+7hJ56u+I9Zawj113JFxYH9Ev9Lovm aJktOx9GojxB9qGs/RQmHh+4e2MPojVAZxLp1/CCaHDUuG4MMvAJURgwlg3LtA2RMYnee+e74E6HQ A76HazzQ==; 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 1eEB1G-0003Tx-89; Mon, 13 Nov 2017 09:27:06 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eEAsv-00027a-Mk for linux-arm-kernel@lists.infradead.org; Mon, 13 Nov 2017 09:18:41 +0000 Received: by mail-wr0-x241.google.com with SMTP id l8so13754997wre.12 for ; Mon, 13 Nov 2017 01:18:12 -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=is0gTjQB/jfUR9ZKHK80zUbAtZxrPJehhMQ29WS2fVeYNJy8UAyVYB/7oULsyF5cp9 SPIMA0r7UZWuvgtBQU8eLt9+SmQzo2Xhn0z/F6edFg/RqwdVK6zxV9pK3cgQHYVo8HLl D6lxXimApW1ICrkUeVWenGkttukHXOLuJc2sLp0BGx0W+lyCneSDBlyXTZwmzpd1k1y9 pxxAPvUHnFYwu/hcuD2sL6ACdcWOBCcSRYRfZrvbJ4dPb6E2eTHZkOWcxDZttfW1Iz8u NuEjpWfVzXIakwdjo5ZM/4d705Hk8dmCehv/C86KYQO3ufn2lIdB/6h4czc2YA5Z26LR G1vQ== X-Gm-Message-State: AJaThX7EOuo81tV4nSaxQsg9RRGtKf1hXEilJ/Po/UUITB01mvmANAw4 FiWBr1RcLnRzYwJTsoyAkyoW/A== 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?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171113_011830_323740_6D423D1B X-CRM114-Status: GOOD ( 13.24 ) 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: Marc Zyngier , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.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 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; } /*