From nobody Sat May 4 02:47:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1564406434; cv=none; d=zoho.com; s=zohoarc; b=VfC/qgrsNly8C0t/qTWPnpanbTV+4dGXXa2sRborWUsRDweLuzxkvljaoJhvudcJAT986TEUQwxNrMjPXtiFfExbhXkBXpAKG56VFDlAdjDstqnnGQV/QVLLx9jTuM3yHXPKWmKYqO/My5gmv4vTgX2Jx1EdSj54L2qBsP8p+AY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564406434; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/j3OpNoQTV5rv5u+oheaY/eqJsEuKaCHneGIkAMsqoQ=; b=ZOJfH5huuwKqlL1rDVtCz7HB66VK8I0v66/mKhIBqHfYiMeg4OJ6iIj+x3ydCL5FTit8W2SRXCWhHqmRDawEh5/4qRZXYnT1CNwN4Z3L7yQQncBsClhb4b0TC9dK0JkbEtYy/LnkLk1BbFAiVF4lDQxFBqbRjgR2Jz3KBrR4Yu8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1564406434788487.69726891005826; Mon, 29 Jul 2019 06:20:34 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hs5Yp-0004WA-UB; Mon, 29 Jul 2019 13:19:31 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hs5Yo-0004Vy-Ua for xen-devel@lists.xenproject.org; Mon, 29 Jul 2019 13:19:30 +0000 Received: from webmail.dornerworks.com (unknown [12.207.209.150]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 7e3b0d5c-b203-11e9-8980-bc764e045a96; Mon, 29 Jul 2019 13:19:30 +0000 (UTC) X-Inumbo-ID: 7e3b0d5c-b203-11e9-8980-bc764e045a96 From: Stewart Hildebrand To: Date: Mon, 29 Jul 2019 09:19:19 -0400 Message-ID: <6f94e7b0f1cfe98a640d7f9ff59f18f299fd0d7d.1564371527.git.stewart.hildebrand@dornerworks.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [172.27.12.5] X-ClientProxiedBy: Mcbain.dw.local (172.27.1.45) To Mcbain.dw.local (172.27.1.45) X-spam-status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED, BAYES_00, MAILSHELL_SCORE_0_4 X-Spam-Flag: NO Subject: [Xen-devel] [PATCH v2 1/2] ns16550: Add compatible string for Raspberry Pi 4 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Andre Przywara Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Per the BCM2835 peripherals datasheet [1] page 10: "The UART core is build to emulate 16550 behaviour ... The implemented UART is not a 16650 compatible UART However as far as possible the first 8 control and status registers are laid out like a 16550 UART. Al 16550 register bits which are not supported can be written but will be ignored and read back as 0. All control bits for simple UART receive/ transmit operations are available." Additionally, Linux uses the 8250/16550 driver for the aux UART [2]. Unfortunately the brcm,bcm2835-aux-uart device tree binding doesn't have the reg-shift and reg-io-width properties [3]. Thus, the reg-shift and reg-io-width properties are inherent properties of this UART. Thanks to Andre Przywara for contributing the reg-shift and reg-io-width setting snippet. In my testing, I have relied on enable_uart=3D1 being set in config.txt, a configuration file read by the Raspberry Pi's firmware. With enable_uart=3D1, the firmware performs UART initialization. [1] https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/= BCM2835-ARM-Peripherals.pdf [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/d= rivers/tty/serial/8250/8250_bcm2835aux.c [3] https://www.kernel.org/doc/Documentation/devicetree/bindings/serial/brc= m,bcm2835-aux-uart.txt Signed-off-by: Stewart Hildebrand Acked-by: Julien Grall Reviewed-by: Andre Przywara Tested-by: Andre Przywara --- xen/drivers/char/ns16550.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index e518f2d790..8667de6d67 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1585,6 +1585,12 @@ static int __init ns16550_uart_dt_init(struct dt_dev= ice_node *dev, if ( uart->reg_width !=3D 1 && uart->reg_width !=3D 4 ) return -EINVAL; =20 + if ( dt_device_is_compatible(dev, "brcm,bcm2835-aux-uart") ) + { + uart->reg_width =3D 4; + uart->reg_shift =3D 2; + } + res =3D platform_get_irq(dev, 0); if ( ! res ) return -EINVAL; @@ -1611,6 +1617,7 @@ static const struct dt_device_match ns16550_dt_match[= ] __initconst =3D DT_MATCH_COMPATIBLE("ns16550"), DT_MATCH_COMPATIBLE("ns16550a"), DT_MATCH_COMPATIBLE("snps,dw-apb-uart"), + DT_MATCH_COMPATIBLE("brcm,bcm2835-aux-uart"), { /* sentinel */ }, }; =20 --=20 2.22.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Sat May 4 02:47:22 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1564406433; cv=none; d=zoho.com; s=zohoarc; b=kfHTWG+hc/CZVXmXwpCjg14ljU5C28ww3D3rKyumczb+wqhenupk35TQ1b2ICtdJsI+2tbx4CjmwmbVZ3E2CXcYu9YEtpvNMk2qP/tP0uflOqoWoJ3LOAoTwcDD7vlUQg2WEzlqWKrsh1f2g7/+88U/ihft+cm5OQwRcl/qPoXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564406433; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=+yy03MwMkMUPqGpjJ9B9PexVY5RBiTTyqHupAiyj2Aw=; b=OyWCP1xNXNc3Xlh2tUq2TgHBwEGVDP0XZwGM0nhjiJfA9uVPtse+5CQN6M7BwVr/FesHoeDj0df2shFT2XE5RbrfCU39SquJ0dsUI+wyDbLaaSC5teurXZ4jdhP9dtPIiNbqgNJSL08V9bVlqRYS90tWk2NkykvUPz00LKPIwms= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1564406433293583.6360573883222; Mon, 29 Jul 2019 06:20:33 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hs5Yt-0004Wy-61; Mon, 29 Jul 2019 13:19:35 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hs5Yr-0004WR-OM for xen-devel@lists.xenproject.org; Mon, 29 Jul 2019 13:19:33 +0000 Received: from webmail.dornerworks.com (unknown [12.207.209.150]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 7f8d9030-b203-11e9-8980-bc764e045a96; Mon, 29 Jul 2019 13:19:32 +0000 (UTC) X-Inumbo-ID: 7f8d9030-b203-11e9-8980-bc764e045a96 From: Stewart Hildebrand To: Date: Mon, 29 Jul 2019 09:19:20 -0400 Message-ID: <2473fc46a8229bb2434a90a510136202e7479177.1564371527.git.stewart.hildebrand@dornerworks.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [172.27.12.5] X-ClientProxiedBy: Mcbain.dw.local (172.27.1.45) To Mcbain.dw.local (172.27.1.45) X-spam-status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED, BAYES_00, MAILSHELL_SCORE_0_4 X-Spam-Flag: NO Subject: [Xen-devel] [PATCH v2 2/2] xen/arm: platform: Add Raspberry Pi platform X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andre Przywara , Julien Grall , Stefano Stabellini , Volodymyr Babchuk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The aux peripherals (uart1, spi1, and spi2) share an IRQ and a page of memory. For debugging, it is helpful to use the aux UART in Xen. In this case, Xen would try to assign spi1 and spi2 to dom0, but this results in an error since the shared IRQ was already assigned to Xen. Blacklist aux devices other than the UART to prevent mapping the shared IRQ and memory range to dom0. Signed-off-by: Stewart Hildebrand Acked-by: Julien Grall --- xen/arch/arm/platforms/Makefile | 1 + xen/arch/arm/platforms/brcm-raspberry-pi.c | 55 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 xen/arch/arm/platforms/brcm-raspberry-pi.c diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makef= ile index 01608f89ee..8632f4115f 100644 --- a/xen/arch/arm/platforms/Makefile +++ b/xen/arch/arm/platforms/Makefile @@ -8,5 +8,6 @@ obj-$(CONFIG_ALL64_PLAT) +=3D seattle.o obj-$(CONFIG_ALL_PLAT) +=3D sunxi.o obj-$(CONFIG_ALL64_PLAT) +=3D thunderx.o obj-$(CONFIG_ALL64_PLAT) +=3D xgene-storm.o +obj-$(CONFIG_ALL64_PLAT) +=3D brcm-raspberry-pi.o obj-$(CONFIG_MPSOC_PLATFORM) +=3D xilinx-zynqmp.o obj-$(CONFIG_MPSOC_PLATFORM) +=3D xilinx-zynqmp-eemi.o diff --git a/xen/arch/arm/platforms/brcm-raspberry-pi.c b/xen/arch/arm/plat= forms/brcm-raspberry-pi.c new file mode 100644 index 0000000000..e22d2b3184 --- /dev/null +++ b/xen/arch/arm/platforms/brcm-raspberry-pi.c @@ -0,0 +1,55 @@ +/* + * xen/arch/arm/platforms/brcm-raspberry-pi.c + * + * Raspberry Pi 4 Platform specific settings. + * + * Stewart Hildebrand + * Copyright (c) 2019 DornerWorks, Ltd + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include + +static const char *const brcm_bcm2838_dt_compat[] __initconst =3D +{ + "brcm,bcm2838", + NULL +}; + +static const struct dt_device_match brcm_bcm2838_blacklist_dev[] __initcon= st =3D +{ + /* + * The aux SPIs share an IRQ and a page with the aux UART. + * If the same page gets mapped to dom0 and Xen, there is risk of + * dom0 writing to the UART that Xen controls. + */ + DT_MATCH_COMPATIBLE("brcm,bcm2835-aux-spi"), + /* + * The aux peripheral also shares a page with the aux UART. + */ + DT_MATCH_COMPATIBLE("brcm,bcm2835-aux"), + { /* sentinel */ }, +}; + +PLATFORM_START(brcm_bcm2838, "Raspberry Pi 4") + .compatible =3D brcm_bcm2838_dt_compat, + .blacklist_dev =3D brcm_bcm2838_blacklist_dev, +PLATFORM_END + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ --=20 2.22.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel