From patchwork Thu Dec 23 11:55:41 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: 1572635 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fd5B5tjd; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JKTqG1Kjwz9t5K for ; Thu, 23 Dec 2021 23:22:50 +1100 (AEDT) Received: from localhost ([::1]:56900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0N7P-0007tr-Vs for incoming@patchwork.ozlabs.org; Thu, 23 Dec 2021 07:22:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0Mjw-0001UO-5c for qemu-ppc@nongnu.org; Thu, 23 Dec 2021 06:58:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53074) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0Mju-0000t1-Dd for qemu-ppc@nongnu.org; Thu, 23 Dec 2021 06:58:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640260709; 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=cIMQ6+5zcOJyU3/jxVV3Bhh/HwifxZgqMUUJxuhYIK8=; b=fd5B5tjd2esEFJkk4lzQ6OtXFc2fL0yyT3rbRznLvNqk8JElRFdA5RyK//582qc+RjweyS Cin3jC4LrwrleVpQi6rX+hKC+UHFmogY6SHA0H9pVCehw+AlMWJEBMdNIjQUSOUHHrxafB sS3bXUEd2LLJqu1u5R5eWkTGp3SGX50= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-68-9JvuiLIdN6uDqJWj9Alqqw-1; Thu, 23 Dec 2021 06:58:28 -0500 X-MC-Unique: 9JvuiLIdN6uDqJWj9Alqqw-1 Received: by mail-wm1-f71.google.com with SMTP id p22-20020a05600c1d9600b00345a25ea8cfso1864482wms.5 for ; Thu, 23 Dec 2021 03:58:28 -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=cIMQ6+5zcOJyU3/jxVV3Bhh/HwifxZgqMUUJxuhYIK8=; b=yxnUFsJ9vsg25iq/bs9NU/FZqLsnEfMIwlND8f8ngtklfZjdCso8SuomZjxL1onAg8 Tw46a8UmttozbBtPT3+rF4nrbMsUHcBX8LWQcxmD7XewJTamKmOs6SZs8f+YPHOnEbvd sQPjzR7nfMi4qL0k4BrEvFWFnl5+UzoBmr2lu8mLFvKWhn38w44+U/mHQpE6FxV0fBZd t5VkOJHYVhN5laF8ewIRQzs7IngVVO5UHn995qXepIhHHzAbVn4iQVz463E2Cn5PAzlV u3ZAhIWbxcF79fwslqXcWyr4KdoqpygHZcbA3DIv0CpeAliHEwzQSkuhxS36Q+kZs7I/ 7/BQ== X-Gm-Message-State: AOAM531zXDuHVYH1rY9QTWK7Axq8fA9o0FS3O9z1mlUvkuP7x/KptxSC xHkNIkv6T+RuISIiprZg3Jbt/1b+yXIqiBZqZmvZSB4q0KKzGcK4t1pbS+8TXspVYKLE3FwVYUz d8QKyHv2ChHKE X-Received: by 2002:a7b:cd0e:: with SMTP id f14mr1453664wmj.3.1640260707523; Thu, 23 Dec 2021 03:58:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLg7ZBmot/JWFarBL1366EEW2gjsu8I9BPhoO0enF42tjxKy/3erccjpOE4zYy85mbwd1wfA== X-Received: by 2002:a7b:cd0e:: with SMTP id f14mr1453641wmj.3.1640260707375; Thu, 23 Dec 2021 03:58:27 -0800 (PST) Received: from x1w.. (33.red-193-152-124.dynamicip.rima-tde.net. [193.152.124.33]) by smtp.gmail.com with ESMTPSA id l13sm5229854wrs.73.2021.12.23.03.58.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Dec 2021 03:58:26 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 10/23] dma: Let dma_buf_rw() take MemTxAttrs argument Date: Thu, 23 Dec 2021 12:55:41 +0100 Message-Id: <20211223115554.3155328-11-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211223115554.3155328-1-philmd@redhat.com> References: <20211223115554.3155328-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: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.203, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-ppc@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 , Peter Maydell , Dmitry Fleytman , "Michael S. Tsirkin" , Jason Wang , Bin Meng , David Hildenbrand , Peter Xu , Gerd Hoffmann , Klaus Jensen , Sven Schnelle , Hannes Reinecke , qemu-block@nongnu.org, Daniel Henrique Barboza , Havard Skinnemoen , Joel Stanley , Marcel Apfelbaum , Stefan Weil , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Richard Henderson , Greg Kurz , Beniamino Galvani , Eric Auger , qemu-arm@nongnu.org, Jan Kiszka , =?utf-8?q?C=C3=A9dric_?= =?utf-8?q?Le_Goater?= , Keith Busch , John Snow , David Gibson , Eduardo Habkost , Andrew Jeffery , Klaus Jensen , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Tyrone Ting , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-ppc" Let devices specify transaction attributes when calling dma_buf_rw(). Keep the default MEMTXATTRS_UNSPECIFIED in the 2 callers. Reviewed-by: Klaus Jensen Signed-off-by: Philippe Mathieu-Daudé --- softmmu/dma-helpers.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/softmmu/dma-helpers.c b/softmmu/dma-helpers.c index 7f37548394e..fa81d2b386c 100644 --- a/softmmu/dma-helpers.c +++ b/softmmu/dma-helpers.c @@ -295,7 +295,7 @@ BlockAIOCB *dma_blk_write(BlockBackend *blk, static uint64_t dma_buf_rw(void *buf, int32_t len, QEMUSGList *sg, - DMADirection dir) + DMADirection dir, MemTxAttrs attrs) { uint8_t *ptr = buf; uint64_t resid; @@ -307,8 +307,7 @@ static uint64_t dma_buf_rw(void *buf, int32_t len, QEMUSGList *sg, while (len > 0) { ScatterGatherEntry entry = sg->sg[sg_cur_index++]; int32_t xfer = MIN(len, entry.len); - dma_memory_rw(sg->as, entry.base, ptr, xfer, dir, - MEMTXATTRS_UNSPECIFIED); + dma_memory_rw(sg->as, entry.base, ptr, xfer, dir, attrs); ptr += xfer; len -= xfer; resid -= xfer; @@ -319,12 +318,14 @@ static uint64_t dma_buf_rw(void *buf, int32_t len, QEMUSGList *sg, uint64_t dma_buf_read(void *ptr, int32_t len, QEMUSGList *sg) { - return dma_buf_rw(ptr, len, sg, DMA_DIRECTION_FROM_DEVICE); + return dma_buf_rw(ptr, len, sg, DMA_DIRECTION_FROM_DEVICE, + MEMTXATTRS_UNSPECIFIED); } uint64_t dma_buf_write(void *ptr, int32_t len, QEMUSGList *sg) { - return dma_buf_rw(ptr, len, sg, DMA_DIRECTION_TO_DEVICE); + return dma_buf_rw(ptr, len, sg, DMA_DIRECTION_TO_DEVICE, + MEMTXATTRS_UNSPECIFIED); } void dma_acct_start(BlockBackend *blk, BlockAcctCookie *cookie,