From patchwork Fri Nov 24 11:39:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 119575 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2091815qgn; Fri, 24 Nov 2017 03:42:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMafZ1/TkI4cmxF4IMyy1R2XJPcxiJGWi2OZ31r8ojeJTo86TlprLHxbTyUaWqwDX66DpwU4 X-Received: by 10.107.180.147 with SMTP id d141mr30979697iof.25.1511523728056; Fri, 24 Nov 2017 03:42:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511523728; cv=none; d=google.com; s=arc-20160816; b=L7NQOxrs8QIUYEYCKmpUDsWJ2MfygLUKt75bl6waouoMJwL6ZUHkr7DkkBUwcYl8yV gqQU3xcSlJ+lhcAI1NjkCoqsXHVIeyFOGmQl7kBmnBv+Gu2DIujDHoRSHoUqtKTXKdRC zzzM1P0RHDcFoOIBbcLX8w0jzAscyBMyimP0UHE1DZv+90h6+vqYj7cKxV57riurUkhC f+tnmEvknSKA7ywnm10qRPsMZf/+R8EtIoBBI+4VbmKNlZ9Vofoj976cT0ZrEyh2yvht LTySVJWGExpTRxt+UuT0clAttnlPlr13uCu5GWI2oS+HzBsUcNITCyrWMyJZWKe0x44j uJhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=w9zmYrouzxWgm6JpbKu11TDVZDg0t6EaMZe5hyxmMos=; b=hq0GRMmFxfwKSdgLtMdnWhuCWMPl9IBCIDtp6mWlLoKuamyREO1zVlm/ufWSQHe8ua RaN8r1qbOJIRWviFl0w2HeMwS9x43w5SKuJWCEB4LOakhQutghPLPmRIMRs5Wo7PfQPL Xy7FoApDwxDCHGkgD2lOEeg5DkeR2fZ5M6SDIM4DcKBs9HhpbVVRaub5sYiZKdoPfwSi u1WqvZ0uLdzwtimU1I2HXkbvG/fs0wMLe6MYebFIJpQSPFwUAdJtztQ7U0TyGNFeBFdd dgPtMGdqy13569FEiHNG0+V31qieuGT9azIUpkGV66PG7UQ34zxADmk51KjHVvH5LZuv Kljw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Q91hDhpT; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id c65si2022595itg.125.2017.11.24.03.42.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Nov 2017 03:42:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Q91hDhpT; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eICKY-00015E-9q; Fri, 24 Nov 2017 11:39:38 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eICKW-000150-W8 for xen-devel@lists.xenproject.org; Fri, 24 Nov 2017 11:39:37 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id 83/E7-27451-8F4081A5; Fri, 24 Nov 2017 11:39:36 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsXiVRvsovudRSL K4HuPjsX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmvFm3U/Wgq8yFW1n57A1MK4R72Lk4hASmMEo 0fz2LSOIwyIwj1liwZrjYI6EQD+rxIFjK9m7GDmBnDyJJe17mSDsNIkfdz6ydTFyANkVEj872 UDCQgJaEkdPzWaFmNrCJPHl9AF2kBo2AROJWR0SIDUiAkoS91ZNZgKpYRZ4ziRxaMJXZpCEsE CYRNea82CDWARUJV5deMoIYvMKeEusPfaIEWKvnMTNc51g9ZwCPhJnfn1ihVjsLfHv0Hy2CYy CCxgZVjGqF6cWlaUW6VroJRVlpmeU5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEBhwDEOxg PNjsfIhRkoNJSZS3o188SogvKT+lMiOxOCO+qDQntfgQowwHh5IE7w9miSghwaLU9NSKtMwcY OjDpCU4eJREeK+ApHmLCxJzizPTIVKnGC059u259YeJ49nM1w3MHNOutjYxC7Hk5eelSonzLg FpEABpyCjNgxsHi89LjLJSwryMQAcK8RSkFuVmlqDKv2IU52BUEuZ9BDKFJzOvBG7rK6CDmIA OenpSHOSgkkSElFQD40ZzwYlxvzbYbGV/O98vuzdCTveTkWem28n2r0e2e8kuVs5+tkTtaMe0 W/s1om0vJ4ttK01kKyiy8v84LX6e27eLfEfuzbtRWPc3t2D6iZdvD61nP2T0ZYXh597fT64tq Yjvvdq2lJ/17Iwcp749S+REJjWHbDowfffOzx5T7i925/w9VXZZ1G0lluKMREMt5qLiRADd16 uwygIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-14.tower-206.messagelabs.com!1511523574!69830096!1 X-Originating-IP: [74.125.83.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63858 invoked from network); 24 Nov 2017 11:39:35 -0000 Received: from mail-pg0-f68.google.com (HELO mail-pg0-f68.google.com) (74.125.83.68) by server-14.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 24 Nov 2017 11:39:35 -0000 Received: by mail-pg0-f68.google.com with SMTP id s11so15241405pgc.5 for ; Fri, 24 Nov 2017 03:39:35 -0800 (PST) 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=AO7hTeEqqoM1gnL+o4ZAMqcM355fPvcntn4YtSAg8jk=; b=Q91hDhpTrFjAX7/j9XLwfy/3AKeQXojTc8B37wy9lgGLf3MnDxOTbhmlRAA50usbOs NIrU66FBDAPHgGroRBTEagC02F9rnqq+ikBLmYHFJyNmuYIeGjM2Vi93hwhZjkBWslrm uPeo+zvvm+0S3cJElAphb4k98NJH+Vs5sik1Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AO7hTeEqqoM1gnL+o4ZAMqcM355fPvcntn4YtSAg8jk=; b=M3dF/069X744KzvUvvDS8hMLyTZaU13OyWFxBl4KuEgHfnZjrHTu+gVuZflYCB3Ggp Ud5Z41O+CqV9T/0QINm7xBSdUKno602NjP6013IRnIUN0zOgnNaSN2Y+zErVUlagZZRg gH/037ldQ5e5se46x8GE2yN0mD9eu9ikEbwiLIFNshiZCZUy+rZOL3fbBJpCerUbjcDf BMtvbhzcflPQ6R6XRwvjgMVyb9YvDfymkLaX/pOTESrgO4RbQt4CRU5HrCdZjNkjSi3C rUFjfQkNgETIrvk+AM43rJkMm19udZ1i6fhqxB4lZub9zPe4ETXD6CrvbEP5SCQ2jarV UudQ== X-Gm-Message-State: AJaThX6nbExTl6wiIYukhlQCUQTCqR8+iz+bd5KVb2wHATbbaqC3UE40 5TbWeh8QsWPATATDBK9tUydS9TS4B48= X-Received: by 10.99.168.67 with SMTP id i3mr28338792pgp.63.1511523573809; Fri, 24 Nov 2017 03:39:33 -0800 (PST) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id x6sm33141985pfx.15.2017.11.24.03.39.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Nov 2017 03:39:33 -0800 (PST) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 24 Nov 2017 17:09:12 +0530 Message-Id: <1511523552-23628-4-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511523552-23628-1-git-send-email-bhupinder.thakur@linaro.org> References: <1511523552-23628-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH 3/3 v3] xen: Fix 16550 UART console for HP Moonshot (Aarch64) platform X-BeenThere: xen-devel@lists.xenproject.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.xenproject.org Sender: "Xen-devel" The console was not working on HP Moonshot (HPE Proliant Aarch64) because the UART registers were accessed as 8-bit aligned addresses. However, registers are 32-bit aligned for HP Moonshot. Since ACPI/SPCR table does not specify the register shift to be applied to the register offset, this patch implements an erratum to correctly set the register shift for HP Moonshot. Similar erratum was implemented in linux in the following commit: commit 79a648328d2a604524a30523ca763fbeca0f70e3 Author: Loc Ho Date: Mon Jul 3 14:33:09 2017 -0700 ACPI: SPCR: Workaround for APM X-Gene 8250 UART 32-alignment errata APM X-Gene verion 1 and 2 have an 8250 UART with its register aligned to 32-bit. In addition, the latest released BIOS encodes the access field as 8-bit access instead 32-bit access. This causes no console with ACPI boot as the console will not match X-Gene UART port due to the lack of mmio32 option. Signed-off-by: Loc Ho Acked-by: Greg Kroah-Hartman Signed-off-by: Rafael J. Wysocki Signed-off-by: Bhupinder Thakur Reviewed-by: Konrad Rzeszutek Wilk --- Changes since v2: - removed the use of local variable xgene_8250 in xgene_8250_erratum_present CC: Andrew Cooper CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Wei Liu CC: Julien Grall xen/drivers/char/ns16550.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index af4712f..8c4720a 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1571,6 +1571,30 @@ DT_DEVICE_END #endif /* HAS_DEVICE_TREE */ #if defined(CONFIG_ACPI) && defined(CONFIG_ARM) +/* + * APM X-Gene v1 and v2 UART hardware is an 16550 like device but has its + * register aligned to 32-bit. In addition, the BIOS also encoded the + * access width to be 8 bits. This function detects this errata condition. + */ +static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb) +{ + if ( tb->interface_type != ACPI_DBG2_16550_COMPATIBLE ) + return false; + + if ( memcmp(tb->header.oem_id, "APMC0D", ACPI_OEM_ID_SIZE) && + memcmp(tb->header.oem_id, "HPE ", ACPI_OEM_ID_SIZE) ) + return false; + + if ( !memcmp(tb->header.oem_table_id, "XGENESPC", + ACPI_OEM_TABLE_ID_SIZE) && tb->header.oem_revision == 0 ) + return true; + + if ( !memcmp(tb->header.oem_table_id, "ProLiant", + ACPI_OEM_TABLE_ID_SIZE) && tb->header.oem_revision == 1 ) + return true; + + return false; +} static int ns16550_init_acpi(struct ns16550 **puart) { @@ -1596,7 +1620,19 @@ static int ns16550_init_acpi(struct ns16550 **puart) uart->io_base = spcr->serial_port.address; uart->irq = spcr->interrupt; uart->reg_width = spcr->serial_port.bit_width / 8; - uart->reg_shift = 0; + + if ( xgene_8250_erratum_present(spcr) ) + { + /* + * For xgene v1 and v2 the registers are 32-bit and so a + * register shift of 2 has to be applied to get the + * correct register offset. + */ + uart->reg_shift = 2; + } + else + uart->reg_shift = 0; + uart->io_size = UART_NUM_REGS << uart->reg_shift; irq_set_type(spcr->interrupt, spcr->interrupt_type);