Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7496957ybl; Tue, 24 Dec 2019 03:43:29 -0800 (PST) X-Google-Smtp-Source: APXvYqyb0yPT+7493pNXYYe2JYEZl8N+B6jfCKUj2VWEjUrZE1qbe25mFJjtlIoDSmCPljmra1qV X-Received: by 2002:a9d:74c4:: with SMTP id a4mr38590321otl.119.1577187809357; Tue, 24 Dec 2019 03:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577187809; cv=none; d=google.com; s=arc-20160816; b=mjgsVUqHJzGtY6I4RPDl15P1yk5aVqHCdWC0p4uMydqAoeY9a16UDbd9UQkwuZwH2L isr6/Ze6fAYV/0ayKROgOm3+ZProfUdoVVOqojPN7N8nySK7tEKlznkzpFp1znJLqEK5 X4Q+qJKv6JjXGJ6qJqz2jKtm7UrHp79h2g/nyj4Zyp9XSBIkDXq92BGp9YCThB12KY9V plhoXUCmB3U6bo6FkkPXQDozUGpj2S/icJi4XldG5YzpOPc6cRtyMZ0MyIBWfkpdv79Q /VFl/umllUcbnQTWkMNsMChd7465sdxDlIztvmM+jbh8tDcKnBz+sYSy1qTViy40l7Il lV+A== 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=okdRCJ3TbGwDdHVpV6FsUBY2XVJt0mWxV0TsENfNtxs=; b=JPNzFd9tNiAlFB4SWnDqGSCc0GJ0JSCB5JpL9weBSuxo/YNp31nD1ssgCo4XN5h5/9 DDSihY7+ntP2Lbu0XSdyqvauYwyD+WM3TCJrwM6JRmUs2fz6rSHYVYYJIFqC7sEXn545 5H66ZqgT2sFXh4ppxov2BIHpE8qOJvoHDnnAhLpvJfwMx5RENJTWf12EAf+30uPTvbtQ qZuv52S5Ky4xHpriPKyjwhxeFr4AAM0RmtwOARGRy/7/bBX427WL/1H1lSVZBi6QBIkN +1Z0VMdy/oK+pkVih9BWL8Yrc/+6dEg12swbIzBrpusijhgOpTxvZaF0wIWBTOOOGq2x mXnA== 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 z14si12003097oth.15.2019.12.24.03.43.16; Tue, 24 Dec 2019 03:43:29 -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 S1727050AbfLXLlY (ORCPT + 99 others); Tue, 24 Dec 2019 06:41:24 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:35881 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbfLXLlX (ORCPT ); Tue, 24 Dec 2019 06:41:23 -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 1iji5x-000169-CB; Tue, 24 Dec 2019 12:11:21 +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 13/32] irqchip/gic-v4.1: Add VPE INVALL callback Date: Tue, 24 Dec 2019 11:10:36 +0000 Message-Id: <20191224111055.11836-14-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 GICv4.1 redistributors have a VPE-aware INVALL register. Progress! We can now emulate a guest-requested INVALL without emiting a VINVALL command. Reviewed-by: Zenghui Yu Signed-off-by: Marc Zyngier --- drivers/irqchip/irq-gic-v3-its.c | 14 ++++++++++++++ include/linux/irqchip/arm-gic-v3.h | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index a5567d099a3e..403f5753e1ed 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -3670,6 +3670,19 @@ static void its_vpe_4_1_deschedule(struct its_vpe *vpe, } } +static void its_vpe_4_1_invall(struct its_vpe *vpe) +{ + void __iomem *rdbase; + u64 val; + + val = GICR_INVALLR_V; + val |= FIELD_PREP(GICR_INVALLR_VPEID, vpe->vpe_id); + + /* Target the redistributor this vPE is currently known on */ + rdbase = per_cpu_ptr(gic_rdists->rdist, vpe->col_idx)->rd_base; + gic_write_lpir(val, rdbase + GICR_INVALLR); +} + 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); @@ -3685,6 +3698,7 @@ static int its_vpe_4_1_set_vcpu_affinity(struct irq_data *d, void *vcpu_info) return 0; case INVALL_VPE: + its_vpe_4_1_invall(vpe); return 0; default: diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index 1c91dede7663..37b14fb82773 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h @@ -249,6 +249,12 @@ #define GICR_TYPER_COMMON_LPI_AFF GENMASK_ULL(25, 24) #define GICR_TYPER_AFFINITY GENMASK_ULL(63, 32) +#define GICR_INVLPIR_VPEID GENMASK_ULL(47, 32) +#define GICR_INVLPIR_V GENMASK_ULL(63, 63) + +#define GICR_INVALLR_VPEID GICR_INVLPIR_VPEID +#define GICR_INVALLR_V GICR_INVLPIR_V + #define GIC_V3_REDIST_SIZE 0x20000 #define LPI_PROP_GROUP1 (1 << 1) -- 2.20.1