Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2106481imw; Tue, 5 Jul 2022 23:29:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sSd4t3LuMxIcrAlq5gc8SqRr6C/ytEUK4kcejAqpFRw5tHLs+0SjYCV1wdpRxfeZ4Yo2wm X-Received: by 2002:a05:6a00:21c8:b0:4c4:4bd:dc17 with SMTP id t8-20020a056a0021c800b004c404bddc17mr44906656pfj.57.1657088996640; Tue, 05 Jul 2022 23:29:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657088996; cv=pass; d=google.com; s=arc-20160816; b=zloRoZe1QozcRGgPgFTblLozmGURE3vKXUhkbNxn74y+a8YwSLxPI0cTQJL8lIEllW VVlCD5pzZIFjsRj3JCCOoHWkBGWZq7oLg7anblUsvNkMzp5Piy4pAOekQmgmhfHJfcgZ 6F5jCDNr+Gd2BuKc5bsKd2Fgyl7/GqhU7sPUTP1E/rNIYWNHg0OpzwFFXBz/btXCWsgB 51hu6/kjUKzxFkSSHkgVCdFceaTQIhIBdQ09Ya5VswqNquZCYotGfyhS169VUeTVLGSB 8cvK9NhqcU/7tMupkvFM95Uya9dAlG/vEOJBVIrLck2ewXq70OezB2quQjCoo/SWNaSx jmkQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=ZOhxWwfEe2gdOEbpD2pjMTaRdE59L5rfSB/zx9TzAy0=; b=Tv4ywze5H9FbyHPJb9JKuWKz1WaYeI8/qzVmnyjlmvQjHMs/WAIOMjaFCefmuCT72K 4WT/LMI5wV8p2jTGmKnXEWtwE0nyXmnmxySBE1RhANOVNdIzT/zAyM0FzRbgKp2hx5MW ncKYcDmrlZ4cwT9QhvErNvzpw+cP1L+bAqqtun/UgvhsCIoJKYl93AH/VJmMsM2g/+hK cldKv+aXWpbEffuX5hx5ZqgaK6Fq/qZeYwM1A80f6vMXgruzNMkcbBMza2va/xCfheam SEYiQ4Sunrmb0WZhoBM4IMV42TDD9QdOGzOtBr2seQI5Mix4SpwcZ4khYorb6qlxku2h xWvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Q546eqOW; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g71-20020a636b4a000000b00411806249d6si18624235pgc.762.2022.07.05.23.29.43; Tue, 05 Jul 2022 23:29:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Q546eqOW; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbiGFG2R (ORCPT + 99 others); Wed, 6 Jul 2022 02:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbiGFG2P (ORCPT ); Wed, 6 Jul 2022 02:28:15 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2079.outbound.protection.outlook.com [40.107.93.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FD0B21D; Tue, 5 Jul 2022 23:28:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cIEMVpS8xIs/HMa1MWPuemaHfzeBUJZKv61Q7XZwFqoOh/E7vu2rxlPmYvGSmOhGnJutui5MpzAanxfW8o54w8T3FRbvGJBcHj+Me1lYtSgQsciBw+apxadvhFwRbU7q6Jejw5uF+Pq/CQxIaV8xP/Fp4IcqqYgmUVOe3F0OM4+qDyny+WBQ4SWXn8wbyVqw2k+7hRhIdlYtUN48t7FlkzT9nlz3hHgGRaNxo5B3pG1KX25w1QuOvuVlOp4jKcRcVrAzZMpMDsvHUug2etnm/+NrI8Ttn3MET0rZlSdC62c8yHdlgS5VqBaYfYWxhd2ZYRtyLom2EO/Y4j33jaRpng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZOhxWwfEe2gdOEbpD2pjMTaRdE59L5rfSB/zx9TzAy0=; b=Qqxi/6cJ34FVoFu+ebq3WnvxNM2zAjP8YzYO7iYs4QlCkWdHAylqZmebt/ZlLaxKaF+7HKWzWDoyFTDGo/56DRrjhiU/bBg24kk/JlilshDoUZiTGBxP/YVlQDqWHjvA9IZksd7vM29JAtXMBk1TbklR3OXouf9tWXL+DuOxXkTVL9h86vhavPJehENB9t+IRgDrWLLNdUtLzZ1XqEqynfumqq3L4HsScSS+UjcZi1rcOYCh64h33QkHK6d1GUx7hwvCcSNlb7cd0q7S5/cve6YB4wtapE7gzGnQSVYg9FlZNJorPSiV/muIb8Rzr525ZVI/cHND4tOcDix2zPVrCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=linux.ibm.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZOhxWwfEe2gdOEbpD2pjMTaRdE59L5rfSB/zx9TzAy0=; b=Q546eqOWyVy8yIZiBdXAHdsXg8S1Er8IKfnhED/oH4GtbWwJxcrV1kR+Sr4oH1iBjrOte7bPjanQez5RGR2JrGpA2d8yeEXGQao8y7hbVw8BDbpD5qpO5W2ufGBTTgtD2SgpAgkHi4xuB7g0SZ1bi14S8Y0Gp3uqtVuWtvOeocRLhwX8Tu0dq0/N0lkWr46LU1lX+aOY7F2Cn7WekITEQF+YES4zh/OJDG998igm7uEEC+XFR1qZoP2ppGxNa/Iqs453WQmDXvHghraFW2jpSSGSI5/YohMFwldSev0ZkGaMvncuK/wXTZxIkpZlhmeLr3Z93BeOom/CpiHfZUOGHQ== Received: from DM6PR02CA0075.namprd02.prod.outlook.com (2603:10b6:5:1f4::16) by BN8PR12MB3316.namprd12.prod.outlook.com (2603:10b6:408:42::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Wed, 6 Jul 2022 06:28:11 +0000 Received: from DM6NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1f4:cafe::f6) by DM6PR02CA0075.outlook.office365.com (2603:10b6:5:1f4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14 via Frontend Transport; Wed, 6 Jul 2022 06:28:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by DM6NAM11FT062.mail.protection.outlook.com (10.13.173.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5417.15 via Frontend Transport; Wed, 6 Jul 2022 06:28:10 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Wed, 6 Jul 2022 06:28:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Tue, 5 Jul 2022 23:28:09 -0700 Received: from Asurada-Nvidia.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Tue, 5 Jul 2022 23:28:07 -0700 From: Nicolin Chen To: , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , , Subject: [RFT][PATCH v2 0/9] Update vfio_pin/unpin_pages API Date: Tue, 5 Jul 2022 23:27:50 -0700 Message-ID: <20220706062759.24946-1-nicolinc@nvidia.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 74ce2c6b-09e8-4a7d-9ace-08da5f18b2df X-MS-TrafficTypeDiagnostic: BN8PR12MB3316:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?mZO7gOG3nLhi6C3Lkq2mRtsIT6vPO4kNZj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19a3btQonIG7jZw5PGcWIwLQmuFGPTNG9tvBbnjUDHHceM94XhUvAu?= =?us-ascii?Q?AO8EpXF79gZIPK2L8sIY9HhOQnUHHh+JdeFHpgfgKkuE0xmdc9ckxH4qgF1r?= =?us-ascii?Q?3NE9svdPGmY+1mYrZwNjXnd6k78KfbdnGEaX/Vni+E0ohAE=3D?= X-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(376002)(396003)(136003)(39860400002)(346002)(46966006)(36840700001)(40470700004)(5660300002)(6666004)(82740400003)(356005)(921005)(41300700001)(81166007)(4326008)(8676002)(70206006)(70586007)(36860700001)(15650500001)(82310400005)(186003)(7696005)(478600001)(316002)(2906002)(966005)(8936002)(1076003)(2616005)(86362001)(40480700001)(7416002)(40460700003)(7406005)(26005)(83380400001)(47076005)(36756003)(110136005)(426003)(336012)(54906003)(36900700001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2022 06:28:10.9949 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74ce2c6b-09e8-4a7d-9ace-08da5f18b2df X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3316 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a preparatory series for IOMMUFD v2 patches. It prepares for replacing vfio_iommu_type1 implementations of vfio_pin/unpin_pages() with IOMMUFD version. There's a gap between these two versions: the vfio_iommu_type1 version inputs a non-contiguous PFN list and outputs another PFN list for the pinned physical page list, while the IOMMUFD version only supports a contiguous address input by accepting the starting IO virtual address of a set of pages to pin and by outputting to a physical page list. The nature of existing callers mostly aligns with the IOMMUFD version, except s390's vfio_ccw_cp code where some additional change is needed along with this series. Overall, updating to "iova" and "phys_page" does improve the caller side to some extent. Also fix a misuse of physical address and virtual address in the s390's crypto code. And update the input naming at the adjacent vfio_dma_rw(). This is on github: https://github.com/nicolinc/iommufd/commits/vfio_pin_pages Request for testing: I only did build for s390 and i915 code, so it'd be nice to have people who have environment to run sanity accordingly. Thanks! Changelog v2: * Added a patch to make vfio_unpin_pages return void * Added two patches to remove PFN list from two s390 callers * Renamed "phys_page" parameter to "pages" for vfio_pin_pages * Updated commit log of kmap_local_page() patch * Added Harald's "Reviewed-by" to pa_ind patch * Rebased on top of Alex's extern removal path v1: https://lore.kernel.org/kvm/20220616235212.15185-1-nicolinc@nvidia.com/ Nicolin Chen (9): vfio: Make vfio_unpin_pages() return void vfio/ap: Pass in physical address of ind to ap_aqic() vfio/ccw: Only pass in contiguous pages vfio: Pass in starting IOVA to vfio_pin/unpin_pages API vfio/ap: Remove redundant pfn vfio/ccw: Change pa_pfn list to pa_iova list vfio: Rename user_iova of vfio_dma_rw() vfio/ccw: Add kmap_local_page() for memcpy vfio: Replace phys_pfn with pages for vfio_pin_pages() .../driver-api/vfio-mediated-device.rst | 6 +- arch/s390/include/asm/ap.h | 6 +- drivers/gpu/drm/i915/gvt/kvmgt.c | 46 ++--- drivers/s390/cio/vfio_ccw_cp.c | 195 +++++++++++------- drivers/s390/crypto/ap_queue.c | 2 +- drivers/s390/crypto/vfio_ap_ops.c | 54 +++-- drivers/s390/crypto/vfio_ap_private.h | 4 +- drivers/vfio/vfio.c | 55 +++-- drivers/vfio/vfio.h | 8 +- drivers/vfio/vfio_iommu_type1.c | 46 +++-- include/linux/vfio.h | 9 +- 11 files changed, 218 insertions(+), 213 deletions(-) -- 2.17.1