From patchwork Thu Sep 3 11:08:23 2020 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: 274700 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D53AFC433E2 for ; Thu, 3 Sep 2020 11:10:36 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8F1E7206EB for ; Thu, 3 Sep 2020 11:10:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YGI4DY76" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F1E7206EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kDn8V-0002dA-JI for qemu-devel@archiver.kernel.org; Thu, 03 Sep 2020 07:10:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kDn73-0008O4-VT for qemu-devel@nongnu.org; Thu, 03 Sep 2020 07:09:06 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:33858 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kDn71-0005pe-FI for qemu-devel@nongnu.org; Thu, 03 Sep 2020 07:09:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599131342; 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=j+CTPuGUnIINTsaPCLli+OHIjRAwlTE0OOiFGbSRLLI=; b=YGI4DY762GNDVysu1xauKV8EmU09E4Meoo/UFXaxmE71ah00uJTdUnT8XnPE2pxVn3IKeT KWv+cwjkg3Tp9u6re5BSVL/7NzZ3LYLwlxFM201WCbwEQp6vqHObLiWJTAbPY2OUuOimyF 77C/laYMwqOnbXdR7fbKfI9VWSZJOM4= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-oKTlDOANM_-xqn2af-4jPQ-1; Thu, 03 Sep 2020 07:09:01 -0400 X-MC-Unique: oKTlDOANM_-xqn2af-4jPQ-1 Received: by mail-wr1-f70.google.com with SMTP id b8so960229wrr.2 for ; Thu, 03 Sep 2020 04:09:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j+CTPuGUnIINTsaPCLli+OHIjRAwlTE0OOiFGbSRLLI=; b=egxlEMdYWjhURtRgF678Ca3/YaHLqD6vOGd0zsOqmc8NIaKMpSqzHIL5m68GHwYTt6 COI0eol+8jVpmuEA2dsROUUIlL4fUVaBbBhtTXAk14gDS7u2nMGxKdTQxf8v19fbC+xh YGs/dIFkKXKvXz0DFXEzZp7H+1xj/vT56ADvKyPryiUnu6svgG8IBXfIb7Se7dcxGn7R sgoIu+Q8B9CJCgk4DTIJ20aXZV4TdpaCA8ihExJII50L/VYTrK4qt60dgKzr483mwS1P Z/wUvZv1xPULZ8ezhYGTalHGYG4DAffo+he6E4/eP8UUuUh7mnhD+WzZIiOoJ6HYCiZk txSg== X-Gm-Message-State: AOAM533cxhZ2U1hR5fLkk1pCFSvHA3meTPK1TsuCPAxUd7y49FGk+1WV 56zXI9zEwIk5X3EGicvl5yAoCUBE2tDVHb34lPyMjeKa/l6KB/lHR9jI2R/qGoz9nNVnB2FRnLW pGQUYM853avQCags= X-Received: by 2002:adf:e9c1:: with SMTP id l1mr1912999wrn.68.1599131339764; Thu, 03 Sep 2020 04:08:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNjVckWeZj1Fks7WkDAmCdI4aYyZe18yH1B95ng9F9Ur0Iayl4PU3nMhc55IyTVorvdu0rOQ== X-Received: by 2002:adf:e9c1:: with SMTP id l1mr1912961wrn.68.1599131339616; Thu, 03 Sep 2020 04:08:59 -0700 (PDT) Received: from localhost.localdomain (50.red-83-52-54.dynamicip.rima-tde.net. [83.52.54.50]) by smtp.gmail.com with ESMTPSA id q18sm3863193wre.78.2020.09.03.04.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 04:08:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 04/12] dma: Let dma_memory_rw_relaxed() take MemTxAttrs argument Date: Thu, 3 Sep 2020 13:08:23 +0200 Message-Id: <20200903110831.353476-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200903110831.353476-1-philmd@redhat.com> References: <20200903110831.353476-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.002 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/03 04:23:49 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Mark Cave-Ayland , Peter Xu , Gerd Hoffmann , "Edgar E. Iglesias" , Eduardo Habkost , "Edgar E . Iglesias" , qemu-block@nongnu.org, Li Qiang , "Emilio G . Cota" , Peter Chubb , Joel Stanley , Richard Henderson , Laszlo Ersek , Robert Foley , Alistair Francis , Richard Henderson , Beniamino Galvani , Eric Auger , qemu-arm@nongnu.org, Jan Kiszka , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Stefan Hajnoczi , John Snow , David Gibson , Tony Nguyen , Prasad J Pandit , Alexander Bulekov , Andrew Jeffery , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Emanuele Giuseppe Esposito , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-ppc@nongnu.org, Klaus Jensen , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- include/sysemu/dma.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 34f957cc278..6068323e48f 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -82,23 +82,26 @@ static inline bool dma_memory_valid(AddressSpace *as, static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr, void *buf, dma_addr_t len, - DMADirection dir) + DMADirection dir, MemTxAttrs attrs) { - return (bool)address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, + return (bool)address_space_rw(as, addr, attrs, buf, len, dir == DMA_DIRECTION_FROM_DEVICE); } static inline int dma_memory_read_relaxed(AddressSpace *as, dma_addr_t addr, void *buf, dma_addr_t len) { - return dma_memory_rw_relaxed(as, addr, buf, len, DMA_DIRECTION_TO_DEVICE); + return dma_memory_rw_relaxed(as, addr, buf, len, + DMA_DIRECTION_TO_DEVICE, + MEMTXATTRS_UNSPECIFIED); } static inline int dma_memory_write_relaxed(AddressSpace *as, dma_addr_t addr, const void *buf, dma_addr_t len) { return dma_memory_rw_relaxed(as, addr, (void *)buf, len, - DMA_DIRECTION_FROM_DEVICE); + DMA_DIRECTION_FROM_DEVICE, + MEMTXATTRS_UNSPECIFIED); } static inline int dma_memory_rw(AddressSpace *as, dma_addr_t addr, @@ -107,7 +110,8 @@ static inline int dma_memory_rw(AddressSpace *as, dma_addr_t addr, { dma_barrier(as, dir); - return dma_memory_rw_relaxed(as, addr, buf, len, dir); + return dma_memory_rw_relaxed(as, addr, buf, len, dir, + MEMTXATTRS_UNSPECIFIED); } static inline int dma_memory_read(AddressSpace *as, dma_addr_t addr,