From patchwork Thu Jul 10 14:39:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 33432 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8052C203F4 for ; Thu, 10 Jul 2014 14:41:55 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id j17sf50498821oag.8 for ; Thu, 10 Jul 2014 07:41:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=ouDhXU4uY8ChIIqOwIMajHD9FbRL+0BXdv6lYiU16Ow=; b=lohk35muVVTvgT0i3vKjqg3zX6KFne4awQJYg2oFiw8bbY3VP3ZULdmPtfJGn1Ax7c +nxj9ERA2rQn2ij9ww1ckQG3kzxW+rc5eCrO3JiQXCDB78GWb+1izYNY+3r4d9lRn2wG f06vVppfwpDfj9iaWoezBpyZEZqXS9UB4ZTtoFmPwo1BZF999NuoKLbV1mBXnFt1NMfM hiNBMSxawd9S6b3q4lILztfsC405BQQ2x/01ri+AM4R/x4eJDGMAvkSe56+87p6VvC2g Aa04wDpGmDPUIvnxx52F0KnumL+2GJPe2tnCfzc0QoTxxSrP5Rczn2DKAKjzfjOfn4Ly VnAQ== X-Gm-Message-State: ALoCoQmmORQufetSuEQTz2TpFVXu1vkGDXWeGwIbIuJ2mByQMKeME+XDgW4UH/UqgiWfA+jGNVht X-Received: by 10.182.116.167 with SMTP id jx7mr17395010obb.10.1405003315127; Thu, 10 Jul 2014 07:41:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.17 with SMTP id z17ls84379qge.74.gmail; Thu, 10 Jul 2014 07:41:55 -0700 (PDT) X-Received: by 10.58.133.130 with SMTP id pc2mr652570veb.48.1405003315039; Thu, 10 Jul 2014 07:41:55 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id pw10si23006711vec.96.2014.07.10.07.41.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Jul 2014 07:41:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id hy10so10837508vcb.3 for ; Thu, 10 Jul 2014 07:41:55 -0700 (PDT) X-Received: by 10.58.207.84 with SMTP id lu20mr2331719vec.9.1405003314781; Thu, 10 Jul 2014 07:41:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp139198vcb; Thu, 10 Jul 2014 07:41:54 -0700 (PDT) X-Received: by 10.66.151.144 with SMTP id uq16mr48214249pab.68.1405003313981; Thu, 10 Jul 2014 07:41:53 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id cw3si48645092pbc.117.2014.07.10.07.41.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jul 2014 07:41:53 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X5FWZ-0002aW-A6; Thu, 10 Jul 2014 14:40:39 +0000 Received: from mail-lb0-f171.google.com ([209.85.217.171]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X5FWB-0001ID-P8 for linux-arm-kernel@lists.infradead.org; Thu, 10 Jul 2014 14:40:16 +0000 Received: by mail-lb0-f171.google.com with SMTP id s7so6194300lbd.2 for ; Thu, 10 Jul 2014 07:39:51 -0700 (PDT) X-Received: by 10.112.84.199 with SMTP id b7mr5661229lbz.25.1405003191656; Thu, 10 Jul 2014 07:39:51 -0700 (PDT) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id k3sm21663774lam.4.2014.07.10.07.39.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jul 2014 07:39:50 -0700 (PDT) From: Christoffer Dall To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH 6/6] arm/arm64: KVM: vgic: Clarify and correct vgic documentation Date: Thu, 10 Jul 2014 07:39:56 -0700 Message-Id: <1405003196-12403-7-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1405003196-12403-1-git-send-email-christoffer.dall@linaro.org> References: <1405003196-12403-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140710_074015_995743_9C60ECC2 X-CRM114-Status: GOOD ( 11.97 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.171 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.2 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.217.171 listed in wl.mailspike.net] Cc: Marc Zyngier , Christoffer Dall , eric.auger@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The VGIC virtual distributor implementation documentation was written a very long time ago, before the true nature of the beast had been partially absorbed into my bloodstream. Clarify the docs. Plus, it fixes an actual bug. ICFRn, pfff. Signed-off-by: Christoffer Dall Acked-by: Marc Zyngier --- virt/kvm/arm/vgic.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 2c13384..df0785c 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -36,21 +36,22 @@ * How the whole thing works (courtesy of Christoffer Dall): * * - At any time, the dist->irq_pending_on_cpu is the oracle that knows if - * something is pending - * - VGIC pending interrupts are stored on the vgic.irq_pending vgic - * bitmap (this bitmap is updated by both user land ioctls and guest - * mmio ops, and other in-kernel peripherals such as the - * arch. timers) and indicate the 'wire' state. + * something is pending on the CPU interface. + * - Interrupts that are pending on the distributor are stored on the + * vgic.irq_pending vgic bitmap (this bitmap is updated by both user land + * ioctls and guest mmio ops, and other in-kernel peripherals such as the + * arch. timers). * - Every time the bitmap changes, the irq_pending_on_cpu oracle is * recalculated * - To calculate the oracle, we need info for each cpu from * compute_pending_for_cpu, which considers: * - PPI: dist->irq_pending & dist->irq_enable * - SPI: dist->irq_pending & dist->irq_enable & dist->irq_spi_target - * - irq_spi_target is a 'formatted' version of the GICD_ICFGR + * - irq_spi_target is a 'formatted' version of the GICD_ITARGETSRn * registers, stored on each vcpu. We only keep one bit of * information per interrupt, making sure that only one vcpu can * accept the interrupt. + * - If any of the above state changes, we must recalculate the oracle. * - The same is true when injecting an interrupt, except that we only * consider a single interrupt at a time. The irq_spi_cpu array * contains the target CPU for each SPI.