From nobody Tue Feb 10 02:42:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1625217894; cv=none; d=zohomail.com; s=zohoarc; b=bNjPcNPTheeT/WxEc13oJICiyqQt8R6sltLRECsgyUq8u6f4rqFSqMljZeXKdcNLW/oMpK2y/BTESNGS2OyKRJ3Wp6YWkqQ30NQxNmFIIHcahOR2S8WuTZ07Zmva2e8MTjM8zaH0Zcfv3zBC+aWORSzAiAugo+4BedhkIZzRszM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625217894; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=iiJ+z74eASISUbcozFLozDh4qxKrnkY4zanz2+HAJIE=; b=oIiYQOo6zknWd1KIpY/OxYb/vN9u35fH041DDcVgqVylki4bBlu/b2tN6LN+yrELxLLVetWtkDFHGhPQO7fX/HMxQ2eXQOe3f1Gv9okRP4xa4lRWGl9/UGOuZ5MGo3gQQQQhudK7YiS+AnNmF9voZUg0hF8J0NitcjjVYx8bXgo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1625217894132474.6710240427908; Fri, 2 Jul 2021 02:24:54 -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-586-R0N_f1zwN325KVjiEN1hdQ-1; Fri, 02 Jul 2021 05:24:52 -0400 Received: by mail-wm1-f69.google.com with SMTP id f11-20020a05600c154bb02901e0210617aaso2748224wmg.1 for ; Fri, 02 Jul 2021 02:24:51 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.Ascou-CH1 (pop.92-184-108-94.mobile.abo.orange.fr. [92.184.108.94]) by smtp.gmail.com with ESMTPSA id v17sm2540092wrt.74.2021.07.02.02.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 02:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625217893; 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=iiJ+z74eASISUbcozFLozDh4qxKrnkY4zanz2+HAJIE=; b=d2BfuhgcmcRB+qAEuankgvQrcEcZFiK/TDsioVeJzOUiSqxzOvezDbm+0ZfU1QW6QJ9nXl sIV6z8ixME7pblaDKmRNqH08uiy/dwBtYy8O4uP01pbhtJZUVmaHfdsjRyLiljimwLEt8F 577I8jhv8x+8964vfSDgE0mVZeqZUGE= X-MC-Unique: R0N_f1zwN325KVjiEN1hdQ-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=iiJ+z74eASISUbcozFLozDh4qxKrnkY4zanz2+HAJIE=; b=Hjfj49GH8pBuY6QEsnOYTMCFbL5NNuvEYh4IcCSgEkhG2IKqnqCvpICBxUq9QmK1tt oypv9NKGrhi2F6dkOqJG6sULbH/5q2gbsYeRycBwA2ElvjZ3AHD6LSv3G8d0FJt9EfHz 5ekmCajGPGqUhC0kYe0PiCpTfkTBmX2aBQ4f5OHXpnI3KQMcLD9KESmd+YodpbXNgfsY hQ37Z6PzHFsQQ0LeItqdRhevwcmVbvDivSyfp6JirAJwPVx7Wn02iP+JiE9/M2p3YYMJ EeFkdet0jxnQwWE/YVxDAmEfIxhx68U4CzL/S5d07GBQ3RRk1PdI0AVJCFAiXw1VJp2U TTfw== X-Gm-Message-State: AOAM530mTzFoEg2ljeIW6MRS8qd4h9cUVlU7xnBmbuFCVJggHIy21dso 1TTXw/H2ztvT4BdNGtD6piFdM0P2CIOnzOOVdr7/FKAEKwhn9rLAC5CKYvU63brCQB+Z4aV9Hq8 1h6zFbgHxDS2qgA== X-Received: by 2002:adf:90c6:: with SMTP id i64mr836904wri.168.1625217890969; Fri, 02 Jul 2021 02:24:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylDnMg/+NCOXtFrF+UPntIOpgHVD26moxKi66kfIL9dSFy4Pudojq4JuMRd4ues8mu/gt7ug== X-Received: by 2002:adf:90c6:: with SMTP id i64mr836891wri.168.1625217890837; Fri, 02 Jul 2021 02:24:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , Alexander Bulekov , Stefan Hajnoczi , Mauro Matteo Cascella , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Li Qiang , "Edgar E . Iglesias" Subject: [PATCH v3 2/6] dma: Let dma_memory_set() take MemTxAttrs argument Date: Fri, 2 Jul 2021 11:24:35 +0200 Message-Id: <20210702092439.989969-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702092439.989969-1-philmd@redhat.com> References: <20210702092439.989969-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) X-ZM-MESSAGEID: 1625217894827100001 Let devices specify transaction attributes when calling dma_memory_set(). Reviewed-by: Richard Henderson Reviewed-by: Li Qiang Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/ppc/spapr_vio.h | 3 ++- include/sysemu/dma.h | 3 ++- hw/nvram/fw_cfg.c | 3 ++- softmmu/dma-helpers.c | 5 ++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index 4c45f1579fa..c90e74a67dd 100644 --- a/include/hw/ppc/spapr_vio.h +++ b/include/hw/ppc/spapr_vio.h @@ -111,7 +111,8 @@ static inline int spapr_vio_dma_write(SpaprVioDevice *d= ev, uint64_t taddr, static inline int spapr_vio_dma_set(SpaprVioDevice *dev, uint64_t taddr, uint8_t c, uint32_t size) { - return (dma_memory_set(&dev->as, taddr, c, size) !=3D 0) ? + return (dma_memory_set(&dev->as, taddr, + c, size, MEMTXATTRS_UNSPECIFIED) !=3D 0) ? H_DEST_PARM : H_SUCCESS; } =20 diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 296f3b57c9c..d23516f020a 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -175,9 +175,10 @@ static inline MemTxResult dma_memory_write(AddressSpac= e *as, dma_addr_t addr, * @addr: address within that address space * @c: constant byte to fill the memory * @len: the number of bytes to fill with the constant byte + * @attrs: memory transaction attributes */ MemTxResult dma_memory_set(AddressSpace *as, dma_addr_t addr, - uint8_t c, dma_addr_t len); + uint8_t c, dma_addr_t len, MemTxAttrs attrs); =20 /** * address_space_map: Map a physical memory region into a host virtual add= ress. diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 9b8dcca4ead..d3c3b15a728 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -399,7 +399,8 @@ static void fw_cfg_dma_transfer(FWCfgState *s) * tested before. */ if (read) { - if (dma_memory_set(s->dma_as, dma.address, 0, len)) { + if (dma_memory_set(s->dma_as, dma.address, 0, len, + MEMTXATTRS_UNSPECIFIED)) { dma.control |=3D FW_CFG_DMA_CTL_ERROR; } } diff --git a/softmmu/dma-helpers.c b/softmmu/dma-helpers.c index 7d766a5e89a..1f07217ad4a 100644 --- a/softmmu/dma-helpers.c +++ b/softmmu/dma-helpers.c @@ -19,7 +19,7 @@ /* #define DEBUG_IOMMU */ =20 MemTxResult dma_memory_set(AddressSpace *as, dma_addr_t addr, - uint8_t c, dma_addr_t len) + uint8_t c, dma_addr_t len, MemTxAttrs attrs) { dma_barrier(as, DMA_DIRECTION_FROM_DEVICE); =20 @@ -31,8 +31,7 @@ MemTxResult dma_memory_set(AddressSpace *as, dma_addr_t a= ddr, memset(fillbuf, c, FILLBUF_SIZE); while (len > 0) { l =3D len < FILLBUF_SIZE ? len : FILLBUF_SIZE; - error |=3D address_space_write(as, addr, MEMTXATTRS_UNSPECIFIED, - fillbuf, l); + error |=3D address_space_write(as, addr, attrs, fillbuf, l); len -=3D l; addr +=3D l; } --=20 2.31.1