1*8fb49b4cSBin Meng // SPDX-License-Identifier: GPL-2.0+
2*8fb49b4cSBin Meng /*
3*8fb49b4cSBin Meng * Copyright (C) 2018, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
4*8fb49b4cSBin Meng * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
5*8fb49b4cSBin Meng *
6*8fb49b4cSBin Meng * VirtIO is a virtualization standard for network and disk device drivers
7*8fb49b4cSBin Meng * where just the guest's device driver "knows" it is running in a virtual
8*8fb49b4cSBin Meng * environment, and cooperates with the hypervisor. This enables guests to
9*8fb49b4cSBin Meng * get high performance network and disk operations, and gives most of the
10*8fb49b4cSBin Meng * performance benefits of paravirtualization. In the U-Boot case, the guest
11*8fb49b4cSBin Meng * is U-Boot itself, while the virtual environment are normally QEMU targets
12*8fb49b4cSBin Meng * like ARM, RISC-V and x86.
13*8fb49b4cSBin Meng *
14*8fb49b4cSBin Meng * See http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.pdf for
15*8fb49b4cSBin Meng * the VirtIO specification v1.0.
16*8fb49b4cSBin Meng */
17*8fb49b4cSBin Meng
18*8fb49b4cSBin Meng #include <common.h>
19*8fb49b4cSBin Meng #include <dm.h>
20*8fb49b4cSBin Meng #include <virtio_types.h>
21*8fb49b4cSBin Meng #include <virtio.h>
22*8fb49b4cSBin Meng #include <dm/lists.h>
23*8fb49b4cSBin Meng
24*8fb49b4cSBin Meng static const char *const virtio_drv_name[VIRTIO_ID_MAX_NUM] = {
25*8fb49b4cSBin Meng [VIRTIO_ID_NET] = VIRTIO_NET_DRV_NAME,
26*8fb49b4cSBin Meng [VIRTIO_ID_BLOCK] = VIRTIO_BLK_DRV_NAME,
27*8fb49b4cSBin Meng };
28*8fb49b4cSBin Meng
virtio_get_config(struct udevice * vdev,unsigned int offset,void * buf,unsigned int len)29*8fb49b4cSBin Meng int virtio_get_config(struct udevice *vdev, unsigned int offset,
30*8fb49b4cSBin Meng void *buf, unsigned int len)
31*8fb49b4cSBin Meng {
32*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
33*8fb49b4cSBin Meng
34*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
35*8fb49b4cSBin Meng
36*8fb49b4cSBin Meng return ops->get_config(vdev->parent, offset, buf, len);
37*8fb49b4cSBin Meng }
38*8fb49b4cSBin Meng
virtio_set_config(struct udevice * vdev,unsigned int offset,void * buf,unsigned int len)39*8fb49b4cSBin Meng int virtio_set_config(struct udevice *vdev, unsigned int offset,
40*8fb49b4cSBin Meng void *buf, unsigned int len)
41*8fb49b4cSBin Meng {
42*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
43*8fb49b4cSBin Meng
44*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
45*8fb49b4cSBin Meng
46*8fb49b4cSBin Meng return ops->set_config(vdev->parent, offset, buf, len);
47*8fb49b4cSBin Meng }
48*8fb49b4cSBin Meng
virtio_generation(struct udevice * vdev,u32 * counter)49*8fb49b4cSBin Meng int virtio_generation(struct udevice *vdev, u32 *counter)
50*8fb49b4cSBin Meng {
51*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
52*8fb49b4cSBin Meng
53*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
54*8fb49b4cSBin Meng if (!ops->generation)
55*8fb49b4cSBin Meng return -ENOSYS;
56*8fb49b4cSBin Meng
57*8fb49b4cSBin Meng return ops->generation(vdev->parent, counter);
58*8fb49b4cSBin Meng }
59*8fb49b4cSBin Meng
virtio_get_status(struct udevice * vdev,u8 * status)60*8fb49b4cSBin Meng int virtio_get_status(struct udevice *vdev, u8 *status)
61*8fb49b4cSBin Meng {
62*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
63*8fb49b4cSBin Meng
64*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
65*8fb49b4cSBin Meng
66*8fb49b4cSBin Meng return ops->get_status(vdev->parent, status);
67*8fb49b4cSBin Meng }
68*8fb49b4cSBin Meng
virtio_set_status(struct udevice * vdev,u8 status)69*8fb49b4cSBin Meng int virtio_set_status(struct udevice *vdev, u8 status)
70*8fb49b4cSBin Meng {
71*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
72*8fb49b4cSBin Meng
73*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
74*8fb49b4cSBin Meng
75*8fb49b4cSBin Meng return ops->set_status(vdev->parent, status);
76*8fb49b4cSBin Meng }
77*8fb49b4cSBin Meng
virtio_reset(struct udevice * vdev)78*8fb49b4cSBin Meng int virtio_reset(struct udevice *vdev)
79*8fb49b4cSBin Meng {
80*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
81*8fb49b4cSBin Meng
82*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
83*8fb49b4cSBin Meng
84*8fb49b4cSBin Meng return ops->reset(vdev->parent);
85*8fb49b4cSBin Meng }
86*8fb49b4cSBin Meng
virtio_get_features(struct udevice * vdev,u64 * features)87*8fb49b4cSBin Meng int virtio_get_features(struct udevice *vdev, u64 *features)
88*8fb49b4cSBin Meng {
89*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
90*8fb49b4cSBin Meng
91*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
92*8fb49b4cSBin Meng
93*8fb49b4cSBin Meng return ops->get_features(vdev->parent, features);
94*8fb49b4cSBin Meng }
95*8fb49b4cSBin Meng
virtio_set_features(struct udevice * vdev)96*8fb49b4cSBin Meng int virtio_set_features(struct udevice *vdev)
97*8fb49b4cSBin Meng {
98*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
99*8fb49b4cSBin Meng
100*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
101*8fb49b4cSBin Meng
102*8fb49b4cSBin Meng return ops->set_features(vdev->parent);
103*8fb49b4cSBin Meng }
104*8fb49b4cSBin Meng
virtio_find_vqs(struct udevice * vdev,unsigned int nvqs,struct virtqueue * vqs[])105*8fb49b4cSBin Meng int virtio_find_vqs(struct udevice *vdev, unsigned int nvqs,
106*8fb49b4cSBin Meng struct virtqueue *vqs[])
107*8fb49b4cSBin Meng {
108*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
109*8fb49b4cSBin Meng
110*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
111*8fb49b4cSBin Meng
112*8fb49b4cSBin Meng return ops->find_vqs(vdev->parent, nvqs, vqs);
113*8fb49b4cSBin Meng }
114*8fb49b4cSBin Meng
virtio_del_vqs(struct udevice * vdev)115*8fb49b4cSBin Meng int virtio_del_vqs(struct udevice *vdev)
116*8fb49b4cSBin Meng {
117*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
118*8fb49b4cSBin Meng
119*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
120*8fb49b4cSBin Meng
121*8fb49b4cSBin Meng return ops->del_vqs(vdev->parent);
122*8fb49b4cSBin Meng }
123*8fb49b4cSBin Meng
virtio_notify(struct udevice * vdev,struct virtqueue * vq)124*8fb49b4cSBin Meng int virtio_notify(struct udevice *vdev, struct virtqueue *vq)
125*8fb49b4cSBin Meng {
126*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
127*8fb49b4cSBin Meng
128*8fb49b4cSBin Meng ops = virtio_get_ops(vdev->parent);
129*8fb49b4cSBin Meng
130*8fb49b4cSBin Meng return ops->notify(vdev->parent, vq);
131*8fb49b4cSBin Meng }
132*8fb49b4cSBin Meng
virtio_add_status(struct udevice * vdev,u8 status)133*8fb49b4cSBin Meng void virtio_add_status(struct udevice *vdev, u8 status)
134*8fb49b4cSBin Meng {
135*8fb49b4cSBin Meng u8 old;
136*8fb49b4cSBin Meng
137*8fb49b4cSBin Meng if (!virtio_get_status(vdev, &old))
138*8fb49b4cSBin Meng virtio_set_status(vdev, old | status);
139*8fb49b4cSBin Meng }
140*8fb49b4cSBin Meng
virtio_finalize_features(struct udevice * vdev)141*8fb49b4cSBin Meng int virtio_finalize_features(struct udevice *vdev)
142*8fb49b4cSBin Meng {
143*8fb49b4cSBin Meng struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(vdev->parent);
144*8fb49b4cSBin Meng u8 status;
145*8fb49b4cSBin Meng int ret;
146*8fb49b4cSBin Meng
147*8fb49b4cSBin Meng ret = virtio_set_features(vdev);
148*8fb49b4cSBin Meng if (ret)
149*8fb49b4cSBin Meng return ret;
150*8fb49b4cSBin Meng
151*8fb49b4cSBin Meng if (uc_priv->legacy)
152*8fb49b4cSBin Meng return 0;
153*8fb49b4cSBin Meng
154*8fb49b4cSBin Meng virtio_add_status(vdev, VIRTIO_CONFIG_S_FEATURES_OK);
155*8fb49b4cSBin Meng ret = virtio_get_status(vdev, &status);
156*8fb49b4cSBin Meng if (ret)
157*8fb49b4cSBin Meng return ret;
158*8fb49b4cSBin Meng if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) {
159*8fb49b4cSBin Meng debug("(%s): device refuses features %x\n", vdev->name, status);
160*8fb49b4cSBin Meng return -ENODEV;
161*8fb49b4cSBin Meng }
162*8fb49b4cSBin Meng
163*8fb49b4cSBin Meng return 0;
164*8fb49b4cSBin Meng }
165*8fb49b4cSBin Meng
virtio_driver_features_init(struct virtio_dev_priv * priv,const u32 * feature,u32 feature_size,const u32 * feature_legacy,u32 feature_legacy_size)166*8fb49b4cSBin Meng void virtio_driver_features_init(struct virtio_dev_priv *priv,
167*8fb49b4cSBin Meng const u32 *feature,
168*8fb49b4cSBin Meng u32 feature_size,
169*8fb49b4cSBin Meng const u32 *feature_legacy,
170*8fb49b4cSBin Meng u32 feature_legacy_size)
171*8fb49b4cSBin Meng {
172*8fb49b4cSBin Meng priv->feature_table = feature;
173*8fb49b4cSBin Meng priv->feature_table_size = feature_size;
174*8fb49b4cSBin Meng priv->feature_table_legacy = feature_legacy;
175*8fb49b4cSBin Meng priv->feature_table_size_legacy = feature_legacy_size;
176*8fb49b4cSBin Meng }
177*8fb49b4cSBin Meng
virtio_init(void)178*8fb49b4cSBin Meng int virtio_init(void)
179*8fb49b4cSBin Meng {
180*8fb49b4cSBin Meng struct udevice *bus;
181*8fb49b4cSBin Meng int ret;
182*8fb49b4cSBin Meng
183*8fb49b4cSBin Meng /* Enumerate all known virtio devices */
184*8fb49b4cSBin Meng ret = uclass_first_device(UCLASS_VIRTIO, &bus);
185*8fb49b4cSBin Meng if (ret)
186*8fb49b4cSBin Meng return ret;
187*8fb49b4cSBin Meng
188*8fb49b4cSBin Meng while (bus) {
189*8fb49b4cSBin Meng ret = uclass_next_device(&bus);
190*8fb49b4cSBin Meng if (ret)
191*8fb49b4cSBin Meng break;
192*8fb49b4cSBin Meng }
193*8fb49b4cSBin Meng
194*8fb49b4cSBin Meng return ret;
195*8fb49b4cSBin Meng }
196*8fb49b4cSBin Meng
virtio_uclass_pre_probe(struct udevice * udev)197*8fb49b4cSBin Meng static int virtio_uclass_pre_probe(struct udevice *udev)
198*8fb49b4cSBin Meng {
199*8fb49b4cSBin Meng struct dm_virtio_ops *ops;
200*8fb49b4cSBin Meng
201*8fb49b4cSBin Meng ops = (struct dm_virtio_ops *)(udev->driver->ops);
202*8fb49b4cSBin Meng
203*8fb49b4cSBin Meng /*
204*8fb49b4cSBin Meng * Check virtio transport driver ops here so that we don't need
205*8fb49b4cSBin Meng * check these ops each time when the virtio_xxx APIs are called.
206*8fb49b4cSBin Meng *
207*8fb49b4cSBin Meng * Only generation op is optional. All other ops are must-have.
208*8fb49b4cSBin Meng */
209*8fb49b4cSBin Meng if (!ops->get_config || !ops->set_config ||
210*8fb49b4cSBin Meng !ops->get_status || !ops->set_status ||
211*8fb49b4cSBin Meng !ops->get_features || !ops->set_features ||
212*8fb49b4cSBin Meng !ops->find_vqs || !ops->del_vqs ||
213*8fb49b4cSBin Meng !ops->reset || !ops->notify)
214*8fb49b4cSBin Meng return -ENOENT;
215*8fb49b4cSBin Meng
216*8fb49b4cSBin Meng return 0;
217*8fb49b4cSBin Meng }
218*8fb49b4cSBin Meng
virtio_uclass_post_probe(struct udevice * udev)219*8fb49b4cSBin Meng static int virtio_uclass_post_probe(struct udevice *udev)
220*8fb49b4cSBin Meng {
221*8fb49b4cSBin Meng struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(udev);
222*8fb49b4cSBin Meng char dev_name[30], *str;
223*8fb49b4cSBin Meng struct udevice *vdev;
224*8fb49b4cSBin Meng int ret;
225*8fb49b4cSBin Meng
226*8fb49b4cSBin Meng if (uc_priv->device > VIRTIO_ID_MAX_NUM) {
227*8fb49b4cSBin Meng debug("(%s): virtio device ID %d exceeds maximum num\n",
228*8fb49b4cSBin Meng udev->name, uc_priv->device);
229*8fb49b4cSBin Meng return 0;
230*8fb49b4cSBin Meng }
231*8fb49b4cSBin Meng
232*8fb49b4cSBin Meng if (!virtio_drv_name[uc_priv->device]) {
233*8fb49b4cSBin Meng debug("(%s): underlying virtio device driver unavailable\n",
234*8fb49b4cSBin Meng udev->name);
235*8fb49b4cSBin Meng return 0;
236*8fb49b4cSBin Meng }
237*8fb49b4cSBin Meng
238*8fb49b4cSBin Meng snprintf(dev_name, sizeof(dev_name), "%s#%d",
239*8fb49b4cSBin Meng virtio_drv_name[uc_priv->device], udev->seq);
240*8fb49b4cSBin Meng str = strdup(dev_name);
241*8fb49b4cSBin Meng if (!str)
242*8fb49b4cSBin Meng return -ENOMEM;
243*8fb49b4cSBin Meng
244*8fb49b4cSBin Meng ret = device_bind_driver(udev, virtio_drv_name[uc_priv->device],
245*8fb49b4cSBin Meng str, &vdev);
246*8fb49b4cSBin Meng if (ret == -ENOENT) {
247*8fb49b4cSBin Meng debug("(%s): no driver configured\n", udev->name);
248*8fb49b4cSBin Meng return 0;
249*8fb49b4cSBin Meng }
250*8fb49b4cSBin Meng if (ret) {
251*8fb49b4cSBin Meng free(str);
252*8fb49b4cSBin Meng return ret;
253*8fb49b4cSBin Meng }
254*8fb49b4cSBin Meng device_set_name_alloced(vdev);
255*8fb49b4cSBin Meng
256*8fb49b4cSBin Meng INIT_LIST_HEAD(&uc_priv->vqs);
257*8fb49b4cSBin Meng
258*8fb49b4cSBin Meng return 0;
259*8fb49b4cSBin Meng }
260*8fb49b4cSBin Meng
virtio_uclass_child_post_bind(struct udevice * vdev)261*8fb49b4cSBin Meng static int virtio_uclass_child_post_bind(struct udevice *vdev)
262*8fb49b4cSBin Meng {
263*8fb49b4cSBin Meng /* Acknowledge that we've seen the device */
264*8fb49b4cSBin Meng virtio_add_status(vdev, VIRTIO_CONFIG_S_ACKNOWLEDGE);
265*8fb49b4cSBin Meng
266*8fb49b4cSBin Meng return 0;
267*8fb49b4cSBin Meng }
268*8fb49b4cSBin Meng
virtio_uclass_child_pre_probe(struct udevice * vdev)269*8fb49b4cSBin Meng static int virtio_uclass_child_pre_probe(struct udevice *vdev)
270*8fb49b4cSBin Meng {
271*8fb49b4cSBin Meng struct virtio_dev_priv *uc_priv = dev_get_uclass_priv(vdev->parent);
272*8fb49b4cSBin Meng u64 device_features;
273*8fb49b4cSBin Meng u64 driver_features;
274*8fb49b4cSBin Meng u64 driver_features_legacy;
275*8fb49b4cSBin Meng int i;
276*8fb49b4cSBin Meng int ret;
277*8fb49b4cSBin Meng
278*8fb49b4cSBin Meng /*
279*8fb49b4cSBin Meng * Save the real virtio device (eg: virtio-net, virtio-blk) to
280*8fb49b4cSBin Meng * the transport (parent) device's uclass priv for future use.
281*8fb49b4cSBin Meng */
282*8fb49b4cSBin Meng uc_priv->vdev = vdev;
283*8fb49b4cSBin Meng
284*8fb49b4cSBin Meng /*
285*8fb49b4cSBin Meng * We always start by resetting the device, in case a previous driver
286*8fb49b4cSBin Meng * messed it up. This also tests that code path a little.
287*8fb49b4cSBin Meng */
288*8fb49b4cSBin Meng ret = virtio_reset(vdev);
289*8fb49b4cSBin Meng if (ret)
290*8fb49b4cSBin Meng goto err;
291*8fb49b4cSBin Meng
292*8fb49b4cSBin Meng /* We have a driver! */
293*8fb49b4cSBin Meng virtio_add_status(vdev, VIRTIO_CONFIG_S_DRIVER);
294*8fb49b4cSBin Meng
295*8fb49b4cSBin Meng /* Figure out what features the device supports */
296*8fb49b4cSBin Meng virtio_get_features(vdev, &device_features);
297*8fb49b4cSBin Meng debug("(%s) plain device features supported %016llx\n",
298*8fb49b4cSBin Meng vdev->name, device_features);
299*8fb49b4cSBin Meng if (!(device_features & (1ULL << VIRTIO_F_VERSION_1)))
300*8fb49b4cSBin Meng uc_priv->legacy = true;
301*8fb49b4cSBin Meng
302*8fb49b4cSBin Meng /* Figure out what features the driver supports */
303*8fb49b4cSBin Meng driver_features = 0;
304*8fb49b4cSBin Meng for (i = 0; i < uc_priv->feature_table_size; i++) {
305*8fb49b4cSBin Meng unsigned int f = uc_priv->feature_table[i];
306*8fb49b4cSBin Meng
307*8fb49b4cSBin Meng WARN_ON(f >= 64);
308*8fb49b4cSBin Meng driver_features |= (1ULL << f);
309*8fb49b4cSBin Meng }
310*8fb49b4cSBin Meng
311*8fb49b4cSBin Meng /* Some drivers have a separate feature table for virtio v1.0 */
312*8fb49b4cSBin Meng if (uc_priv->feature_table_legacy) {
313*8fb49b4cSBin Meng driver_features_legacy = 0;
314*8fb49b4cSBin Meng for (i = 0; i < uc_priv->feature_table_size_legacy; i++) {
315*8fb49b4cSBin Meng unsigned int f = uc_priv->feature_table_legacy[i];
316*8fb49b4cSBin Meng
317*8fb49b4cSBin Meng WARN_ON(f >= 64);
318*8fb49b4cSBin Meng driver_features_legacy |= (1ULL << f);
319*8fb49b4cSBin Meng }
320*8fb49b4cSBin Meng } else {
321*8fb49b4cSBin Meng driver_features_legacy = driver_features;
322*8fb49b4cSBin Meng }
323*8fb49b4cSBin Meng
324*8fb49b4cSBin Meng if (uc_priv->legacy) {
325*8fb49b4cSBin Meng debug("(%s): legacy virtio device\n", vdev->name);
326*8fb49b4cSBin Meng uc_priv->features = driver_features_legacy & device_features;
327*8fb49b4cSBin Meng } else {
328*8fb49b4cSBin Meng debug("(%s): v1.0 complaint virtio device\n", vdev->name);
329*8fb49b4cSBin Meng uc_priv->features = driver_features & device_features;
330*8fb49b4cSBin Meng }
331*8fb49b4cSBin Meng
332*8fb49b4cSBin Meng /* Transport features always preserved to pass to finalize_features */
333*8fb49b4cSBin Meng for (i = VIRTIO_TRANSPORT_F_START; i < VIRTIO_TRANSPORT_F_END; i++)
334*8fb49b4cSBin Meng if ((device_features & (1ULL << i)) &&
335*8fb49b4cSBin Meng (i == VIRTIO_F_VERSION_1))
336*8fb49b4cSBin Meng __virtio_set_bit(vdev->parent, i);
337*8fb49b4cSBin Meng
338*8fb49b4cSBin Meng debug("(%s) final negotiated features supported %016llx\n",
339*8fb49b4cSBin Meng vdev->name, uc_priv->features);
340*8fb49b4cSBin Meng ret = virtio_finalize_features(vdev);
341*8fb49b4cSBin Meng if (ret)
342*8fb49b4cSBin Meng goto err;
343*8fb49b4cSBin Meng
344*8fb49b4cSBin Meng return 0;
345*8fb49b4cSBin Meng
346*8fb49b4cSBin Meng err:
347*8fb49b4cSBin Meng virtio_add_status(vdev, VIRTIO_CONFIG_S_FAILED);
348*8fb49b4cSBin Meng return ret;
349*8fb49b4cSBin Meng }
350*8fb49b4cSBin Meng
virtio_uclass_child_post_probe(struct udevice * vdev)351*8fb49b4cSBin Meng static int virtio_uclass_child_post_probe(struct udevice *vdev)
352*8fb49b4cSBin Meng {
353*8fb49b4cSBin Meng /* Indicates that the driver is set up and ready to drive the device */
354*8fb49b4cSBin Meng virtio_add_status(vdev, VIRTIO_CONFIG_S_DRIVER_OK);
355*8fb49b4cSBin Meng
356*8fb49b4cSBin Meng return 0;
357*8fb49b4cSBin Meng }
358*8fb49b4cSBin Meng
359*8fb49b4cSBin Meng UCLASS_DRIVER(virtio) = {
360*8fb49b4cSBin Meng .name = "virtio",
361*8fb49b4cSBin Meng .id = UCLASS_VIRTIO,
362*8fb49b4cSBin Meng .flags = DM_UC_FLAG_SEQ_ALIAS,
363*8fb49b4cSBin Meng .pre_probe = virtio_uclass_pre_probe,
364*8fb49b4cSBin Meng .post_probe = virtio_uclass_post_probe,
365*8fb49b4cSBin Meng .child_post_bind = virtio_uclass_child_post_bind,
366*8fb49b4cSBin Meng .child_pre_probe = virtio_uclass_child_pre_probe,
367*8fb49b4cSBin Meng .child_post_probe = virtio_uclass_child_post_probe,
368*8fb49b4cSBin Meng .per_device_auto_alloc_size = sizeof(struct virtio_dev_priv),
369*8fb49b4cSBin Meng };
370