Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp974686ybl; Fri, 24 Jan 2020 13:01:44 -0800 (PST) X-Google-Smtp-Source: APXvYqw43aQtSoU9sp+ctQ1ur3U9kqhPl3jxJGYyYLokTAPYxO+en2menGuplFFyNEOau+am4WvF X-Received: by 2002:a9d:7618:: with SMTP id k24mr4233344otl.65.1579899704285; Fri, 24 Jan 2020 13:01:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579899704; cv=none; d=google.com; s=arc-20160816; b=oIgDwLSXHolOa3nXLAa8SqBCFkchqQTPFmg1ZW/wJblDm4WpPBCfvP1kWz+NYzPJud cpGDjTb3i37zLG3rgcG4oDHR8RexiJ2jV9mPnC+03ovxmAQNOfKw/gl6Du2qselxJqJu 7hS7p2mcRDaUPZdP4XT6ZHZhmtvwPMc7nCqLeNbzV8UlXkeGjWdVr+65vSPfvswIokUG jSB0YnwjFfwFyVBK86PG4EueXz7RFrwl32PoI0BbirQkGjyhO+uw9zP1e6dJ74cU50O4 /DDq6oQSm57Ep2n756uGlcSN7isntf9Rlkm73vkXxgUuYT6TARR4IC8fP0h4U86310y8 xojw== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=BPG/p33QHagEsBwPP2rSrCpekxhjR/ZBLvWfyFQItOE=; b=o3Gc6QM5LwDtYMjeQI9F+qtkgu9THtpptRioX9f6bVgPkI81msEE9dvb80orKwQsXj C23dMCLnZDYX7KPbQsoEbSoSju9xSL6Zij2cqDcF8I84l+nIY2x+3SS1DSBcrP829RQT uyBA8pgWT/07SDCI8OS9mqI1O9SjRcTQaisE+H8eLv6RYlzuieY4ounX6VnJapLaIasg a55Ys3UdDBkb3ksiuZO2yIWGRUm6UmRo9zDH6jiiysmbQxG7fuC/8JofTsxqJgWOltz9 tprWFzF3u1Dv8vpgB4w20qOYjFKK32mKmJ4ae1LKX1EW1Pz4Nj6P5CKljzu4H+/PEa4t r2WQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n25si299330oij.175.2020.01.24.13.01.32; Fri, 24 Jan 2020 13:01:44 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392155AbgAXTMg (ORCPT + 99 others); Fri, 24 Jan 2020 14:12:36 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:43025 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403972AbgAXTLS (ORCPT ); Fri, 24 Jan 2020 14:11:18 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iv4MM-0007aC-5U; Fri, 24 Jan 2020 20:11:14 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 673DA1C1A61; Fri, 24 Jan 2020 20:11:08 +0100 (CET) Date: Fri, 24 Jan 2020 19:11:08 -0000 From: "tip-bot2 for Marc Zyngier" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/core] irqchip/gic-v4.1: Implement the v4.1 flavour of VMOVP Cc: Marc Zyngier , Zenghui Yu , x86 , LKML In-Reply-To: <20191224111055.11836-9-maz@kernel.org> References: <20191224111055.11836-9-maz@kernel.org> MIME-Version: 1.0 Message-ID: <157989306824.396.8718529101220247643.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the irq/core branch of tip: Commit-ID: dd3f050a216ef7c8ce21ba48fd3b2ece2155382f Gitweb: https://git.kernel.org/tip/dd3f050a216ef7c8ce21ba48fd3b2ece2155382f Author: Marc Zyngier AuthorDate: Tue, 24 Dec 2019 11:10:31 Committer: Marc Zyngier CommitterDate: Wed, 22 Jan 2020 14:22:20 irqchip/gic-v4.1: Implement the v4.1 flavour of VMOVP With GICv4.1, VMOVP is extended to allow a default doorbell to be specified, as well as a validity bit for this doorbell. As an added bonus, VMOVP isn't required anymore of moving a VPE between redistributors that share the same affinity. Let's add this support to the VMOVP builder, and make sure we don't issue the command if we don't really need to. Signed-off-by: Marc Zyngier Reviewed-by: Zenghui Yu Link: https://lore.kernel.org/r/20191224111055.11836-9-maz@kernel.org --- drivers/irqchip/irq-gic-v3-its.c | 40 +++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 9bc8adf..53a7663 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -470,6 +470,17 @@ static void its_encode_vmapp_default_db(struct its_cmd_block *cmd, its_mask_encode(&cmd->raw_cmd[1], vpe_db_lpi, 31, 0); } +static void its_encode_vmovp_default_db(struct its_cmd_block *cmd, + u32 vpe_db_lpi) +{ + its_mask_encode(&cmd->raw_cmd[3], vpe_db_lpi, 31, 0); +} + +static void its_encode_db(struct its_cmd_block *cmd, bool db) +{ + its_mask_encode(&cmd->raw_cmd[2], db, 63, 63); +} + static inline void its_fixup_cmd(struct its_cmd_block *cmd) { /* Let's fixup BE commands */ @@ -756,6 +767,11 @@ static struct its_vpe *its_build_vmovp_cmd(struct its_node *its, its_encode_vpeid(cmd, desc->its_vmovp_cmd.vpe->vpe_id); its_encode_target(cmd, target); + if (is_v4_1(its)) { + its_encode_db(cmd, true); + its_encode_vmovp_default_db(cmd, desc->its_vmovp_cmd.vpe->vpe_db_lpi); + } + its_fixup_cmd(cmd); return valid_vpe(its, desc->its_vmovp_cmd.vpe); @@ -3327,7 +3343,7 @@ static int its_vpe_set_affinity(struct irq_data *d, bool force) { struct its_vpe *vpe = irq_data_get_irq_chip_data(d); - int cpu = cpumask_first(mask_val); + int from, cpu = cpumask_first(mask_val); /* * Changing affinity is mega expensive, so let's be as lazy as @@ -3335,14 +3351,24 @@ static int its_vpe_set_affinity(struct irq_data *d, * into the proxy device, we need to move the doorbell * interrupt to its new location. */ - if (vpe->col_idx != cpu) { - int from = vpe->col_idx; + if (vpe->col_idx == cpu) + goto out; - vpe->col_idx = cpu; - its_send_vmovp(vpe); - its_vpe_db_proxy_move(vpe, from, cpu); - } + from = vpe->col_idx; + vpe->col_idx = cpu; + + /* + * GICv4.1 allows us to skip VMOVP if moving to a cpu whose RD + * is sharing its VPE table with the current one. + */ + if (gic_data_rdist_cpu(cpu)->vpe_table_mask && + cpumask_test_cpu(from, gic_data_rdist_cpu(cpu)->vpe_table_mask)) + goto out; + its_send_vmovp(vpe); + its_vpe_db_proxy_move(vpe, from, cpu); + +out: irq_data_update_effective_affinity(d, cpumask_of(cpu)); return IRQ_SET_MASK_OK_DONE;