From patchwork Mon Feb 19 18:58:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 203218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1475183dyc; Mon, 19 Feb 2024 10:59:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWr5Ch+qS6KZulvIaZ6Vc66yY1XhgNnxWOjyM9v6ofPtCzbHhZO5og0L3DgkZ/kfvY78a30CmZGkt500AS4j26r0+ecHQ== X-Google-Smtp-Source: AGHT+IF6ur5uSUmArFbo93UWYPloCYjFAEts9U2jOlenfbVxdRqepQ7YoMX0eOYf1jmiybRvCQMY X-Received: by 2002:a19:6502:0:b0:512:b24f:8336 with SMTP id z2-20020a196502000000b00512b24f8336mr2446193lfb.27.1708369157432; Mon, 19 Feb 2024 10:59:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708369157; cv=pass; d=google.com; s=arc-20160816; b=tMuH2HBy+x7+GA34/MLDnyyFmC2nLd9eAa+NjAZF130VLoC+1JnwcvwK8Vpo4sS24Q csfeoO68zE6k6Sr0JkxC9eZj31sD/uD+VUzWEiG0VJG6b67aH31bNtsXTD1p+e7qGhTf GfGNw8esoHmQpLAQEPNegP3h88qnC9WapDhonurYd7VkGsLy0FGBGm2nEEFGxfNlhvPl klzOX9AfkLKDrr2GPWszjEIci0gtz8A9Fa09W13J9oKJs3hAL7KNvRX+vaRImnalsubH FkWB1J9P4XO5S2XZO/jDY5pYgCwcGx+fMbiaoQ+QANcRAukLBA5SRitYobXb4TDL1fXK THvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=malznfxmTFeYI5AQuBOcx//3J2Klq63IEw4UgO+FW8I=; fh=PoZSk4NBlSl3lK4uTZC6W+wPRyAdQQ0EuxnJHtYkfRY=; b=bGZPJbw6RwLZuvSuXQhBmZZi09/GbYgfFUWDZRjbl51xj16rhJO5N0NxcRo+5vTTfY theH25PgLlnLB8p7S9MTTDyGrkuQwSh18+9CS/cOHUo8GW+Okyaindx/cWGrZdcW1G18 a3Az1XtA9T4JI8Loxxv+a2yOkcJvHuzthP2H0soDC7BOymFg7f+0YrSsaIS9RGFFfJVS dhQA6hD5o919TET9HiaVmZ6YTU02SKCYCyXR4nu6UM2stkZGLQJEd9aU++Od7IFBM0TH OtU3rxWrWV/TzQQ2pL+dCClnbOnmzKndsAJMljonVsxxnUKONxjZOGUeovtURMsiDWvi 4c0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TymjM0U4; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-71847-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71847-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b15-20020a170906038f00b00a3eea20dc57si66243eja.129.2024.02.19.10.59.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 10:59:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71847-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TymjM0U4; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-71847-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71847-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F2AD31F22337 for ; Mon, 19 Feb 2024 18:59:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EF7B4EB53; Mon, 19 Feb 2024 18:58:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="TymjM0U4" Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC12B482FA for ; Mon, 19 Feb 2024 18:58:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708369107; cv=none; b=ePrMEKKjfefBlXVD12eAYNccFWXNRVUrS/1nqRzszoBCCrE94R85eLZheAIVmx4GpkSgzyQNTMjRTTul15HH2Knq4t7koajSg9UIeGarjRHvp2pUkPtpSa3UP9hodDrnQG6MrqLBwmQo+kmdnuBStd+dIafV/9zk+YqD2fgEzRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708369107; c=relaxed/simple; bh=yXY4BKwNMqksd8A/oUnvq+Iq0aUB3gr/Y3i4+5lzsvA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XEiV+Dxi6peydmR5eKuE/t/Sko1MTkGYG6mKlzR2Q3XYeY/gDQNDy63yAzdqV5nPLPoMmrFjhHtAOl9AjVvIfoZ7VtJqj4g0ooXSnNgIcOrgg6e+jP+tGm72h2WbIrnJpFJE09JgwkCu/VE11w9Z9bBS0EYNU/d7i/dC2mfkCQ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=TymjM0U4; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708369103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=malznfxmTFeYI5AQuBOcx//3J2Klq63IEw4UgO+FW8I=; b=TymjM0U4219Zm3uEd/Lb8NxsD72R3xzRJZRLZBjvd9XHgLBu8YMPWhynBzrl8JRv3paxch lwj9pWCJOssGT/aTbkmYfA4DY/0hoWqJyMUQMa+NXEZkMY7B5s52UXj0Q2QgC1umO8It4y kkbdXBlbN4LMCE9vFrfXl6eQVykFEc8= From: Oliver Upton To: Thomas Gleixner Cc: Marc Zyngier , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, Jing Zhang , Oliver Upton , stable@vger.kernel.org, George Cherian Subject: [PATCH 1/3] irqchip/gic-v3-its: Do not assume vPE tables are preallocated Date: Mon, 19 Feb 2024 18:58:06 +0000 Message-ID: <20240219185809.286724-2-oliver.upton@linux.dev> In-Reply-To: <20240219185809.286724-1-oliver.upton@linux.dev> References: <20240219185809.286724-1-oliver.upton@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791354897373524293 X-GMAIL-MSGID: 1791354897373524293 We go through quite a bit of trouble to make sure we pick up any preallocated LPI tables on the redistributors, as enabling LPIs is a one-way switch. There is no such restriction for vLPIs, and for GICv4.1 we expect to allocate a new vPE table at boot. This works as intended when initializing an ITS, however when setting up a redistributor in its_cpu_init_lpis() the early return for preallocated RD tables skips straight past GICv4 setup. This all comes to a head when trying to kexec into a new kernel, as the new kernel silently fails to set up GICv4, leading to a complete loss of SGIs and LPIs for KVM VMs (ouch). Slap a band-aid on the problem by ensuring its_cpu_init_lpis() always initializes GICv4 on the way out, even if the other RD tables were preallocated. Cc: stable@vger.kernel.org Fixes: 6479450f72c1 ("irqchip/gic-v4: Fix occasional VLPI drop") Reported-by: George Cherian Co-developed-by: Marc Zyngier Signed-off-by: Marc Zyngier Signed-off-by: Oliver Upton --- I debated a bit on the fixes tag between the blamed commit and commit 5e5168461c22 ("irqchip/gic-v4.1: VPE table (aka GICR_VPROPBASER) allocation"), although it would appear GICv4 could be left in an unknown state after kexec too. drivers/irqchip/irq-gic-v3-its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index d097001c1e3e..0022852ce494 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -3172,6 +3172,7 @@ static void its_cpu_init_lpis(void) val |= GICR_CTLR_ENABLE_LPIS; writel_relaxed(val, rbase + GICR_CTLR); +out: if (gic_rdists->has_vlpis && !gic_rdists->has_rvpeid) { void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); @@ -3207,7 +3208,6 @@ static void its_cpu_init_lpis(void) /* Make sure the GIC has seen the above */ dsb(sy); -out: gic_data_rdist()->flags |= RD_LOCAL_LPI_ENABLED; pr_info("GICv3: CPU%d: using %s LPI pending table @%pa\n", smp_processor_id(), From patchwork Mon Feb 19 18:58:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 203219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1475255dyc; Mon, 19 Feb 2024 10:59:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXbmvdzt6j/3vXR2v8sDUy8XRyFx0x61wx/hU6hUgJm6KUdjkaBqplp9eyIpzS0Rm4go6jt9ORDRGwyMeO1OWgllet0ug== X-Google-Smtp-Source: AGHT+IFYg30QJArHd4Pbpa1r9qu8XqIqNqe7Gh0RqTLRN3BXbJRhEo2ARKQYlx8mZkJultVqZ1rX X-Received: by 2002:a17:906:e58:b0:a3e:dfce:dae8 with SMTP id q24-20020a1709060e5800b00a3edfcedae8mr628400eji.42.1708369172329; Mon, 19 Feb 2024 10:59:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708369172; cv=pass; d=google.com; s=arc-20160816; b=QmFS7JZzUoBkJ4iaigBVnhNt+njA9PmXQPxl4ws3kiTKVF8v1d2lTOhNCuNAk1og/E BWsRmzo/NkcDn3DGn3SV6wWnbL/1W5ShOkabL0TFK89oXsOrOayCHmtNPpuuHyFZMZPD Be8UJfyt6pD8Qfft8BtA0b4PP463ikTR/k1ldcGAxuXbRTK9UnFxZwL8H6cdd2FMfzRT rd2g0khfMVZUhWwZl7/xb+EkJaL9OmtZ2/rDMbEgnY2cVhNaPp3OWPpn6e94uHbi9pKR +OVIdcDkEKb2v6az4QEbYdU1xALg/q5jlsqFoVlRCC2L9pXQbTghAb7PRbWGz1EfLN1s 8rgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=n0uvz70joVA5h7nCkx+6qjmdsOAE7FpYRNnHlS3lny0=; fh=fgV4Kp0ZgGkINw9PbGnSyYl5n9Uaijr/GJFF1V5tx/4=; b=EfGWqopDiih41zP5+kpA1/61jRKYKAHtTfDK3WWdjrBrCvg2+W9wCzCxhk0SMmeN1X KnDD6RBv+ciCeXX27RF0XO4RTwO1MLGxHzy3LmkHd3EJVE3dV6/ZMfqD/V8DY6ORlSs+ 26wLBbXck5G9ocfzu8XJSSl40Kk4Y65+Xqa0Zpwt8cHvSvd19Hpv/TTlpdWlTdbPhVtK vTCUmMRrlypPW5xIp713gbeCUtv3QazbwR8Q498puk0XhN7dLnf/zD39iLqHbGco7tpP pwtKi8L86KYVTpIpWxw1HyqTcVVkOvzdiL6Y+6VmkCnlDky7DR5Qpyn1AP+R26acckKu WHvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=MRaf230x; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-71848-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71848-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k16-20020a170906579000b00a3e8a693317si1138729ejq.344.2024.02.19.10.59.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 10:59:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71848-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=MRaf230x; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-71848-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71848-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D24B81F236A7 for ; Mon, 19 Feb 2024 18:59:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD4314F21B; Mon, 19 Feb 2024 18:58:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="MRaf230x" Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D61487B8 for ; Mon, 19 Feb 2024 18:58:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708369109; cv=none; b=uQfIsX+wZMS8JLUfh/mZifPGgfRoSgoh4ojjv8bl6QLLb/aK7pkWI9r0/e9ZfYZ67CJn9MK0615jM0oQJqlHgH1d5sROMJhONVjn+Opbkbpo8vsNJ+KaEXUfYnjLmvkmMltc/UYpPxtE/B+WywUZ+xBkTdAqQakO7/fgBN+br8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708369109; c=relaxed/simple; bh=sQ09ukYCJMs0FVbHxpjJQwqr/OlvaGUdTVWxvm0dbCw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pvAM40z7/Jz4RUdwYOYkGdX96x7duDtQvoXcl2h0kFWn7iE8m176SxFaVdl5lQ/Ir4IhVrh2vDz8JRTCtpmvRDj+NaYNujf4Wz2hbHrHbIClQ4G5mrPHpumGGMcAsO47K662CSQjpOvMldqPs82/b7lku8TvrBU7j1R5EUarkf4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=MRaf230x; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708369105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n0uvz70joVA5h7nCkx+6qjmdsOAE7FpYRNnHlS3lny0=; b=MRaf230xQXz2XUHhNl+qaNg7U148naafFkbpIjvX5ofDIryb/ebMbKl5AfD5yIdB2kC01m TSiy2qQWMMmXuqWaBa+9n70/T2Rb0eTsoKGEIAtME5P0eyHqLqsVN+VLPwaNManRBOUCU+ QyOgXYqz7O7W3v3Lo+/zZnKrDywl9lU= From: Oliver Upton To: Thomas Gleixner Cc: Marc Zyngier , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, Jing Zhang , Oliver Upton Subject: [PATCH 2/3] irqchip/gic-v3-its: Spin off GICv4 init into a separate function Date: Mon, 19 Feb 2024 18:58:07 +0000 Message-ID: <20240219185809.286724-3-oliver.upton@linux.dev> In-Reply-To: <20240219185809.286724-1-oliver.upton@linux.dev> References: <20240219185809.286724-1-oliver.upton@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791354912892986933 X-GMAIL-MSGID: 1791354912892986933 Burying the GICv4 redistributor initialization into the routine for LPIs is a bit confusing, and can lead to sillies where unexpected codepaths may not fully initialize the RD. Hoist it out of its_cpu_init_lpis() into a dedicated function. Signed-off-by: Oliver Upton --- drivers/irqchip/irq-gic-v3-its.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 0022852ce494..63d1743f08cc 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -3173,8 +3173,25 @@ static void its_cpu_init_lpis(void) writel_relaxed(val, rbase + GICR_CTLR); out: - if (gic_rdists->has_vlpis && !gic_rdists->has_rvpeid) { + /* Make sure the GIC has seen the above */ + dsb(sy); + gic_data_rdist()->flags |= RD_LOCAL_LPI_ENABLED; + pr_info("GICv3: CPU%d: using %s LPI pending table @%pa\n", + smp_processor_id(), + gic_data_rdist()->flags & RD_LOCAL_PENDTABLE_PREALLOCATED ? + "reserved" : "allocated", + &paddr); +} + +static void its_cpu_init_vlpis(void) +{ + /* No vLPIs? No problem. */ + if (!gic_rdists->has_vlpis) + return; + + if (!gic_rdists->has_rvpeid) { void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); + u64 val; /* * It's possible for CPU to receive VLPIs before it is @@ -3193,7 +3210,8 @@ 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, 0, 0); + its_clear_vpend_valid(vlpi_base, 0, 0); + return; } if (allocate_vpe_l1_table()) { @@ -3205,15 +3223,6 @@ static void its_cpu_init_lpis(void) gic_rdists->has_rvpeid = false; gic_rdists->has_vlpis = false; } - - /* Make sure the GIC has seen the above */ - dsb(sy); - gic_data_rdist()->flags |= RD_LOCAL_LPI_ENABLED; - pr_info("GICv3: CPU%d: using %s LPI pending table @%pa\n", - smp_processor_id(), - gic_data_rdist()->flags & RD_LOCAL_PENDTABLE_PREALLOCATED ? - "reserved" : "allocated", - &paddr); } static void its_cpu_init_collection(struct its_node *its) @@ -5265,6 +5274,7 @@ int its_cpu_init(void) return ret; its_cpu_init_lpis(); + its_cpu_init_vlpis(); its_cpu_init_collections(); } From patchwork Mon Feb 19 18:58:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Upton X-Patchwork-Id: 203221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1480436dyc; Mon, 19 Feb 2024 11:07:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV4Zsv7WXYZXDn2y5tqf+16iMSJsQmuW3/drN16rMYYTS98FlTbXjVViD/WpeDIEatwaO/jv3Rt37/gjgVA+51lSbIR8w== X-Google-Smtp-Source: AGHT+IG4xTMQwNqJTjRZsPy4EkxqiYw1Lu7e/Mk/Nj8YBm/UrZmmWI+sSeIBKbyjqNRUPXkicQI2 X-Received: by 2002:a17:902:820c:b0:1db:7052:2f62 with SMTP id x12-20020a170902820c00b001db70522f62mr11190348pln.50.1708369637204; Mon, 19 Feb 2024 11:07:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708369637; cv=pass; d=google.com; s=arc-20160816; b=ejAYWZ+hMbPC3QAvdYRpIHAZvuIDT6OIE8/0Z3e4/wQMoDRbjNdkMrhlBiumWB7P4a FyI4JQqC36O4bWf1f3ms+Ow10JQdXw8k5yzo6xrFjWn4egdSTeiVNm8pHTXKoiA+H+x4 0+kRwtbSL8nQCa1oZEWFVttnrnE7W9MxGgo54m4txFCCzc2f6LETXYmYCuRj8wS0Vi1d GlzMTf1zlXheAxP1YdRaHhKj/WzUhTT75GvJTDdA135Z9L5a/aAi85JzCVwkzBmF6aF+ +g/bcbBBZ54bl/5Fn1WgXTjUZk1BzczU1mpGE9iu64fekG5a2vLdXlmxzy4fNSlP4K/8 dZ9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=O6mYbl34iGDajSSuwNwYK5N248BsKIXOEJAXAf9uLUE=; fh=fgV4Kp0ZgGkINw9PbGnSyYl5n9Uaijr/GJFF1V5tx/4=; b=oQ97gvKJvLddnRhZw6l1E9sNtZWiBnwEqM1dghK5TbS36szZb8DUwigcJPmsZ4wNOW NtZUje9hof2TtH8XHouoxxpZxiRNODmAJb/gDGD0zwCydM2zWPlbcZiH9PWVAMU6nva7 pgzqbnVWuqbQcyLO6dILeTjMJrkhbNeq8QIpAiYrfDpuXW2ZomBOiALTY2SixF3CHprq UvvtBRGl5xne5ejnG+SwNWIJ4I6aiptEGGKXJnmL2mdmHDxvKrZZVQ4yYQF5tUWQwYyr xKmAjn89IQwe+q6gTOTPEx+L4QEIwdWGeOAOJF60ee967l4q1XXaoSu17kdzFD5KEtoQ JL2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=erdwcROx; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-71849-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71849-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lv11-20020a1709032a8b00b001da1d2ad541si4953923plb.572.2024.02.19.11.07.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 11:07:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71849-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=erdwcROx; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-71849-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71849-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 636A7B21FF1 for ; Mon, 19 Feb 2024 18:59:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B6E64F60E; Mon, 19 Feb 2024 18:58:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="erdwcROx" Received: from out-176.mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C878487A3 for ; Mon, 19 Feb 2024 18:58:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708369111; cv=none; b=HKqRKFi4IOuQVELcYHEoNJpne7FRovAFyhU6SmgYicZ04pFNPRAl4iGBADCweW48c5ZYfcmtGDZMGgU+fUJJBpYh/35TdHHO+BenfFq66v6RLCkpR89Dl7N6vKckt/N6NzI28qELWsBKvMcQLwHB2/g5UU31apiJecUYa8pBbRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708369111; c=relaxed/simple; bh=AVsdCCM8FvfXsv0NexSqvyqeP7RkJJs+vf3bnHoUDbA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AEQqmj4F2Xja86x2jUzuRUZuLloyU+bBvIKgZUjQUP5MmkqFAtBI6Tnx7gVDP5i1RdnF7Lv8ZqEXV9wL+KUVqve3pDHLAZ4V9IchL+05SGssmolAJVchs0IYuAWTBHDkLZWTCqQf4gyJbns2rvh5Gl6VgLj5PhWKmuAg55cMnPc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=erdwcROx; arc=none smtp.client-ip=91.218.175.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708369107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O6mYbl34iGDajSSuwNwYK5N248BsKIXOEJAXAf9uLUE=; b=erdwcROxjTVj9GYsF9NxwZtHNpUShYCx45EDDOMeS+jAJihxWdrPa0U1lhk/4/FnuC7+2g 6JUYy8lf8giYc6dFvutLvzVCiE2tKOwcceN27OylehFuPrm9rlUze2Uoy930paO+8vWiFX OVADPtybepCZRTctZIlkmbbnW0WSTKY= From: Oliver Upton To: Thomas Gleixner Cc: Marc Zyngier , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, Jing Zhang , Oliver Upton Subject: [PATCH 3/3] irqchip/gic-v3-its: Print the vPE table installed in redistributor Date: Mon, 19 Feb 2024 18:58:08 +0000 Message-ID: <20240219185809.286724-4-oliver.upton@linux.dev> In-Reply-To: <20240219185809.286724-1-oliver.upton@linux.dev> References: <20240219185809.286724-1-oliver.upton@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791355400856288166 X-GMAIL-MSGID: 1791355400856288166 Hindsight is 20/20 of course, but the recent vPE table programming bug could've been root caused a bit more quickly if we print the table getting installed at every redistributor. Promote to pr_info() and add some additional context, such as the provenance of the installed vPE table. Signed-off-by: Oliver Upton --- drivers/irqchip/irq-gic-v3-its.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 63d1743f08cc..c3ef9665a2ad 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -2835,7 +2835,8 @@ static int allocate_vpe_l1_table(void) u64 val, gpsz, npg, pa; unsigned int psz = SZ_64K; unsigned int np, epp, esz; - struct page *page; + struct page *page = NULL; + bool from_its = false; if (!gic_rdists->has_rvpeid) return 0; @@ -2865,8 +2866,10 @@ static int allocate_vpe_l1_table(void) return -ENOMEM; val = inherit_vpe_l1_table_from_its(); - if (val & GICR_VPROPBASER_4_1_VALID) + if (val & GICR_VPROPBASER_4_1_VALID) { + from_its = true; goto out; + } /* First probe the page size */ val = FIELD_PREP(GICR_VPROPBASER_4_1_PAGE_SIZE, GIC_PAGE_SIZE_64K); @@ -2945,9 +2948,12 @@ static int allocate_vpe_l1_table(void) gicr_write_vpropbaser(val, vlpi_base + GICR_VPROPBASER); cpumask_set_cpu(smp_processor_id(), gic_data_rdist()->vpe_table_mask); - pr_debug("CPU%d: VPROPBASER = %llx %*pbl\n", - smp_processor_id(), val, - cpumask_pr_args(gic_data_rdist()->vpe_table_mask)); + pr_info("CPU%d: Using %s vPE table @%llx (%s)\n", + smp_processor_id(), + (val & GICR_VPROPBASER_4_1_INDIRECT) ? "indirect" : "direct", + val & GICR_VPROPBASER_4_1_ADDR, + (page) ? "allocated" : + ((from_its) ? "inherited from ITS" : "inherited from RD")); return 0; }