Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7495180ybl; Tue, 24 Dec 2019 03:41:08 -0800 (PST) X-Google-Smtp-Source: APXvYqyixYMAtJ+rRERnIoDexUd+inmAarz6enR+nYyw2MpP9hb187MA6QxuoCEc/1V5mTEXElu+ X-Received: by 2002:a05:6830:14d9:: with SMTP id t25mr28608219otq.258.1577187668383; Tue, 24 Dec 2019 03:41:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577187668; cv=none; d=google.com; s=arc-20160816; b=EiJ7LfggDVQ6dgDjGGNUXsfenxnQJFHO1q7mTtRvwwhyRClhkvvs8Gcqy220JsRCoU zXR7kHr2ZThSqsf9XhrfLbTQKSvuJ2oz0RWn1Z5y7i2oYUGafiuZ+yNfUAIiNj1YJ6Gc IGsPhrFbPNqs6C34WNqY5e3nonTX7ZvGvyZQgez2SgvhXpJmmS9wrikuOb824oeryKxB Q1r9OOmT2WoXEkF2UPL5fVKniwFA8WiXrNzzUw0mWSeFpcWx0o5KK599EbidRwL5/pgz kr2501CRCXGZvW5uty4P4grMcASgpcQ7ip5L5Mt7jKS+cIjolpk9Rf46g1it2XOO0a4Y 0hmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=wzsXlfEhccNJFr0XOwjtNZTXnpR/uQ2tfrFZdWT1pjs=; b=rMAA/f0JyXUSHUiRW84W8cmy/Z1GU5PNb86nzsYZQFDA3QRZ1vVuyZW1wYl4g6FmF6 F0CAuGDv7pGAZldxstGEc9PHpPnXmw3gd5LNEd/2u3v+8gat2M/1FUxxccqJ0EyQ6/cv Z0//kgnkprYdJLupdhee8ESiUf3t9lcDdkMqOoQUL8dSXDAoK7BLdZLdXQEHMmAbMeMJ QV9FD0YtfxoCFRyhcMPDOkTY0/Wj/1M7/bfaYz15zmhd8SnYH/8EIc86QBF/DhfFxZCh LvOa+7a7+CCQTeV1HSV0kIwBOikcQeNkXUuzqZiDgCO1tOKQqrSREod2pgKmfDJpc0JM x5Sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16si10969737oih.154.2019.12.24.03.40.55; Tue, 24 Dec 2019 03:41:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726195AbfLXLj4 (ORCPT + 99 others); Tue, 24 Dec 2019 06:39:56 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:40549 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbfLXLj4 (ORCPT ); Tue, 24 Dec 2019 06:39:56 -0500 Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.lan) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:DHE-RSA-AES128-GCM-SHA256:128) (Exim 4.80) (envelope-from ) id 1iji6B-000169-Fg; Tue, 24 Dec 2019 12:11:36 +0100 From: Marc Zyngier To: kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Cc: Eric Auger , James Morse , Julien Thierry , Suzuki K Poulose , Thomas Gleixner , Jason Cooper , Lorenzo Pieralisi , Andrew Murray , Zenghui Yu , Robert Richter Subject: [PATCH v3 26/32] irqchip/gic-v4.1: Eagerly vmap vPEs Date: Tue, 24 Dec 2019 11:10:49 +0000 Message-Id: <20191224111055.11836-27-maz@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191224111055.11836-1-maz@kernel.org> References: <20191224111055.11836-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, eric.auger@redhat.com, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, tglx@linutronix.de, jason@lakedaemon.net, lorenzo.pieralisi@arm.com, Andrew.Murray@arm.com, yuzenghui@huawei.com, rrichter@marvell.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have HW-accelerated SGIs being delivered to VPEs, it becomes required to map the VPEs on all ITSs instead of relying on the lazy approach that we would use when using the ITS-list mechanism. Signed-off-by: Marc Zyngier --- drivers/irqchip/irq-gic-v3-its.c | 39 +++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 5126bdcfe079..3234bb9fbdbe 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1554,12 +1554,31 @@ static int its_irq_set_irqchip_state(struct irq_data *d, return 0; } +/* + * Two favourable cases: + * + * (a) Either we have a GICv4.1, and all vPEs have to be mapped at all times + * for vSGI delivery + * + * (b) Or the ITSs do not use a list map, meaning that VMOVP is cheap enough + * and we're better off mapping all VPEs always + * + * If neither (a) nor (b) is true, then we map vPEs on demand. + * + */ +static bool gic_requires_eager_mapping(void) +{ + if (!its_list_map || gic_rdists->has_rvpeid) + return true; + + return false; +} + static void its_map_vm(struct its_node *its, struct its_vm *vm) { unsigned long flags; - /* Not using the ITS list? Everything is always mapped. */ - if (!its_list_map) + if (gic_requires_eager_mapping()) return; raw_spin_lock_irqsave(&vmovp_lock, flags); @@ -1593,7 +1612,7 @@ static void its_unmap_vm(struct its_node *its, struct its_vm *vm) unsigned long flags; /* Not using the ITS list? Everything is always mapped. */ - if (!its_list_map) + if (gic_requires_eager_mapping()) return; raw_spin_lock_irqsave(&vmovp_lock, flags); @@ -4109,8 +4128,12 @@ static int its_vpe_irq_domain_activate(struct irq_domain *domain, struct its_vpe *vpe = irq_data_get_irq_chip_data(d); struct its_node *its; - /* If we use the list map, we issue VMAPP on demand... */ - if (its_list_map) + /* + * If we use the list map, we issue VMAPP on demand... Unless + * we're on a GICv4.1 and we eagerly map the VPE on all ITSs + * so that VSGIs can work. + */ + if (!gic_requires_eager_mapping()) return 0; /* Map the VPE to the first possible CPU */ @@ -4136,10 +4159,10 @@ static void its_vpe_irq_domain_deactivate(struct irq_domain *domain, struct its_node *its; /* - * If we use the list map, we unmap the VPE once no VLPIs are - * associated with the VM. + * If we use the list map on GICv4.0, we unmap the VPE once no + * VLPIs are associated with the VM. */ - if (its_list_map) + if (!gic_requires_eager_mapping()) return; list_for_each_entry(its, &its_nodes, entry) { -- 2.20.1