From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B62D92ECD27 for ; Mon, 3 Nov 2025 09:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762163592; cv=none; b=nsbQls8NH+jkqyxVNVGDoHbIGq8ivA+e6Z96r1vevELS3CJZR390Zosc/nIAsXT6hf9a+d1foXujTdu97kOlSUsAWDCXmSxhE4QQqmY4naps/3Xb/ZUevtr8vuUVQ5UxCCnQrGE3tdJ2O9ahDJ2EpojY28eoK4yr3lMm0jP7mXI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762163592; c=relaxed/simple; bh=JKFySBYZ5L+2LiVx7km0crRWvXRHHVbQF5Z8FU6+lVc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mSO/sgfbJPYc6RGW767fomGCqimHpIynENRzPYW4IfIZBH59DXJYhx/g6+wAjbC+jd8WnJCTC/2OAyZJzyYs77gfqGPVTrhMM56j8EcNH5iEyqI34G8WVZ1IiC+Mk6Pm/z/5Ma1c73MV/ygS2B2Ynko/Vkw2dD1F6fF9kHhJSIY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=qgBEghLz; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="qgBEghLz" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4770d4df4deso70365e9.1 for ; Mon, 03 Nov 2025 01:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1762163589; x=1762768389; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=CJ4RrOu9uCN2bW8pg1KpsPpPzgZldv3XyNgHXUg1t1c=; b=qgBEghLzI6p4nXja6eDgqJF5triVdz9vQVhuTpjyBQlTtQv7QA8qzd7dBgrYXKyBCM ZaIawiARDYbF5/2a7f6PyBpKhORhJM5z1394TM3b9UJy1o4ObyN60iu3gijdwlOUCfNw 71HPhor4aXpa2JI15i2mRMzbFcbVOH8BfvIyp/75uCAilDk9efQLX2/j6wJL6C/fFxtx UGhXCZhSU39FakV4ZtKlt8GVp5KlW6LVd77awZAYPfhOaPOov0z5H7WbNAT1EadocT9W KS+iR/jFb2XNI/7BuaPmzrDI/IwT2T2/6OPoOSdfjzxWAx0N9Gpf+g+OlXXpnD09qmiG PbOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762163589; x=1762768389; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=CJ4RrOu9uCN2bW8pg1KpsPpPzgZldv3XyNgHXUg1t1c=; b=El5liQSpGYT+MNbyZ+v/e9PhgQPfH3PMzJdVJ/Uny7Lp5DumgjhseABeDXx9pGA84M isaWtqIN3ed/MTtCrKq2hbUTCKZMhsj5loVjlnpgNPDiW83gmIOQ6cQtLUymneRVfHbf oTbRR7oGhUD5I0ZCm5ZVxxTdAyKyW3AVP2FUHAn/aa/ULgz8Wb6ZHThKofPbJdCQPfd2 BP8eIqqRSfZwmC4IVMzpjk7qt4Htk+ogZSI7mqdpTKNd4I0Rhj05ZksYn60o5/UYi+6I m2GN5BzQANGu8/7+30tM0vSgQ6zjWnCmmAIxkWN9NSSmvbYZUpMKGlrTDFCGEy9YzSOm /JxQ== X-Forwarded-Encrypted: i=1; AJvYcCWliMiQ1lF10HYPtl3/YcEWacyg3gafe1ouZTUkC2Am02gxrJLPmVoJqGU6qd0VTvKvEGs=@vger.kernel.org X-Gm-Message-State: AOJu0Ywtpqo47Kwd+Z1iie/kEigyxboTEFmJyT4skgo0LM29ePFmScB6 XAMlbsmwNrM6gnBcB7IrKoLgJ7ScJ/kQ7ZFmbb9sa0POnzHlQ+DnBiBJT9oWlrLCow== X-Gm-Gg: ASbGncuu8nxJPZatsm8Th6MHCvLmowhlr34ONfAsX3aSsGtaoG//2fRidc4LRYVhjuJ dBGn6gwKActSobbxeEpP/otvcjg4UUh6jR4Xcw4tSfXgDi73qzbqic/jyaLpLeisoLX7BISHqHL rcnQIrarcXv6xRHJRs/Xb8t1VA5CdsQtQ8MBofZEQ4TXd+PPoQc/P28Sod7OBLR2HEyShUVKvgb k/0AqS8QxIiCPm6Ju6pcFJVlb8YLEggTtH5r5FWS+azh6f4MRAzWokFv0aNCWqSavl4F93t5nqD a8hfMVJSZsQ0PLAtvbMJ9uixems8Sp4wGOeHMe6PBDn587C+ggSOpKiCm6EaMiSaA9DZSM3QTwZ 86KDj1jq7Oung6w9Msq0+KqoEZBncbhQiUNV7ulQ+O9Rj+y9Tu7pT94Oyv1F+qcYgWLPLYh7Hu/ FRiuuqKVGjaYyqtEvZvbPYWogoYkNVDH2ZeZkeJ62VnT5ThceTPw== X-Google-Smtp-Source: AGHT+IE1mff4da9I5vysNB0ob0JmOMr70AWi7AKZOtcSI5qvyyAXHktFY8REU7m0liVQkNgCELSSCg== X-Received: by 2002:a7b:cb14:0:b0:46f:a42d:41f0 with SMTP id 5b1f17b1804b1-4775268121fmr217365e9.0.1762163588833; Mon, 03 Nov 2025 01:53:08 -0800 (PST) Received: from google.com (54.140.140.34.bc.googleusercontent.com. [34.140.140.54]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429c13e0325sm20082715f8f.29.2025.11.03.01.53.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 01:53:08 -0800 (PST) Date: Mon, 3 Nov 2025 09:53:04 +0000 From: Mostafa Saleh To: Jason Gunthorpe Cc: Alexander Gordeev , David Airlie , Alex Williamson , Ankit Agrawal , Christian Borntraeger , Brett Creeley , dri-devel@lists.freedesktop.org, Eric Auger , Eric Farman , Giovanni Cabiddu , Vasily Gorbik , Heiko Carstens , intel-gfx@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , Kevin Tian , kvm@vger.kernel.org, Kirti Wankhede , linux-s390@vger.kernel.org, Longfang Liu , Matthew Rosato , Nikhil Agarwal , Nipun Gupta , Peter Oberparleiter , Halil Pasic , Pranjal Shrivastava , qat-linux@intel.com, Rodrigo Vivi , Simona Vetter , Shameer Kolothum , Sven Schnelle , Tvrtko Ursulin , virtualization@lists.linux.dev, Vineeth Vijayan , Yishai Hadas , Zhenyu Wang , Zhi Wang , patches@lists.linux.dev Subject: Re: [PATCH 00/22] vfio: Give VFIO_DEVICE_GET_REGION_INFO its own op Message-ID: References: <0-v1-679a6fa27d31+209-vfio_get_region_info_op_jgg@nvidia.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0-v1-679a6fa27d31+209-vfio_get_region_info_op_jgg@nvidia.com> On Thu, Oct 23, 2025 at 08:09:14PM -0300, Jason Gunthorpe wrote: > There is alot of duplicated code in the drivers for processing > VFIO_DEVICE_GET_REGION_INFO. Introduce a new op get_region_info_caps() > which provides a struct vfio_info_cap and handles the cap chain logic > to write the caps back to userspace and remove all of this duplication > from drivers. > > This is done in two steps, the first is a largely mechanical introduction > of the get_region_info(). These patches are best viewed with the diff > option to ignore whitespace (-b) as most of the lines are re-indending > things. > > Then drivers are updated to remove the duplicate cap related code. Some > drivers are converted to use vfio_info_add_capability() instead of open > coding a version of it. The series as a whole looks good. However, I got confused walking through it as almost all non-PCI drivers had to transition to get_region_info then get_region_info_caps then removing get_region_info completely from core code after introducing it in this series. IMO, the series should start with just consolidating PCI based implementation and then add get_region_info_caps for all drivers at the end. Anyway, no really strong opinion as the final outcome makes sense. Thanks, Mostafa > > This is on github: https://github.com/jgunthorpe/linux/commits/vfio_get_region_info_op > > Jason Gunthorpe (22): > vfio: Provide a get_region_info op > vfio/hisi: Convert to the get_region_info op > vfio/virtio: Convert to the get_region_info op > vfio/nvgrace: Convert to the get_region_info op > vfio/pci: Fill in the missing get_region_info ops > vfio/mtty: Provide a get_region_info op > vfio/mdpy: Provide a get_region_info op > vfio/mbochs: Provide a get_region_info op > vfio/platform: Provide a get_region_info op > vfio/fsl: Provide a get_region_info op > vfio/cdx: Provide a get_region_info op > vfio/ccw: Provide a get_region_info op > vfio/gvt: Provide a get_region_info op > vfio: Require drivers to implement get_region_info > vfio: Add get_region_info_caps op > vfio/mbochs: Convert mbochs to use vfio_info_add_capability() > vfio/gvt: Convert to get_region_info_caps > vfio/ccw: Convert to get_region_info_caps > vfio/pci: Convert all PCI drivers to get_region_info_caps > vfio/platform: Convert to get_region_info_caps > vfio: Move the remaining drivers to get_region_info_caps > vfio: Remove the get_region_info op > > drivers/gpu/drm/i915/gvt/kvmgt.c | 272 ++++++++---------- > drivers/s390/cio/vfio_ccw_ops.c | 45 +-- > drivers/vfio/cdx/main.c | 29 +- > drivers/vfio/fsl-mc/vfio_fsl_mc.c | 43 ++- > .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 54 ++-- > drivers/vfio/pci/mlx5/main.c | 1 + > drivers/vfio/pci/nvgrace-gpu/main.c | 53 +--- > drivers/vfio/pci/pds/vfio_dev.c | 1 + > drivers/vfio/pci/qat/main.c | 1 + > drivers/vfio/pci/vfio_pci.c | 1 + > drivers/vfio/pci/vfio_pci_core.c | 110 +++---- > drivers/vfio/pci/virtio/common.h | 5 +- > drivers/vfio/pci/virtio/legacy_io.c | 38 +-- > drivers/vfio/pci/virtio/main.c | 5 +- > drivers/vfio/platform/vfio_amba.c | 1 + > drivers/vfio/platform/vfio_platform.c | 1 + > drivers/vfio/platform/vfio_platform_common.c | 40 ++- > drivers/vfio/platform/vfio_platform_private.h | 3 + > drivers/vfio/vfio_main.c | 45 +++ > include/linux/vfio.h | 4 + > include/linux/vfio_pci_core.h | 3 + > samples/vfio-mdev/mbochs.c | 71 ++--- > samples/vfio-mdev/mdpy.c | 34 +-- > samples/vfio-mdev/mtty.c | 33 +-- > 24 files changed, 363 insertions(+), 530 deletions(-) > > > base-commit: 211ddde0823f1442e4ad052a2f30f050145ccada > -- > 2.43.0 >