From patchwork Fri Apr 1 15:49:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8726271 Return-Path: X-Original-To: patchwork-linux-arm@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 1DB36C0553 for ; Fri, 1 Apr 2016 15:54:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49C2F201FA for ; Fri, 1 Apr 2016 15:54:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 80BBF20145 for ; Fri, 1 Apr 2016 15:54:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1am1Nk-0005ZL-Ih; Fri, 01 Apr 2016 15:53:08 +0000 Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1am1Lf-0002tv-6q for linux-arm-kernel@lists.infradead.org; Fri, 01 Apr 2016 15:51:05 +0000 Received: by mail-pa0-x230.google.com with SMTP id td3so93479028pab.2 for ; Fri, 01 Apr 2016 08:50:39 -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=E5X5+IGcFP1Z53M59tqPXuph9gB0OIdLnQuk/M4rOZohuhZZo+6QXYZrs4aPZ9LbZd C1mdIYj2nLg6Gw7PQS4Cz3jR65xyOjfM5Hf6Ewrm/h5Xm6WkYKEej0JIB4+sEIXLeYvB l54YtfCaFhMbxVWTgtpOPUKqS0VgfYktrTk6U= 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=ZE9k1mLCMuwmM8qTLndQ0Bnxq7ZmklSHJm3S3KfncIblbJ560ZNligjc+xuVHsQO+L DiCmGJV6mgoC9WW5qIx9ToFWXbCreBRowtIGUlr2xKhkCfOAQfo+LS8was1xt+wWmz7Y nPlGfKGFWhyyXL/cW6CyYo3NExjlvb76fT2M2OnZRiG0UM0FOSpOhjbF9SKzdl6AVnfr pFDuxI4fbnmvr6hgpwlDb+s1FJGHeLCxTTBMgE44HKN0fyOlU55t0WQ5+mWHKAJXnGDN xETj1gRetE7KOcOJytQ+KPNzYagVXTCRaMtvOgDAinzu4lKRlJAEMIS2MyFQEZ/GYZ0M M0fg== X-Gm-Message-State: AD7BkJKPakPJNruB+CtgWDA9ugxA1mhkRbIa9kbW6oljUqC3/AQ1OiiRaephvCqSKCgnpF9M X-Received: by 10.66.118.7 with SMTP id ki7mr32128985pab.152.1459525838662; Fri, 01 Apr 2016 08:50:38 -0700 (PDT) Received: from localhost.localdomain ([167.160.116.218]) by smtp.gmail.com with ESMTPSA id yj1sm22536791pac.16.2016.04.01.08.50.30 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 01 Apr 2016 08:50:37 -0700 (PDT) From: Shannon Zhao To: linux-arm-kernel@lists.infradead.org, stefano.stabellini@citrix.com Subject: [PATCH v10 07/17] Xen: ARM: Add support for mapping AMBA device mmio Date: Fri, 1 Apr 2016 23:49:05 +0800 Message-Id: <1459525755-36968-8-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1459525755-36968-1-git-send-email-shannon.zhao@linaro.org> References: <1459525755-36968-1-git-send-email-shannon.zhao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160401_085100_028809_3B95BDFB X-CRM114-Status: GOOD ( 12.70 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, david.vrabel@citrix.com, zhaoshenglong@huawei.com, xen-devel@lists.xen.org, shannon.zhao@linaro.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-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,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 Reviewed-by: Julien Grall --- 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