All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Alex Williamson <alex.williamson@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: Eric Auger <eric.auger@redhat.com>,
	Christoph Hellwig <hch@lst.de>, Kevin Tian <kevin.tian@intel.com>,
	Yi Liu <yi.l.liu@intel.com>
Subject: Re: [PATCH v2 1/8] kvm/vfio: Move KVM_DEV_VFIO_GROUP_* ioctls into functions
Date: Thu, 21 Apr 2022 11:51:48 -0300	[thread overview]
Message-ID: <20220421145148.GA1710803@nvidia.com> (raw)
In-Reply-To: <1-v2-6a528653a750+1578a-vfio_kvm_no_group_jgg@nvidia.com>

On Wed, Apr 20, 2022 at 04:23:10PM -0300, Jason Gunthorpe wrote:
> To make it easier to read and change in following patches.
> 
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  virt/kvm/vfio.c | 271 ++++++++++++++++++++++++++----------------------
>  1 file changed, 146 insertions(+), 125 deletions(-)
> 
> This is best viewed with 'git show -b'

Zero day hit a warning on 32bit, I'll fold this into v3:

--- a/virt/kvm/vfio.c
+++ b/virt/kvm/vfio.c
@@ -259,9 +259,10 @@ static int kvm_vfio_group_set_spapr_tce(struct kvm_device *dev,
 }
 #endif
 
-static int kvm_vfio_set_group(struct kvm_device *dev, long attr, u64 arg)
+static int kvm_vfio_set_group(struct kvm_device *dev, long attr,
+			      void __user *arg)
 {
-	int32_t __user *argp = (int32_t __user *)(unsigned long)arg;
+	int32_t __user *argp = arg;
 	int32_t fd;
 
 	switch (attr) {
@@ -277,7 +278,7 @@ static int kvm_vfio_set_group(struct kvm_device *dev, long attr, u64 arg)
 
 #ifdef CONFIG_SPAPR_TCE_IOMMU
 	case KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE:
-		return kvm_vfio_group_set_spapr_tce(dev, (void __user *)arg);
+		return kvm_vfio_group_set_spapr_tce(dev, arg);
 #endif
 	}
 
@@ -289,7 +290,8 @@ static int kvm_vfio_set_attr(struct kvm_device *dev,
 {
 	switch (attr->group) {
 	case KVM_DEV_VFIO_GROUP:
-		return kvm_vfio_set_group(dev, attr->attr, attr->addr);
+		return kvm_vfio_set_group(dev, attr->attr,
+					  u64_to_user_ptr(attr->addr));
 	}
 
 	return -ENXIO;

  parent reply	other threads:[~2022-04-21 14:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 19:23 [PATCH v2 0/8] Remove vfio_group from the struct file facing VFIO API Jason Gunthorpe
2022-04-20 19:23 ` [PATCH v2 1/8] kvm/vfio: Move KVM_DEV_VFIO_GROUP_* ioctls into functions Jason Gunthorpe
2022-04-21 13:22   ` Cornelia Huck
2022-04-21 14:46   ` Yi Liu
2022-04-21 14:51   ` Jason Gunthorpe [this message]
2022-04-20 19:23 ` [PATCH v2 2/8] kvm/vfio: Store the struct file in the kvm_vfio_group Jason Gunthorpe
2022-04-21 14:46   ` Yi Liu
2022-04-20 19:23 ` [PATCH v2 3/8] vfio: Change vfio_external_user_iommu_id() to vfio_file_iommu_group() Jason Gunthorpe
2022-04-20 23:38   ` Tian, Kevin
2022-04-21  5:39   ` Christoph Hellwig
2022-04-21 14:57   ` Yi Liu
2022-04-22 17:05     ` Jason Gunthorpe
2022-04-23 12:53       ` Yi Liu
2022-04-20 19:23 ` [PATCH v2 4/8] vfio: Remove vfio_external_group_match_file() Jason Gunthorpe
2022-04-21  5:39   ` Christoph Hellwig
2022-04-21 14:50   ` Yi Liu
2022-04-20 19:23 ` [PATCH v2 5/8] vfio: Change vfio_external_check_extension() to vfio_file_enforced_coherent() Jason Gunthorpe
2022-04-20 23:49   ` Tian, Kevin
2022-04-21  5:41   ` Christoph Hellwig
2022-04-22  0:12     ` Tian, Kevin
     [not found]     ` <BN9PR11MB5276CFD31471D4EE85DD705A8CF79@BN9PR11MB5276.namprd11.prod.outlook.com>
2022-04-22  0:32       ` Tian, Kevin
2022-04-22 16:58         ` Jason Gunthorpe
2022-04-24  5:51           ` Tian, Kevin
2022-04-20 19:23 ` [PATCH v2 6/8] vfio: Change vfio_group_set_kvm() to vfio_file_set_kvm() Jason Gunthorpe
2022-04-20 23:51   ` Tian, Kevin
2022-04-21  5:41   ` Christoph Hellwig
2022-04-20 19:23 ` [PATCH v2 7/8] kvm/vfio: Remove vfio_group from kvm Jason Gunthorpe
2022-04-20 23:55   ` Tian, Kevin
2022-04-21  5:42   ` Christoph Hellwig
2022-04-20 19:23 ` [PATCH v2 8/8] vfio/pci: Use the struct file as the handle not the vfio_group Jason Gunthorpe
2022-04-21  0:05   ` Tian, Kevin
2022-04-21  5:43   ` Christoph Hellwig
2022-04-21 14:51 ` [PATCH v2 0/8] Remove vfio_group from the struct file facing VFIO API Yi Liu

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=20220421145148.GA1710803@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=hch@lst.de \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=yi.l.liu@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.