From: Konrad Rzeszutek Wilk <konrad@darnok.org>
To: Bhupinder Thakur <bhupinder.thakur@linaro.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Julien Grall <julien.grall@arm.com>,
Jan Beulich <jbeulich@suse.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH 3/3 v3] xen: Fix 16550 UART console for HP Moonshot (Aarch64) platform
Date: Fri, 24 Nov 2017 08:51:25 -0500 [thread overview]
Message-ID: <20171124135125.GE16160@localhost.localdomain> (raw)
In-Reply-To: <1511523552-23628-4-git-send-email-bhupinder.thakur@linaro.org>
On Fri, Nov 24, 2017 at 05:09:12PM +0530, Bhupinder Thakur wrote:
> 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 <lho@apm.com>
> 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 <lho@apm.com>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> Changes since v2:
> - removed the use of local variable xgene_8250 in xgene_8250_erratum_present
>
> CC: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: George Dunlap <George.Dunlap@eu.citrix.com>
> CC: Ian Jackson <ian.jackson@eu.citrix.com>
> CC: Jan Beulich <jbeulich@suse.com>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Tim Deegan <tim@xen.org>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Julien Grall <julien.grall@arm.com>
>
> 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);
> --
> 2.7.4
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2017-11-24 13:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-24 11:39 [PATCH 0/3 v3] xen: ACPI/SPCR based initialization of 8250 UART Bhupinder Thakur
2017-11-24 11:39 ` [PATCH 1/3 v3] xen: Refactor 16550 UART code Bhupinder Thakur
2017-11-24 13:37 ` Konrad Rzeszutek Wilk
2017-11-24 16:04 ` Julien Grall
2017-11-24 11:39 ` [PATCH 2/3 v3] xen: Add support for initializing 16550 UART using ACPI Bhupinder Thakur
2017-11-24 13:50 ` Konrad Rzeszutek Wilk
2017-11-24 15:11 ` Andre Przywara
2017-11-24 15:52 ` Julien Grall
2017-11-24 16:05 ` Julien Grall
2017-11-27 10:01 ` Jan Beulich
2017-11-24 11:39 ` [PATCH 3/3 v3] xen: Fix 16550 UART console for HP Moonshot (Aarch64) platform Bhupinder Thakur
2017-11-24 13:51 ` Konrad Rzeszutek Wilk [this message]
2017-11-27 10:06 ` Jan Beulich
2017-11-27 10:30 ` Julien Grall
2017-11-27 10:37 ` Graeme Gregory
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171124135125.GE16160@localhost.localdomain \
--to=konrad@darnok.org \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=bhupinder.thakur@linaro.org \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=konrad.wilk@oracle.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).