RE: [PATCH v4 1/1] vfio/nvgpu: Add vfio pci variant module for grace hopper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>> +static ssize_t nvgpu_vfio_pci_read(struct vfio_device *core_vdev,
>>> +           char __user *buf, size_t count, loff_t *ppos) {
>>> +   unsigned int index = VFIO_PCI_OFFSET_TO_INDEX(*ppos);
>>> +
>>> +   /*
>>> +    * Only the device memory present on the hardware is mapped, which may
>>> +    * not be power-of-2 aligned. A read to the BAR2 region implies an
>>> +    * access outside the available device memory on the hardware.
>>> +    */
>>> +   if (index == VFIO_PCI_BAR2_REGION_INDEX)
>>> +           return -EINVAL;
>>>
>> What does the qemu do in this case? Crash the VM?
>
> Yes, I don't think return -errno matches what we discussed for returning -1 on read and dropping writes outside of the device memory.

I tried to replicate what is done by vfio-pci core module in vfio_pci_bar_rw()
where -EINVAL is returned in case of e.g. the access offset is outside the
BAR range.

Such an error comes to Qemu in vfio_region_read/vfio_region_write() which 
handles the error by returning data as -1 on read and dropping on write.

But it seems that we don't need such approach here. I will make the change
so that vfio-pci variant driver's read/write explicitly reads -1 and drops writes
instead of returning -EINVAL.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux