From nobody Mon Feb 9 18:20:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599234317; cv=none; d=zohomail.com; s=zohoarc; b=OQZQnTBvItS6VgqH+b5DAIsYtt8azjmJ5SSzc6q2tE9cvU3JiZ58niMSp/ahtHNNEzcVQ5LJg3/z0HrWpf0Nj5PuMQw96uFyGxoCrQquPyh/EFepM7NCZsp92kAsvaywlEaeDX/MlvUS29s0PGdK5+8ocp+nzxcn/PraIjMuGdU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599234317; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=NBNySzGMTXJs2pDI5BsQ+zAeetphAuLxBRAjAf+BQcE=; b=S6+fWVp+cbPRrLPATrX9rQ786E8QqT6V0sQPEmrjeh/uoRuED9PxtpwBgdCOrBhuRxn51iOE8nx2JMNa2cCBpKZQPa7d3DfHTVkNQAVAtn67PC1VwS8DobOATYzSTefwq/5qFtAzbzZFNjCu42b8pMWeSyN7H3er3/x3mr1Xi4Q= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599234317168624.5971572629873; Fri, 4 Sep 2020 08:45:17 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-264-ownkTR3MMkexrPR1zxaAPg-1; Fri, 04 Sep 2020 11:45:01 -0400 Received: by mail-wr1-f71.google.com with SMTP id r15so2443885wrt.8 for ; Fri, 04 Sep 2020 08:45:00 -0700 (PDT) Return-Path: Return-Path: 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) X-MC-Unique: ownkTR3MMkexrPR1zxaAPg-1 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=JR0LNb7os0D/RlkGk91wJMUO6Rg/VXyYS9FETgAYCZfaZC3xQOY8v+LX3CbHXP5lXE h5a8OaGM11TzDhs5ZvPIqZv30uemBaCoAnLxndPeHZbwBrXXbm//kUpjEHZVNCbkTgYL xxcut3Xkof6psV8JYwII/Ik1ah5U56APxE2eNvF/fGiEI9iRVZbrApbzp8RwsZSVaEh6 EavSOIZZYHYuzqmHO8lmKi+AdDk46ago0AFfnyApSmsU3abf17qGi/ihVtJgESNbbkXQ 6/xDozVhfZXOf4/0qD2SvgBflCanh9KvPbxD6ymUwrEQr8D1rIInlTw+Lt3XkeFN8ZYs ZQpA== X-Gm-Message-State: AOAM532NjpvZ1ZC9m7NalaFGwiDheFc9DpkpAPx56ZNAHp4zxsIdJnuW gPqNkm9na0d+XXVYmmW2I3MAq8/sQjjpU/86v9GhC5i5IPkkF82VJhWSNQoRRZAoa2Ob076lLfK rUpqI9THbMeaSUw== X-Received: by 2002:a1c:56d6:: with SMTP id k205mr8168130wmb.88.1599234299958; Fri, 04 Sep 2020 08:44:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFxiYDEEqBUW6jemEzqr0197NXQuJsZ/5BdTi1biAgAKoiz3JWSdkEC9UC1GEvatNNhWXXUg== X-Received: by 2002:a1c:56d6:: with SMTP id k205mr8168088wmb.88.1599234299679; 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 Cc: Laszlo Ersek , Marcel Apfelbaum , "Edgar E. Iglesias" , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Mark Cave-Ayland , Jason Wang , Peter Xu , "Michael S. Tsirkin" , Jan Kiszka , Eric Auger , David Gibson , Beniamino Galvani , Andrew Jeffery , Richard Henderson , Joel Stanley , Eduardo Habkost , Alistair Francis , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , John Snow , qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Peter Maydell , Andrew Baumann , Peter Chubb , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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: quoted-printable Add documentation based on address_space_map / address_space_unmap. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias Reviewed-by: Richard Henderson --- 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, d= ma_addr_t addr, =20 int dma_memory_set(AddressSpace *as, dma_addr_t addr, uint8_t c, dma_addr_= t len); =20 +/** + * 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 perf= orm + * 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; } =20 +/** + * address_space_unmap: Unmaps a memory region previously mapped + * by dma_memory_map() + * + * Will also mark the memory as dirty if @dir =3D=3D %DMA_DIRECTION_FROM_D= EVICE. + * @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_le= n) --=20 2.26.2