History log of /kvmtool/hw/serial.c (Results 1 – 25 of 74)
Revision Date Author Comments
# 2f030d28 03-Feb-2023 Rajnesh Kanwal <rkanwal@rivosinc.com>

riscv: Move serial and rtc from IO port space to MMIO area.

The default serial and rtc IO region overlaps with PCI IO bar
region leading bar 0 activation to fail. Moving these devices
to MMIO region

riscv: Move serial and rtc from IO port space to MMIO area.

The default serial and rtc IO region overlaps with PCI IO bar
region leading bar 0 activation to fail. Moving these devices
to MMIO region similar to ARM.

Given serial has been moved from 0x3f8 to 0x10000000, this
requires us to now pass earlycon=uart8250,mmio,0x10000000
from cmdline rather than earlycon=uart8250,mmio,0x3f8.

To avoid the need to change the address every time the tool
is updated, we can also just pass "earlycon" from cmdline
and guest then finds the type and base address by following
the Device Tree's stdout-path property.

Signed-off-by: Rajnesh Kanwal <rkanwal@rivosinc.com>
Tested-by: Atish Patra <atishp@rivosinc.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20230203122934.18714-1-rkanwal@rivosinc.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# 45b4968e 15-Mar-2021 Andre Przywara <andre.przywara@arm.com>

hw/serial: ARM/arm64: Use MMIO at higher addresses

Using the UART devices at their legacy I/O addresses as set by IBM in
1981 was a kludge we used for simplicity on ARM platforms as well.
However th

hw/serial: ARM/arm64: Use MMIO at higher addresses

Using the UART devices at their legacy I/O addresses as set by IBM in
1981 was a kludge we used for simplicity on ARM platforms as well.
However this imposes problems due to their missing alignment and overlap
with the PCI I/O address space.

Now that we can switch a device easily between using ioports and MMIO,
let's move the UARTs out of the first 4K of memory on ARM platforms.

That should be transparent for well behaved guests, since the change is
naturally reflected in the device tree. Even "earlycon" keeps working,
as the stdout-path property is adjusted automatically.

People providing direct earlycon parameters via the command line need to
adjust it to: "earlycon=uart,mmio,0x1000000".

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20210315153350.19988-22-andre.przywara@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# 59866df6 15-Mar-2021 Andre Przywara <andre.przywara@arm.com>

hw/serial: Switch to new trap handlers

Now that the serial device has a trap handler adhering to the MMIO fault
handler prototype, let's switch over to the joint registration routine.

This allows u

hw/serial: Switch to new trap handlers

Now that the serial device has a trap handler adhering to the MMIO fault
handler prototype, let's switch over to the joint registration routine.

This allows us to get rid of the ioport shim routines.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20210315153350.19988-15-andre.przywara@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# 47a51060 15-Mar-2021 Andre Przywara <andre.przywara@arm.com>

hw/serial: Refactor trap handler

With the planned retirement of the special ioport emulation code, we
need to provide an emulation function compatible with the MMIO prototype.

Adjust the trap handl

hw/serial: Refactor trap handler

With the planned retirement of the special ioport emulation code, we
need to provide an emulation function compatible with the MMIO prototype.

Adjust the trap handler to use that new function, and provide shims to
implement the old ioport interface, for now.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20210315153350.19988-14-andre.przywara@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# a81be31e 15-Mar-2021 Andre Przywara <andre.przywara@arm.com>

hw/serial: Use device abstraction for FDT generator function

At the moment we use the .generate_fdt_node member of the ioport ops
structure to store the function pointer for the FDT node generator
f

hw/serial: Use device abstraction for FDT generator function

At the moment we use the .generate_fdt_node member of the ioport ops
structure to store the function pointer for the FDT node generator
function. ioport__register() will then put a wrapper and this pointer
into the device header.
The serial device is the only device making use of this special ioport
feature, so let's move this over to using the device header directly.

This will allow us to get rid of this .generate_fdt_node member in the
ops and simplify the code.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20210315153350.19988-3-andre.przywara@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# 56e45ea4 01-Feb-2019 Andre Przywara <andre.przywara@arm.com>

arm: fdt: add stdout-path to /chosen node

The DT spec describes the stdout-path property in the /chosen node to
contain the DT path for a default device usable for outputting characters.
The Linux k

arm: fdt: add stdout-path to /chosen node

The DT spec describes the stdout-path property in the /chosen node to
contain the DT path for a default device usable for outputting characters.
The Linux kernel uses this for earlycon (without further parameters),
other DT users might rely on this as well.

Add a stdout-path property pointing to the "serial0" alias, then add an
aliases node at the end of the FDT, containing the actual path. This
allows the FDT generation code in hw/serial.c to set this string.

Even when we use the virtio console, the serial console is still there
and works, so we can expose this unconditionally. Putting the virtio
console path in there will not work anyway.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

show more ...


# 7590908e 09-Jan-2015 Andre Przywara <andre.przywara@arm.com>

kvmtool: remove 8250 IRQ line reset on device_init

Currently we reset the KVM interrupt line on initializing the 8250
serial device emulation.
For ARM this creates a problem where we use the in-kern

kvmtool: remove 8250 IRQ line reset on device_init

Currently we reset the KVM interrupt line on initializing the 8250
serial device emulation.
For ARM this creates a problem where we use the in-kernel IRQ chip
before having fully initialized it. But with the new kernel interface
we cannot finish the GIC initialization before we know the number of
used IRQs, so we have to wait until all devices have been created and
initialized.
Since the in-kernel GIC emulation resets the IRQ line anyway and also
QEMU gets away without resetting it, the easiest solution is to drop
the IRQ line reset.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

show more ...


# 890ad914 17-Dec-2014 Andre Przywara <andre.przywara@arm.com>

kvmtool: ARM: advertise 8250 IRQs as level-triggered

Both the 16550/8250 UART emulation in kvmtool as well as all the
drivers and DTBs for real hardware use level triggered interrutpts.
But the devi

kvmtool: ARM: advertise 8250 IRQs as level-triggered

Both the 16550/8250 UART emulation in kvmtool as well as all the
drivers and DTBs for real hardware use level triggered interrutpts.
But the device tree currently describes them as being edge triggered,
which can lead to hangs in guests.
Use the new IRQ type parameter to properly describe the interrupts.
This goes along the lines of a similar QEMU patch:
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=0be969a2d974971628fc4ed95834d22ecf0fd497

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

show more ...


# 2bfd9ac3 17-Dec-2014 Andre Przywara <andre.przywara@arm.com>

kvmtool: ARM: allow level interrupts in device tree

Currently we describe every interrupt for each device in the FDT
as being edge triggered.
Add a parameter to the irq property generation to allow

kvmtool: ARM: allow level interrupts in device tree

Currently we describe every interrupt for each device in the FDT
as being edge triggered.
Add a parameter to the irq property generation to allow devices to
specify their interrupts as level triggered if needed.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

show more ...


# 4123ca55 27-May-2014 Marc Zyngier <marc.zyngier@arm.com>

kvmtool: virtio: pass trapped vcpu to IO accessors

The recent introduction of bi-endianness on arm/arm64 had the
odd effect of breaking virtio-pci support on these platforms, as the
device endian fi

kvmtool: virtio: pass trapped vcpu to IO accessors

The recent introduction of bi-endianness on arm/arm64 had the
odd effect of breaking virtio-pci support on these platforms, as the
device endian field defaults to being VIRTIO_ENDIAN_HOST, which
is the wrong thing to have on a bi-endian capable architecture.

The fix is to check for the endianness on the ioport path the
same way we do it for mmio, which implies passing the vcpu all
the way down. Patch is a bit ugly, but aligns MMIO and ioport nicely.

Tested on arm64 and x86.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 12c406a8 11-Sep-2013 Jonathan Austin <jonathan.austin@arm.com>

kvm tools: remove periodic tick in favour of a polling thread

Currently the only use of the periodic timer tick in kvmtool is to
handle reading from stdin. Though functional, this periodic tick can

kvm tools: remove periodic tick in favour of a polling thread

Currently the only use of the periodic timer tick in kvmtool is to
handle reading from stdin. Though functional, this periodic tick can be
problematic on slow (eg FPGA) platforms and can cause low interactivity or
even stop the execution from progressing at all.

This patch removes the periodic tick in favour of a dedicated thread blocked
waiting for input from the console. In order to reflect the new behaviour,
the old 'kvm__arch_periodic_tick' function is renamed to 'kvm__arch_read_term'.

In making this change it is necessary to actively flush the emulated serial
console's output buffer after the guest writes to it, as otherwise flushing
only happens with terminal input. Similarly, it is no longer necessary to
flush the buffer when we process input.

Signed-off-by: Jonathan Austin <jonathan.austin@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# e5965f36 01-May-2013 Marc Zyngier <Marc.Zyngier@arm.com>

kvm tools: 8250: add address qualifier to uart name in fdt node

Having several uarts with the same name makes the kernel (and dtc)
choke. Add the base address as a qualifier so we get unique names.

kvm tools: 8250: add address qualifier to uart name in fdt node

Having several uarts with the same name makes the kernel (and dtc)
choke. Add the base address as a qualifier so we get unique names.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# d28abb58 01-May-2013 Will Deacon <will.deacon@arm.com>

kvm tools: 8250: add fdt node generation

This patch adds fdt node generation to the 8250 emulation. The
serial8250_device is now stashed inside the ioport priv field, so that
it can be retrieved fro

kvm tools: 8250: add fdt node generation

This patch adds fdt node generation to the 8250 emulation. The
serial8250_device is now stashed inside the ioport priv field, so that
it can be retrieved from the ioport passed back to the generation code.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 206c41f4 01-May-2013 Will Deacon <will.deacon@arm.com>

kvm tools: ioport: add arch callback to remap IRQ lines for ioport devices

If an architecture other than x86 wants to make use of ioport devices, the
interrupt lines will likely need remapping from

kvm tools: ioport: add arch callback to remap IRQ lines for ioport devices

If an architecture other than x86 wants to make use of ioport devices, the
interrupt lines will likely need remapping from their fixed values.

This patch allows an architecture callback, ioport__map_irq, to map
interrupts as appropriate.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 76525988 01-May-2013 Marc Zyngier <Marc.Zyngier@arm.com>

kvm tools: console: unconditionally output to any console

Kvmtool suppresses any output to a console that has not been elected
as *the* console.

While this makes sense on the input side (we want th

kvm tools: console: unconditionally output to any console

Kvmtool suppresses any output to a console that has not been elected
as *the* console.

While this makes sense on the input side (we want the input to be sent
to one console driver only), it seems to be the wrong thing to do on
the output side, as it effectively prevents the guest from switching
from one console to another (think earlyprintk using 8250 to virtio
console).

After all, the guest *does* poke this device and outputs something
there.

Just remove the kvm->cfg.active_console test from the output paths.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# d3476f7d 24-Oct-2012 Sasha Levin <sasha.levin@oracle.com>

kvm tools: use mutex abstraction instead of pthread mutex

We already have something to wrap pthread with mutex_[init,lock,unlock]
calls. This patch creates a new struct mutex abstraction and moves
e

kvm tools: use mutex abstraction instead of pthread mutex

We already have something to wrap pthread with mutex_[init,lock,unlock]
calls. This patch creates a new struct mutex abstraction and moves
everything to work with it.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 4346fd8f 17-Sep-2012 Sasha Levin <levinsasha928@gmail.com>

kvm tools: remove global kvm object

This was ugly, and now we get rid of it.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>


# 49a8afd1 17-Sep-2012 Sasha Levin <levinsasha928@gmail.com>

kvm tools: use init/exit where possible

Switch to using init/exit calls instead of the repeating call blocks in builtin-run.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekk

kvm tools: use init/exit where possible

Switch to using init/exit calls instead of the repeating call blocks in builtin-run.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 2651ea58 05-Sep-2012 Sasha Levin <levinsasha928@gmail.com>

kvm tools: move active_console into struct kvm_config

This config option was 'extern'ed between different objects. Clean it up
and move it into struct kvm_config.

Signed-off-by: Sasha Levin <levins

kvm tools: move active_console into struct kvm_config

This config option was 'extern'ed between different objects. Clean it up
and move it into struct kvm_config.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 226e727b 22-Jul-2012 Sasha Levin <levinsasha928@gmail.com>

kvm tools: support injecting arbitrary sysrqs

Add support to 'lkvm debug' to inject arbitrary sysrqs using a new
'-s <sysrq>' argument.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-o

kvm tools: support injecting arbitrary sysrqs

Add support to 'lkvm debug' to inject arbitrary sysrqs using a new
'-s <sysrq>' argument.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 20715a22 18-Dec-2011 Sasha Levin <levinsasha928@gmail.com>

kvm tools: Fixes for serial module

Fixes include:
- Error handling
- Cleanup
- Standard init/uninit

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>


# d4b02a37 21-Dec-2011 Thomas Gleixner <tglx@linutronix.de>

kvm tool: Implement a serial FIFO emulation

Adding FIFO functionality to the serial emulator to speed up the
console handling.

This also restricts sysrq functionality to the first serial port and
f

kvm tool: Implement a serial FIFO emulation

Adding FIFO functionality to the serial emulator to speed up the
console handling.

This also restricts sysrq functionality to the first serial port and
fixes the sysrq injection, which was broken because nothing ever reset
the BI status bit in the LSR.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 8dfae8be 10-Dec-2011 Thomas Gleixner <tglx@linutronix.de>

kvm tools: serial: Make it work with non rt guests as well

Sasha reported, that a non RT guest reports "too much work for irq 4"
with the previous serial overhaul.

The reason is, that the new code

kvm tools: serial: Make it work with non rt guests as well

Sasha reported, that a non RT guest reports "too much work for irq 4"
with the previous serial overhaul.

The reason is, that the new code allows unlimited tx transfers, which
triggers the sanity check in the 8250.c interrupt handler.

Limit the consecutive TX chars to 16 and let the guest kernel escape
from the 8250 interrupt handler. Set the TEMT/THRE bits in the
periodic serial console update.

Reported-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# f6b8ccc1 10-Dec-2011 Thomas Gleixner <tglx@linutronix.de>

kvm tool: serial: Fix interrupt handling

The interrupt injection of the serial emulation is completely
broken. It's just doing random toggling of the interrupt line, which
can lead to complete conso

kvm tool: serial: Fix interrupt handling

The interrupt injection of the serial emulation is completely
broken. It's just doing random toggling of the interrupt line, which
can lead to complete console hangs.

The real hardware asserts the interrupt line when a condition
(RX/TX/Status) is met and the corresponding interrupt is enabled in
the IER. It's deasserted when the condition is cleared or the
corresponding interrupt is disabled in the IER.

So the correct emulation just needs to check after each state change
in the LSR or the IER which bits in the IIR need to be set and update
the interrupt line accordingly. To avoid setting the same state over
and over keep an internal state of the last set interrupt line state
and only update via the kvm ioctl when the new state differs.

Rename serial8250__inject_interrupts() to serial8250__update_consoles()
which reflects what the function really is about.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# c59fa0c4 10-Dec-2011 Thomas Gleixner <tglx@linutronix.de>

kvm tool: serial: Simplify switch cases

There is no point to have the same switch case construct for all the
registers, just to take care of the oddball case of DLL/DLM.

Signed-off-by: Thomas Gleix

kvm tool: serial: Simplify switch cases

There is no point to have the same switch case construct for all the
registers, just to take care of the oddball case of DLL/DLM.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


123