Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp974769ybl; Fri, 24 Jan 2020 13:01:48 -0800 (PST) X-Google-Smtp-Source: APXvYqyuh67v3LqhcY4kLKtZvcGBb5d71T2hZ8xZDZdHDxw7dQm83le/o0pyOEsreyjZ1Sn1V+ie X-Received: by 2002:a9d:7ac9:: with SMTP id m9mr4043838otn.80.1579899708363; Fri, 24 Jan 2020 13:01:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579899708; cv=none; d=google.com; s=arc-20160816; b=fJ6mfHV4ZXWiYRUyc1SmDgHKVwd0dP8abKK0CxS+QOXkuU4Veh50TeT95KY53MpFy+ 1E15d8T86KIrD9cm2aC8/AURanfc8V07mtp7uxGW6f/fO8Z2oOXC2ZEzdfbPDXTjv/N3 3dS0V16SA3y0Byq6249ydy3mo5WquXAL1Xt9DFOm0XMGphI4rTinsAIPkREPs/SzNKJd K+3aoAHG9hKb+7m6oK5C/ym7vXz/fXd/u1QizZ4xgT2gPy3sr2s5iAmnaUpkNWDATJ7S ZMsYuioxNCG3Ya0GwF5Z9qxT1NkiyW5u1mxci70NaLbx8gJMq1ZdW5WBlLNEbzl7iFcw sxuA== 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=4qm/JEQ2hMJt8/YCJnrvbURV7R/AmWYcHqFP+81NZwg=; b=o1xstmH7Gc458V39ljSAzWj1K8xkjJvIeXOCarcuPyzmDk9ogwtH3oT4vQ9MHJQxrm n936v7P9cL4HlWPfZN4DR93j8sTNytvGv/XbZ3cT0YC6SvsRhx714oek3r4SEqnPQbc5 U4ZszchyL7XXDiTcFRD3/smwHd5Rla3tx+7zdUwHdqshA11BUmBIadFkr38eBCSdm0UL xZXALfT5Qby0E4hPSc8GO5fbgz9Dfzv9IrwEWFGGGpX4M7hhcwHBFKjW9S507+4F0ezR F69NgDY8CXFMybwXq4kcq7LveJKsWXwC4q5rDoeVuYYJBW8V6sKVl9JHLAMM7lO1Gc/M 5F1w== 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 v16si29329oiv.114.2020.01.24.13.01.36; Fri, 24 Jan 2020 13:01:48 -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 S2392183AbgAXTMo (ORCPT + 99 others); Fri, 24 Jan 2020 14:12:44 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:43008 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403921AbgAXTLQ (ORCPT ); Fri, 24 Jan 2020 14:11:16 -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-0007a0-4H; 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 42C041C1A62; 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 eviction callback Cc: Marc Zyngier , Zenghui Yu , x86 , LKML In-Reply-To: <20191224111055.11836-13-maz@kernel.org> References: <20191224111055.11836-13-maz@kernel.org> MIME-Version: 1.0 Message-ID: <157989306704.396.6901889458265160578.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: e64fab1a1477dbf0c355691914511612ba312932 Gitweb: https://git.kernel.org/tip/e64fab1a1477dbf0c355691914511612ba312932 Author: Marc Zyngier AuthorDate: Tue, 24 Dec 2019 11:10:35 Committer: Marc Zyngier CommitterDate: Wed, 22 Jan 2020 14:22:20 irqchip/gic-v4.1: Add VPE eviction callback When descheduling a VPE, special care must be taken to tell the GIC about whether we want to receive a doorbell or not. This is a major improvement on GICv4.0, where the doorbell had to be separately enabled/disabled. Signed-off-by: Marc Zyngier Reviewed-by: Zenghui Yu Link: https://lore.kernel.org/r/20191224111055.11836-13-maz@kernel.org --- drivers/irqchip/irq-gic-v3-its.c | 53 ++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 3adc597..69b16e5 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2630,7 +2630,7 @@ static int __init allocate_lpi_tables(void) return 0; } -static u64 its_clear_vpend_valid(void __iomem *vlpi_base) +static u64 its_clear_vpend_valid(void __iomem *vlpi_base, u64 clr, u64 set) { u32 count = 1000000; /* 1s! */ bool clean; @@ -2638,6 +2638,8 @@ static u64 its_clear_vpend_valid(void __iomem *vlpi_base) val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); val &= ~GICR_VPENDBASER_Valid; + val &= ~clr; + val |= set; gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); do { @@ -2650,6 +2652,11 @@ static u64 its_clear_vpend_valid(void __iomem *vlpi_base) } } while (!clean && count); + if (unlikely(val & GICR_VPENDBASER_Dirty)) { + pr_err_ratelimited("ITS virtual pending table not cleaning\n"); + val |= GICR_VPENDBASER_PendingLast; + } + return val; } @@ -2758,7 +2765,7 @@ static void its_cpu_init_lpis(void) * ancient programming gets left in and has possibility of * corrupting memory. */ - val = its_clear_vpend_valid(vlpi_base); + val = its_clear_vpend_valid(vlpi_base, 0, 0); WARN_ON(val & GICR_VPENDBASER_Dirty); } @@ -3438,16 +3445,10 @@ static void its_vpe_deschedule(struct its_vpe *vpe) void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); u64 val; - val = its_clear_vpend_valid(vlpi_base); + val = its_clear_vpend_valid(vlpi_base, 0, 0); - if (unlikely(val & GICR_VPENDBASER_Dirty)) { - pr_err_ratelimited("ITS virtual pending table not cleaning\n"); - vpe->idai = false; - vpe->pending_last = true; - } else { - vpe->idai = !!(val & GICR_VPENDBASER_IDAI); - vpe->pending_last = !!(val & GICR_VPENDBASER_PendingLast); - } + vpe->idai = !!(val & GICR_VPENDBASER_IDAI); + vpe->pending_last = !!(val & GICR_VPENDBASER_PendingLast); } static void its_vpe_invall(struct its_vpe *vpe) @@ -3639,6 +3640,35 @@ static void its_vpe_4_1_schedule(struct its_vpe *vpe, gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); } +static void its_vpe_4_1_deschedule(struct its_vpe *vpe, + struct its_cmd_info *info) +{ + void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); + u64 val; + + if (info->req_db) { + /* + * vPE is going to block: make the vPE non-resident with + * PendingLast clear and DB set. The GIC guarantees that if + * we read-back PendingLast clear, then a doorbell will be + * delivered when an interrupt comes. + */ + val = its_clear_vpend_valid(vlpi_base, + GICR_VPENDBASER_PendingLast, + GICR_VPENDBASER_4_1_DB); + vpe->pending_last = !!(val & GICR_VPENDBASER_PendingLast); + } else { + /* + * We're not blocking, so just make the vPE non-resident + * with PendingLast set, indicating that we'll be back. + */ + val = its_clear_vpend_valid(vlpi_base, + 0, + GICR_VPENDBASER_PendingLast); + vpe->pending_last = true; + } +} + 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); @@ -3650,6 +3680,7 @@ static int its_vpe_4_1_set_vcpu_affinity(struct irq_data *d, void *vcpu_info) return 0; case DESCHEDULE_VPE: + its_vpe_4_1_deschedule(vpe, info); return 0; case INVALL_VPE: