Lines Matching refs:vdev

32 	struct virtio_device *vdev;  member
81 __virtio32 type = vbr->out_hdr.type & ~cpu_to_virtio32(vq->vdev, VIRTIO_BLK_T_OUT); in __virtblk_add_req()
92 if (type == cpu_to_virtio32(vq->vdev, VIRTIO_BLK_T_SCSI_CMD)) { in __virtblk_add_req()
98 if (vbr->out_hdr.type & cpu_to_virtio32(vq->vdev, VIRTIO_BLK_T_OUT)) in __virtblk_add_req()
104 if (type == cpu_to_virtio32(vq->vdev, VIRTIO_BLK_T_SCSI_CMD)) { in __virtblk_add_req()
124 req->resid_len = virtio32_to_cpu(vblk->vdev, vbr->in_hdr.residual); in virtblk_request_done()
125 req->sense_len = virtio32_to_cpu(vblk->vdev, vbr->in_hdr.sense_len); in virtblk_request_done()
126 req->errors = virtio32_to_cpu(vblk->vdev, vbr->in_hdr.errors); in virtblk_request_done()
136 struct virtio_blk *vblk = vq->vdev->priv; in virtblk_done()
176 vbr->out_hdr.type = cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_FLUSH); in virtio_queue_rq()
178 vbr->out_hdr.ioprio = cpu_to_virtio32(vblk->vdev, req_get_ioprio(vbr->req)); in virtio_queue_rq()
183 vbr->out_hdr.sector = cpu_to_virtio64(vblk->vdev, blk_rq_pos(vbr->req)); in virtio_queue_rq()
184 vbr->out_hdr.ioprio = cpu_to_virtio32(vblk->vdev, req_get_ioprio(vbr->req)); in virtio_queue_rq()
187 vbr->out_hdr.type = cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_SCSI_CMD); in virtio_queue_rq()
189 vbr->out_hdr.ioprio = cpu_to_virtio32(vblk->vdev, req_get_ioprio(vbr->req)); in virtio_queue_rq()
192 vbr->out_hdr.type = cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_GET_ID); in virtio_queue_rq()
194 vbr->out_hdr.ioprio = cpu_to_virtio32(vblk->vdev, req_get_ioprio(vbr->req)); in virtio_queue_rq()
207 vbr->out_hdr.type |= cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_OUT); in virtio_queue_rq()
209 vbr->out_hdr.type |= cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_IN); in virtio_queue_rq()
270 if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) in virtblk_ioctl()
283 if (virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_GEOMETRY)) { in virtblk_getgeo()
284 virtio_cread(vblk->vdev, struct virtio_blk_config, in virtblk_getgeo()
286 virtio_cread(vblk->vdev, struct virtio_blk_config, in virtblk_getgeo()
288 virtio_cread(vblk->vdev, struct virtio_blk_config, in virtblk_getgeo()
341 struct virtio_device *vdev = vblk->vdev; in virtblk_config_changed_work() local
348 virtio_cread(vdev, struct virtio_blk_config, capacity, &capacity); in virtblk_config_changed_work()
352 dev_warn(&vdev->dev, "Capacity %llu too large: truncating\n", in virtblk_config_changed_work()
362 dev_notice(&vdev->dev, in virtblk_config_changed_work()
373 static void virtblk_config_changed(struct virtio_device *vdev) in virtblk_config_changed() argument
375 struct virtio_blk *vblk = vdev->priv; in virtblk_config_changed()
388 struct virtio_device *vdev = vblk->vdev; in init_vq() local
390 err = virtio_cread_feature(vdev, VIRTIO_BLK_F_MQ, in init_vq()
421 err = vdev->config->find_vqs(vdev, num_vqs, vqs, callbacks, names); in init_vq()
472 static int virtblk_get_cache_mode(struct virtio_device *vdev) in virtblk_get_cache_mode() argument
477 err = virtio_cread_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE, in virtblk_get_cache_mode()
481 writeback = virtio_has_feature(vdev, VIRTIO_BLK_F_WCE); in virtblk_get_cache_mode()
486 static void virtblk_update_cache_mode(struct virtio_device *vdev) in virtblk_update_cache_mode() argument
488 u8 writeback = virtblk_get_cache_mode(vdev); in virtblk_update_cache_mode()
489 struct virtio_blk *vblk = vdev->priv; in virtblk_update_cache_mode()
509 struct virtio_device *vdev = vblk->vdev; in virtblk_cache_type_store() local
512 BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE)); in virtblk_cache_type_store()
520 virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i); in virtblk_cache_type_store()
521 virtblk_update_cache_mode(vdev); in virtblk_cache_type_store()
531 u8 writeback = virtblk_get_cache_mode(vblk->vdev); in virtblk_cache_type_show()
565 static int virtblk_probe(struct virtio_device *vdev) in virtblk_probe() argument
576 if (!vdev->config->get) { in virtblk_probe()
577 dev_err(&vdev->dev, "%s failure: config access disabled\n", in virtblk_probe()
589 err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SEG_MAX, in virtblk_probe()
599 vdev->priv = vblk = kmalloc(sizeof(*vblk), GFP_KERNEL); in virtblk_probe()
605 vblk->vdev = vdev; in virtblk_probe()
625 if (!virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC)) in virtblk_probe()
658 vblk->disk->driverfs_dev = &vdev->dev; in virtblk_probe()
663 virtblk_update_cache_mode(vdev); in virtblk_probe()
666 if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO)) in virtblk_probe()
670 virtio_cread(vdev, struct virtio_blk_config, capacity, &cap); in virtblk_probe()
674 dev_warn(&vdev->dev, "Capacity %llu too large: truncating\n", in virtblk_probe()
691 err = virtio_cread_feature(vdev, VIRTIO_BLK_F_SIZE_MAX, in virtblk_probe()
699 err = virtio_cread_feature(vdev, VIRTIO_BLK_F_BLK_SIZE, in virtblk_probe()
708 err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, in virtblk_probe()
715 err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, in virtblk_probe()
721 err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, in virtblk_probe()
727 err = virtio_cread_feature(vdev, VIRTIO_BLK_F_TOPOLOGY, in virtblk_probe()
733 virtio_device_ready(vdev); in virtblk_probe()
740 if (virtio_has_feature(vdev, VIRTIO_BLK_F_CONFIG_WCE)) in virtblk_probe()
758 vdev->config->del_vqs(vdev); in virtblk_probe()
767 static void virtblk_remove(struct virtio_device *vdev) in virtblk_remove() argument
769 struct virtio_blk *vblk = vdev->priv; in virtblk_remove()
782 vdev->config->reset(vdev); in virtblk_remove()
786 vdev->config->del_vqs(vdev); in virtblk_remove()
796 static int virtblk_freeze(struct virtio_device *vdev) in virtblk_freeze() argument
798 struct virtio_blk *vblk = vdev->priv; in virtblk_freeze()
801 vdev->config->reset(vdev); in virtblk_freeze()
808 vdev->config->del_vqs(vdev); in virtblk_freeze()
812 static int virtblk_restore(struct virtio_device *vdev) in virtblk_restore() argument
814 struct virtio_blk *vblk = vdev->priv; in virtblk_restore()
817 ret = init_vq(vdev->priv); in virtblk_restore()
821 virtio_device_ready(vdev); in virtblk_restore()