From patchwork Thu Mar 24 14:44:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8661661 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D0E01C0553 for ; Thu, 24 Mar 2016 14:49:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBE502041D for ; Thu, 24 Mar 2016 14:49:34 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2347C203DC for ; Thu, 24 Mar 2016 14:49:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj6Xd-00037h-Gf; Thu, 24 Mar 2016 14:47:17 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj6Xb-000378-PZ for xen-devel@lists.xen.org; Thu, 24 Mar 2016 14:47:15 +0000 Received: from [193.109.254.147] by server-12.bemta-14.messagelabs.com id 2F/54-02979-3FDF3F65; Thu, 24 Mar 2016 14:47:15 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-7.tower-27.messagelabs.com!1458830832!33620316!1 X-Originating-IP: [209.85.220.41] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7277 invoked from network); 24 Mar 2016 14:47:14 -0000 Received: from mail-pa0-f41.google.com (HELO mail-pa0-f41.google.com) (209.85.220.41) by server-7.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 24 Mar 2016 14:47:14 -0000 Received: by mail-pa0-f41.google.com with SMTP id tt10so23992629pab.3 for ; Thu, 24 Mar 2016 07:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PO2yePTVVNjv+ScXuWCyBYXqVDxmpUUcbVXBLwhhHcE=; b=UOI+xcwrcDDpUc0JSGm9q5w68DpJMMZbTv1a3l6FJ8QKoAQ/kLjuAL3LWNKc+vZhbR otU848Q3+1DEjmVCXXfb7+LcvWcdBOi4EnI8u4wdR7W4U96uwAhzaMp7OpNO6bCKR3k0 aQCtoUjkBkWtLarZMqjqu7OF9vkohkxJagrdg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PO2yePTVVNjv+ScXuWCyBYXqVDxmpUUcbVXBLwhhHcE=; b=HqX6nDP0rYcbZ2vrkFKJpEhsh92cYQtAPSWNeMO46UNTYgTq2Hq/vyIMxnOYdQgrgG wxyjsSy0rVzYjrE8033g593DEqrT2KdZySycOIOl0q4JGgMkRgsGtPxIumUXZUbpYnyQ E+5oFFIAzZfXOj50ObuEvZLgAO+tULOHyMmVdoYMFgbrNF/uNGAPLymLUPAy1w/Yiyab iCvT9Pi2fq9+Z5NEM6jzPF5KEOeTAQ62wcgSvTDxxC74iX/jg66yC5y25K3/TcYxh5FS +a0hUghLjCEfqhuerVhe4uV2ubgDis4V4jHe9/lijEtpGwF6nqcASCcilcu2WxaM8ltR 7Kdw== X-Gm-Message-State: AD7BkJJ3s3iNtPcc7j6lT5N3O0bCoeVNV/9m+/m2FfKY6qPdXXkZ2g49z2NWGJN2KbZdW+7C X-Received: by 10.66.248.198 with SMTP id yo6mr13277376pac.54.1458830832639; Thu, 24 Mar 2016 07:47:12 -0700 (PDT) Received: from localhost.localdomain ([104.238.45.135]) by smtp.gmail.com with ESMTPSA id lq10sm10780673pab.36.2016.03.24.07.47.00 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 24 Mar 2016 07:47:11 -0700 (PDT) From: Shannon Zhao To: linux-arm-kernel@lists.infradead.org, stefano.stabellini@citrix.com, david.vrabel@citrix.com Date: Thu, 24 Mar 2016 22:44:26 +0800 Message-Id: <1458830676-27075-8-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458830676-27075-1-git-send-email-shannon.zhao@linaro.org> References: <1458830676-27075-1-git-send-email-shannon.zhao@linaro.org> Cc: devicetree@vger.kernel.org, linux-efi@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, peter.huangpeng@huawei.com, julien.grall@arm.com, shannon.zhao@linaro.org, zhaoshenglong@huawei.com, xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH v7 07/17] Xen: ARM: Add support for mapping AMBA device mmio X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a bus_notifier for AMBA bus device in order to map the device mmio regions when DOM0 booting with ACPI. Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini --- drivers/xen/arm-device.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/xen/arm-device.c b/drivers/xen/arm-device.c index 76e26e5..3854043 100644 --- a/drivers/xen/arm-device.c +++ b/drivers/xen/arm-device.c @@ -139,3 +139,46 @@ static int __init register_xen_platform_notifier(void) } arch_initcall(register_xen_platform_notifier); + +#ifdef CONFIG_ARM_AMBA +#include + +static int xen_amba_notifier(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct amba_device *adev = to_amba_device(data); + int r = 0; + + switch (action) { + case BUS_NOTIFY_ADD_DEVICE: + r = xen_map_device_mmio(&adev->res, 1); + break; + case BUS_NOTIFY_DEL_DEVICE: + r = xen_unmap_device_mmio(&adev->res, 1); + break; + default: + return NOTIFY_DONE; + } + if (r) + dev_err(&adev->dev, "AMBA: Failed to %s device %s MMIO!\n", + action == BUS_NOTIFY_ADD_DEVICE ? "map" : + (action == BUS_NOTIFY_DEL_DEVICE ? "unmap" : "?"), + adev->dev.init_name); + + return NOTIFY_OK; +} + +static struct notifier_block amba_device_nb = { + .notifier_call = xen_amba_notifier, +}; + +static int __init register_xen_amba_notifier(void) +{ + if (!xen_initial_domain() || acpi_disabled) + return 0; + + return bus_register_notifier(&amba_bustype, &amba_device_nb); +} + +arch_initcall(register_xen_amba_notifier); +#endif