02 Nov, 2017
1 commit
-
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.By default all files without license information are under the default
license of the kernel, which is GPL version 2.Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if
Reviewed-by: Philippe Ombredanne
Reviewed-by: Thomas Gleixner
Signed-off-by: Greg Kroah-Hartman
03 May, 2017
2 commits
-
Allows maintaining extra context per vq. For ease of use, passing in
NULL is legal and disables the feature for all vqs.Includes fixes by Christian for s390, acked by Cornelia.
Signed-off-by: Christian Borntraeger
Acked-by: Cornelia Huck
Signed-off-by: Michael S. Tsirkin -
We are going to add more parameters to find_vqs, let's wrap the call so
we don't need to tweak all drivers every time.Signed-off-by: Michael S. Tsirkin
28 Feb, 2017
2 commits
-
This basically passed up the pci_irq_get_affinity information through
virtio through an optional get_vq_affinity method. It is only implemented
by the PCI backend for now, and only when we use per-virtqueue IRQs.Signed-off-by: Christoph Hellwig
Reviewed-by: Jason Wang
Signed-off-by: Michael S. Tsirkin -
Add a struct irq_affinity pointer to the find_vqs methods, which if set
is used to tell the PCI layer to create the MSI-X vectors for our I/O
virtqueues with the proper affinity from the start. Compared to after
the fact affinity hints this gives us an instantly working setup and
allows to allocate the irq descritors node-local and avoid interconnect
traffic. Last but not least this will allow blk-mq queues are created
based on the interrupt affinity for storage drivers.Signed-off-by: Christoph Hellwig
Reviewed-by: Jason Wang
Signed-off-by: Michael S. Tsirkin
02 Aug, 2016
1 commit
-
The interaction between virtio and IOMMUs is messy.
On most systems with virtio, physical addresses match bus addresses,
and it doesn't particularly matter which one we use to program
the device.On some systems, including Xen and any system with a physical device
that speaks virtio behind a physical IOMMU, we must program the IOMMU
for virtio DMA to work at all.On other systems, including SPARC and PPC64, virtio-pci devices are
enumerated as though they are behind an IOMMU, but the virtio host
ignores the IOMMU, so we must either pretend that the IOMMU isn't
there or somehow map everything as the identity.Add a feature bit to detect that quirk: VIRTIO_F_IOMMU_PLATFORM.
Any device with this feature bit set to 0 needs a quirk and has to be
passed physical addresses (as opposed to bus addresses) even though
the device is behind an IOMMU.Note: it has to be a per-device quirk because for example, there could
be a mix of passed-through and virtual virtio devices. As another
example, some devices could be implemented by an out of process
hypervisor backend (in case of qemu vhost, or vhost-user) and so support
for an IOMMU needs to be coded up separately.It would be cleanest to handle this in IOMMU core code, but that needs
per-device DMA ops. While we are waiting for that to be implemented, use
a work-around in virtio core.Note: a "noiommu" feature is a quirk - add a wrapper to make
that clear.Signed-off-by: Michael S. Tsirkin
13 Jan, 2016
1 commit
-
checkpatch.pl wants arrays of strings declared as follows:
static const char * const names[] = { "vq-1", "vq-2", "vq-3" };
Currently the find_vqs() function takes a const char *names[] argument
so passing checkpatch.pl's const char * const names[] results in a
compiler error due to losing the second const.This patch adjusts the find_vqs() prototype and updates all virtio
transports. This makes it possible for virtio_balloon.c, virtio_input.c,
virtgpu_kms.c, and virtio_rpmsg_bus.c to use the checkpatch.pl-friendly
type.Signed-off-by: Stefan Hajnoczi
Signed-off-by: Michael S. Tsirkin
Acked-by: Bjorn Andersson
01 Jun, 2015
2 commits
-
The current memory accessors logic is:
- little endian if little_endian
- native endian (i.e. no byteswap) if !little_endianIf we want to fully support cross-endian vhost, we also need to be
able to convert to big endian.Instead of changing the little_endian argument to some 3-value enum, this
patch changes the logic to:
- little endian if little_endian
- big endian if !little_endianThe native endian case is handled by all users with a trivial helper. This
patch doesn't change any functionality, nor it does add overhead.Signed-off-by: Greg Kurz
Signed-off-by: Michael S. Tsirkin
Reviewed-by: Cornelia Huck
Reviewed-by: David Gibson -
Signed-off-by: Greg Kurz
Signed-off-by: Michael S. Tsirkin
Acked-by: Cornelia Huck
Reviewed-by: David Gibson
01 Apr, 2015
2 commits
-
"virtio: core support for config generation"
fixed reading up 64 bit values, adding generation
checks for such reads.By mistake, it left an explicit get call in place
as well. the result is that the value is read twice,
the first result is discarded.Not a big deal since this only happens with virtio
blk and only on boot ATM, so performance isn't
affected, but let's clean it up.Signed-off-by: Michael S. Tsirkin
Reviewed-by: Cornelia Huck
Signed-off-by: Rusty Russell -
This simply reorders functions in virtio_config
so width access wrapper helpers are all together.
Drops an extra empty line while we are at it.Signed-off-by: Michael S. Tsirkin
Signed-off-by: Rusty Russell
15 Dec, 2014
1 commit
-
virtio 1.0 spec says:
Drivers MUST NOT assume reads from fields greater than 32 bits wide are
atomic, nor are reads from multiple fields: drivers SHOULD read device
configuration space fields like so:
u32 before, after;
do {
before = get_config_generation(device);
// read config entry/entries.
after = get_config_generation(device);
} while (after != before);Do exactly this, for transports that support it.
Signed-off-by: Michael S. Tsirkin
12 Dec, 2014
1 commit
-
virtio_cread_bytes is implemented incorrectly in case length happens to
be 2,4 or 8 bytes: transports and devices will assume it's an integer
value that has to be converted to LE format.Let's just do multiple 1-byte reads: this also makes life easier
for transports who only need to implement 1,2,4 and 8 byte reads.Signed-off-by: Michael S. Tsirkin
09 Dec, 2014
6 commits
-
This will make it easy for transports to validate features and return
failure.Signed-off-by: Michael S. Tsirkin
-
We (ab)use virtio conversion functions for device-specific
config space accesses.Based on original patches by Cornelia and Rusty.
Signed-off-by: Rusty Russell
Signed-off-by: Cornelia Huck
Signed-off-by: Michael S. Tsirkin
Reviewed-by: David Hildenbrand -
virtio 1.0 makes all memory structures LE, so
we need APIs to conditionally do a byteswap on BE
architectures.To make it easier to check code statically,
add virtio specific types for multi-byte integers
in memory.Add low level wrappers that do a byteswap conditionally, these will be
useful e.g. for vhost. Add high level wrappers that
query device endian-ness and act accordingly.Signed-off-by: Michael S. Tsirkin
Reviewed-by: Cornelia Huck -
Change u32 to u64, and use BIT_ULL and 1ULL everywhere.
Note: transports are unchanged, and only set low 32 bit.
This guarantees that no transport sets e.g. VERSION_1
by mistake without proper support.Based on patch by Rusty.
Signed-off-by: Rusty Russell
Signed-off-by: Cornelia Huck
Signed-off-by: Michael S. Tsirkin
Reviewed-by: David Hildenbrand
Reviewed-by: Cornelia Huck -
It seemed like a good idea to use bitmap for features
in struct virtio_device, but it's actually a pain,
and seems to become even more painful when we get more
than 32 feature bits. Just change it to a u32 for now.Based on patch by Rusty.
Suggested-by: David Hildenbrand
Signed-off-by: Rusty Russell
Signed-off-by: Cornelia Huck
Signed-off-by: Michael S. Tsirkin
Reviewed-by: Cornelia Huck -
Add low level APIs to test/set/clear feature bits.
For use by transports, to make it easier to
write code independent of feature bit array format.Note: APIs is prefixed with __ and has _bit suffix
to stress its low level nature. It's for use by transports only:
drivers should use virtio_has_feature and never need to set/clear
features.Signed-off-by: Michael S. Tsirkin
Reviewed-by: Cornelia Huck
15 Oct, 2014
1 commit
-
virtio spec 0.9.X requires DRIVER_OK to be set before
VQs are used, but some drivers use VQs before probe
function returns.
Since DRIVER_OK is set after probe, this violates the spec.Even though under virtio 1.0 transitional devices support this
behaviour, we want to make it possible for those early callers to become
spec compliant and eventually support non-transitional devices.Add API for drivers to call before using VQs.
Sets DRIVER_OK internally.
Signed-off-by: Michael S. Tsirkin
Reviewed-by: Cornelia Huck
Signed-off-by: Rusty Russell
17 Oct, 2013
2 commits
-
The virtio_cread() functions should now be used.
Signed-off-by: Rusty Russell
-
This lets the us do endian conversion if necessary, and insulates the
drivers from that change.Signed-off-by: Rusty Russell
13 Oct, 2012
1 commit
-
Signed-off-by: David Howells
Acked-by: Arnd Bergmann
Acked-by: Thomas Gleixner
Acked-by: Michael Kerrisk
Acked-by: Paul E. McKenney
Acked-by: Dave Jones
28 Sep, 2012
2 commits
-
virtio network device multiqueue support reserves
vq 3 for future use (useful both for future extensions and to make it
pretty - this way receive vqs have even and transmit - odd numbers).
Make it possible to skip initialization for
specific vq numbers by specifying NULL for name.
Document this usage as well as (existing) NULL callback.Drivers using this not coded up yet, so I simply tested
with virtio-pci and verified that this patch does
not break existing drivers.Signed-off-by: Michael S. Tsirkin
Signed-off-by: Rusty Russell -
Sometimes, virtio device need to configure irq affinity hint to maximize the
performance. Instead of just exposing the irq of a virtqueue, this patch
introduce an API to set the affinity for a virtqueue.The api is best-effort, the affinity hint may not be set as expected due to
platform support, irq sharing or irq type. Currently, only pci method were
implemented and we set the affinity according to:- if device uses INTX, we just ignore the request
- if device has per vq vector, we force the affinity hint
- if the virtqueues share MSI, make the affinity OR over all affinities
requestedSigned-off-by: Jason Wang
Signed-off-by: Paolo Bonzini
Signed-off-by: Rusty Russell
22 May, 2012
1 commit
-
- Delete "@request_vqs" and "@free_vqs" comments, since
they are no longer in struct virtio_config_ops.
- According to the macro below, "@val" should be "@v".Signed-off-by: Chen Baozi
Signed-off-by: Rusty Russell
05 Mar, 2012
1 commit
-
If a header file is making use of BUG, BUG_ON, BUILD_BUG_ON, or any
other BUG variant in a static inline (i.e. not in a #define) then
that header really should be including and not just
expecting it to be implicitly present.We can make this change risk-free, since if the files using these
headers didn't have exposure to linux/bug.h already, they would have
been causing compile failures/warnings.Signed-off-by: Paul Gortmaker
03 Dec, 2011
1 commit
24 Nov, 2011
1 commit
-
virtio pci device reset actually just does an I/O
write, which in PCI is really posted, that is it
can complete on CPU before the device has received it.Further, interrupts might have been pending on
another CPU, so device callback might get invoked after reset.This conflicts with how drivers use reset, which is typically:
reset
unregister
a callback running after reset completed can race with
unregister, potentially leading to use after free bugs.Fix by flushing out the write, and flushing pending interrupts.
This assumes that device is never reset from
its vq/config callbacks, or in parallel with being
added/removed, document this assumption.Signed-off-by: Michael S. Tsirkin
Signed-off-by: Rusty Russell
17 Nov, 2011
1 commit
-
Add a new .bus_name to virtio_config_ops then modify virtio_net to
call through to it in an ethtool .get_drvinfo routine to report
bus_info in ethtool -i output which is consistent with other
emulated NICs and the output of lspci.Signed-off-by: Rick Jones
Signed-off-by: David S. Miller
02 Nov, 2011
1 commit
-
This patch adds virtio_config_val_len() which allows retrieving variable
length data from the virtio config space only if a specific feature is on.Cc: Amit Shah
Cc: "Michael S. Tsirkin"
Cc: Rusty Russell
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Sasha Levin
Signed-off-by: Rusty Russell
30 May, 2011
1 commit
-
It's unclear to me if it's important, but it's obviously causing my
technical colleages some headaches and I'd hate such imprecision to
slow virtio adoption.I've emailed this to all non-trivial contributors for approval, too.
Signed-off-by: Rusty Russell
Acked-by: Grant Likely
Acked-by: Ryan Harper
Acked-by: Anthony Liguori
Acked-by: Eric Van Hensbergen
Acked-by: john cooper
Acked-by: Aneesh Kumar K.V
Acked-by: Christian Borntraeger
Acked-by: Fernando Luis Vazquez Cao
24 Jan, 2011
1 commit
-
Now BUILD_BUG_ON() can handle optimizable constants, we don't need
MAYBE_BUILD_BUG_ON any more.Signed-off-by: Rusty Russell
23 Sep, 2009
1 commit
-
gcc permitting variable length arrays makes the current construct used for
BUILD_BUG_ON() useless, as that doesn't produce any diagnostic if the
controlling expression isn't really constant. Instead, this patch makes
it so that a bit field gets used here. Consequently, those uses where the
condition isn't really constant now also need fixing.Note that in the gfp.h, kmemcheck.h, and virtio_config.h cases
MAYBE_BUILD_BUG_ON() really just serves documentation purposes - even if
the expression is compile time constant (__builtin_constant_p() yields
true), the array is still deemed of variable length by gcc, and hence the
whole expression doesn't have the intended effect.[akpm@linux-foundation.org: make arch/sparc/include/asm/vio.h compile]
[akpm@linux-foundation.org: more nonsensical assertions in tpm.c..]
Signed-off-by: Jan Beulich
Cc: Andi Kleen
Cc: Rusty Russell
Cc: Catalin Marinas
Cc: "David S. Miller"
Cc: Rajiv Andrade
Cc: Mimi Zohar
Cc: James Morris
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
30 Jul, 2009
1 commit
-
I've been doing this for years, and akpm picked me up on it about 12
months ago. lguest partly serves as example code, so let's do it Right.Also, remove two unused fields in struct vblk_info in the example launcher.
Signed-off-by: Rusty Russell
Cc: Ingo Molnar
12 Jun, 2009
3 commits
-
Drivers don't add transport features to their table, so we
shouldn't check these with virtio_check_driver_offered_feature().We could perhaps add an ->offered_feature() virtio_config_op,
but that perhaps that would be overkill for a consitency check
like this.Signed-off-by: Mark McLoughlin
Signed-off-by: Rusty Russell -
This replaces find_vq/del_vq with find_vqs/del_vqs virtio operations,
and updates all drivers. This is needed for MSI support, because MSI
needs to know the total number of vectors upfront.Signed-off-by: Michael S. Tsirkin
Signed-off-by: Rusty Russell (+ lguest/9p compile fixes) -
Add a linked list of all virtqueues for a virtio device: this helps for
debugging and is also needed for upcoming interface change.Also, add a "name" field for clearer debug messages.
Signed-off-by: Rusty Russell
25 Jul, 2008
2 commits
-
Rather than explicitly handing the features to the lower-level, we just
hand the virtio_device and have it set the features. This make it clear
that it has the chance to manipulate the features of the device at this
point (and that all feature negotiation is already done).Signed-off-by: Rusty Russell
-
We assign feature bits as required, but it makes sense to reserve some
for the particular transport, rather than the particular device.Signed-off-by: Rusty Russell