From patchwork Thu Dec 16 12:35:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12680995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF19AC433EF for ; Thu, 16 Dec 2021 12:50:17 +0000 (UTC) Received: from localhost ([::1]:50052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mxqDA-000214-2n for qemu-devel@archiver.kernel.org; Thu, 16 Dec 2021 07:50:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxpzf-0001T7-ML for qemu-devel@nongnu.org; Thu, 16 Dec 2021 07:36:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26229) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mxpzb-0004RE-LH for qemu-devel@nongnu.org; Thu, 16 Dec 2021 07:36:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639658175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OjX8CYLaX4R3RIAI7ku1YNlJqt9CA9792fVcfHD3DXE=; b=Nh5JAJtmvi4VYN46SFfyWlgdWLG7L4CD1sd1pTSDxrEEgPOcC4jA0JWokqCzXSu8goHw27 mI8RBT9wJ7FlYOWaOZkQ9Pd4zuj9bLlj1t8oDSaPATtM3tql0XPtqCpaqFT6O2uhKBFX7x PpFsvd/pjePH7i1rEMpTpwiXN7sATLE= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-86-W6j6MWRrP-aTnodghcrcNw-1; Thu, 16 Dec 2021 07:36:14 -0500 X-MC-Unique: W6j6MWRrP-aTnodghcrcNw-1 Received: by mail-wm1-f70.google.com with SMTP id o17-20020a05600c511100b00343141e2a16so7730761wms.5 for ; Thu, 16 Dec 2021 04:36:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OjX8CYLaX4R3RIAI7ku1YNlJqt9CA9792fVcfHD3DXE=; b=tyo1nhYaJKlgn/xeGO0VmxU/CjeoqOLxHbncgoNWwmaQ0E1qjxhTbCnFfddKljQ1xn vPBZjoOWg6ceNvo5AE6T09UfIWCOIyTDhQw3OX4dPRacAE8uHdOIfOd+COqUdyV0/Pkz 90biS9z5fYhNX4m9FSCFzQtI6WSomofHhOdCvDH/t5T6R/I0Iu4SylUMkKIcIHoiUcjw 475q+7NUdEzWqaevhbh2bVhN7B3HfK/TLwcDbMFoh/Rm/ENy6EQ8BNXSlHX5LSIDWimF RQ7224vCFGYfnavVZuX1gIwNpKaRhKLqqxCWS28IKppRCTtekD9QjVcOmq3d70iO/72H Awcg== X-Gm-Message-State: AOAM530oAxghKoGTj9/pFBsiCnptVDVkU4Vulsho9zp8U9knOgojNJ5v +WLZjSybBbql3ZkyXR+6ZsUuaKmBGlLAlgEI2AZyNIfzpLKwIGi2uju1Lli21FkQZVGrCF0Ihx1 8jqqgP0eOx8X/sXha0bYwHFrvbrj1hcxmiKUibA9jwFZc0W+04PXDJFiuPrOx4RHH X-Received: by 2002:a5d:66cb:: with SMTP id k11mr9233293wrw.253.1639658172879; Thu, 16 Dec 2021 04:36:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2kn9WZBr5BRR9aX7rH7oWfDlQQBLIJSj9XP+aC0UFvSZ8A6EAhCUwTwi39z/SeU3tS1RolQ== X-Received: by 2002:a5d:66cb:: with SMTP id k11mr9233254wrw.253.1639658172653; Thu, 16 Dec 2021 04:36:12 -0800 (PST) Received: from localhost.localdomain (174.red-83-50-185.dynamicip.rima-tde.net. [83.50.185.174]) by smtp.gmail.com with ESMTPSA id o12sm6105798wrc.85.2021.12.16.04.36.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 04:36:12 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 1/8] dma: Have dma_buf_rw() take a void pointer Date: Thu, 16 Dec 2021 13:35:51 +0100 Message-Id: <20211216123558.799425-2-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211216123558.799425-1-philmd@redhat.com> References: <20211216123558.799425-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.718, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Hannes Reinecke , qemu-block@nongnu.org, David Hildenbrand , John Snow , Jason Wang , "Michael S. Tsirkin" , Li Qiang , Qiuhao Li , Peter Xu , Keith Busch , Alexander Bulekov , Gerd Hoffmann , Klaus Jensen , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" DMA operations are run on any kind of buffer, not arrays of uint8_t. Convert dma_buf_rw() to take a void pointer argument to save us pointless casts to uint8_t *. Signed-off-by: Philippe Mathieu-Daudé --- softmmu/dma-helpers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/softmmu/dma-helpers.c b/softmmu/dma-helpers.c index 3c06a2feddd..09e29997ee5 100644 --- a/softmmu/dma-helpers.c +++ b/softmmu/dma-helpers.c @@ -294,9 +294,10 @@ BlockAIOCB *dma_blk_write(BlockBackend *blk, } -static uint64_t dma_buf_rw(uint8_t *ptr, int32_t len, QEMUSGList *sg, +static uint64_t dma_buf_rw(void *buf, int32_t len, QEMUSGList *sg, DMADirection dir) { + uint8_t *ptr = buf; uint64_t resid; int sg_cur_index;