cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

vhost-user-fs-ccw.c (2285B)


      1/*
      2 * virtio ccw vhost-user-fs implementation
      3 *
      4 * Copyright 2020 IBM Corp.
      5 *
      6 * This work is licensed under the terms of the GNU GPL, version 2 or (at
      7 * your option) any later version. See the COPYING file in the top-level
      8 * directory.
      9 */
     10#include "qemu/osdep.h"
     11#include "hw/qdev-properties.h"
     12#include "qapi/error.h"
     13#include "hw/virtio/vhost-user-fs.h"
     14#include "virtio-ccw.h"
     15
     16typedef struct VHostUserFSCcw {
     17    VirtioCcwDevice parent_obj;
     18    VHostUserFS vdev;
     19} VHostUserFSCcw;
     20
     21#define TYPE_VHOST_USER_FS_CCW "vhost-user-fs-ccw"
     22#define VHOST_USER_FS_CCW(obj) \
     23        OBJECT_CHECK(VHostUserFSCcw, (obj), TYPE_VHOST_USER_FS_CCW)
     24
     25
     26static Property vhost_user_fs_ccw_properties[] = {
     27    DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags,
     28                    VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true),
     29    DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev,
     30                       VIRTIO_CCW_MAX_REV),
     31    DEFINE_PROP_END_OF_LIST(),
     32};
     33
     34static void vhost_user_fs_ccw_realize(VirtioCcwDevice *ccw_dev, Error **errp)
     35{
     36    VHostUserFSCcw *dev = VHOST_USER_FS_CCW(ccw_dev);
     37    DeviceState *vdev = DEVICE(&dev->vdev);
     38
     39    qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
     40}
     41
     42static void vhost_user_fs_ccw_instance_init(Object *obj)
     43{
     44    VHostUserFSCcw *dev = VHOST_USER_FS_CCW(obj);
     45    VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
     46
     47    ccw_dev->force_revision_1 = true;
     48    virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
     49                                TYPE_VHOST_USER_FS);
     50}
     51
     52static void vhost_user_fs_ccw_class_init(ObjectClass *klass, void *data)
     53{
     54    DeviceClass *dc = DEVICE_CLASS(klass);
     55    VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
     56
     57    k->realize = vhost_user_fs_ccw_realize;
     58    device_class_set_props(dc, vhost_user_fs_ccw_properties);
     59    set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
     60}
     61
     62static const TypeInfo vhost_user_fs_ccw = {
     63    .name          = TYPE_VHOST_USER_FS_CCW,
     64    .parent        = TYPE_VIRTIO_CCW_DEVICE,
     65    .instance_size = sizeof(VHostUserFSCcw),
     66    .instance_init = vhost_user_fs_ccw_instance_init,
     67    .class_init    = vhost_user_fs_ccw_class_init,
     68};
     69
     70static void vhost_user_fs_ccw_register(void)
     71{
     72    type_register_static(&vhost_user_fs_ccw);
     73}
     74
     75type_init(vhost_user_fs_ccw_register)