From patchwork Thu Nov 9 10:19:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 118423 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp741437edl; Thu, 9 Nov 2017 02:21:38 -0800 (PST) X-Google-Smtp-Source: ABhQp+RjpTNFW01kRLC6pXbRuJefN810UM/otxwHgXz/sNTtWt6uw7cIT/R9BKX7A8sMHyUSa1lH X-Received: by 10.36.88.137 with SMTP id f131mr4436382itb.4.1510222898121; Thu, 09 Nov 2017 02:21:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510222898; cv=none; d=google.com; s=arc-20160816; b=eDH6HCXaoPVhJVXxjrp3nCEIJfbEhQqEzxMePzY772V2kXkKE3h+0Ue+BVR/ncDNra VMPUl+19E1C+ELU6qyoKO0Sb4wrWy6h48TObgOFQCMZ0vImRbXKvjUfd0PFBamRq899U dXFNuodD/hfNKmlaTKGQBjwv5HkXFQKMM6wRp3/9ygZ2UXzdOhfvw3fSbnnRCXcGfNhz iVLfi8ImJhQkTFGkFLMUlwfliAVBZbNsHYEkbp4XlLhx5cIo1IKCufjtKx/1BMa7RxwI 8n2MAzMk4qm/rqQFxOe2NvugyOgFQlvLUIF7nLqGGvv+4TrSfhK9OWXI57HL5VkS9Xr7 +2og== 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=ydow1mgrn7iKnqCKPG/BQA82n3ePmt3B/Tej5k/wmiE=; b=ohAVDHubj1XKSUODnYBjiVQfnRL9Dh834Es11RbbY8BCahpHCjpqeS9UaPVjd8ZIdy uF7Gj42T56bmH8OBs9ot4DUqeC/phAySqX1othVf+iypZ57idsvedHq6QYyX7B9RhH3S Jv/IuUYI6XPqjrmcFiyGiVMGT5nVT0R7zngUySBee5prTDnkIzWqO1mnUQ/edUwWPnYU qUFwhNVzkonlOOOTkw+edNu/L73MlsTA7Og9KBgV0+q66NqG0PpX3DaEGqAz+k/DZKwS 7iwu1JCT5CZWuchouVBXZjhfUKFcxUMsDFD2zdNE6LvHdihGuWINlxBKC6Qtf6SZSMsR CGfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=c7CWSGTz; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.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 d75si5675436iod.226.2017.11.09.02.21.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Nov 2017 02:21:38 -0800 (PST) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) 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=c7CWSGTz; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.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 1eCjw2-0007Zd-DT; Thu, 09 Nov 2017 10:19:46 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCjw0-0007Yh-LD for xen-devel@lists.xenproject.org; Thu, 09 Nov 2017 10:19:44 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id AA/B5-15886-FBB240A5; Thu, 09 Nov 2017 10:19:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsXiVRvsqLtfmyX K4NJ5XovvWyYzOTB6HP5whSWAMYo1My8pvyKBNePH42bWghuyFUdmN7E0MG4Q72Lk4hASmM4o cXzKe2YQh0VgHrNE48tWpi5GTg4JgX5WiZbvsRB2nkT/k0lsEHaaxMV771kg7AqJrnUT2EFsI QEtiaOnZrNCTG1hktjxbzlQEQcHm4CJxKwOCZAaEQEliXurJjOB1DALPGeSODThKzNIQlggTO LIhV1gi1kEVCUure0BG8or4C1x8vQqqIPkJG6e6wSr5xTwkWg4uIgJZL4QUM2bD94TGAUXMDK sYtQoTi0qSy3SNTLQSyrKTM8oyU3MzNE1NDDWy00tLk5MT81JTCrWS87P3cQIDLh6BgbGHYzN J/wOMUpyMCmJ8j54xRQlxJeUn1KZkVicEV9UmpNafIhRhoNDSYL3mBZLlJBgUWp6akVaZg4w9 GHSEhw8SiK880DSvMUFibnFmekQqVOMlhz79tz6w8TxbObrBmaOaVdbm5iFWPLy81KlxHm3gz QIgDRklObBjYPF5yVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrwHQKbwZOaVwG19BXQQE9B B0exgB5UkIqSkGhgjAm9JL7if+CrEqev810SF+qtpazWz/ltrli/LSC7d4Dzv9SbHBOlKtm0/ mDafF5ow95zGdtWFp+ZwfDa/Ip3z7369ZoqSVwvD5XVbuo/uehtz0v2G+PtLjz8dmz5DTvuSW 82X86wqE0TNRece9b2h9OXjquxT3TekZA8sff2C753XlXO3X5ctVGIpzkg01GIuKk4EAIlXQn LKAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-14.tower-31.messagelabs.com!1510222782!114041455!1 X-Originating-IP: [74.125.83.65] 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 13597 invoked from network); 9 Nov 2017 10:19:43 -0000 Received: from mail-pg0-f65.google.com (HELO mail-pg0-f65.google.com) (74.125.83.65) by server-14.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 9 Nov 2017 10:19:43 -0000 Received: by mail-pg0-f65.google.com with SMTP id s75so4320239pgs.0 for ; Thu, 09 Nov 2017 02:19:42 -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=XvX3HGKnzxrOCSAx/jzxhxa+FKAyUYSlRcfXqggaSbw=; b=c7CWSGTz1nX3GMn/m1dM+2TJtVAgag9YRNV9lxkQ8y4TFYQnpSEvndTOifYN09GWEy bJVoEmFeyCHw6mLBK6NQhGtkBWB1PLnpcKnJ2rOUM8mcMmXO2DWW2jpQmz1A9k2F1vHr Fn7fB2YpKgCV13CZjvmMHz/G/ctmA16eo+doI= 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=XvX3HGKnzxrOCSAx/jzxhxa+FKAyUYSlRcfXqggaSbw=; b=GwrmDjRGow+3VGV+xedt13qk2BE2kkRN3dZx6UiI7gcHJi3ngmq5BAwIsu8mddn3TI 7/0Dosv/mWXZ/hs4LSxul3+hiFrWUcNRzvW+5vVThI9BJN9Ql8BSJQIfAT5OdI/9YOTS I6/sV9HoY2j3RTEz6DgderSbY5MPb/+NDE6qAYq6jmxI6mLHrDddRUF8j0wAE+35DSLF H5MPUlh6b+6bo7g0CbmyhfHTBan45b6YZPO7EzEnfvRWFHZAem34J/tPDJRdhigv2p5M 597ZmKYrq9YktlacSEhvdMtrx78x1rN/eTmnUsXfES8tkZtCiBrYbeVTPgvnntWn0+Tv 4gyQ== X-Gm-Message-State: AJaThX4+WaVd5YCuEkXICvX7he5IkVtxH11C6WesHfx+oiF1M1Mv6HfB Wuh4qfd6E4Y9qohWhDnJNQ/qgjwMmAc= X-Received: by 10.99.123.90 with SMTP id k26mr3453767pgn.33.1510222781420; Thu, 09 Nov 2017 02:19:41 -0800 (PST) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id f12sm11467975pga.7.2017.11.09.02.19.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Nov 2017 02:19:40 -0800 (PST) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Thu, 9 Nov 2017 15:49:24 +0530 Message-Id: <1510222764-11746-3-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510222764-11746-1-git-send-email-bhupinder.thakur@linaro.org> References: <1510222764-11746-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 2/2 v2] xen: Fix 16550 UART console for HP Moonshot (Aarch64) platform 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" 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: 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 --- 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 | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index cf42fce..bb01c46 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1517,6 +1517,33 @@ static int ns16550_init_dt(struct ns16550 *uart, #ifdef CONFIG_ACPI #include +/* + * 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) +{ + bool xgene_8250 = false; + + 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 ) + xgene_8250 = true; + + if ( !memcmp(tb->header.oem_table_id, "ProLiant", + ACPI_OEM_TABLE_ID_SIZE) && tb->header.oem_revision == 1 ) + xgene_8250 = true; + + return xgene_8250; +} + static int ns16550_init_acpi(struct ns16550 *uart, const void *data) { @@ -1539,9 +1566,20 @@ static int ns16550_init_acpi(struct ns16550 *uart, uart->io_base = spcr->serial_port.address; uart->irq = spcr->interrupt; uart->reg_width = spcr->serial_port.bit_width / 8; - uart->reg_shift = 0; - uart->io_size = UART_MAX_REG << uart->reg_shift; + 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_MAX_REG << uart->reg_shift; irq_set_type(spcr->interrupt, spcr->interrupt_type); return 0;