From nobody Mon Feb 9 15:45:33 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=1640912166; cv=none; d=zohomail.com; s=zohoarc; b=R7kOgNaEyR95cSPC+p3DOtmeDLk7/epGNs9tOT2rpBjaW5f/RWxO2+8WzZZBl5kWNQLyH/5xi2UVXPZcWJ2vRNl98lLbxvLXFYYFUoGxX+P/KWLgsrwMnXYNhwHUh5VxsPQ3RjXZJPIubFBf8qfjRO8BXQTTk9y0174+hSluS4Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640912166; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=KeiKMm3CiVyYkpY8CZBmincKnDi2qBU6go149AXy5rM=; b=La5+3Z5O/5bMjTOrFFXdVAZ4aA5LeAKNk+/+k75VuhtQlUUgqkb0dYwkAYRpgwlkXpvKPoKkDKKyWw1wZEhiGF5S9+mBfevBU8Eqv2Tcm14wGy9PB1cd8yVhUbi1zDsm5HCWzwNIjQFbtRVyFbI5yo9xPP1tlyNDkQb86XFnKhw= 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 1640912166625104.06436784869345; Thu, 30 Dec 2021 16:56:06 -0800 (PST) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-646-ybvbxBdNMgm3gPrvwfDJsA-1; Thu, 30 Dec 2021 19:56:04 -0500 Received: by mail-ed1-f71.google.com with SMTP id w6-20020a05640234c600b003f916e1b615so8834755edc.17 for ; Thu, 30 Dec 2021 16:56:04 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (26.red-83-50-86.dynamicip.rima-tde.net. [83.50.86.26]) by smtp.gmail.com with ESMTPSA id b7sm9978785edj.24.2021.12.30.16.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 16:56:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640912166; 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=KeiKMm3CiVyYkpY8CZBmincKnDi2qBU6go149AXy5rM=; b=Neroi8xz6c7ibgkP0XtH/meXqrK3FDsimcjKud637kTeRVvTZmLuaZKp/Esc9WjsuBuwiD aXT8se7AuQ4BKHe993u9BdH8yYFNnAlQ3NuOz088Ocja2KiGSzTMtHSUmXz4a+7J4EpGgb +7lvXpLa47wxPAOKPGcKbIv9miUsw0Q= X-MC-Unique: ybvbxBdNMgm3gPrvwfDJsA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KeiKMm3CiVyYkpY8CZBmincKnDi2qBU6go149AXy5rM=; b=7xm3hOwWhmWScEcs6OU5BTU0K88Uf4eTmy3/lzkN+RUlk7UNyEs/iqR0rcZv98z7d3 JjUtQi1zkN+ZmLfLwJx1rgVftPPYDsb6iiyss7TrYffkSUiLnynREo4I2/yJXVljknsy qYWAbCaIEa4pEz/VB4M3hKscYpJucXijn5VNq2mNlabkimKNQgwAHR0wpQDbqVwzL9Ha Lekp/aYLLj+CkwktCtKXly6h0cQRXnQHi5z58nmfBtT1tEzTls0RIAL6Wy5dStukQpUa FjyfXPeX2asF80O0xgFL0l/qGSnfKBaYoEzn3W7BjlRXyD4EmzRzmmVPoiY4cpJA4pC6 oOfg== X-Gm-Message-State: AOAM533P3fBti+vyUSD0VqQS0afANmo4U9XbWMZIIQ1t/XKPiUIgKGQv d0kJGB/a6TgLtCfliC5HC5Lun9IT1Kax4SDcTOAxJ8+8aA2sG3zNfdw3BT8kllNugw4osNHCbBS yfdBT1VbWN0Kf+Q== X-Received: by 2002:a17:907:3f1e:: with SMTP id hq30mr26395921ejc.613.1640912163733; Thu, 30 Dec 2021 16:56:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8EpB5y2+AMoaEaWfz4XYbAXOoEvLYwkRjiiX7GIsqoOr1LpK8Iery8RuK1CPuCr8UjUlmnA== X-Received: by 2002:a17:907:3f1e:: with SMTP id hq30mr26395911ejc.613.1640912163521; Thu, 30 Dec 2021 16:56:03 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Li Qiang , "Edgar E . Iglesias" , Stefan Hajnoczi Subject: [PULL 03/22] dma: Let dma_memory_set() take MemTxAttrs argument Date: Fri, 31 Dec 2021 01:55:27 +0100 Message-Id: <20211231005546.723396-4-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211231005546.723396-1-philmd@redhat.com> References: <20211231005546.723396-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: 1640912167771000001 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 Acked-by: Stefan Hajnoczi Message-Id: <20211223115554.3155328-3-philmd@redhat.com> --- 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 c06b30de112..f7803fe3c30 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.33.1