Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp973809ybl; Fri, 24 Jan 2020 13:01:01 -0800 (PST) X-Google-Smtp-Source: APXvYqz47MADc9P86PUzAW9A2Ek0/gyVnv8Datgl/06Nhf2WCZS2xjFbOSyMNwSZ0JJVJ6siMUzb X-Received: by 2002:a05:6830:13d3:: with SMTP id e19mr4196513otq.135.1579899660850; Fri, 24 Jan 2020 13:01:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579899660; cv=none; d=google.com; s=arc-20160816; b=ZMOS4YzDeYN4z/BbnwyIWZBAjRrDfnIpAVyegX+lPM0wpOrY4tAgtlQhgMq4Pf1wJL dPZhg73VSketBfpCXakuBS16MhuRx1/nLvZGU5XvdyLqBzZu89F1+bhsD+5chofSCEqk hJ2Yqajis9FCAibyEMSS/ZqglK5m2ixoyOPPeEX1r2A0H77b7yxScsi85pTdxusoIghi 5nYbn3H5oKBR6bNxxojkX2AMjlfXZdectV7vGKSYC2Yf7eUMTg1Z3PNR+jg1/DfYNST/ 9+L3lLAOApi6C47tbbrpxdzrctzh9Rl8uTBv0yPnFBiaYTeiW+BDpeE160DvbkqeDKd+ DrGg== 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=w4r1J27+k8r+0gkDye976I98ci92ND18Ke3RGv8xNeU=; b=qc03WnsVdKcwOUG2V7zBD/OFfemrbcH9OFcpW64i7oGUUgIWwGwLQGyvxOHYMcwoOb b3goNFZZLFXIJRws9Eo5niCupuJhO8oJCUFQb2LbALP09HNjfh1EWN8lfj9qkWuH7GaV kgwKESZRo9ltYYmjloOpmtVeho2dh/TzV6UPUu7Pow9hDeHRZoNmr1wyuhpUmT5KUbjA INgp9zw7kEBovml3txOnlQuqF/kn6LXQuF4CY8A1Ln5lV7tSTYQtMM6gzEl7AKmGOkOZ xBvoZEaefPm4EPZHpcbu+lVn6Oz6v7C8GUu3t4HrZBwdomPSoCMlkFbWyIjkPBPLnMz5 NEKg== 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 s129si287470oig.177.2020.01.24.13.00.48; Fri, 24 Jan 2020 13:01:00 -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 S2403955AbgAXTLO (ORCPT + 99 others); Fri, 24 Jan 2020 14:11:14 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:42991 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391877AbgAXTLM (ORCPT ); Fri, 24 Jan 2020 14:11:12 -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 1iv4MG-0007a5-IW; Fri, 24 Jan 2020 20:11:08 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 81F311C1A63; Fri, 24 Jan 2020 20:11:07 +0100 (CET) Date: Fri, 24 Jan 2020 19:11:07 -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: Add VPE residency callback Cc: Marc Zyngier , Zenghui Yu , x86 , LKML In-Reply-To: <20191224111055.11836-12-maz@kernel.org> References: <20191224111055.11836-12-maz@kernel.org> MIME-Version: 1.0 Message-ID: <157989306735.396.13318292050521196157.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: 91bf6395f7b8614a5a9934a0ae9c8b5312d77b29 Gitweb: https://git.kernel.org/tip/91bf6395f7b8614a5a9934a0ae9c8b5312d77b29 Author: Marc Zyngier AuthorDate: Tue, 24 Dec 2019 11:10:34 Committer: Marc Zyngier CommitterDate: Wed, 22 Jan 2020 14:22:20 irqchip/gic-v4.1: Add VPE residency callback Making a VPE resident on GICv4.1 is pretty simple, as it is just a single write to the local redistributor. We just need extra information about which groups to enable, which the KVM code will have to provide. Signed-off-by: Marc Zyngier Reviewed-by: Zenghui Yu Link: https://lore.kernel.org/r/20191224111055.11836-12-maz@kernel.org --- drivers/irqchip/irq-gic-v3-its.c | 17 +++++++++++++++++ include/linux/irqchip/arm-gic-v3.h | 9 +++++++++ include/linux/irqchip/arm-gic-v4.h | 5 +++++ 3 files changed, 31 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 5ef706e..3adc597 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -3624,12 +3624,29 @@ static void its_vpe_4_1_unmask_irq(struct irq_data *d) its_vpe_4_1_send_inv(d); } +static void its_vpe_4_1_schedule(struct its_vpe *vpe, + struct its_cmd_info *info) +{ + void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); + u64 val = 0; + + /* Schedule the VPE */ + val |= GICR_VPENDBASER_Valid; + val |= info->g0en ? GICR_VPENDBASER_4_1_VGRP0EN : 0; + val |= info->g1en ? GICR_VPENDBASER_4_1_VGRP1EN : 0; + val |= FIELD_PREP(GICR_VPENDBASER_4_1_VPEID, vpe->vpe_id); + + gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); +} + static int its_vpe_4_1_set_vcpu_affinity(struct irq_data *d, void *vcpu_info) { + struct its_vpe *vpe = irq_data_get_irq_chip_data(d); struct its_cmd_info *info = vcpu_info; switch (info->cmd_type) { case SCHEDULE_VPE: + its_vpe_4_1_schedule(vpe, info); return 0; case DESCHEDULE_VPE: diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index 1f17181..822dae6 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h @@ -328,6 +328,15 @@ #define GICR_VPENDBASER_Valid (1ULL << 63) /* + * GICv4.1 VPENDBASER, used for VPE residency. On top of these fields, + * also use the above Valid, PendingLast and Dirty. + */ +#define GICR_VPENDBASER_4_1_DB (1ULL << 62) +#define GICR_VPENDBASER_4_1_VGRP0EN (1ULL << 59) +#define GICR_VPENDBASER_4_1_VGRP1EN (1ULL << 58) +#define GICR_VPENDBASER_4_1_VPEID GENMASK_ULL(15, 0) + +/* * ITS registers, offsets from ITS_base */ #define GITS_CTLR 0x0000 diff --git a/include/linux/irqchip/arm-gic-v4.h b/include/linux/irqchip/arm-gic-v4.h index 498e523..d9c3496 100644 --- a/include/linux/irqchip/arm-gic-v4.h +++ b/include/linux/irqchip/arm-gic-v4.h @@ -100,6 +100,11 @@ struct its_cmd_info { union { struct its_vlpi_map *map; u8 config; + bool req_db; + struct { + bool g0en; + bool g1en; + }; }; };