From patchwork Sat Oct 7 06:55:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liming Wu X-Patchwork-Id: 13412206 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 288673C0D for ; Sat, 7 Oct 2023 06:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=jaguarmicro.com header.i=@jaguarmicro.com header.b="ni413uTq" Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2069.outbound.protection.outlook.com [40.107.215.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C184BD; Fri, 6 Oct 2023 23:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kcmWn73NH/rVMhw/IkIFC85s0jMGle0p11r5FcEwCWbeeMjp30bqjOaDlhsved+IEkVTOiYojGjGCOMi9ciu8PNFyWYz0qILd4ZfBpVPLQY6V3/OBxt/lYuCHQ0zP8J49RPr+5Zr4icGuT1Jt2iXzdD1iKJRYPuc6xPkaK1GSMVo/DsgWdDZ101RXnKrJbyVkdMxTpGhAaOUOsT6UcEjRHUb7vXNHNvsFN0buZRZ9xgajIvh4+xFrluJQ14xzNgfQLcNAXJw9BUtTeizDYdao1+nzJHSAbUwav/P6oZzU1ceaUB7WiulHZHh6yaXzQW9tVuMJJQnovdkcgtUGZTKmw== 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=BmAQQl8A0PCsUojiB3YSOfAuymoeUEitnUHJzywMjMY=; b=hUNFkve3v18jVluqmMjUoSFiu5OZTZdjLsD1VP31L2OWcYsJ66c1SYjagxNI83U4MXeJJsfCERBxYIz4qEJgF9XhOjQMunQdQWHb7kvdbUnkF9nH4u8qkzIru9FD215dWMKInyJ5J42+62w3zN03Rs95WnRYkcwu4GF5bcXoAMHyDR1jC1UxhX5qVR2Rh9wb3srxxEN1xL0I06ESwzrmjgOP1sKSNqivgwxKYG+DQq6DvyG8ctML16bnIl2rRiFb5W7m90v7LR6c9VE5WCN2JvlQTHN1+LL89nJ+tVs8/9Y0uT2Yok/F2vKfa2uIGDbht7LSxc2e/53wLEly8SmdqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=jaguarmicro.com; dmarc=pass action=none header.from=jaguarmicro.com; dkim=pass header.d=jaguarmicro.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jaguarmicro.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BmAQQl8A0PCsUojiB3YSOfAuymoeUEitnUHJzywMjMY=; b=ni413uTqNxlw65q8g1WBi5WYN4ope1u1IugbcVoHFwbzic0ZOwToku4hmnegEmJemQGp+uK4xpyGeKYvwbNf8BdDwJPiRNX5Rneiw2MksJpXjcCFK/P2Z7iXzhYo8stfCEb/wJp4n20JxI0wQSY3zriSbr8zc+0uzPv2d0AxpQv5mOYWuQTTgtlJGuXTzx9QGkxYa7sMRibrfRQW8RXMAkQm/mt7/m+nOHc+Shq8PhCtc8IFMEJ0SGndmh9URzVE8TAJnLLQniXrotdNbJDTenW5+W4PXhgWDhlaAC5Bt3Anvd42xNo8ZnClifTerELx5lClc2iuuFem/9Lk3jjDqw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=jaguarmicro.com; Received: from PSAPR06MB3942.apcprd06.prod.outlook.com (2603:1096:301:2b::5) by TYZPR06MB6745.apcprd06.prod.outlook.com (2603:1096:400:45a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.38; Sat, 7 Oct 2023 06:56:04 +0000 Received: from PSAPR06MB3942.apcprd06.prod.outlook.com ([fe80::e5ee:587c:9e8e:1dbd]) by PSAPR06MB3942.apcprd06.prod.outlook.com ([fe80::e5ee:587c:9e8e:1dbd%4]) with mapi id 15.20.6838.033; Sat, 7 Oct 2023 06:56:04 +0000 From: liming.wu@jaguarmicro.com To: "Michael S . Tsirkin" , Jason Wang Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Liming Wu Subject: [PATCH v2 1/2] tools/virtio: Add dma sync api for virtio test Date: Sat, 7 Oct 2023 14:55:46 +0800 Message-Id: <20231007065547.1028-1-liming.wu@jaguarmicro.com> X-Mailer: git-send-email 2.34.0.windows.1 In-Reply-To: <20230927111904-mutt-send-email-mst@kernel.org> References: <20230927111904-mutt-send-email-mst@kernel.org> X-ClientProxiedBy: SI2PR02CA0050.apcprd02.prod.outlook.com (2603:1096:4:196::11) To PSAPR06MB3942.apcprd06.prod.outlook.com (2603:1096:301:2b::5) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB3942:EE_|TYZPR06MB6745:EE_ X-MS-Office365-Filtering-Correlation-Id: d4f1d500-c40f-47ff-a437-08dbc7027934 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PqOhxHxAd2s811+oko7SrSKHuGTxtjtKq3gy/veBMuZPJoe3qRjPlPh5oJwMaAEfa06bI3FXnb8GLuyk1eMRuJmTADD67JeKKaEAyTEJZZqfajvhtq8vqE+ORgSlMHcMDaMePRXIxDKCGmDQuz4Q8jAVJY4U5CTDmAGMX8b12lCq/CuJ2npxP237x3JzJ0L43EiYXDWE+qAXf/CgKrMSR9iPIBSuZXqJisr31UhFcDYQw3BF1QPgeTEaURqvBVuwF3v+ukgM0Fb97uvLZJs1S+BHS0+iFIsq5Gxt4uuJHqYeThAyShWTxZWDruQqx4WgDGIrGKkUUr+RMXhOcWbDdvLX6RF2OrPVuH8gzXS7LurxaK9tuyskRhSXSz/Y2AoZNuuv/fnW4V/F7kLgCMsfpm8u99lOWGps7nG+Yo2bO+sOj7O2hCb2dEAv03Cobruw+tl4Z/PshLbuChQrfvw4JDb2Qxk1sRVRAeeh7mHyEMOatW4TsujpjLBdwsFOcWy7nWN3Ux5fNHfYHtXYXuu49JrJGaUPh0iwwus7zgTvq/MoFw0UXro4u1En625AZKYKcyESR7QSg2hvEIvnrexoTTfZO081CdDROHS6TEB0AMJP3o4RifbduHXbdOb3JrTb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB3942.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39830400003)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(2906002)(4326008)(8936002)(5660300002)(8676002)(86362001)(36756003)(316002)(41300700001)(6636002)(66946007)(66556008)(66476007)(110136005)(9686003)(6486002)(6512007)(478600001)(6666004)(2616005)(38100700002)(38350700002)(1076003)(26005)(107886003)(6506007)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ayjCmb2+9IZR6IrAZ9de4Cvsj6BQD0QnerNq8r8IW6AySnkHLG8yuv7tsw/61+FjHX2oY9WRcsIh4jvPrxnIdHgfyVfGO01PUs3cEDPg0SF6kixsJwSjuI7tvEqD3yyddjNtS0soQY5HDdjylmFgLkbs37WQlp/AJ9LH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6CkxdijnQh7TGm71BIWp1mtIeoSrcR21H02lSkzu50IU71J+daqNSvamRSikuAfvqQZe7v9nv6guY3ZkecjzMOUlPvgPa65qPoApLeButUqW+pw3ux7ztc19BfhdqrBm8X3lUYx4crK0Wp49HRTRlZRMRUrtr/4ALe423h4aVvULcDaO0sd/wt5Q3E7GDz99TPeKbZkcbcq5hHCTAEf9ewZttgDpyBE3Eu+um1knPl44pmV3TBI2gF4spbdBAfLV4qdx5mCa5Nt6s0EPRk2fY9xMCAff2gO0hm1lfta4iFIOhb3UCgpxRQzVchVeR7qBJCY9zmaKR6PmccEf5pylNY+L9UcDeP/MehFhrecUlxAZcgVol/QItnIIA0KOA== X-OriginatorOrg: jaguarmicro.com X-MS-Exchange-CrossTenant-Network-Message-Id: d4f1d500-c40f-47ff-a437-08dbc7027934 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB3942.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2023 06:56:04.2418 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 1e45a5c2-d3e1-46b3-a0e6-c5ebf6d8ba7b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LekE///l/2t/emQ5tachb38OXYW27x+mM0rETfEwh2Eh/QM+5GhyDNTwvPpA0f7Gsuc+tjyalG/G5VN/MUVfM26BuFm36kQI6qgY+W4IYY4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6745 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net From: Liming Wu Fixes: 8bd2f71054bd ("virtio_ring: introduce dma sync api for virtqueue") also add dma sync api for virtio test. Signed-off-by: Liming Wu --- tools/virtio/linux/dma-mapping.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/virtio/linux/dma-mapping.h b/tools/virtio/linux/dma-mapping.h index 834a90bd3270..822ecaa8e4df 100644 --- a/tools/virtio/linux/dma-mapping.h +++ b/tools/virtio/linux/dma-mapping.h @@ -24,11 +24,23 @@ enum dma_data_direction { #define dma_map_page(d, p, o, s, dir) (page_to_phys(p) + (o)) #define dma_map_single(d, p, s, dir) (virt_to_phys(p)) +#define dma_map_single_attrs(d, p, s, dir, a) (virt_to_phys(p)) #define dma_mapping_error(...) (0) #define dma_unmap_single(d, a, s, r) do { (void)(d); (void)(a); (void)(s); (void)(r); } while (0) #define dma_unmap_page(d, a, s, r) do { (void)(d); (void)(a); (void)(s); (void)(r); } while (0) +#define sg_dma_address(sg) (0) +#define dma_need_sync(v, a) (0) +#define dma_unmap_single_attrs(d, a, s, r, t) do { \ + (void)(d); (void)(a); (void)(s); (void)(r); (void)(t); \ +} while (0) +#define dma_sync_single_range_for_cpu(d, a, o, s, r) do { \ + (void)(d); (void)(a); (void)(o); (void)(s); (void)(r); \ +} while (0) +#define dma_sync_single_range_for_device(d, a, o, s, r) do { \ + (void)(d); (void)(a); (void)(o); (void)(s); (void)(r); \ +} while (0) #define dma_max_mapping_size(...) SIZE_MAX #endif