Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1500210imu; Mon, 5 Nov 2018 22:50:17 -0800 (PST) X-Google-Smtp-Source: AJdET5c4Br9vHqTuJ6mttQGZO6T8f+66XcPYq0ArhHuFwN9b8zid7t01foeIWDtsJnuu6GwFjd30 X-Received: by 2002:a63:c447:: with SMTP id m7mr20249848pgg.27.1541487017677; Mon, 05 Nov 2018 22:50:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541487017; cv=none; d=google.com; s=arc-20160816; b=CsV9uVSHTPs9RY+Kwo2gCgwAXAXtJdmbecJaj8RNCAe5meKqrTT8zjlfuOTR+L9Epw TSkbi20biSzxUu8VSWbFknx1ytSycwp3rAmmAhF6Qeip1muxAmmhXK16jYX9RgP+HTmh 9jra8DaMEJhjUBpd2didka0NOnNOQ9ul5TvCZ89UiCan/2j6v0q2NO7O0Y4iPcHmIwYz kGNrBmyxTGg8GboomPeB02u5G5vVO2E2js9nZUiDI+AYJRR58oTRBnSPlTbGMNKKMaHZ goMjGykOL2TL4x+MWuQ2ZOungF2J7whE9Kt++fVMPf02bjIMJHAT/0rzaZYWBTCM9g7L HBfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Bv+I4cZWz/7OSnebPzabzctlazRlUw6DC1PF6SY/M5o=; b=DPwSvw4k9LwhICR6xtk8JMsPjAUdGMkapPUMtrH1darZNc15z3oed2OmytGnT2InfV 0N74X8WreifYXLXTB4aJVqxPUjyWXeWmh6QAlTN2iddMvB5Dp+w1aitQWo48RTeJ0cZq oo9uJoLmth9W1bZjW2+K9te+C87bHzu/Vux7kBIS3JRUtv9/SIUUzbzxl+Q4aG6m3+/v HuAHtFe1N/D2whCgvkRru9BQbaj25x1sNmOQNLVZjTe3LWfGEIgDkgR3b0T/Ze/UexbS MBDiTpWck/QkI/RmdA00XQmeRKhVrDsl5DSIkhHpJH5FZV+B/EJHB5mqvQdd29wWydXL 31mw== 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 o1-v6si45373611pgh.193.2018.11.05.22.50.02; Mon, 05 Nov 2018 22:50:17 -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 S2387902AbeKFQLm (ORCPT + 99 others); Tue, 6 Nov 2018 11:11:42 -0500 Received: from out1.zte.com.cn ([202.103.147.172]:47578 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387731AbeKFQLm (ORCPT ); Tue, 6 Nov 2018 11:11:42 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 1E389EBB46DCC869C012; Tue, 6 Nov 2018 14:47:16 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wA66l8Uq044657; Tue, 6 Nov 2018 14:47:08 +0800 (GMT-8) (envelope-from peng.hao2@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.74.120.59]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018110614472243-8886602 ; Tue, 6 Nov 2018 14:47:22 +0800 From: Peng Hao To: robh+dt@kernel.org, mark.rutland@arm.com, arnd@arndb.de, gregkh@linuxfoundation.org, andy@infradead.org, dvhart@infradead.org Cc: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, hutao@cn.fujitsu.com, linux-doc@vger.kernel.org, Peng Hao Subject: [PATCH V8 05/11] misc/pvpanic: add support to get pvpanic device info FDT Date: Tue, 6 Nov 2018 22:57:16 +0800 Message-Id: <1541516242-98568-5-git-send-email-peng.hao2@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1541516242-98568-1-git-send-email-peng.hao2@zte.com.cn> References: <1541516242-98568-1-git-send-email-peng.hao2@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-11-06 14:47:22, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-06 14:47:04, Serialize complete at 2018-11-06 14:47:04 X-MAIL: mse01.zte.com.cn wA66l8Uq044657 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org By default, when ACPI tables and FDT coexist for ARM64, current kernel takes precedence over FDT to get device information. Virt machine in qemu provides both FDT and ACPI table. Increases the way to get information through FDT. Acked-by: Mark Rutland Signed-off-by: Peng Hao --- drivers/misc/pvpanic.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c index e923dac..c7f62bd 100644 --- a/drivers/misc/pvpanic.c +++ b/drivers/misc/pvpanic.c @@ -2,6 +2,7 @@ * pvpanic.c - pvpanic Device Support * * Copyright (C) 2013 Fujitsu. + * Copyright (C) 2018 ZTE. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +23,9 @@ #include #include +#include +#include +#include #include #include #include @@ -123,4 +127,62 @@ static int pvpanic_remove(struct acpi_device *device) return 0; } -module_acpi_driver(pvpanic_driver); +static int pvpanic_mmio_probe(struct platform_device *pdev) +{ + struct resource *mem; + + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!mem) + return -EINVAL; + + base = devm_ioremap_resource(&pdev->dev, mem); + if (base == NULL) + return -EFAULT; + + atomic_notifier_chain_register(&panic_notifier_list, + &pvpanic_panic_nb); + + return 0; +} + +static int pvpanic_mmio_remove(struct platform_device *pdev) +{ + + atomic_notifier_chain_unregister(&panic_notifier_list, + &pvpanic_panic_nb); + + return 0; +} + +static const struct of_device_id pvpanic_mmio_match[] = { + { .compatible = "qemu,pvpanic-mmio", }, + {} +}; + +static struct platform_driver pvpanic_mmio_driver = { + .driver = { + .name = "pvpanic-mmio", + .of_match_table = pvpanic_mmio_match, + }, + .probe = pvpanic_mmio_probe, + .remove = pvpanic_mmio_remove, +}; + +static int __init pvpanic_mmio_init(void) +{ + if (acpi_disabled) + return platform_driver_register(&pvpanic_mmio_driver); + else + return acpi_bus_register_driver(&pvpanic_driver); +} + +static void __exit pvpanic_mmio_exit(void) +{ + if (acpi_disabled) + platform_driver_unregister(&pvpanic_mmio_driver); + else + acpi_bus_unregister_driver(&pvpanic_driver); +} + +module_init(pvpanic_mmio_init); +module_exit(pvpanic_mmio_exit); -- 1.8.3.1