From patchwork Tue Oct 24 15:18:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 157601 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp2023491vqx; Tue, 24 Oct 2023 08:31:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3ZEFp9wtrZEgLqy2Yx8HqUQEdweN6hbgKZ6CPVee1p6EMfjRFmgOWjpPNqLM8uvb6JTbL X-Received: by 2002:a17:90b:4d8e:b0:27d:515d:94f0 with SMTP id oj14-20020a17090b4d8e00b0027d515d94f0mr9314403pjb.24.1698161458330; Tue, 24 Oct 2023 08:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698161458; cv=none; d=google.com; s=arc-20160816; b=cRudnE25+TrCX3aV9C0IvqK29t83puNo356r7OOL7EFh4rqTo9ZS85ZJMYNki4Uj34 YIA9sokuwxGi3S4nkvUWZHfZBmR2oD3lHqU7zep/cUNQk701lMCZVI9FqMDsQmQMTYnb 4uoaEmRRdc6EKK4J+zaJH70Z/Qck7/I0p06Gg5/O8rRXMcc3YXvVdhvAZrypuFM30Q/Z cw589PjKk/Pv/cVzWZIvFgndN0zLBdUMiGpeoWqsS7og6C4If/eGW2HRu0oSROKZtiUf czPznHnriSuS+zBKBHirwzbSFTW92czufx3o2ql9vXrAhWV/9iKWZakbzCmwCMmQrTSX QqWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=NNfCkWmd5LT0BAlRMwpLRo9og9wq6dyC/LO+q6jD+yw=; fh=2v+fthcp+AO1xAcVFW3dmEaVhmA0tv0h9zDy6/i/pj4=; b=pXi8LquSIteBHaTrM5gmhFnMC70qJ3mwekU1/kmAkjyTFKWeEuqv9vjBvfJ9OEk6Tb 5YUo+jQXloCqrAHjvy6xcfo+ZLpJC3F2e5R+R9UnS9/m2/zhKBeGxBOfYHC5zxKpVz0W QBF3kVqx56oYAKUEyQUJFOHmB+ufMxz2kzy3NMwPfBIkSyOcng/yUGjXBSPbaDUemHP7 i/tiiuAxs3YhCqfDFsiaHV68edxeeolT0qdvnXDgMhfmsyt/y/5CbAZ1057coTCFN5nn 5pbkJgMAa2va7aH5sFxs3ZCspe9QILF4pnTlzJzJv5eEQXmsfzBoboayxoRRCVJwN6qh QThw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=pyT8sDn3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id h24-20020a17090aa89800b0027ced9acac0si11225718pjq.2.2023.10.24.08.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:30:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=pyT8sDn3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 987C380A3F23; Tue, 24 Oct 2023 08:30:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343900AbjJXPaY (ORCPT + 27 others); Tue, 24 Oct 2023 11:30:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343898AbjJXP35 (ORCPT ); Tue, 24 Oct 2023 11:29:57 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF1472D52; Tue, 24 Oct 2023 08:18:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=NNfCkWmd5LT0BAlRMwpLRo9og9wq6dyC/LO+q6jD+yw=; b=pyT8sDn3D1Na/0O83HIphO1Ygc l6elglC6TwBupkx3TMPL6MHhd2AQ13+rYybnm0Z2pPCaFUuxwj82HJY+JIzqfk8mGsLNkv610UyCO Mu8peZB3jHlW2munKziOBEfKGZwJcPj8n/tN4OL3S9fexilLt0PcraVsNGn/RbnYJMs6Gx+A/yVsV 8Yb4sXGt74xXlYc6UEszKMH3by5XWusgwOTbCfqzHtABHHLYkGpXAcRtU6UgpuhZrNXk2EdBkqfEC gZrnaaFcBiIzZgVdZDiJT4aZixMrV3HtPxI0LxbVPyNoi1yiCfbQ6QuP6izPgBwNqRCmtL8esPEGk gnU6KdQw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:44458 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qvJBE-0004VZ-1a; Tue, 24 Oct 2023 16:18:52 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qvJBF-00AqRw-Us; Tue, 24 Oct 2023 16:18:54 +0100 In-Reply-To: References: From: Russell King (Oracle) To: linux-pm@vger.kernel.org, loongarch@lists.linux.dev, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, kvmarm@lists.linux.dev, x86@kernel.org, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org Cc: Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse , Marc Zyngier , Thomas Gleixner Subject: [PATCH 32/39] irqchip/gic-v3: Don't return errors from gic_acpi_match_gicc() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Sender: Russell King Date: Tue, 24 Oct 2023 16:18:53 +0100 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 08:30:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780651349561627087 X-GMAIL-MSGID: 1780651349561627087 From: James Morse gic_acpi_match_gicc() is only called via gic_acpi_count_gicr_regions(). It should only count the number of enabled redistributors, but it also tries to sanity check the GICC entry, currently returning an error if the Enabled bit is set, but the gicr_base_address is zero. Adding support for the online-capable bit to the sanity check complicates it, for no benefit. The existing check implicitly depends on gic_acpi_count_gicr_regions() previous failing to find any GICR regions (as it is valid to have gicr_base_address of zero if the redistributors are described via a GICR entry). Instead of complicating the check, remove it. Failures that happen at this point cause the irqchip not to register, meaning no irqs can be requested. The kernel grinds to a panic() pretty quickly. Without the check, MADT tables that exhibit this problem are still caught by gic_populate_rdist(), which helpfully also prints what went wrong: | CPU4: mpidr 100 has no re-distributor! Signed-off-by: James Morse Reviewed-by: Gavin Shan Signed-off-by: Russell King (Oracle) --- drivers/irqchip/irq-gic-v3.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index d50d9414f471..e787e7bbb5a2 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -2428,21 +2428,15 @@ static int __init gic_acpi_match_gicc(union acpi_subtable_headers *header, /* * If GICC is enabled and has valid gicr base address, then it means - * GICR base is presented via GICC + * GICR base is presented via GICC. The redistributor is only known to + * be accessible if the GICC is marked as enabled. If this bit is not + * set, we'd need to add the redistributor at runtime, which isn't + * supported. */ - if (acpi_gicc_is_usable(gicc) && gicc->gicr_base_address) { + if (gicc->flags & ACPI_MADT_ENABLED && gicc->gicr_base_address) acpi_data.enabled_rdists++; - return 0; - } - /* - * It's perfectly valid firmware can pass disabled GICC entry, driver - * should not treat as errors, skip the entry instead of probe fail. - */ - if (!acpi_gicc_is_usable(gicc)) - return 0; - - return -ENODEV; + return 0; } static int __init gic_acpi_count_gicr_regions(void)