aboutsummaryrefslogtreecommitdiffstats
path: root/xen/drivers/char
Commit message (Collapse)AuthorAgeFilesLines
* patches to support booting from my grubroot2013-10-231-2/+2
|
* ns16550: Use correct #define symbol for HAS_IOPORTSAndrew Cooper2013-09-251-1/+1
| | | | | | | | | | CID 1091471, Regression caused by 7c1de0038895cbc75ebd0caffc5b0f3f03c5ad51 This appears to be a typo which causes check_existence() to unconditionally return 1 in all cases. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* ns16550: support DesignWare 8250Ian Campbell2013-09-211-0/+14
| | | | | | | | | | | | This hardware has an additional feature which signals an error if you try to write LCR while the UART is busy. We need to clear this error during setup, otherwise LCR.DLAB doesn't get set and we cannot read/write the divisor. This has been tested on the cubieboard2 Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org> Cc: jbeulich@suse.com
* ns16550: make usable on ARMIan Campbell2013-09-211-12/+181
| | | | | | | | | | | | | | There are several aspects to this: - Correctly conditionalise use of PCI - Correctly conditionalise use of IO ports - Add discovery via device tree - Support different registers shift/stride and widths - Add vuart hooks. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Frser <keir@xen.org> Reviewed-by: Jan Beulich <jbeulich@suse.com> Cc: PranavkumarSawargaonkar<pranavkumar@linaro.org>
* xen/arm: replace io{read,write}{l,b} with {read,write}{l,b}Ian Campbell2013-09-213-6/+9
| | | | | | | | | | | | | | | | | | | | We appear to have invented the io versions ourselves for Xen on ARM, while x86 has the plain read/write. (and so does Linux FWIW) read/write are used in common driver code (specifically ns16550) so instead of keeping our own variant around lets replace it with the more standard ones. At the same time resync with Linux making the "based on" comment in both sets of io.h somewhat true (they don't look to have been very based on before...). Our io.h is now consistent with Linux v3.11. Note that iowrite and write take their arguments in the opposite order. Also make asm-arm/io.h useful and include it where necessary instead of picking up the include from mm.h. Remove the include from mm.h Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Julien Grall <julien.grall@linaro.org>
* ehci-dbgp: avoid division by zero.Tim Deegan2013-09-121-0/+3
| | | | | | | | | | | Unlikely to ever see hardware reporting 0 ports, but might as well fail gracefully if we do. Coverity CID 1055266 Signed-off-by: Tim Deegan <tim@xen.org> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>
* ehci-dbgp: drop dead code.Tim Deegan2013-09-121-5/+0
| | | | | | | | | | | We can only reach this spot by breaking out of the scan loop, so by construction ret > 0. Coverity CID 1055259 Signed-off-by: Tim Deegan <tim@xen.org> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>
* console: buffer and show origin of guest PV writesDaniel De Graaf2013-09-101-17/+76
| | | | | | | | | | | | | Guests other than domain 0 using the console output have previously been controlled by the VERBOSE #define, but with no designation of which guest's output was on the console. This patch converts the HVM output buffering to be used by all domains except the hardware domain (dom0): stripping non-printable characters, line buffering the output, and prefixing it with the domain ID. This is especially useful for debugging stub domains during early boot. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Keir Fraser <keir@xen.org>
* xen/char: dt-uart: Allow the user to give a path to the nodeJulien Grall2013-09-061-6/+10
| | | | | | | | | | | On some board, there is no alias to the UART. To avoid modification in the device tree, dt-uart should also search device by path. To distinguish an alias from a path, dt-uart will check the first character. If it's a / then it's path, otherwise it's an alias. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* pl011: preserve RTS and DTR signal on UART initAndre Przywara2013-09-031-2/+5
| | | | | | | | | | | | | Although we do not support hardware flow control in the Xen driver for the PL011 UART, the other end may be configured to use it. In this case it waits in vain for the RTS signal to be asserted by the host and will never transmit any characters. So we leave RTS and DTR as they had been setup before. This fixes the UART input on Calxeda Midway, which uses hardware flow control for the serial-over-LAN functionality. Signed-off-by: Andre Przywara <andre.przywara@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen: update tx_ready callback for ARM serial driversTomasz Wroblewski2013-08-283-3/+3
| | | | | | | | Type of tx_ready callback got changed to int to facilitate error condition, but the ARM serial drivers were not modified thus breaking the compilation. Reported-by: Julien Grall <julien.grall@linaro.org> Signed-off-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com>
* PCI UART: better cope with UART being temporarily unavailableTomasz Wroblewski2013-08-283-25/+42
| | | | | | | | | | | | | This happens for example when dom0 disables ioport responses during PCI subsystem initialisation. If a __ns16550_poll() happens to be scheduled during that time, Xen hangs. Detect and exit that condition. Amended ns16550_ioport_invalid function to only check IER register, which contins 3 reserved (always 0) bits, therefore it's sufficient for that test. Signed-off-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* Fix inactive timer list corruption on second S3 resumeTomasz Wroblewski2013-08-281-1/+3
| | | | | | | | | | | init_timer cannot be safely called multiple times on same timer since it does memset(0) on the structure, erasing the auxiliary member used by linked list code. This breaks inactive timer list in common/timer.c. Moved resume_timer initialisation to ns16550_init_postirq, so it's only done once. Signed-off-by: Tomasz Wroblewski <tomasz.wroblewski@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* PCI: centralize parsing of device coordinates in command line optionsJan Beulich2013-08-282-30/+16
| | | | | | | | | With yet another case to come in a subsequent patch, it seems time to do this in a single place rather than hand crafting it in various scattered around locations. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* pl011: early_panic if baud rate not set in hardwareIan Campbell2013-08-271-0/+2
| | | | | | | | | | | Now that the driver defaults to BAUD_AUTO this can happen if the early uart != console or if early printk isn't in use. The following division by zero causes a trap but that uses regular printk and not early_printk, so it is never seen. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Julien Grall <julien.grall@linaro.org>
* drivers/char: pl011: Enable receive timeout interruptJulien Grall2013-08-271-1/+1
| | | | | | | | | | | | The commit 874f76a "PL011: fix reverse logic for interrupt mask register" introduced regression on the Versatile Express. The board didn't receive correctly input. The timeout interrupt may be asserted when the FIFO is not empty, and no futher data is received over a 32-bit period. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/arm: Add the new OMAP UART driver.Chen Baozi2013-08-222-0/+375
| | | | | | | | | TI OMAP UART introduces some features such as register access modes, which makes its configuration and interrupt handling differs from 8250 compatible UART. Thus, we seperate this driver from ns16550's implementation. Signed-off-by: Chen Baozi <baozich@gmail.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen: rename ns16550-uart.h to 8250-uart.h and fix some typosChen Baozi2013-08-221-1/+1
| | | | | | | | | | | Since UARTs on OMAP5 & Allwinner's SoC are not ns16550 but only 8250 compatible, rename ns16550-uart.h to 8250-uart.h, which is a more pervasive name. At the same time, fix some typos, which have redundance UART_ prefixes in some macros. Signed-off-by: Chen Baozi <baozich@gmail.com> Acked-by: Julien Grall <julien.grall@linaro.org> Acked-by: Keir Fraser <keir@xen.org>
* PL011: fix reverse logic for interrupt mask registerAndre Przywara2013-08-211-3/+3
| | | | | | | | | | | | | | The PL011 IMSC register description is somehow fuzzy in the documentation; by comparing it with the Linux implementation one can see that the logic is actually reversed to Xen's implementation: A "0" in field means interrupt disabled, a "1" enables it. Therefore we enabled all interrupts instead of disabling them in the beginning and later on masked the wrong interrupts. Unclear how this worked on the Versatile Express, but this fix is needed to get Calxeda Midway running (and works on VExpress, too). Signed-off-by: Andre Przywara <andre.przywara@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* PL011: don't force baud rate of 38400 bpsAndre Przywara2013-08-201-1/+1
| | | | | | | | | | | | The PL011 driver currently sets the baudrate to a hardcoded value of 38400 bits/second. This will break Calxeda Midway, which uses 115200 bps. Instead don't tinker with the baud rate register at all and rely on the firmware or bootloader setting the correct value in here. This works fine on Versatile Express and Calxeda Midway. Signed-off-by: Andre Przywara <andre.przywara@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* watchdog/crash: Always disable watchdog in console_force_unlock()Andrew Cooper2013-08-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | Depending on the state of the conring and serial_tx_buffer, console_force_unlock() can be a long running operation, usually because of serial_start_sync() XenServer testing has found a reliable case where console_force_unlock() on one PCPU takes long enough for another PCPU to timeout due to the watchdog (such as waiting for a tlb flush callin). The watchdog timeout causes the second PCPU to repeat the console_force_unlock(), at which point the first PCPU typically fails an assertion in spin_unlock_irqrestore(&port->tx_lock) (because the tx_lock has been unlocked behind itself). console_force_unlock() is only on emergency paths, so one way or another the host is going down. Disable the watchdog before forcing the console lock to help prevent having pcpus completing with each other to bring the host down. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* watchdog: Move watchdog from being x86 specific to common codeAndrew Cooper2013-08-131-1/+1
| | | | | | | | | | | | | | | Augment watchdog_setup() to be able to possibly return an error, and introduce watchdog_enabled() as a better alternative to knowing the architectures internal details. This patch does not change the x86 implementaion, beyond making it compile. For header files, some includes of xen/nmi.h were only for the watchdog functions, so are replaced rather than adding an extra include of xen/watchdog.h Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* pl011: Implement vuart_info callbackJulien Grall2013-08-081-0/+15
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Reviewed-by: Tim Deegan <tim@xen.org>
* exynos4210: Implement vuart_info callbackJulien Grall2013-08-081-0/+15
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Reviewed-by: Tim Deegan <tim@xen.org>
* xen/arm: New callback in uart_driver to retrieve serial informationJulien Grall2013-08-081-0/+8
| | | | | | | | | | There is no way to retrieve basic informations (base address, size, ....) for an UART. This callback will be used later to partially emulate the real UART for DOM0 on ARM. Signed-off-by: Julien Grall <julien.grall@linaro.org> Reviewed-by: Tim Deegan <tim@xen.org> Acked-by: Keir Fraser <keir@xen.org>
* xen/conring: Write to console ring even if console lock is bustedAndrew Cooper2013-08-061-3/+2
| | | | | | | | | | | | | | | | | | console_lock_busted gets set when an NMI/MCE/Double Fault handler decides to bring Xen down in an emergency. conring_puts() cannot block and does not have problematic interactions with the console_lock. Therefore, choosing to not put the string into the console ring simply means that the kexec environment cant find any panic() message caused by an IST interrupt, which is unhelpful for debugging purposes. In the case that two pcpus fight with console_force_unlock(), having slightly garbled strings in the console ring is far more useful than having nothing at all. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Matt Wilson <msw@amazon.com> Acked-by: Keir Fraser <keir@xen.org>
* xen/conring: Clean up writing to the console ringAndrew Cooper2013-08-061-9/+10
| | | | | | | | | | | | Refactor putchar_console_ring() to conring_puts(). This allows for consistency with {sercon,vga}_puts(), prevents needless recalculation of the conring consumer index, and slight cleanup at the two callsites. There is no functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Matt Wilson <msw@amazon.com> Acked-by: Keir Fraser <keir@xen.org>
* pl011: Move registers' definition in a separate fileJulien Grall2013-08-051-47/+1
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Reviewed-by: Tim Deegan <tim@xen.org>
* pl011: Use ioreadl/iowritelJulien Grall2013-08-051-38/+42
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* extract register definitions from ns16550 into a separated headerChen Baozi2013-07-161-111/+44
| | | | | Signed-off-by: Chen Baozi <baozich@gmail.com> Acked-by: Keir Fraser <keir@xen.org>
* use SMP barrier in common code dealing with shared memory protocolsIan Campbell2013-07-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Xen currently makes no strong distinction between the SMP barriers (smp_mb etc) and the regular barrier (mb etc). In Linux, where we inherited these names from having imported Linux code which uses them, the SMP barriers are intended to be sufficient for implementing shared-memory protocols between processors in an SMP system while the standard barriers are useful for MMIO etc. On x86 with the stronger ordering model there is not much practical difference here but ARM has weaker barriers available which are suitable for use as SMP barriers. Therefore ensure that common code uses the SMP barriers when that is all which is required. On both ARM and x86 both types of barrier are currently identical so there is no actual change. A future patch will change smp_mb to a weaker barrier on ARM. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* drivers/exynos4210: Return -ENOMEM when ioremap has failedJulien Grall2013-05-231-0/+1
| | | | | Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/arm: Add Exynos 4210 UART supportAnthony PERARD2013-05-132-0/+366
| | | | | | Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/arm: Use device tree API in pl011 UART driverJulien Grall2013-05-131-16/+72
| | | | | | | | Allow UART driver to retrieve all its information in the device tree. It's possible to choose the pl011 driver via the Xen command line. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* xen/arm: Add generic UART to get the device in the device treeJulien Grall2013-05-133-0/+76
| | | | | | | | | | | | | This generic UART will find the right UART via xen command line with dtuart=myserial. "myserial" is the alias of the UART in the device tree. Xen will retrieve the information via the device tree and call the initialization function for this specific UART thanks to the device API. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* xen/arm: New callback in uart_driver to get device tree interrupt structureJulien Grall2013-05-131-0/+10
| | | | | | | | | | | The existing function serial_irq doesn't allow to retrieve if the interrupt is edge or level trigger. Use this function to routes IRQs for all serial ports which Xen is using to Xen. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
* ns16550: delay resume until dom0 ACPI has a chance to runBen Guthro2013-04-241-1/+54
| | | | | | | | | | | | | | | | | | | | | | Check for ioport access, before fully resuming operation, to avoid spinning in __ns16550_poll when reading the LSR register returns 0xFF on failing ioport access. On some systems (like Lenovo T410, and some HP machines of similar vintage) there is a SuperIO card that provides this legacy ioport on the LPC bus. In this case, we need to wait for dom0's ACPI processing to run the proper AML to re-initialize the chip, before we can use the card again. This may cause a small amount of garbage to be written to the serial log while we wait patiently for that AML to be executed. This implementation limits the number of retries, to avoid a situation where we keep trying over and over again, in the case of some other failure on the ioport. Signed-Off-By: Ben Guthro <benjamin.guthro@citrix.com> Acked-by: Keir Fraser <keir@xen.org>
* Fix emacs local variable block to use correct C style variable.David Vrabel2013-02-214-4/+4
| | | | | | | The emacs variable to set the C style from a local variable block is c-file-style, not c-set-style. Signed-off-by: David Vrabel <david.vrabel@citrix.com
* x86: move watchdog declarations from config.h to nmi.hJan Beulich2013-02-151-0/+1
| | | | | | | They don't belong into the former. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* xen: Fix some over-long source lines.Keir Fraser2013-01-301-5/+8
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* xen: Define debug_build() based on NDEBUG. Use it in a few printk's.Keir Fraser2013-01-301-6/+1
| | | | Signed-off-by: Keir Fraser <keir@xen.org>
* xen: print "debug=y|n" during hypervisor startupDario Faggioli2013-01-301-2/+7
| | | | | | | | So that we can easily figure out whether or not we are running a debug build of Xen (e.g., via `xl dmesg'). Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Committed-by: Keir Fraser <keir@xen.org>
* xen: infrastructure to have cross-platform video driversStefano Stabellini2013-01-241-6/+6
| | | | | | | | | | | | | | - introduce a new HAS_VIDEO config variable; - build xen/drivers/video/font* if HAS_VIDEO; - rename vga_puts to video_puts; - rename vga_init to video_init; - rename vga_endboot to video_endboot. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xen/xsm: Add xsm_default parameter to XSM hooksDaniel De Graaf2013-01-111-1/+1
| | | | | | | | | | | | | | Include the default XSM hook action as the first argument of the hook to facilitate quick understanding of how the call site is expected to be used (dom0-only, arbitrary guest, or device model). This argument does not solely define how a given hook is interpreted, since any changes to the hook's default action need to be made identically to all callers of a hook (if there are multiple callers; most hooks only have one), and may also require changing the arguments of the hook. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Keir Fraser <keir@xen.org>
* xen: use XSM instead of IS_PRIV where duplicatedDaniel De Graaf2013-01-111-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Xen hypervisor has two basic access control function calls: IS_PRIV and the xsm_* functions. Most privileged operations currently require that both checks succeed, and many times the checks are at different locations in the code. This patch eliminates the explicit and implicit IS_PRIV checks that are duplicated in XSM hooks. When XSM_ENABLE is not defined or when the dummy XSM module is used, this patch should not change any functionality. Because the locations of privilege checks have sometimes moved below argument validation, error returns of some functions may change from EPERM to EINVAL or ESRCH if called with invalid arguments and from a domain without permission to perform the operation. Some checks are removed due to non-obvious duplicates in their callers: * acpi_enter_sleep is checked in XENPF_enter_acpi_sleep * map_domain_pirq has IS_PRIV_FOR checked in its callers: * physdev_map_pirq checks when acquiring the RCU lock * ioapic_guest_write is checked in PHYSDEVOP_apic_write * PHYSDEVOP_{manage_pci_add,manage_pci_add_ext,pci_device_add} are checked by xsm_resource_plug_pci in pci_add_device * PHYSDEVOP_manage_pci_remove is checked by xsm_resource_unplug_pci in pci_remove_device * PHYSDEVOP_{restore_msi,restore_msi_ext} are checked by xsm_resource_setup_pci in pci_restore_msi_state * do_console_io has changed to IS_PRIV from an explicit domid==0 Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Jan Beulich <jbeulich@suse.com> Committed-by: Keir Fraser <keir@xen.org>
* pl011: set baud and clock_hz to the right defaults for Versatile ExpressStefano Stabellini2012-11-151-2/+2
| | | | | | Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xen: replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when appropriateStefano Stabellini2012-10-171-3/+3
| | | | | | | | | | | | Note: these changes don't make any difference on x86. Replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when it is used as an hypercall argument. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Ian Campbell <ian.campbell@citrix.com>
* xen/console: introduce a 'w' debug-key that dumps the console ringMatt Wilson2012-10-011-0/+45
| | | | | | | | | | This patch adds a new 'w' debug-key, chosen from the limited remaining keys only due to its proximity to 'q', that dumps the console ring to configured console devices. It's useful to for tracking down how an unresponsive system got into a broken state via serial console. Signed-off-by: Matt Wilson <msw@amazon.com> Committed-by: Keir Fraser <keir@xen.org>
* PCI: don't allow guest assignment of devices used by XenJan Beulich2012-09-112-0/+6
| | | | | | | | | | This covers the devices used for the console and the AMD IOMMU ones (as would be any others that might get passed to pci_ro_device()). Boot video device determination cloned from similar Linux logic. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
* PCI: bus scan adjustmentsJan Beulich2012-09-111-2/+9
| | | | | | | | | | | As done elsewhere, the ns16550 code shouldn't look at non-zero functions of a device if that isn't multi-function. Also both there and in pass-through's _scan_pci_devices() skip looking at non-zero functions when the device at function zero doesn't exist. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>