From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:a0c:f381:0:0:0:0:0 with SMTP id i1csp2332885qvk; Fri, 4 Sep 2020 08:47:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjDi2+s+xCDkiEEwxerXVlB+/w2pMpcpm02Tutuz8qu8SeB4v00t6/dtQk0sCx8W26fbH+ X-Received: by 2002:a25:a201:: with SMTP id b1mr10410868ybi.225.1599234427339; Fri, 04 Sep 2020 08:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599234427; cv=none; d=google.com; s=arc-20160816; b=RxuJuZfztt9e5ozGKQXjh7g3PTpr4Ve+calCW9BSSwynoXDNmTqHDpUSgejxQ2+c2Z qLooDfwxPtS4rugLEJLko/0dhAaDe5hrbts+vYQ6GQ9r92+l8vzpWfK56cZzkwB9bOoQ bZYm/n5uQlUvrvxMp/w/MHIYVDmtc/rb0nozKAWDI+j4BNZolXWSvPs0X7DJmF8GL9No wK6MyzEUqiHzQjxn2QiukkFa9KKbCdjxDnKNzFYICtaO1nHLIBmdcxXmEtZqfCZL968R hvTAOcolUANKKURmld1wKAO7799vC+n6q1InxGkjolh4IprvLEyBzwWVG1QlxpyiwKnR 0fng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=NBNySzGMTXJs2pDI5BsQ+zAeetphAuLxBRAjAf+BQcE=; b=mPZCwon8JdJa5mmEsPwgqTUWjUKUYY9RfBiD8HVtup55xW0r0TmlMHepwtOXo6y9f+ X1EtTR/ojdq8mcIyWdW5ZD/wHsJDsMoqitIByZi8t/7zDeYSlSsgNvUGxK7PXnLoPD1O 2FNqdVdIEl+cU+oCycQWrQPk8cPBYww3iO4kWtGJxPx20AHN3vgeuYi0B4RkN088VmEH pEQkUdNuDh5YOoxEB15tEzK8z6GGuKAu+EuLL3GK+F0kgv3QmGe4kJ22rMMvOcusuQHs zIjzKc4pJEO9IGCq49fQbCL7h6mgspP6Yji+wYPL66I6HLLFM/BAwDti7oYSU9aUAft7 L4Bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u13si7296071ybd.405.2020.09.04.08.47.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Sep 2020 08:47:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:46356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kEDve-00042v-QM for alex.bennee@linaro.org; Fri, 04 Sep 2020 11:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kEDti-0001A7-5x for qemu-devel@nongnu.org; Fri, 04 Sep 2020 11:45:07 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:59669 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 1kEDtf-0007SD-9Z for qemu-devel@nongnu.org; Fri, 04 Sep 2020 11:45:05 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-302-CoIrDsahOmSsIci_nLpWBg-1; Fri, 04 Sep 2020 11:45:01 -0400 X-MC-Unique: CoIrDsahOmSsIci_nLpWBg-1 Received: by mail-wr1-f69.google.com with SMTP id g6so2463563wrv.3 for ; Fri, 04 Sep 2020 08:45: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=NBNySzGMTXJs2pDI5BsQ+zAeetphAuLxBRAjAf+BQcE=; b=Kq2QQb4oz/AGrcDYV7RvtKMVX3MkgDnhrwps+TPdH54plyC87c9Y0ugBqddzpTfg9X hVqFRseas3nxNiZMIJehBqtjXnjeRr/wBKqtlaEAYuHOaBd7JOp8ujO/pTDVzZh+7dfV ZicsRBoOcSyHVcTKSRvJyDUG17HyYXm6HVroXkVk2sTbwqmxV0s8V7t7fgViTmKKR2VZ bpEfij2eSCuoUqiYdAHUGTcckOgbraL8OWpLJvKEGg7jPczWui0cVOdux0aCiaJDzRQW 3YqTcFLEmr2K9tnDsLaqTcjN6Cvcyy8981ShPIIM4wdtgcE7it55kTA/WeJRmctk0VFU 4G3Q== X-Gm-Message-State: AOAM531VBRz/ym14aTUCrFPPTPfcUKnFL7fUQ7R3yUr1hcA0/Mz/dKdb A7yoCEqosyG6xOdsRUjBuXFTZF0Fdwx66vNQA0ZkeS+4m37hheSbkkqX148+6LURQp7FB7/u/bb CvXEZp7BRyHd3diE= X-Received: by 2002:a1c:56d6:: with SMTP id k205mr8168125wmb.88.1599234299958; Fri, 04 Sep 2020 08:44:59 -0700 (PDT) X-Received: by 2002:a1c:56d6:: with SMTP id k205mr8168088wmb.88.1599234299679; Fri, 04 Sep 2020 08:44: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 c206sm12217832wmf.47.2020.09.04.08.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 08:44:59 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini Subject: [PATCH 03/13] dma: Document address_space_map/address_space_unmap() prototypes Date: Fri, 4 Sep 2020 17:44:29 +0200 Message-Id: <20200904154439.643272-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200904154439.643272-1-philmd@redhat.com> References: <20200904154439.643272-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8; text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/04 01:57:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, 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-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" , qemu-block@nongnu.org, Joel Stanley , David Gibson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Eduardo Habkost , Alistair Francis , Beniamino Galvani , Eric Auger , qemu-arm@nongnu.org, Jan Kiszka , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , John Snow , Richard Henderson , Andrew Jeffery , Laszlo Ersek , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Andrew Baumann , qemu-ppc@nongnu.org, Peter Chubb Errors-To: qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-devel" X-TUID: /1TmvJJQmpr2 Add documentation based on address_space_map / address_space_unmap. Signed-off-by: Philippe Mathieu-Daudé --- include/sysemu/dma.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 80c5bc3e02d..19bc9ad1b69 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -1,7 +1,7 @@ /* * DMA helper functions * - * Copyright (c) 2009 Red Hat + * Copyright (c) 2009, 2020 Red Hat * * This work is licensed under the terms of the GNU General Public License * (GNU GPL), version 2 or later. @@ -125,6 +125,20 @@ static inline int dma_memory_write(AddressSpace *as, dma_addr_t addr, int dma_memory_set(AddressSpace *as, dma_addr_t addr, uint8_t c, dma_addr_t len); +/** + * address_space_map: Map a physical memory region into a DMA controller + * virtual address + * + * May map a subset of the requested range, given by and returned in @plen. + * May return %NULL and set *@plen to zero(0), if resources needed to perform + * the mapping are exhausted. + * Use only for reads OR writes - not for read-modify-write operations. + * + * @as: #AddressSpace to be accessed + * @addr: address within that address space + * @len: pointer to length of buffer; updated on return + * @dir: indicates the transfer direction + */ static inline void *dma_memory_map(AddressSpace *as, dma_addr_t addr, dma_addr_t *len, DMADirection dir) @@ -138,6 +152,20 @@ static inline void *dma_memory_map(AddressSpace *as, return p; } +/** + * address_space_unmap: Unmaps a memory region previously mapped + * by dma_memory_map() + * + * Will also mark the memory as dirty if @dir == %DMA_DIRECTION_FROM_DEVICE. + * @access_len gives the amount of memory that was actually read or written + * by the caller. + * + * @as: #AddressSpace used + * @buffer: host pointer as returned by address_space_map() + * @len: buffer length as returned by address_space_map() + * @dir: indicates the transfer direction + * @access_len: amount of data actually transferred + */ static inline void dma_memory_unmap(AddressSpace *as, void *buffer, dma_addr_t len, DMADirection dir, dma_addr_t access_len) -- 2.26.2