public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Peng Hao <peng.hao2@zte.com.cn>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn,
	wanpeng.li@hotmail.com
Subject: Re: [PATCH V3 1/2] kvm/x86 : add coalesced pio support
Date: Wed, 29 Aug 2018 17:14:33 +0200	[thread overview]
Message-ID: <20180829151432.GA19487@flask> (raw)
In-Reply-To: <1535109632-59745-2-git-send-email-peng.hao2@zte.com.cn>

2018-08-24 19:20+0800, Peng Hao:
> Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
> ---
>  include/uapi/linux/kvm.h  | 5 +++--
>  virt/kvm/coalesced_mmio.c | 8 +++++---
>  virt/kvm/kvm_main.c       | 2 ++
>  3 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index b6270a3..9cc56d3 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -420,13 +420,13 @@ struct kvm_run {
>  struct kvm_coalesced_mmio_zone {
>  	__u64 addr;
>  	__u32 size;
> -	__u32 pad;
> +	__u32 pio;

I would prefer to have this as a slightly more compatible

	union {
		__u32 pad;
		__u32 pio;
	};

>  };
>  
>  struct kvm_coalesced_mmio {
>  	__u64 phys_addr;
>  	__u32 len;
> -	__u32 pad;
> +	__u32 pio;

Also, please add a check that "pio <= 1".

This would catch most cases where userspace passed garbage in that field
and we'd also make the remaining bits available for future features.

Thanks.

  reply	other threads:[~2018-08-29 15:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 11:20 [PATCH V3 0/2] introduce coalesced pio support Peng Hao
2018-08-24 11:20 ` [PATCH V3 1/2] kvm/x86 : add " Peng Hao
2018-08-29 15:14   ` Radim Krčmář [this message]
2018-08-24 11:20 ` [PATCH V3 2/2] kvm/x86 : add document for coalesced pio Peng Hao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180829151432.GA19487@flask \
    --to=rkrcmar@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peng.hao2@zte.com.cn \
    --cc=wanpeng.li@hotmail.com \
    --cc=zhong.weidong@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox