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: 64372 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp697182lbc; Thu, 24 Mar 2016 07:47:55 -0700 (PDT) X-Received: by 10.98.15.23 with SMTP id x23mr13490192pfi.60.1458830856097; Thu, 24 Mar 2016 07:47:36 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kv12si2484027pab.194.2016.03.24.07.47.35; Thu, 24 Mar 2016 07:47:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757428AbcCXOrT (ORCPT + 7 others); Thu, 24 Mar 2016 10:47:19 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35828 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752825AbcCXOrN (ORCPT ); Thu, 24 Mar 2016 10:47:13 -0400 Received: by mail-pa0-f47.google.com with SMTP id td3so23721680pab.2 for ; Thu, 24 Mar 2016 07:47:13 -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=ZLjF8L6hMWP4s8iExzH75m8o8NfY1/C6H6cOuJSm7qjXqJ11V63Ykx2sEmTWulb1ye Lr/vTPcq1uh6N8m9I1ur0L6tbA7sqvYGtjVRiZ4TJtUwMQ75jf1HnGvW9kThjuHXohSV hLiQMZkHgYG8DRnjZS9vBWc70xbckRP4MROxGL7JACK+wcwkBlHXJG/g2wfdw2lEBxxv kxZQ3owsQs5p4ce/N+cXVspif/HsmC/ggljs4sBiFBNX6r9G05Es1XNUbxaa+3dQgXcI i9qPNGf7l9uGnMsoG95Ohs1TihUhNKM2EHQol3mLy9C1C0P6oyR0Sdy1EPnfcP+qsO0Q qGIg== X-Gm-Message-State: AD7BkJKB0/vXPnEJ3o/8pdwpFf/vFgZTwVLxY29xlSGhyMkiy2WqJSKCxNLwoYvbO7+xikre 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 Cc: devicetree@vger.kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, julien.grall@arm.com, peter.huangpeng@huawei.com, xen-devel@lists.xen.org, zhaoshenglong@huawei.com, shannon.zhao@linaro.org Subject: [PATCH v7 07/17] Xen: ARM: Add support for mapping AMBA device mmio 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> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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(+) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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