From patchwork Mon Nov 13 09:17:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10055377 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 B6BE360586 for ; Mon, 13 Nov 2017 09:22:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4C5028EA4 for ; Mon, 13 Nov 2017 09:22:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A96CA291D5; Mon, 13 Nov 2017 09:22:56 +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 187AA28EA4 for ; Mon, 13 Nov 2017 09:22:56 +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=GoOL9memnZYuKDl65dlRb8rWIWKZ+yryKec5/DJdjzI=; b=Q9IPICIlThbwAh3UldpNzFFx2f YoyFsPBYIGhZKuuVHLeYMp9hQcY00PTAjY08I4aLGPEJaeC06/22dRUugaZbXq7p1sLJQNDmKsQHG ygdEG471mYYzbO528kiELyC1WVw4NbWq/ya753YeBsql9y1XTjdsKSUsSBZx1WJYCW+o/h1zmmXFa 8wD8wjbYga/yLmMBmyzUbiHJ1NyOrUnyPmA+oxUQIDaDIfSO4IzZO3m45jrCI/CHXBLmY7QD2fhHb QXJhl1xjhhoVzkUlboSz7sFiCZyaYBF8kZpAlfzoJRBtdAcW4eu1q4xYEe2fYHvWhIzFmG1sdgkmX XlKc+eEw==; 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 1eEAxD-0007Mm-3D; Mon, 13 Nov 2017 09:22:55 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eEAsp-000233-Om for linux-arm-kernel@lists.infradead.org; Mon, 13 Nov 2017 09:18:34 +0000 Received: by mail-wr0-x243.google.com with SMTP id j23so13766988wra.9 for ; Mon, 13 Nov 2017 01:18:03 -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=fE8zlhDVJe3lNgREpso3Zow9ZEBO9AGHgMslbgJSBO0=; b=P0w+c9aRW+0a3l0fEhb+OovrVULmgrks+AQB3pGVPiltnBA2zPtSOa/j4Z1epBTrRx yH85p0uqC/DGmqKtYUBMiLy7SAUeUUxUQAAIhS3fBOjWXPWrN98AORb0rHRjOAEHr/iT vPsUdnrdZAWUhtrtdO7Vh0qSq9ZOqpkhOJnIQ= 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=fE8zlhDVJe3lNgREpso3Zow9ZEBO9AGHgMslbgJSBO0=; b=Q0x1hO7+Zpf09H+jSX/ktNVVhXDPPvl74FxpvPiuwdARTgBDCIcTxd9/24MKN5ShyP ietQK1RhXj8BK2yqY8oF10IQaA14fXthPHX8Cgl9qiLLEG9lBFLOpAHeZCvbjln0ArLY L9Pdw+Ucxmz5YwnKfGWYCWHJSsIeblvlltUD5400YMIMe+pBcQ1gn35+aAxywNPO3UKH wLgIxY2QrvLZopMDuFm8VYa/FOazJhWUNogPqTkay5TPQamTimgjlqulrnMRazuSnKZs x98e9V4Cvvm0270fAKAwEfYIwjl5Ni78VNFGfMSnD1bREVP8MbYigVW9HAUZX3NWJtVr 7kmA== X-Gm-Message-State: AJaThX6Z4peMfgbyAfxfQfCLkhDZbBRGZL4y/eUzOUIFxKiwaYS9Wi8U ACuKY/F4VcFFNwrWOJTXMZn4Aw== X-Google-Smtp-Source: AGs4zMbXOD2uOcK7uNmNbrg0kGhWRJyEGD7pztKGSvjRrzoPAQzS6l0HfLATi+HZQVvs3ABO2wHeDg== X-Received: by 10.223.139.3 with SMTP id n3mr7062973wra.166.1510564682021; Mon, 13 Nov 2017 01:18:02 -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.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Nov 2017 01:18:01 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 06/27] KVM: arm/arm64: vITS: Add a helper to update the affinity of an LPI Date: Mon, 13 Nov 2017 10:17:31 +0100 Message-Id: <20171113091752.10663-7-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_011824_271177_9554F8E0 X-CRM114-Status: GOOD ( 12.60 ) 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 In order to help integrating the vITS code with GICv4, let's add a new helper that deals with updating the affinity of an LPI, which will later be augmented with super duper extra GICv4 goodness. Reviewed-by: Christoffer Dall Reviewed-by: Eric Auger Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-its.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index 1de4e68ef1b6..09accdfed189 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -336,6 +336,15 @@ static int vgic_copy_lpi_list(struct kvm_vcpu *vcpu, u32 **intid_ptr) return i; } +static int update_affinity(struct vgic_irq *irq, struct kvm_vcpu *vcpu) +{ + spin_lock(&irq->irq_lock); + irq->target_vcpu = vcpu; + spin_unlock(&irq->irq_lock); + + return 0; +} + /* * Promotes the ITS view of affinity of an ITTE (which redistributor this LPI * is targeting) to the VGIC's view, which deals with target VCPUs. @@ -350,10 +359,7 @@ static void update_affinity_ite(struct kvm *kvm, struct its_ite *ite) return; vcpu = kvm_get_vcpu(kvm, ite->collection->target_addr); - - spin_lock(&ite->irq->irq_lock); - ite->irq->target_vcpu = vcpu; - spin_unlock(&ite->irq->irq_lock); + update_affinity(ite->irq, vcpu); } /* @@ -696,11 +702,7 @@ static int vgic_its_cmd_handle_movi(struct kvm *kvm, struct vgic_its *its, ite->collection = collection; vcpu = kvm_get_vcpu(kvm, collection->target_addr); - spin_lock(&ite->irq->irq_lock); - ite->irq->target_vcpu = vcpu; - spin_unlock(&ite->irq->irq_lock); - - return 0; + return update_affinity(ite->irq, vcpu); } /*