From patchwork Thu Nov 19 14:54:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 7658131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B52D59F2EC for ; Thu, 19 Nov 2015 15:01:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB9F020699 for ; Thu, 19 Nov 2015 15:01:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 824DA20654 for ; Thu, 19 Nov 2015 15:01:12 +0000 (UTC) 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 1ZzQgD-0006tY-Bn; Thu, 19 Nov 2015 14:59:21 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZzQbq-0001QS-R5 for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2015 14:54:56 +0000 Received: by wmww144 with SMTP id w144so119958036wmw.0 for ; Thu, 19 Nov 2015 06:54:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ezqz8l7IGUP9cpGuSc55Luc9ehhyYR+qEtGB8L2vzXE=; b=bHo5VDtt1yu2sEtGqiz4gi9gwEQthA+IDJtiw0yN1mhFQQDz9VW4VuEFhH6RIwFVIr N284z8IpS/1AcSOthGKszO8A1qW0GVcm1PZh5n/S/90ntE7Oi1p09z+L2bk7+lt7UGBY TSdgjxcCnpDt1o6M6dgnpAqoZH/KuxLPrMbepK5Ppdaxz8qLSaA/Asb6lE+ARjFcxngT L/1XSYf9w8IvdVkgW/LXtB1ZHwadVqpOd+ec0gsggdS1jrQaWQmethBbSqAGWXzvpmvF R1wi1L6e4Man2tsYho9g+NldPB8KtsLLvjWY1Ue9BkEwZwi8h/ke2FLAZA5z0XNQyNVB uYiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ezqz8l7IGUP9cpGuSc55Luc9ehhyYR+qEtGB8L2vzXE=; b=TpTf5MdI0Bq5Vad4JYvwON9tYjhTRZfTnNqgI/n4+VV7nU0BhyWxr5MrHOFcUw1HHs zumIeJ/qkr0X19V2EHk+KbMbLtEG7xMrljz42C+Whqm+kaQoxaUJ7teI2ZNZ4Fer2Hdm o4cKtIxVbcYda8wq+yhFAXvfPT7hSqWzkh+32jOb/JIXG7qriM+gz5ux8lDg4C8MOYSR UY9XcWCtHP7KJiwg5MCoSRMWlcaQGx1cfxAMQipbnFzkXHpMCyJHEx4Q+uVZtdrk25Bg 0CZkQkhRpXP4ZdofxcAzcc44WNVAZ/n097UZI0vK9W2wMi4FpgBK4Tc0D8rQS3PlFbLl IU3Q== X-Gm-Message-State: ALoCoQkzdGTOGUT3VkCrAnTG4lw6/sAJWUMjv+GAqgCv+33ck7nn2hAIz8Q6tLUcB1qENuyNblhr X-Received: by 10.28.142.205 with SMTP id q196mr17341802wmd.42.1447944869228; Thu, 19 Nov 2015 06:54:29 -0800 (PST) Received: from new-host-3.home (LMontsouris-657-1-37-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by smtp.gmail.com with ESMTPSA id h67sm34493865wmf.17.2015.11.19.06.54.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Nov 2015 06:54:28 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, alex.williamson@redhat.com, b.reynal@virtualopensystems.com, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Subject: [PATCH v4 11/13] KVM: arm/arm64: vgic: implement clear active for non shared mapped IRQ Date: Thu, 19 Nov 2015 14:54:01 +0000 Message-Id: <1447944843-17731-12-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447944843-17731-1-git-send-email-eric.auger@linaro.org> References: <1447944843-17731-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151119_065451_337267_AAE76076 X-CRM114-Status: GOOD ( 13.79 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andre.przywara@arm.com, linux-kernel@vger.kernel.org, patches@linaro.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-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When disabling a non shared mapped IRQs, we must manually deactivate the corresponding physical IRQ on top of removing the active state from the distributor. Signed-off-by: Eric Auger --- virt/kvm/arm/vgic.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index bd500b4..98ae15f 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -604,14 +604,34 @@ bool vgic_handle_clear_active_reg(struct kvm *kvm, struct kvm_exit_mmio *mmio, phys_addr_t offset, int vcpu_id) { - u32 *reg; + u32 *reg, orig, cleared; struct vgic_dist *dist = &kvm->arch.vgic; + struct kvm_vcpu *vcpu = kvm_get_vcpu(kvm, vcpu_id); + unsigned int i; reg = vgic_bitmap_get_reg(&dist->irq_active, vcpu_id, offset); + orig = *reg; vgic_reg_access(mmio, reg, offset, ACCESS_READ_VALUE | ACCESS_WRITE_CLEARBIT); if (mmio->is_write) { + cleared = orig ^ *reg; + + for (i = 0; i < 32; i++) { + struct irq_phys_map *map; + unsigned int irq_num; + + if (!(cleared && (1 << i))) + continue; + irq_num = (offset * 8) + i; + map = vgic_irq_map_search(vcpu, irq_num); + if (!map || (map && map->shared)) + continue; + irq_set_irqchip_state(map->irq, + IRQCHIP_STATE_ACTIVE, + false); + } + vgic_update_state(kvm); return true; }