History log of /kvmtool/include/kvm/virtio-pci.h (Results 1 – 25 of 27)
Revision Date Author Comments
# c86ef0b8 01-Jul-2022 Jean-Philippe Brucker <jean-philippe.brucker@arm.com>

virtio/pci: Remove VIRTIO_PCI_F_SIGNAL_MSI

VIRTIO_PCI_F_SIGNAL_MSI is not a virtio feature but an internal flag.
Change it to bool to avoid confusion.

Signed-off-by: Jean-Philippe Brucker <jean-phi

virtio/pci: Remove VIRTIO_PCI_F_SIGNAL_MSI

VIRTIO_PCI_F_SIGNAL_MSI is not a virtio feature but an internal flag.
Change it to bool to avoid confusion.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Link: https://lore.kernel.org/r/20220701142434.75170-13-jean-philippe.brucker@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# 3d5cefc2 01-Jul-2022 Jean-Philippe Brucker <jean-philippe.brucker@arm.com>

virtio/pci: Initialize all vectors to VIRTIO_MSI_NO_VECTOR

According to the virtio spec, all vectors must be initialized to
VIRTIO_MSI_NO_VECTOR (0xffff). In 4.1.5.1.2.1 "Device Requirements:
MSI-X

virtio/pci: Initialize all vectors to VIRTIO_MSI_NO_VECTOR

According to the virtio spec, all vectors must be initialized to
VIRTIO_MSI_NO_VECTOR (0xffff). In 4.1.5.1.2.1 "Device Requirements:
MSI-X Vector Configuration":

The device MUST return vector mapped to a given event, (NO_VECTOR if
unmapped) on read of config_msix_vector/queue_msix_vector.

Currently we return 0, which is a valid MSI vector. Return NO_VECTOR
instead.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Link: https://lore.kernel.org/r/20220701142434.75170-12-jean-philippe.brucker@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# b0d56e3c 01-Jul-2022 Jean-Philippe Brucker <jean-philippe.brucker@arm.com>

virtio: Add support for modern virtio-pci

Add support for modern virtio-pci implementation (based on the 1.0 virtio
spec). We add a new transport, alongside MMIO and PCI-legacy. This is now
the defa

virtio: Add support for modern virtio-pci

Add support for modern virtio-pci implementation (based on the 1.0 virtio
spec). We add a new transport, alongside MMIO and PCI-legacy. This is now
the default when selecting PCI, but users can still select the legacy
transport for all virtio devices by passing "--virtio-legacy" on the
command-line.

The main change in modern PCI is the way we address virtqueues, using
64-bit values instead of PFNs. To keep the queue configuration atomic the
device also gets a "queue enable" register. Configuration is also made
extensible by more feature bits and PCI capabilities. Scalability is
improved as well, as devices can have notification registers for each
virtqueue on separate pages. However this implementation keeps a single
notification register.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Link: https://lore.kernel.org/r/20220701142434.75170-9-jean-philippe.brucker@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# 930876d5 01-Jul-2022 Jean-Philippe Brucker <jean-philippe.brucker@arm.com>

virtio: Move PCI transport to pci-legacy

To make space for the more recent virtio version, move the legacy bits of
virtio-pci to a different file.

Signed-off-by: Jean-Philippe Brucker <jean-philipp

virtio: Move PCI transport to pci-legacy

To make space for the more recent virtio version, move the legacy bits of
virtio-pci to a different file.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Link: https://lore.kernel.org/r/20220701142434.75170-8-jean-philippe.brucker@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# 21c9bc74 01-Jul-2022 Jean-Philippe Brucker <jean-philippe.brucker@arm.com>

virtio/pci: Make doorbell offset dynamic

The doorbell offset depends on the transport - virtio-legacy uses a
fixed offset, but modern virtio can have per-vq offsets. Add an offset
field to the virti

virtio/pci: Make doorbell offset dynamic

The doorbell offset depends on the transport - virtio-legacy uses a
fixed offset, but modern virtio can have per-vq offsets. Add an offset
field to the virtio_pci structure.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Link: https://lore.kernel.org/r/20220701142434.75170-4-jean-philippe.brucker@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# e539f3e4 14-May-2020 Alexandru Elisei <alexandru.elisei@arm.com>

virtio/pci: Get emulated region address from BARs

The struct virtio_pci fields port_addr, mmio_addr and msix_io_block
represent the same addresses that are written in the corresponding BARs.
Remove

virtio/pci: Get emulated region address from BARs

The struct virtio_pci fields port_addr, mmio_addr and msix_io_block
represent the same addresses that are written in the corresponding BARs.
Remove this duplication of information and always use the address from the
BAR. This will make our life a lot easier when we add support for
reassignable BARs, because we won't have to update the fields on each BAR
change.

No functional changes.

Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Link: https://lore.kernel.org/r/1589470709-4104-4-git-send-email-alexandru.elisei@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# eb34a8c2 10-Jan-2019 Jean-Philippe Brucker <jean-philippe.brucker@arm.com>

virtio: Add reset() callback

When the guest writes a status of 0, the device should be reset. Add a
reset() callback for the transport layer to reset all queues and their
ioeventfd.

Signed-off-by:

virtio: Add reset() callback

When the guest writes a status of 0, the device should be reset. Add a
reset() callback for the transport layer to reset all queues and their
ioeventfd.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

show more ...


# e9922aaf 04-Jun-2015 Andre Przywara <andre.przywara@arm.com>

kvmtool: don't use PCI config space IRQ line field

In PCI config space there is an interrupt line field (offset 0x3f),
which is used to initially communicate the IRQ line number from
firmware to the

kvmtool: don't use PCI config space IRQ line field

In PCI config space there is an interrupt line field (offset 0x3f),
which is used to initially communicate the IRQ line number from
firmware to the OS. _Hardware_ should never use this information,
as the OS is free to write any information in there.
But kvmtool uses this number when it triggers IRQs in the guest,
which fails starting with Linux 3.19-rc1, where the PCI layer starts
writing the virtual IRQ number in there.

Fix that by storing the IRQ number in a separate field in
struct virtio_pci, which is independent from the PCI config space
and cannot be influenced by the guest.
This fixes ARM/ARM64 guests using PCI with newer kernels.

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

show more ...


# a463650c 04-Feb-2014 Will Deacon <will.deacon@arm.com>

kvm tools: pci: add MMIO interface to virtio-pci devices

This patch adds an MMIO interface for each virtio-pci device, so that
they can be accessed without having to use an ioport. For each device,

kvm tools: pci: add MMIO interface to virtio-pci devices

This patch adds an MMIO interface for each virtio-pci device, so that
they can be accessed without having to use an ioport. For each device, a
new memory BAR is added which corresponds to an area of MMIO space with
a shim trap handler. This handler simply translates the access into an
ioport access via kvm__emulate_io. Since guests can generate accesses
via either the ioport or MMIO regions, an ioeventfd is registered for
both.

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

show more ...


# 45d3b59e 09-Apr-2013 Sasha Levin <sasha.levin@oracle.com>

kvm tools: Increase amount of possible interrupts per PCI device

We've limited the amount of interrupts per PCI device to be the maximum amount of VQs.

Now that the maximum amount of VQs has increa

kvm tools: Increase amount of possible interrupts per PCI device

We've limited the amount of interrupts per PCI device to be the maximum amount of VQs.

Now that the maximum amount of VQs has increased, time to increase this as well.

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

show more ...


# 21ff329d 22-Nov-2012 Will Deacon <will.deacon@arm.com>

kvm tools: add generic device registration mechanism

PCI devices are currently registered into the pci_devices array via the
pci__register function, which can then be indexed later by architecture
c

kvm tools: add generic device registration mechanism

PCI devices are currently registered into the pci_devices array via the
pci__register function, which can then be indexed later by architecture
code to construct device tree nodes. For MMIO devices, there is no such
utility.

Rather than invent a similar mechanism for MMIO, this patch creates a
global device registration mechanism, which allows the device type to be
specified when registered or indexing a device. Current users of the pci
registration code are migrated to the new infrastructure and virtio MMIO
devices are registered at init time.

As part of the device registration, allocation of the device number is
moved out of irq__register_device and performed when adding the device
header to the relevant bus tree, allowing us to maintain separate device
numberspaces for each bus.

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

show more ...


# 43c81c74 30-Aug-2012 Sasha Levin <levinsasha928@gmail.com>

kvm tools: Use the new KVM_SIGNAL_MSI ioctl to inject interrupts directly.

We still create GSIs and keep them for two reasons:

- They're required by virtio-* devices.
- There's not much overhead

kvm tools: Use the new KVM_SIGNAL_MSI ioctl to inject interrupts directly.

We still create GSIs and keep them for two reasons:

- They're required by virtio-* devices.
- There's not much overhead since we just create them when starting the
guest, they don't use anything when the guest is running.

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

show more ...


# 02eca50c 07-Apr-2012 Asias He <asias.hejun@gmail.com>

kvm tools: Rework on virtio transport abstraction.

This patch reworks on virtio transport abstraction.

* Move virtio transport operations to virtio operations and drop
virtio/trans.c This makes t

kvm tools: Rework on virtio transport abstraction.

This patch reworks on virtio transport abstraction.

* Move virtio transport operations to virtio operations and drop
virtio/trans.c This makes the abstraction much cleaner.

* Rename struct virtio_trans to struct virtio_device

struct virtio_trans {
void *virtio;
enum virtio_trans_type type;
struct virtio_trans_ops *trans_ops;
struct virtio_ops *virtio_ops;
};

struct virtio_device {
void *virtio;
struct virtio_ops *ops;
};

The virtio_trans struct is bit confusing since it also includes virtio
operations.

* Introduce virtio_init()
To init device, e.g.
Before:
virtio_trans_init()
ndev->vtrans.trans_ops->init()
ndev->vtrans.virtio_ops = &net_dev_virtio_ops
After:
virtio_init()

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 495fbd4e 19-Dec-2011 Sasha Levin <levinsasha928@gmail.com>

kvm tools: Fixes for virtio module

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

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


# 9c26dab4 10-Dec-2011 Sasha Levin <levinsasha928@gmail.com>

kvm tools: Free up the MSI-X PBA BAR

Free up the BAR to make space for the new virtio BARs. It isn't required
to have the PBA and the table in the separate BARs, and uniting them will
just give us e

kvm tools: Free up the MSI-X PBA BAR

Free up the BAR to make space for the new virtio BARs. It isn't required
to have the PBA and the table in the separate BARs, and uniting them will
just give us extra BARs to play with.

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

show more ...


# 1c47ce69 09-Nov-2011 Sasha Levin <levinsasha928@gmail.com>

kvm tools: Add abstract virtio transport layer

Since virtio-mmio was introduced in 3.2, virtio-pci isn't the only transport
layer between the kernel and virtio devices.

This patch adds an abstract

kvm tools: Add abstract virtio transport layer

Since virtio-mmio was introduced in 3.2, virtio-pci isn't the only transport
layer between the kernel and virtio devices.

This patch adds an abstract virtio-transport layer which allows to easily
use different transports while making it transparent to the device.

This is the first step in adding virtio-mmio support.

Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 14bba8a0 27-Oct-2011 Asias He <asias.hejun@gmail.com>

kvm tools: Fix MSI-X table size set up

We at most have VIRTIO_PCI_MAX_VQ entries for virt queue,
VIRTIO_PCI_MAX_CONFIG entries for config.

To quote the PCI spec:

System software reads this fie

kvm tools: Fix MSI-X table size set up

We at most have VIRTIO_PCI_MAX_VQ entries for virt queue,
VIRTIO_PCI_MAX_CONFIG entries for config.

To quote the PCI spec:

System software reads this field to determine the
MSI-X Table Size N, which is encoded as N-1.
For example, a returned value of "00000000011"
indicates a table size of 4.

So, we should set table size to

VIRTIO_PCI_MAX_VQ + VIRTIO_PCI_MAX_CONFIG - 1

not

VIRTIO_PCI_MAX_VQ + VIRTIO_PCI_MAX_CONFIG

Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 507e02d8 27-Oct-2011 Asias He <asias.hejun@gmail.com>

kvm tools: Set correct virtio pci device class code

All the virtio pci device is set to class code 0x010000, this is wrong.
This patch sets the correct class code and makes lspci report correct
clas

kvm tools: Set correct virtio pci device class code

All the virtio pci device is set to class code 0x010000, this is wrong.
This patch sets the correct class code and makes lspci report correct
class type. For example, the net device:

Before:
$ lspci
00:03.0 SCSI storage controller: Red Hat, Inc Virtio network device

After:
$ lspci
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device

Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 06f48103 23-Aug-2011 Sasha Levin <levinsasha928@gmail.com>

kvm tools: MSI-X fixes

Several fixes in this patch:

* Don't ignore function level and per-vector masking. We're not
supposed to signal when masked and not doing so will improve
performance a bit (i

kvm tools: MSI-X fixes

Several fixes in this patch:

* Don't ignore function level and per-vector masking. We're not
supposed to signal when masked and not doing so will improve
performance a bit (in addition to behaving correctly).

* Implement the missing PBA array. 'lspci -vv' will now show the correct
output:
Capabilities: [40] MSI-X: Enable+ Count=5 Masked-
Vector table: BAR=1 offset=00000000
PBA: BAR=3 offset=00000000

* Checking whether MSI-X is enabled or not is done by probing the
corresponding bit within the PCI header instead of trying to track
the status ourselves.

* Fallback to INTx if MSI-X isn't enabled.

* Use correct max size for MSI-X table.

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

show more ...


# 1599d724 24-Aug-2011 Sasha Levin <levinsasha928@gmail.com>

kvm tools: Move ioeventfd registration to virtio-pci

This patch removed ioeventfd registration from devices and moves it
to a single place in virtio-pci layer.

Signed-off-by: Sasha Levin <levinsash

kvm tools: Move ioeventfd registration to virtio-pci

This patch removed ioeventfd registration from devices and moves it
to a single place in virtio-pci layer.

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

show more ...


# 36f5dc91 22-Aug-2011 Sasha Levin <levinsasha928@gmail.com>

kvm tools: Separate virtio-pci layer

This patch builds a virtio-pci layer which can be used by virtio
devices as a layer to interact with virtio-pci. The purpose of the
patch is to separate the comm

kvm tools: Separate virtio-pci layer

This patch builds a virtio-pci layer which can be used by virtio
devices as a layer to interact with virtio-pci. The purpose of the
patch is to separate the common virtio-pci layer from being replicated
in all virtio devices.

The new layer provides a callback interface to receive information about
virtio events.

This allows us to share the entire functionality of virtio-pci throughout all
virtio devices, for example - we don't need to implement MSI-X for each device
and can just do it once for virtio-pci.

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

show more ...


# b8f43678 11-May-2011 Sasha Levin <levinsasha928@gmail.com>

kvm tools: Use definitions from kernel headers

Instead of redefining virtio pci constants (or not using them at all), use
constants from kernel header.

Acked-and-tested-by: Ingo Molnar <mingo@elte.

kvm tools: Use definitions from kernel headers

Instead of redefining virtio pci constants (or not using them at all), use
constants from kernel header.

Acked-and-tested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 31638bca 05-May-2011 Cyrill Gorcunov <gorcunov@gmail.com>

kvm tools: Gather Virtio-PCI constants into one place

It's better than have them sprinkled in.c files. Note
that pin for ring device is changed so it no longer shared
with block device (it is done i

kvm tools: Gather Virtio-PCI constants into one place

It's better than have them sprinkled in.c files. Note
that pin for ring device is changed so it no longer shared
with block device (it is done in a sake of simplicity).

Also comment style if a bit tuned up in virtio-pci.h
just to be consistent.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 416b2c2d 08-Apr-2011 Asias He <asias.hejun@gmail.com>

kvm tools: Unify virtio code file names

- rename {blk,console}-virtio.* to virtio-{blk,console}.*
- change the virtio block device PCI io space operation callback names

Signed-off-by: Asias He <asi

kvm tools: Unify virtio code file names

- rename {blk,console}-virtio.* to virtio-{blk,console}.*
- change the virtio block device PCI io space operation callback names

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 40ce993f 04-Jan-2011 Pekka Enberg <penberg@kernel.org>

kvm: Implement virtio blk device config space

Signed-off-by: Pekka Enberg <penberg@kernel.org>


12