Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1940318ybg; Sun, 27 Oct 2019 07:51:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDtqqqi7NHyWpY0yhkhGLRvnrlo1BjDir1d5A2Uk94Jf7hIExiTTFob2kJyPVLdx2HCRyL X-Received: by 2002:a05:6402:21e8:: with SMTP id ce8mr14830587edb.32.1572187882858; Sun, 27 Oct 2019 07:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572187882; cv=none; d=google.com; s=arc-20160816; b=t5Szp3M/DCoGiFhqzBFcBPaT8ewSaiQAuzoFgbLzXN7jIhomIuKfSc88xEM3pGl9rz V9FS8KHRzQeNPZ3jlJWEA9oQFXd0llb3FHs7Y+jaryTMehPXXt6kunZ7gPDRKNLbNuTl uGewV+hUSuZfqXtddsiw5EpyrwQAue6Jm9wZVunjO3OfXrFfljRPTq++U/5j3YOKBKJU jPkUr9HOCKejkHsCweNUXRY1iUUqkChEKxxwg9SGhtYs/LehdOBfReZr97tJL8uOYCPl 94dmTK8ucBQ0a59kZFmffqSYpUKpBYF9N9xrcs55s7XAlMO8yf1uH5bP40d4/m84CdmA ZYLw== 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 :dkim-signature; bh=x994jEPaTNBZIlRK5enJ1Yf+puzQt1J5aYLdFmZ2low=; b=Y5lnDQRKfR0j3xiVuyFr4uVUJhf+Lo4OCi/StMdLaVbkIfo+88iuUutc1ajcuGhT0b HxXk5C6KPk2sx5J7MOoO/mtp1b6qXZ5SQI0RvEm16QDPiAFw2rGb3JZH3lQuq7Sj+Jly Xv1TWprV3mhxrZ7u0Am5G/NYoNoZyjaOLXTkCv4hxuw98wSJxb424v8TviKaNx6EZtJ3 Eon7/9T8WwzErkarsl3JqKChffRNskd7mpQ+Duj686Q4eCrqcexhCqMAe/4qsdB8dg+p vrNEVutl7bJVVBT+tSkNwN8TdChupTsAW8YO7wa2xSCMGNxA823u1dvLCaLoj60XSAVn 1a6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="pu/vsRSg"; 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=pass (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 u18si4648520ejk.105.2019.10.27.07.50.59; Sun, 27 Oct 2019 07:51:22 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b="pu/vsRSg"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727516AbfJ0Oq1 (ORCPT + 99 others); Sun, 27 Oct 2019 10:46:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:39064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbfJ0Oq0 (ORCPT ); Sun, 27 Oct 2019 10:46:26 -0400 Received: from localhost.localdomain (82-132-239-15.dab.02.net [82.132.239.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EBE28214AF; Sun, 27 Oct 2019 14:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572187585; bh=RC8PT828U5r9ePm7PoxGLyz3E90+A4ElBuLqHTunDEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pu/vsRSgrOcaIz4jh+LFvVm2i2DH3zcyczc9zpMfbpwDU2nFre9U9dPaSl9Buf85Y F3/h8dabvSGNa74F6NR8XFQwVhLwZE5h5HCtu0eJwwdyINiHgLOAQApdp0G9rRP2Q+ N5FzIlZVWzstXZ+ht2gsVc3S58ynfc4UPh6yT5ik= 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 , Jayachandran C , Robert Richter Subject: [PATCH v2 32/36] irqchip/gic-v4.1: Eagerly vmap vPEs Date: Sun, 27 Oct 2019 14:42:30 +0000 Message-Id: <20191027144234.8395-33-maz@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191027144234.8395-1-maz@kernel.org> References: <20191027144234.8395-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 03ba4964a7f5..796c5937ec15 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1419,12 +1419,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); @@ -1458,7 +1477,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); @@ -3964,8 +3983,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 */ @@ -3991,10 +4014,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