We introduce buffer padding while transmitting and receiving data. We
explicitly introduce padding to make sure that each network packet
needs two descriptors (one for virtio header and another for
network packet).
According the specification 5.1.6.6, we need to explicitly use 2
descriptor for each transmit and receive network packet since we do not
negotiate for VIRTIO_F_ANY_LAYOUT.
In the previous implementation the sg list merged the two descriptor
into one as the memory region were contiguous.
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
As a part of this patch, we configure the max queue size as the
configuration for the number descriptor if the user set the number
of descriptors to zero.
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Simon Kuenzer [Mon, 3 Dec 2018 10:23:18 +0000 (11:23 +0100)]
lib/uknetdev: Zero-initialize netdev data
Whenever a network device is registered by a driver to the uknetdev
API, libuknetdev allocates an API-internal data structure that is used
to track the state of the device state. Subsequent API calls are
assuming that this allocation was zero-initialized. Otherwise,
assertions fail unexpectedly.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Florian Schmidt [Mon, 17 Dec 2018 09:46:16 +0000 (10:46 +0100)]
plat/kvm: Make mxcsr_ptr in entry64.S a 32-bit value
LDMXCSR reads 32 bits into the register. If mxcsr_ptr is only a .word
(and thus 16 bits), the instruction reads adjacent bytes into the MXCSR
register, which can to produce #GP faults on LDMXCSR when those adjacent
bytes contain 1's in bit locations that are reserved in MXCSR.
Cristian Banu [Fri, 7 Dec 2018 05:19:00 +0000 (07:19 +0200)]
plat/virtio: Update off-by-one device id
Extract the virtio_device_id for legacy devices from the PCI Subsystem
Device ID. The previous behaviour resulted in some devices having the
wrong ID attributed to them. For example, a virtio-9p device has a PCI
Device ID of 0x1009 (which would have resulted in virtio_device_id of
10), but a PCI Subsystem Device ID of 9 (which is the correct constant
under virtio_ids.h).
Removes now unused function virtio_device_id_add and misleading macro
VIRTIO_PCI_LEGACY_DEVICEID_START.
Cristian Banu [Wed, 5 Dec 2018 14:27:55 +0000 (16:27 +0200)]
plat/virtio: Fix virtio-bus init getting hanged
This patch fixes getting hanged in virtio-bus initialization. The inner
while loop does not iterate through all the dev_ids, and failing to find
a match against the first dev_id results in an infinite loop.
Bogdan Lascu [Sat, 24 Nov 2018 13:05:18 +0000 (15:05 +0200)]
plat/xen/xenbus: Add _GNU_SOURCE define when using asprintf
Compiling xenbus.c and xs.c gives the warning "implicit definition
of asprintf". Asprintf is not C nor POSIX, so its declaration is
conditioned by a header define that is activated by defining _GNU_SOURCE
before including stdio.h.
This is the setup to reproduce the bug:
Library Configuration -> enable uknetdev
Platform Configuration -> enable KVM guest:
-> disable Virtio bus driver
-> Virtio -> enable Virtio Net device
With this setup, the following error occurs on build:
"undefined reference to ` _virtio_bus_register_driver'"
This fix solves the issue by enabling Virtio bus driver every time
Virtio Net device is enabled.
Radu Nicolau [Sat, 24 Nov 2018 11:23:21 +0000 (13:23 +0200)]
plat/xen/common: Move event channel functions in events.h
Move mask_evtchn, unmask_evtchn and clear_evtchn function
prototypes from hypervisor.h to events.h. Change parameter
type to evtchn_port_t. Remove hypervisor.h inclusion from
arm/arch_events.c and arm/arch_time.c
Signed-off-by: Radu Nicolau <radunicolau102@gmail.com> Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
Radu Nicolau [Sat, 24 Nov 2018 11:23:20 +0000 (13:23 +0200)]
include/xen-x86: Remove os.h on x86
Remove os.h from the project as it was unused.
mm_pv.h included os.h but did not use anything from
it. The rest of the changes have been made in sources
which need the extern definition for the shared info
page.
Signed-off-by: Radu Nicolau <radunicolau102@gmail.com> Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
Birlea Costin [Thu, 8 Nov 2018 14:51:56 +0000 (16:51 +0200)]
plat/xen: Add flush for xen console
Add flush function for xen console. Shutdown can be requested
before the hypervisor gets to print everything to the console
and stops trying. This happens in ukutest and does not get to
print Passed(x/y). This patch assures everything is written
before shutting down.
include/uk/list.h: Replace non-existing panic() calls to UK_CRASH()
These panic() calls are copy-paste artifacts. We do not have the
panic() function. It was working so far, because it is used only in
the lists sanity checking code. Which currently is not even possible
to enable.
Dafna Hirschfeld [Sat, 20 Oct 2018 12:25:42 +0000 (15:25 +0300)]
build: Give CROSS_COMPILE from command line highest priority
Assign CONFIG_CROSS_COMPILE to CROSS_COMPILE only
if CROSS_COMPILE is defined, so that CONFIG_CROSS_COMPILE
will not be erased in case it was set in `.config`
Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Sharan Santhanam [Wed, 24 Oct 2018 13:42:33 +0000 (15:42 +0200)]
plat/drivers: Add & Remove buffer from virtio-ring
The user buffer are enqueued and dequeued into the virtio-ring.
The user data is described to the virtio-ring using a scatter/gather
list. The enqueue and dequeue in turn uses the ring descriptor for
each segment of the scatter gather list.
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Sharan Santhanam [Wed, 24 Oct 2018 13:42:32 +0000 (15:42 +0200)]
plat/drivers: Interrupt handling for virtio-ring
This patch introduces the API for handling the interrupt on the virtio PCI
device. It provides handler for the virtqueue rings. The handler identifies
the virtio device owning the virtqueue and invokes the callback handler
configured by the virtio device.
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Sharan Santhanam [Wed, 24 Oct 2018 13:42:31 +0000 (15:42 +0200)]
plat/drivers: Reintroduce the virtio ring
This patch introduces the API to create destroy the virtio ring. The
configuration API for find the number of queues and setting up
individual queues for a device.
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Sharan Santhanam [Wed, 24 Oct 2018 13:42:30 +0000 (15:42 +0200)]
plat/drivers: Introduce virtio PCI device
We introduces support for virtio PCI legacy device support in this
patch. The driver register on the PCI bus to probe for device with
QUMRANET vendor id. The virtio PCI bus adds the virtio dev. The
virtio bus is responsible for bridging the virtio device with the
driver. The virtio PCI device provides configuration callback for
the PCI bus operation performed on the virtio device. Currently we
add support to the KVM platform
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Sharan Santhanam [Wed, 24 Oct 2018 13:42:28 +0000 (15:42 +0200)]
plat/common: Introduce virtio standard header
We introduce the standard virtio header files.
* virtio_ids: List the ids of the virtio devices
* virtio_ring.h: Describes the virtio ring descriptor, used and
available descriptors.
* virtio_pci.h: Describes the virtio PCI device register map.
* virtio_types.h: Describes the type of the data structure.
* virtio_config.h: Provides helper function to perform IO
operation on the device.
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Sharan Santhanam [Wed, 24 Oct 2018 13:42:27 +0000 (15:42 +0200)]
plat/driver: Remove the virtio-ring implementation
As a part of revamping the virtio layer, we are removing the existing
implementation of virtio ring driver. The virtio ring driver adapted to
the new virtio API will reintroduced later in this patch series
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Wei Chen [Fri, 19 Oct 2018 07:47:56 +0000 (07:47 +0000)]
plat/common: arm: Include correct inline function __uk_test_and_clear_bit
As __uk_test_and_clear_bit has been moved to uk/bitops.h, the time.c could
not find this function from atomic.h. This will cause Arm64 build failed:
LD unikraft_kvm-arm64
/root/UF/unikraft/build/unikraft_kvm-arm64.o: In function `time_block_until':
:(.text+0x400): undefined reference to `__uk_test_and_clear_bit'
:(.text+0x400): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `__uk_test_and_clear_bit'
collect2: error: ld returned 1 exit status
/root/UF/unikraft/plat/kvm/Linker.uk:17: recipe for target '/root/UF/unikraft/build/unikraft_kvm-arm64' failed
make: *** [/root/UF/unikraft/build/unikraft_kvm-arm64] Error 1
Change atomic.h to bitops.h to solve this problem.
Razvan Cojocaru [Fri, 19 Oct 2018 09:43:45 +0000 (11:43 +0200)]
lib/uknetdev: Packet reception and transmission interfaces
Introduce interfaces for single packet transmission and
reception. Both interfaces are designed to support asynchronous
zero-copy operation with netbufs. Receiving can be done with
interrupts or with polling. Transmission supports only polling mode
for now.
Razvan Cojocaru [Fri, 19 Oct 2018 09:43:42 +0000 (11:43 +0200)]
lib/uknetdev: Hardware address interfaces
Add a getter and a setter for a netdev's hardware address (MAC). This
API interface is optional for a driver to implement. By making this
optional we could support network devices that operate on L3 in the
future.
Razvan Cojocaru [Fri, 19 Oct 2018 09:43:41 +0000 (11:43 +0200)]
lib/uknetdev: Netdev initialization
Introduce a 'DPDK RTE Ethernet' inspired API for initializing a
Unikraft network device. The initialization is done in the following
order: (1) Configure main aspects of device (e.g., number of
queues), (2) configure each transmit and receive queue, and (3) start
the device. We also introduce an interface for querying the underlying
device capabilities for each configuration step.
Razvan Cojocaru [Fri, 19 Oct 2018 09:43:40 +0000 (11:43 +0200)]
lib/uknetdev: Netdev registration
Introduce initial netdev API supporting device registration. We
introduce three header files are introduced for describing Unikraft's
netdev API:
uk/netdev_core.h - Core data type definitions
uk/netdev_driver.h - API for drivers
uk/netdev.h - API for network applications and stacks
Simon Kuenzer [Fri, 19 Oct 2018 09:43:39 +0000 (11:43 +0200)]
lib/uknetdev: Netbuf headroom and tailroom helpers
Introduce helpers for calculating available headroom and tailroom on a
Netbuf's data buffer. A header manipulation function is added to
simplify prepending bytes to the packet data or claiming bytes back to
the headroom.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Simon Kuenzer [Fri, 19 Oct 2018 09:43:36 +0000 (11:43 +0200)]
lib/uknetdev: Introduce Netbufs
Adds `struct uk_netbuf`, a structure for describing network
packets. It is designed to support zero-copy operation and simple
embedding to existing network stacks. Netbufs can be (1) initialized
on user-supplied memory regions, intended for network stacks that come
with a packet buffer allocator, or (2) uk_alloc-based allocation.
This commit introduces the netbuf struct and intialization and
allocation functions.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Simon Kuenzer [Thu, 18 Oct 2018 09:29:09 +0000 (11:29 +0200)]
build: Support for static libraries
Introduce support for linking (externally built) static libraries.
A static library can be registered at three different places:
* [LIBNAME]_ALIBS and [LIBNAME]_ALIBS-y
static libraries used when (pre-)linking a library object
* [PLATNAME]_ALIBS and [PLATNAME]_ALIBS-y
static libraries that are linked at the final linking step but only
for a specific platform
* UK_ALIBS and UK_ALIBS-y
static libraries that are linked at the final linking step
While the link order of object files is irrelevant to the linker,
static libraries are handled differently. During linking, static
libraries are only visited once. The only objects taken are those
that resolve at least one yet unresolved symbol. Because of this,
we populate the list of static libraries right after populating all
relevant object files.
Any order or circular dependency within a group of static libraries
is resolved by instructing the linker to scan the archives multiple
times. This is done by the --start-group and --end-group linker flags.
With this change, we also remove the UK_LINK and UK_LINK-y variables
that were used to simplify the platform's linker scripts. Because of
the link order and additional linker flags, we directly assemble the
linker command by taken the items from the corresponding OLIBS and
ALIBS lists.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
Yuri Volchkov [Wed, 10 Oct 2018 12:43:55 +0000 (14:43 +0200)]
include/uk: fix test_bit atomicity
ukarch_test_bit_sync does not make sense. A barrier() call is not a
memory barrier as was said in the comment. Even if it it was, it would
not make ukarch_test_bit_sync atomic.
This commit merges these two function together, and adds a missing
uk_test_bit into bitops.h.
Yuri Volchkov [Wed, 10 Oct 2018 12:43:54 +0000 (14:43 +0200)]
include/uk: do not cast away volatile in atomic.h
Many functions in include/uk/arch/atomic.h accept a volatile argument
and then cast it to something like "__u8 *". In many cases it is ok,
__atomic_*() is called inside the function. But in other cases, this
memory access is a subject to compiler optimization, and may lead to
an unexpected behavior.
While probing the devices on the pci bus, the device identifier are
read from the configuration space. The pci device is identified with
* class_id
* vendor_id
* device_id
* subsystem_id
* subsystemvendor_id
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
lib/uksglist: A scatter/gather list data structure
A scatter/gather list is a list of vectors with each describing the
location and length of one contiguous physical memory region. Scatter
gather lists are helpful for setting up I/O requests with devices.
The sg list provides support for the following operations:
uk_sglist_init
uk_sglist_reset
uk_sglist_count
uk_sglist_alloc
uk_sglist_free
uk_sglist_append
uk_sglist_append_sglist
uk_sglist_build
uk_sglist_clone
uk_sglist_length
uk_sglist_split
uk_sglist_join
uk_sglist_slice
Taken and modified from FreeBSD source commit-id: 4736ccfd9c3
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
NOTE:
Please be aware that this patch uses the update uk_pr_* macros.
Please make sure the patch series "Update libukdebug printing" is reviewed before this patch.
plat/*: Export address conversion with ukplat_virt_to_phys()
ukplat_virt_to_phys() is promoted as a standard platform API and each
platform provides it's own function to convert the virtual address to
physical address.
Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Simon Kuenzer [Thu, 27 Sep 2018 12:41:09 +0000 (14:41 +0200)]
plat/*: Replace uk_printk() with uk_pr_*() equivalents
Replace all occurrences of uk_printk() with reasonable uk_pr_*()
equivalents. An exception is in LinuxU platform. The platform's
command line interaction (e.g., `-h`, `-V`) is going to use standard
output.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Simon Kuenzer [Thu, 27 Sep 2018 12:41:08 +0000 (14:41 +0200)]
plat/linuxu: Use ukplat_coutk() for command line interaction
The platform's command line interaction (e.g., `-h`, `-V`) should
actually use stdio to print messages. printf() would be suitable for
this. However, since this is provided by a libc, it may not be
initialized. Because of this we use ukplat_coutk directly.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Simon Kuenzer [Thu, 27 Sep 2018 12:41:06 +0000 (14:41 +0200)]
lib/ukboot: Use printf() for banner and weak main()
Instead of using libukdebug's kernel console we print directly to
stdout with printf(). This makes the libukboot banner independent of
any print level configuration from libukdebug. To make sure that the
corresponding libc had the chance to initialize its printf(), we move
the banner right before calling main.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Instead of adding multiple ifdefs in the headers in order to choose a
header specific to current architecture, include
<uk/asm/arch_specific_header.h>. This will automatically resolve to
the correct header, via -I flags provided to compiler.
This also moves the arch headers in
arch/<arch_family>/<arch_name>/uk/asm
Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
lib/nolibc: don't include uk/plat/time.h from time.h
Including uk/plat/time.h in time.h of nolibc expose
platform's symbols such as ukplat_monotonic_clock
which are not part of libc.
Instead, uk/plat/time.h should be included directly
from time.c in nolibc
Simon Kuenzer [Thu, 23 Aug 2018 09:49:25 +0000 (11:49 +0200)]
lib/vfscore: Make library un-selectable
This patch adds the option to unselect the vfscore library from builds.
In order to be inline with the Unikraft principle that "everything that
is not needed should be off", vfscore is unselected as default.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
plat/common: Get arch_timer clock frequency from DT for Arm
On a few platforms the frequency is not configured correctly
by the firmware. A property in the DT (clock-frequency) has
been introduced to workaround those firmware. So, we will try
to get clock-frequency from DT first, if failed we will read
the register directly.
Signed-off-by: Wei Chen <wei.chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
As we haven't implement full functions for timer for arm64.
But this function is needed by Unikraft. So we impplement
a temporary function to make compiler happy.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
The boot stack is used for system initialization. This size
is limited, after we have done the initialization, we should
switch away from it as soon as possible. We will use the
memory top as the new stack's top address.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
plat/kvm: Get PSCI conduit method from DTB for Arm64
PSCI supports two conduit method: HVC and SMC. The method
would be set value in device tree's PSCI node. This value
would decide which instruction we should use to call PSCI
functions. We only support PSCI-1.0 and PSCI-0.2 in this
stage.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
plat/kvm: Parse memory info from device tree for Arm64
QEMU/KVM will store the memory informations like memory
region, memory base address and memory size to device
tree. We parse these informations for memory allocater and
new stack setting. QEMU/KVM will always provide us at least
one bank of memory and unikraft will use the first bank for
the time-being. So currently we only supported one bank.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
If we don't enable the CONFIG_HAVE_SCHED, we should get the error:
nolibc/time.c:65:3: error: errno undeclared (first use in this function)
errno = EINVAL;
^~~~~
This because the uk/sched.h include the error.h implicitly. So we
add error.h to the headers.
Signed-off-by: Wei Chen <wei.chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
plat/kvm: Parse command line from device tree for Arm64
Device tree has a "chosen" node, this node can be used to pass
parameters to virtual machine through bootargs property. We can
use this feature to pass command line to unikraft application,
and then parse it from device tree for further usage.
The command line will be modified in uk_argparse, but the memory
attribute of DTB is readonly, we need a copy of this command line.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
plat/kvm: Initialize console from device tree for Arm64
We have implemented a console for early debug console. We had
hardcode the PL011 UART base address. But, after device tree
is ready, we can initialize console from device tree.
Signed-off-by: Wei Chen <wei.chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Arm64 entry code passed the base address of device tree
to _libkvmplat_start. We will check the device tree header
and then save the address for further usage.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
QEMU/KVM provides a 1TB physical address for Arm64. In this case,
we should use 40-bit virtual address to map physical address.
In this patch, we enable the MMU to access memory with virtual
address.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
We're design a direct mapping of physical memory and virtual
memory. In order to improve the security, we use mmu to control
the attributes of image sections. The minimal granularity is 4K.
If map entire physical address with 4k pages, the size of page
tables would be very big. So, wo just use 4K page to map the
area when image has been placed, and use 1G or 2M block to map
other memory areas. In this case, the page tables would only
occupy 20KB memory.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
On Arm64, we need SYNC exception handler to handle some exceptions
like access NULL pointer, and we need IRQ exception handler to handle
IRQs like timer IRQ. Both these types of exceptions would be handled
in EL1. Except these two types of exceptions, other exceptions would
treated as invalid exceptions.
But we have't enabled the GIC, so the IRQ exception also be treated
as invalid exception in current stage.
Sometimes, for debug purpose, we would like to dump the
registers' value while exception happened. This patch add
a function to dump registers. Currently, we haven't enable
the interrupt controller, so any exception is not expected.
So any exception will cause registers dump.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
These APIs are necessary for Unikraft. We have provided local CPU
interrupt functions already, so they can be wrapped in lcpu.c easily.
But we haven't implemented GIC libraries, so the APIs in intctrl.c
are TODO.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
plat/common: Add counter workaround for Cortex-A73 erratum 858921
The errata #858921 describes that Cortex-A73 (r0p0 - r0p2)
counter read can return a wrong value when the counter crosses
a 32bit boundary, but newer Cortex-A73 are not affected.
The workaround involves performing the read twice, compare
bit[32] of the two read values. If bit[32] is different,
keep the first value, otherwise keep the second value.
Signed-off-by: Wei Chen <wei.chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
plat/kvm: Add Arm64 virtual timer library to provide ticks
On KVM platform, print debug message will use ukplat_monotonic_clock
to provide timestamp. So we implement this simple virtual timer
library for timestamp.
Signed-off-by: Wei Chen <Wei.Chen@arm.com> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>