From patchwork Tue Feb 13 14:11:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10216429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C583460329 for ; Tue, 13 Feb 2018 14:11:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4EC928CF8 for ; Tue, 13 Feb 2018 14:11:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A982828DB2; Tue, 13 Feb 2018 14:11:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 306AE28CF8 for ; Tue, 13 Feb 2018 14:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=dr0mNBzppDtdGpXqcJrrzuK5KNQhWdpwwq0gEkEmWwA=; b=VGg BSxD5Rf1O+abDaTVGt/0fQQ1To86stRU+7+NI6aiOsimV6SgxoOZJ9PKXCKAxXW6GM3zYc/vEtNIf HxYeyKP0A7J60utjMccpI30n0OxAxqbTevIwWrUoi+zuIwqzsL/9ca+niq2gNfisrz40fjdvwK9hr MDBInS7P4NE0NXJZhe2G4RkGnXKAXLY9SNkEqDXhuaFPNEi5ekbPpwMO2i0g+3xpWkHK+aLSy4U66 1BAicQTvssmr5yzmbAyU+/d1KHISBySbNU66bwomcUkyF3k3GtFS5bLhV8qRqWJAtBonRlutmEm/E eShTgKDePBpfamd3x1BXaPSsA7Eledw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1elbJH-0007Ut-R5; Tue, 13 Feb 2018 14:11:51 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1elbJE-0007P7-OH for linux-arm-kernel@lists.infradead.org; Tue, 13 Feb 2018 14:11:50 +0000 Received: by mail-wm0-x241.google.com with SMTP id 141so16201316wme.3 for ; Tue, 13 Feb 2018 06:11:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=XYwiMsRR6I6LLIf/qsyo7KHQAbn+dDLHG7JFVeyADxQ=; b=Xpj7LMibq5P45yZ9FhTF8hHW7JsNu+FHVIPDDKrrBlSywVjgwZH+aDncL9dilVCxir bwCqxbA6dmX11FsjyRXt173TShzJPzquSj2pK33o0MQiN84ST4HcOQY2kH255a+KzNYN mZmDnjlCw0VKxEs+2wJYb63CeMm02zEX5MaMA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XYwiMsRR6I6LLIf/qsyo7KHQAbn+dDLHG7JFVeyADxQ=; b=rFG6+2g7FRcOIy1X0iFJgvEWXtVG5nIQR/JrquTns4lERNJnSrSexlfn6N+JtTmMYS eR5I+Y3Zj96y2I63VNdGVqqMo3TrhvQvDa/E7NFvJeczN+pB9+Rd1vHA+CxoZ6n/yVwq 9PEwauTodIbnmz0YHhymicYwTUIez0cTfnczvc9MgCE/OQE1Vejzjn2vrTB1sEyxZ0Y/ 6iopRyxBylRTZyg8bJu6CkgK1j7wd8YuLLH8RS8vfy5pA3q0v8d3pzCZdgWe4loWXdEj cvoFNNvKHMb/nC5DLjtOn4+Ipq8xoX6rZa5O6I8jK2eWAy315GyiQC0cIMCeUdGrigxz QezA== X-Gm-Message-State: APf1xPA48nTJiIIFZpPvoDEHrXBvhl874jjGyH8PjqW70gsFElroKZbf nla4sAGhXYF9MTPN8CYpDk983Jytv5g= X-Google-Smtp-Source: AH8x227cIs7NCBNAcn10gHStuwRqpD1mtLiYLe6PNsG+mX9dygo2cxb6NqXdaXF9izKlOGOL8XLO3A== X-Received: by 10.28.30.66 with SMTP id e63mr1485754wme.69.1518531095983; Tue, 13 Feb 2018 06:11:35 -0800 (PST) Received: from localhost.localdomain ([196.85.252.149]) by smtp.gmail.com with ESMTPSA id l9sm25186821wrl.1.2018.02.13.06.11.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 06:11:35 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, marc.zyngier@arm.com, lorenzo.pieralisi@arm.com Subject: [RFC PATCH] irqchip/gic-v3-its: apply ACPI device based quirks Date: Tue, 13 Feb 2018 14:11:18 +0000 Message-Id: <20180213141118.3092-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180213_061148_814481_401B538B X-CRM114-Status: GOOD ( 10.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tglx@linutronix.de, Ard Biesheuvel , jason@lakedaemon.net, graeme.gregory@linaro.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Reapply the SynQuacer quirk for ITS frames that are matched by 'SCX0005' based ACPI devices, replacing the dummy fwnode with the one populated by the ACPI device core. This allows the SynQuacer ACPI tables to publish a device node such as Device (ITS0) { Name (_HID, "SCX0005") Name (_ADR, 0x30020000) Name (_DSD, Package () // _DSD: Device-Specific Data { ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), Package () { Package (2) { "socionext,synquacer-pre-its", Package () { 0x58000000, 0x200000 } }, } }) } which will trigger the existing quirk that replaces the doorbell address with the appropriate address in the pre-ITS frame. Signed-off-by: Ard Biesheuvel --- Marc, Lorenzo, I am aware that this patch may be seen as controversial, but I would like to propose it nonetheless. The reason is that this is the only thing standing in the way of full ACPI support in Socionext SynQuacer based platforms. The pre-ITS is a monstrosity, but as it turns out, Socionext had help from ARM designing it, and the reason we need DT/ACPI based quirks in the first place is that the IIDR of this GICv3 implementation is simply the ARM Ltd. one (as they designed the IP) Please take this into consideration when reviewing this patch, Thanks, Ard. drivers/irqchip/irq-gic-v3-its.c | 39 ++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 06f025fd5726..a63973baf08a 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -3517,3 +3517,42 @@ int __init its_init(struct fwnode_handle *handle, struct rdists *rdists, return 0; } + +#if defined(CONFIG_SOCIONEXT_SYNQUACER_PREITS) && defined(CONFIG_ACPI) +static acpi_status __init acpi_its_device_probe (acpi_handle handle, + u32 depth, void *context, + void **ret) +{ + struct acpi_device *adev; + unsigned long long phys_base; + struct its_node *its; + acpi_status status; + int err; + + err = acpi_bus_get_device(handle, &adev); + if (err) + return AE_CTRL_TERMINATE; + + status = acpi_evaluate_integer(handle, "_ADR", NULL, &phys_base); + if (ACPI_FAILURE(status)) + return status; + + list_for_each_entry(its, &its_nodes, entry) + if (its->phys_base == phys_base) { + irq_domain_free_fwnode(its->fwnode_handle); + its->fwnode_handle = &adev->fwnode; + its_enable_quirk_socionext_synquacer(its); + break; + } + + return AE_CTRL_TERMINATE; +} + +static int __init acpi_its_device_probe_init(void) +{ + if (!acpi_disabled) + acpi_get_devices("SCX0005", acpi_its_device_probe, NULL, NULL); + return 0; +} +subsys_initcall_sync(acpi_its_device_probe_init); +#endif