Re: [RFC v3 1/5] KVM: add initial support for KVM_SET_IOREGION

Stefan Hajnoczi
2021-02-24T10:07:46Z

[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

On Sun, Feb 21, 2021 at 03:04:37PM +0300, Elena Afanasova wrote:
> diff --git a/virt/kvm/ioregion.c b/virt/kvm/ioregion.c
> new file mode 100644
> index 000000000000..e09ef3e2c9d7
> --- /dev/null
> +++ b/virt/kvm/ioregion.c
> @@ -0,0 +1,265 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +#include <linux/kvm_host.h>
> +#include <linux/fs.h>
> +#include <kvm/iodev.h>
> +#include "eventfd.h"
> +
> +void
> +kvm_ioregionfd_init(struct kvm *kvm)
> +{
> + INIT_LIST_HEAD(&kvm->ioregions_fast_mmio);
> + INIT_LIST_HEAD(&kvm->ioregions_mmio);
> + INIT_LIST_HEAD(&kvm->ioregions_pio);
> +}
> +
> +struct ioregion {
> + struct list_head list;

Linux struct list_head gives no clue about which list this belongs to.
You can help readers by adding a comment:

/* struct kvm ioregions_fast_mmio/ioregions_mmio/ioregions_pio */

> + u64 paddr; /* guest physical address */
> + u64 size; /* size in bytes */
> + struct file *rf;

+ struct file *rf; /* responses are read from this */

> + struct file *wf;

+ struct file *wf; /* commands are written to this */

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]