From nobody Mon Feb 9 23:59:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1601573142; cv=none; d=zohomail.com; s=zohoarc; b=MU1/DW/QzKjRXpufuU0IVDgrgzfzHEpukjvTUUXRoh8kiuMALwJNnStYLZO0CDg3XNdmzYoD4ybHVi7cNY47BKLrApXOFgwTU9bQntNIKycWgSPoldmxLjYK2ApcXg6GVQTY59nNcc5ZrijGJKhx7iIzvVFLYVdVx3lZtxMxyU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573142; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=pWyri9vRLYeVqvreYWHFron9sHPrhWm4LYtp0EVZkVA=; b=XL0UNRxbqYkq6w399DSQ0q9XeDNmygQc40DrZrtVzxeNfQYVP/eyPS1cFh7K/q5lWbvRY/pBDtR4tWvlGWjTpNUM4Y5NZlXf/UKO0M/+zb6ZH5R6XUVBuIV1YL6eZ23dmf25u6oCB1MtTl1HuMfjCLH0qikcPp8QCL8w9Y4JbC4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 160157314200521.642622305750592; Thu, 1 Oct 2020 10:25:42 -0700 (PDT) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-oLZUS-NUNl2z5AKyKytyJw-1; Thu, 01 Oct 2020 13:25:37 -0400 Received: by mail-wm1-f69.google.com with SMTP id l26so1109542wmg.7 for ; Thu, 01 Oct 2020 10:25:37 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id a3sm740469wmb.46.2020.10.01.10.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:25:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573139; 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=pWyri9vRLYeVqvreYWHFron9sHPrhWm4LYtp0EVZkVA=; b=JZwJQYTx7zruB/n8AX9/hVtyc/1k9J5cn95O5RiFdYrCpp6ogvUypWMlwXvYG+RvZ7htzN fjmxpFFjx/JyUTUnsz9NOtoVuqmIwKc4cyFZenbfdsTQYR6EO7NRvqEv2msAju/OuK142A nesKybgYboFVgHpjnpqARDom+tI4Ptc= X-MC-Unique: oLZUS-NUNl2z5AKyKytyJw-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=pWyri9vRLYeVqvreYWHFron9sHPrhWm4LYtp0EVZkVA=; b=H64/IqvVzO7107amelyIdgnFLFB81TraTxAiNRAsI0XV4Pau8qUT9A9NABCbtKK/pe K0diqd2kxYY0wX2+EWRdMpwOwSDSlB5AVSIt8XBGkgsVXIT5UnP8zG4jZHW3tQwRIP8n a5LYt1qjurerdNaltkhjDxo9iTcZpP2flAGbMprC7kZTNCLbMaFpkYmXcBysIykOH+Xa D+TK6On5idN0TuqPqxpeO+meOuXnMq8BeuwZ6nu9GCli4swMoQMcMz11rOmcAOVUKX2c nZ4trYP/YUxHnYDqrze0X6tnLQABay0tvd0lyvd/imRPEm8gOWeHJF6QR49VzG8j7Hgx 1IoA== X-Gm-Message-State: AOAM530xgExWQnVGSsIS+Z06CF2/b5fhDfsllkXAL2HscYoObjk+1etv WeY5s23vsBbpB/n09kQWBFgrNo7kH+dFHPOQM/F3Zj4AjafwRMVQILE+FQiIupZnC13dcsGbplz ygPKAHvH0RcxjPw== X-Received: by 2002:a1c:7d55:: with SMTP id y82mr1098818wmc.100.1601573136396; Thu, 01 Oct 2020 10:25:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgsQMLP8oKgBuvYpoK/ukXPuEKW1rtgM9KCvEL+VHK3idIPhPT4YLEHb2KfaY2WirmsjiRqw== X-Received: by 2002:a1c:7d55:: with SMTP id y82mr1098811wmc.100.1601573136206; Thu, 01 Oct 2020 10:25:36 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 03/16] dma: Document address_space_map/address_space_unmap() prototypes Date: Thu, 1 Oct 2020 19:25:06 +0200 Message-Id: <20201001172519.1620782-4-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201001172519.1620782-1-philmd@redhat.com> References: <20201001172519.1620782-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Add documentation based on address_space_map / address_space_unmap. Reviewed-by: Richard Henderson Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/dma.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 80c5bc3e02..c6e12b4c24 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,19 @@ 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 host virtual add= ress. + * + * 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 +151,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