From patchwork Mon Aug 12 11:28:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Xu X-Patchwork-Id: 171057 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2706198ily; Mon, 12 Aug 2019 04:29:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVdIvjbX4xHozzqu0YKGsCYSjilRPYMqOCPuQ9PsnQvdQvrZRTekjOuBetq5yC8Dv3fbOl X-Received: by 2002:a17:90a:d593:: with SMTP id v19mr22849719pju.1.1565609341437; Mon, 12 Aug 2019 04:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565609341; cv=none; d=google.com; s=arc-20160816; b=CCwjHZMCcyzhzmtqfi+55OjdZELkAvoIn+ApF9XlkOj4ObF2JeoC0t5LeMDFfjU8dG zeCcJZIGnh4WCIpxg0KDUL5gqc8opF+384X8dF0nCk3hMjMrydJNt9R4Z1zYgJe5ceGx jKgl3aKA4nZGUnxBSq5vlrw2efOipOBQXntsCd52iVL+SJ6ZURF8r72jhp5T3YGi8U5F gSqeMfRG3qMrhxMZNwQzv4EdK5tKfiSZMsOyFvVBu/LHGJ633DMz40KCKi4Tk7DsjFDz 73/AWSibC48YKjvfL0bNXG4TZtT+isxsG8nu2GC7N5z8SBtL21cAuwGi+e47kTqZ3AZD SEsQ== 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 :user-agent:date:message-id:subject:from:cc:to; bh=ucxCi1nQ6r6wrP/yAnr42FtbDr3eUvPnbD9JOqKyGr8=; b=Ar+jSRV/OZoa+NwLa9I1PJ/XgLQ2z+nadMzVcGsXdD8ZBdTh1WrURr76bPQ72Ea1O0 XagsNh/P/BdMeayrUJUUmtzubF3yvxJ3JhLmtUCA4x2viiHq4+OA4N/eqVeIfjytvuVD 3CLqDse7+vDxres4jM5FoDzvGksPlenFy+za/7XRY7hhmIowI+/SKHyCPhuSx7eXVReW o6RWQ5i1reBOuyLxKQayVOr3xeAEz6NzStHh4X74blyu4V3pbjBqHhl1nG4aA3ee7b5q 1YM9sYMgOVb97IqOI8u6GLwWSn8JyAQ7vTXbG6H9bhjnyR9iP82S1Ak1FciitlNXV/Yb EUWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-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 b61si57355415plb.401.2019.08.12.04.29.01; Mon, 12 Aug 2019 04:29:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-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-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728207AbfHLL3A (ORCPT + 5 others); Mon, 12 Aug 2019 07:29:00 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:54464 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728473AbfHLL27 (ORCPT ); Mon, 12 Aug 2019 07:28:59 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 988ECB04B9D23C81953D; Mon, 12 Aug 2019 19:28:56 +0800 (CST) Received: from [127.0.0.1] (10.57.101.250) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Mon, 12 Aug 2019 19:28:47 +0800 To: , , "linux-arm-kernel@lists.infradead.org" , CC: Linuxarm , , "Shameerali Kolothum Thodi" , Jonathan Cameron , John Garry , "Salil Mehta" , Shiju Jose , , Zhangyi ac , "Liguozhu (Kenneth)" , Tangkunshan , huangdaode From: Wei Xu Subject: [PATCH] gpio: pl061: Fix the issue failed to register the ACPI interruption Message-ID: <5D514D6F.4090904@hisilicon.com> Date: Mon, 12 Aug 2019 19:28:47 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 X-Originating-IP: [10.57.101.250] X-CFilter-Loop: Reflected Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Invoke acpi_gpiochip_request_interrupts after the acpi data has been attached to the pl061 acpi node to register interruption. Otherwise it will be failed to register interruption for the ACPI case. Because in the gpiochip_add_data_with_key, acpi_gpiochip_add is invoked after gpiochip_add_irqchip but at that time the acpi data has not been attached yet. Tested with below steps on QEMU v4.1.0-rc3 and Linux kernel v5.3-rc4, and found pl061 interruption is missed in the /proc/interrupts: 1. qemu-system-aarch64 \ -machine virt,gic-version=3 -cpu cortex-a57 \ -m 1G,maxmem=4G,slots=4 \ -kernel Image -initrd rootfs.cpio.gz \ -net none -nographic \ -bios QEMU_EFI.fd \ -append "console=ttyAMA0 acpi=force earlycon=pl011,0x9000000" 2. cat /proc/interrupts in the guest console: estuary:/$ cat /proc/interrupts CPU0 2: 3228 GICv3 27 Level arch_timer 4: 15 GICv3 33 Level uart-pl011 42: 0 GICv3 23 Level arm-pmu IPI0: 0 Rescheduling interrupts IPI1: 0 Function call interrupts IPI2: 0 CPU stop interrupts IPI3: 0 CPU stop (for crash dump) interrupts IPI4: 0 Timer broadcast interrupts IPI5: 0 IRQ work interrupts IPI6: 0 CPU wake-up interrupts Err: 0 Fixes: 04ce935c6b2a ("gpio: pl061: Pass irqchip when adding gpiochip") Signed-off-by: Wei Xu --- drivers/gpio/gpio-pl061.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.8.1 . diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c index 722ce5c..e1a434e 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -8,6 +8,7 @@ * * Data sheet: ARM DDI 0190B, September 2000 */ +#include #include #include #include @@ -24,6 +25,9 @@ #include #include +#include "gpiolib.h" +#include "gpiolib-acpi.h" + #define GPIODIR 0x400 #define GPIOIS 0x404 #define GPIOIBE 0x408 @@ -345,6 +349,9 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) if (ret) return ret; + if (has_acpi_companion(dev)) + acpi_gpiochip_request_interrupts(&pl061->gc); + amba_set_drvdata(adev, pl061); dev_info(dev, "PL061 GPIO chip registered\n");