Skip to content

Commit cec9c5e

Browse files
committed
tools/virtio: switch to kernel's virtio_config.h
Drops stubs in virtio_config.h, use the kernel's version instead - we are now activly developing it, so the stub became too hard to maintain. Message-ID: <8e5c85dc8aad001f161f7e2d8799ffbccfc31381.1764873799.git.mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent b0fe545 commit cec9c5e

1 file changed

Lines changed: 1 addition & 101 deletions

File tree

tools/virtio/linux/virtio_config.h

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1 @@
1-
/* SPDX-License-Identifier: GPL-2.0 */
2-
#ifndef LINUX_VIRTIO_CONFIG_H
3-
#define LINUX_VIRTIO_CONFIG_H
4-
#include <linux/virtio_byteorder.h>
5-
#include <linux/virtio.h>
6-
#include <uapi/linux/virtio_config.h>
7-
8-
struct virtio_config_ops {
9-
int (*disable_vq_and_reset)(struct virtqueue *vq);
10-
int (*enable_vq_after_reset)(struct virtqueue *vq);
11-
};
12-
13-
/*
14-
* __virtio_test_bit - helper to test feature bits. For use by transports.
15-
* Devices should normally use virtio_has_feature,
16-
* which includes more checks.
17-
* @vdev: the device
18-
* @fbit: the feature bit
19-
*/
20-
static inline bool __virtio_test_bit(const struct virtio_device *vdev,
21-
unsigned int fbit)
22-
{
23-
return vdev->features & (1ULL << fbit);
24-
}
25-
26-
/**
27-
* __virtio_set_bit - helper to set feature bits. For use by transports.
28-
* @vdev: the device
29-
* @fbit: the feature bit
30-
*/
31-
static inline void __virtio_set_bit(struct virtio_device *vdev,
32-
unsigned int fbit)
33-
{
34-
vdev->features |= (1ULL << fbit);
35-
}
36-
37-
/**
38-
* __virtio_clear_bit - helper to clear feature bits. For use by transports.
39-
* @vdev: the device
40-
* @fbit: the feature bit
41-
*/
42-
static inline void __virtio_clear_bit(struct virtio_device *vdev,
43-
unsigned int fbit)
44-
{
45-
vdev->features &= ~(1ULL << fbit);
46-
}
47-
48-
#define virtio_has_feature(dev, feature) \
49-
(__virtio_test_bit((dev), feature))
50-
51-
/**
52-
* virtio_has_dma_quirk - determine whether this device has the DMA quirk
53-
* @vdev: the device
54-
*/
55-
static inline bool virtio_has_dma_quirk(const struct virtio_device *vdev)
56-
{
57-
/*
58-
* Note the reverse polarity of the quirk feature (compared to most
59-
* other features), this is for compatibility with legacy systems.
60-
*/
61-
return !virtio_has_feature(vdev, VIRTIO_F_ACCESS_PLATFORM);
62-
}
63-
64-
static inline bool virtio_is_little_endian(struct virtio_device *vdev)
65-
{
66-
return virtio_has_feature(vdev, VIRTIO_F_VERSION_1) ||
67-
virtio_legacy_is_little_endian();
68-
}
69-
70-
/* Memory accessors */
71-
static inline u16 virtio16_to_cpu(struct virtio_device *vdev, __virtio16 val)
72-
{
73-
return __virtio16_to_cpu(virtio_is_little_endian(vdev), val);
74-
}
75-
76-
static inline __virtio16 cpu_to_virtio16(struct virtio_device *vdev, u16 val)
77-
{
78-
return __cpu_to_virtio16(virtio_is_little_endian(vdev), val);
79-
}
80-
81-
static inline u32 virtio32_to_cpu(struct virtio_device *vdev, __virtio32 val)
82-
{
83-
return __virtio32_to_cpu(virtio_is_little_endian(vdev), val);
84-
}
85-
86-
static inline __virtio32 cpu_to_virtio32(struct virtio_device *vdev, u32 val)
87-
{
88-
return __cpu_to_virtio32(virtio_is_little_endian(vdev), val);
89-
}
90-
91-
static inline u64 virtio64_to_cpu(struct virtio_device *vdev, __virtio64 val)
92-
{
93-
return __virtio64_to_cpu(virtio_is_little_endian(vdev), val);
94-
}
95-
96-
static inline __virtio64 cpu_to_virtio64(struct virtio_device *vdev, u64 val)
97-
{
98-
return __cpu_to_virtio64(virtio_is_little_endian(vdev), val);
99-
}
100-
101-
#endif
1+
#include "../../include/linux/virtio_config.h"

0 commit comments

Comments
 (0)