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: 10050753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C6A8F60381 for ; Thu, 9 Nov 2017 10:22:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B919E2AC20 for ; Thu, 9 Nov 2017 10:22:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE0382AC28; Thu, 9 Nov 2017 10:22:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Flag: YES X-Spam-Level: ** X-Spam-Status: Yes, score=2.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED, RCVD_IN_SBL_CSS, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=no version=3.3.1 X-Spam-Report: * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, * medium trust * [192.237.175.120 listed in list.dnswl.org] * 1.3 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net * [Blocked - see ] * 3.3 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS * [103.5.19.18 listed in zen.spamhaus.org] * 1.5 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server * [103.5.19.18 listed in dnsbl.sorbs.net] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 379A62AC22 for ; Thu, 9 Nov 2017 10:22:02 +0000 (UTC) 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-Google-Smtp-Source: ABhQp+SwKrLcmLM0kJVgFRmXkvRQS55+28BP87rgMwvBZF925fiLeJBEeLSbyRn7J2n4mlaRmDsyOg== 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" X-Virus-Scanned: ClamAV using ClamSMTP 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;