From nobody Mon Feb 9 20:11:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1599234320; cv=none; d=zohomail.com; s=zohoarc; b=JWzG0rK/bhdBaxbEkIm7H/hLPYSXkrx8Um8RP1ncr0lZwjIb88WcRbzgUqS4+K6VO5szBaqHfUHbj/G4beJtMcStRxj33m39k6bpfaIU8JGE6GgkXRHZxgHSRQL2BAogbdFt6PrytKVPQjGS/k7ONJTrhUBExr3vw9JsWyj4aNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599234320; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ZKu32NjwGavdXRIU1N5tUoqjwLuYO41YyQt79mWEprg=; b=XJUg1CmSRhZ1lRQ4Jdyg/fIouyKL7y65VJ7g/TT5kWQZlxFdxjWxz0K62ZcZqCWxHQ2oc4/bgX4rjMDGYNTkZJCtmownh9tpSsdrUWLMA71W6uDaYSMsD62Nr4r5JxM8OXm/glcTJmJI8grXm9FWeN5UVeFQNA4t1ZCZSrAKfoE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1599234320412334.61944473439917; Fri, 4 Sep 2020 08:45:20 -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-206-aWhl1BKbNEGCZbAWLnbo-Q-1; Fri, 04 Sep 2020 11:45:18 -0400 Received: by mail-wm1-f69.google.com with SMTP id c186so2320143wmd.9 for ; Fri, 04 Sep 2020 08:45:17 -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 b76sm12067956wme.45.2020.09.04.08.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 08:45:15 -0700 (PDT) X-MC-Unique: aWhl1BKbNEGCZbAWLnbo-Q-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=ZKu32NjwGavdXRIU1N5tUoqjwLuYO41YyQt79mWEprg=; b=j8HIexLb0y3crrDz1Atfb24qpreeQZovrjG+PynjhZh6GBpbJ/guVSzIr7g8CjaUaD CLXoGubRY+aRGCq0/v6IJp//AzcOQJaDmgUHwda5rLwwNbL/SqVvA8h1ryp8eBIk5s44 M3+C3I5cdZV/qH951OhzEZN4G7wJWsuswJPhyBL+d0JdFJFPyH3aqdgEdJ3uIPJM+lGZ f6pNGDmDT44RbudLWLpCyiuymjyPPFh5N7gWpGS+Fb6TKdfvi6YGiO6a1/uNv0V27ibH 6Bc6I60VZgfjxYgGeTskTrNuGoWwUmESGYaQEjd5dhaVrpl+D3cAhHyB/MZ3yzMvXSOb wQsw== X-Gm-Message-State: AOAM532wmhS7qVeRKKjkzwXlONskSFm0mGAdChZzwq1slx7hhiJy50L9 vEVq5Z23Gs1fY4VnNhRwwJnQRITOrnl6d3EnN2GciNuagxiDja8oQYWEThq4WlewI/J81lnruQS SRcXj6NMs3m1OxA== X-Received: by 2002:a05:600c:2053:: with SMTP id p19mr8173820wmg.50.1599234316737; Fri, 04 Sep 2020 08:45:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1NIGcHfhX+nU2pn1CtiWuzxIG2c0hCBCjyt9EdYJLodE++4yx4FX32BYRNC1HzUMpH9nOaw== X-Received: by 2002:a05:600c:2053:: with SMTP id p19mr8173787wmg.50.1599234316558; Fri, 04 Sep 2020 08:45:16 -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 06/13] dma: Let dma_memory_read() propagate MemTxResult Date: Fri, 4 Sep 2020 17:44:32 +0200 Message-Id: <20200904154439.643272-7-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 dma_memory_rw_relaxed() returns a MemTxResult type. Do not discard it, return it to the caller. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Li Qiang Reviewed-by: Richard Henderson --- include/sysemu/dma.h | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 661d7d0ca88..2961a96ad67 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -89,8 +89,9 @@ static inline MemTxResult dma_memory_rw_relaxed(AddressSp= ace *as, buf, len, dir =3D=3D DMA_DIRECTION_FROM_DEVICE= ); } =20 -static inline int dma_memory_read_relaxed(AddressSpace *as, dma_addr_t add= r, - void *buf, dma_addr_t len) +static inline MemTxResult dma_memory_read_relaxed(AddressSpace *as, + dma_addr_t addr, + void *buf, dma_addr_t le= n) { return dma_memory_rw_relaxed(as, addr, buf, len, DMA_DIRECTION_TO_DEVI= CE); } @@ -124,8 +125,20 @@ static inline MemTxResult dma_memory_rw(AddressSpace *= as, dma_addr_t addr, return dma_memory_rw_relaxed(as, addr, buf, len, dir); } =20 -static inline int dma_memory_read(AddressSpace *as, dma_addr_t addr, - void *buf, dma_addr_t len) +/** + * dma_memory_read: Read from an address space from DMA controller. + * + * Return a MemTxResult indicating whether the operation succeeded + * or failed (eg unassigned memory, device rejected the transaction, + * IOMMU fault). Called within RCU critical section. + * + * @as: #AddressSpace to be accessed + * @addr: address within that address space + * @buf: buffer with the data transferred + * @len: length of the data transferred + */ +static inline MemTxResult dma_memory_read(AddressSpace *as, dma_addr_t add= r, + void *buf, dma_addr_t len) { return dma_memory_rw(as, addr, buf, len, DMA_DIRECTION_TO_DEVICE); } --=20 2.26.2