From patchwork Mon Nov 13 09:17:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10055411 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 B3E0B60586 for ; Mon, 13 Nov 2017 09:30:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99F2028418 for ; Mon, 13 Nov 2017 09:30:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E0E7292B2; Mon, 13 Nov 2017 09:30:03 +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=unavailable 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 1307728418 for ; Mon, 13 Nov 2017 09:30:03 +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=I3qilY73KXrykmrrwv28ohZvxy8b7lOE09Au+ci7pXw=; b=q/xNyWn6wDK10lno6zmeNQiz9v dYwrY1VthW1OYD/oehcLz/k83cOF5kby6RQHTnV9LUKJvkYR90rXH1iWfS5WCLkWaQm144sZzusF8 VEQH7FNGHnm3emq1Jh5QTm0YPf4ofhjRCpgnAbQ4GEFclPzCRciIguFcJWBQkwz22PZg1r3Lqbbpk 00tEueQpz6kFqPrx8G82+j4YUCO0pFKmOGZQK0IjG52YF/gz8jlgbvMA5Fs5Uk4DCPdCfDrLKwJZ0 +nACWCgAQ457gjCIZ7WzoD8JKygU96sspVqHOF9vrRQ4gBERME2olHzjfppAdLlh/6p7bBc6S7jmd +DBRjHoQ==; 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 1eEB46-0005xf-F8; Mon, 13 Nov 2017 09:30:02 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eEAtB-0002eu-7W for linux-arm-kernel@bombadil.infradead.org; Mon, 13 Nov 2017 09:18:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PE5qhv+fZLBZ4Af/gHogvtPZ0qvUqAvSrTxv7tVDE6s=; b=xnaI6FHzMsskXS+TuYv60hVgi 6fl//dIFTmer1WHGt3FlzjBgCHZPdm3qI5S2pX21ob4Bpl1WoCsXUZCnhhQt2rLFTsmMp0nB0VzRK eQNQRXY9lOWaHmH040m7K2uvEz35tqsMmyIyINbdWOqpF8GFPzBdehWKmD8wADk8RECTBYE1tpxU6 L+kLsoDKSDR3Ydnic01dzgDheTRHCLxzdae7rIRmYfhVLZvR/zjB0WfwAAceNy5j9gQ1v2vf3vHNs LJPNQFEtFjaxou4fHsVuUbpHBwm3Yt6TRP4ARxrGlbcfFChisyTvJEKyrCl7W5PEvGzl13wmVMSvG 22I7k2W1Q==; Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eEAt7-0005WG-PU for linux-arm-kernel@lists.infradead.org; Mon, 13 Nov 2017 09:18:43 +0000 Received: by mail-wm0-x242.google.com with SMTP id 9so8086677wme.4 for ; Mon, 13 Nov 2017 01:18:18 -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=PE5qhv+fZLBZ4Af/gHogvtPZ0qvUqAvSrTxv7tVDE6s=; b=fm7DCKhDIP9KVuTnsKKRm4xr2ELN9Hg9LrnM3Ls1r15jMCWhHLdmaC6hBT+vZHLwKl JgJjw/TBVHjmSJfcbdiaF6BF+VA+LyJP4wdgY6h5rnhb5dZ8rKR5SWNKBHze6/+iaE4T BnZf1sDYjZx2meskWifcIo0lBkUxEtmMkRQg8= 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=PE5qhv+fZLBZ4Af/gHogvtPZ0qvUqAvSrTxv7tVDE6s=; b=Kuh/stpenwIAzd86AuAHn7rgDyfowin8a1qRH1lCJR6nkb78OHtInNZ2JP7xUtQkL1 k0rWO5lwNYc79IR/8kOI2IBtaVh0PeibUE4sN9d69mahrGw/7hc+0zlNWCHFYDIadL5Y FFN1VriqzKEQG1CLVvBO3SVNN0/34drurMtePsUMcF/ZC1GiVHkMj5CI4Z/8yEFAFfg/ s1AetX52opdT+0oE9DCq7ev6/HtZj2EPAWU8ARFS0wl0W15BFqpKQoG7JJVZsMLL5Ocx xKllUUnbWcqL6qgm15ZroLJGIrAkc4Zj4PRF0RR8aE/fYv/3Xjj1w8zKm5YAHv+/v9Pr eJGg== X-Gm-Message-State: AJaThX5GSvf3FikvAPoQgBeLTVH4Tu/09NMNSJOUwa60bXhjfqFLvKeP eDvI1vxKeHpuQSDvAJPiFDnYtg== X-Google-Smtp-Source: AGs4zMbkYp/SWi0GHrl6c09yfuihx4eu0GQSeqcCpazalNSp71lIiX+4SapLw59e/ErhMP2P291hFg== X-Received: by 10.28.110.14 with SMTP id j14mr5673604wmc.46.1510564697099; Mon, 13 Nov 2017 01:18:17 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Nov 2017 01:18:16 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 16/27] KVM: arm/arm64: GICv4: Handle INVALL applied to a vPE Date: Mon, 13 Nov 2017 10:17:41 +0100 Message-Id: <20171113091752.10663-17-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-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 There is no need to perform an INV for each interrupt when updating multiple interrupts. Instead, we can rely on the final VINVALL that gets sent to the ITS to do the work for all of them. Acked-by: Christoffer Dall Reviewed-by: Eric Auger Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-its.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index 4768a0e21cc5..bf571f6d2b32 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -38,7 +38,7 @@ static int vgic_its_save_tables_v0(struct vgic_its *its); static int vgic_its_restore_tables_v0(struct vgic_its *its); static int vgic_its_commit_v0(struct vgic_its *its); static int update_lpi_config(struct kvm *kvm, struct vgic_irq *irq, - struct kvm_vcpu *filter_vcpu); + struct kvm_vcpu *filter_vcpu, bool needs_inv); /* * Creates a new (reference to a) struct vgic_irq for a given LPI. @@ -106,7 +106,7 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid, * However we only have those structs for mapped IRQs, so we read in * the respective config data from memory here upon mapping the LPI. */ - ret = update_lpi_config(kvm, irq, NULL); + ret = update_lpi_config(kvm, irq, NULL, false); if (ret) return ERR_PTR(ret); @@ -273,7 +273,7 @@ static struct its_collection *find_collection(struct vgic_its *its, int coll_id) * VCPU. Unconditionally applies if filter_vcpu is NULL. */ static int update_lpi_config(struct kvm *kvm, struct vgic_irq *irq, - struct kvm_vcpu *filter_vcpu) + struct kvm_vcpu *filter_vcpu, bool needs_inv) { u64 propbase = GICR_PROPBASER_ADDRESS(kvm->arch.vgic.propbaser); u8 prop; @@ -298,7 +298,7 @@ static int update_lpi_config(struct kvm *kvm, struct vgic_irq *irq, } if (irq->hw) - return its_prop_update_vlpi(irq->host_irq, prop, true); + return its_prop_update_vlpi(irq->host_irq, prop, needs_inv); return 0; } @@ -1117,7 +1117,7 @@ static int vgic_its_cmd_handle_inv(struct kvm *kvm, struct vgic_its *its, if (!ite) return E_ITS_INV_UNMAPPED_INTERRUPT; - return update_lpi_config(kvm, ite->irq, NULL); + return update_lpi_config(kvm, ite->irq, NULL, true); } /* @@ -1152,12 +1152,15 @@ static int vgic_its_cmd_handle_invall(struct kvm *kvm, struct vgic_its *its, irq = vgic_get_irq(kvm, NULL, intids[i]); if (!irq) continue; - update_lpi_config(kvm, irq, vcpu); + update_lpi_config(kvm, irq, vcpu, false); vgic_put_irq(kvm, irq); } kfree(intids); + if (vcpu->arch.vgic_cpu.vgic_v3.its_vpe.its_vm) + its_invall_vpe(&vcpu->arch.vgic_cpu.vgic_v3.its_vpe); + return 0; }