Re: [PATCH v4 kvmtool 08/12] vfio-pci: add MSI-X support

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

 



Jean-Philippe Brucker <jean-philippe.brucker@xxxxxxx> writes:

> Hi Punit,
>
> Thanks for the review
>
> On 09/03/18 16:53, Punit Agrawal wrote:

[...]

>>> +static void vfio_pci_msix_table_access(struct kvm_cpu *vcpu, u64 addr, u8 *data,
>>> +				       u32 len, u8 is_write, void *ptr)
>>> +{
>>> +	struct kvm *kvm = vcpu->kvm;
>>> +	struct vfio_pci_msi_entry *entry;
>>> +	struct vfio_pci_device *pdev = ptr;
>>> +	struct vfio_device *vdev = container_of(pdev, struct vfio_device, pci);
>>> +
>>> +	u64 offset = addr - pdev->msix_table.guest_phys_addr;
>>> +
>>> +	size_t vector = offset / PCI_MSIX_ENTRY_SIZE;
>>> +	/* PCI spec says that software must use aligned 4 or 8 bytes accesses */
>>> +	off_t field = offset % PCI_MSIX_ENTRY_SIZE;
>> 
>> Does the 4/8 byte access assumption be checked? Or is this something
>> enforced before we get here.
>
> It's specific to MSI-X tables, so it would need to be checked here. The
> spec (6.8.2) says "undefined behaviour", so we're free to do whatever we
> want. I suppose we can return here

Makes sense. For unaligned accesses, it might be worth warning the user
to highlight the deviation from spec.

Thanks,
Punit

[...]




[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