[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Xen ARM - Exposing a PL011 to the guest





On 03/02/17 13:53, Bhupinder Thakur wrote:
Hi,

Hi Bhupinder,

Hi,

I have done the changes for emulating pl011 in Xen. Currently, I have
verified the emulation code by manually reading/writing data to
/dev/ttyAMA0 which is the device file for pl011 device. The data is
flowing fine between xenconsoled and the guest domain.

As a next step, I wanted to use /dev/ttyAMA0 as a console.

For that I tried adding console=ttyAMA0 instead of console=hvc0 in the
"extra" directive in the domU configuration file. However, I do not
see the output on the console once I attached the console using "xl
console <domain_name>". I tried using "xl console -t serial
<domain_name>" also but that shows the tty1 console and not the
ttyAMA0 one.

I would try to verify that when Linux uses the pl011 as a console (as
opposed to just writing some characters into /dev/ttyAMA0), that it
doesn't error out somewhere.  So like Stefano suggests, make sure you
check the guest kernel log after boot (assuming you can SSH or something
into the box) and look at 'dmesg' to see if the pl011 driver failed.

You could also try adding some log info in you Xen pl011 emulation code
to see if the guest kernel driver prods the device in the sequence you
expect, based on looking at the linux driver for the pl011.

I tested with the following changes:

1. Compiled out CONFIG_HVC_XEN
2. Specified "console=ttyAMA0" in the guest configuration

With some more changes/fixes, the guest console is working partially
over ttyAMA0. I can see the guest boot prints on the console. However,
the prints stop just towards the end when the init scripts are
executed.

So it seems that during boot, initially ttyAMA0 is used as a
write-only port, where the console driver keeps writing the output to
the port. Till this point, only tx has been enabled on ttyAMA0 (driver
probe() is called at this point). No irq/rx has been enabled yet. Just
as the init scripts are executed, the irq/rx is also enabled on
ttyAMA0 (driver startup() is called at this time which enables rx and
registers IRQ) and then the boot prints stop.

So if I understand correctly, you don't receive anymore output. Correct?
Have you tried to see whether the pl011 driver is receiving interrupt or even Linux calling it.

Assuming you have Xen built with debug enabled (see CONFIG_DEBUG), you could use xen_raw_printk in the pl011 driver to see what's going on. This will issue an hypercall and the message will be directly printed on Xen console.

If you compile out the HVC_XEN support, you could directly use HYPERVISOR_console_io(CONSOLEIO_write, len, str).

Another observation is that unless you compile out HVC_XEN support,
the hvc0 console also keeps receiving the data even if the
console=ttyAMA0.

HVC is the preferred console when using Xen, I think you would also need to add "earlycon=pl0111,addr" on the kernel commandline where addr is the base address of the PL011 to get Linux using the serial port as boot console.

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.