From nobody Fri Dec 19 18:53:09 2025 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=1601573170; cv=none; d=zohomail.com; s=zohoarc; b=ZSdL47+tvwFVl0U/28xLaO6opcTT3cKEabOCUKBjTHiPA7vqoh7h3a1Jf0P72D8QMRRST/akRbZZ2bhAzgZCMxB2LIcgqSLEdNodEdgmDvXJkjiv6Bqa/P3o0ycgucUkEByYVESWrEwRa/zIoayWX4WMc3pFd8/NHAcULSjrPio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573170; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=aHD/JvXVYrPLsc/yxY4/t3jAkkzEX3PgR+IV4TUEuDY=; b=jiLy+Dyv2NDKrdTkdCPsG3Tq56a6oHelhEhquIFr6BNbSBOh4dwBU4q+/71aPeViXXXk4WaJStSfl44NryjIqglBGAJ7+9WWuTm8XToxoH3Fp3rRSfgLIQTJ5yMB1Tu2jQR8RzwZwmYBZkeflsJCCJjCeLMDTg/MWgd6dmbHJUo= 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 1601573170642912.079285514318; Thu, 1 Oct 2020 10:26:10 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-98-2-GacnY2NzKxvz92pdtTuw-1; Thu, 01 Oct 2020 13:26:07 -0400 Received: by mail-wr1-f70.google.com with SMTP id l17so2299078wrw.11 for ; Thu, 01 Oct 2020 10:26:07 -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 u66sm845421wmg.44.2020.10.01.10.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573169; 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=aHD/JvXVYrPLsc/yxY4/t3jAkkzEX3PgR+IV4TUEuDY=; b=fs1YrzVbIPfSp9Z+6FnI+9gnPQGqU0dM/idAcL2gwHO8t/egLAMjv/3JDhg3nwWBx9PMXx mVpQOy8M0Lo2x7q+ffwYhuqOWMJVSjlMH1JR0C+1QmX9OBDl8AQYYB5B4vL8rTvpTYHC90 Kl7ducjpyo8yN499oA6weKZlDtiXD1w= X-MC-Unique: 2-GacnY2NzKxvz92pdtTuw-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=aHD/JvXVYrPLsc/yxY4/t3jAkkzEX3PgR+IV4TUEuDY=; b=ggSNTmGXFhxMTe976Zu6UUqRwfhlFcdbzDQlB8i8K0jyuhsHR5fwrtTSsMYVWDapD+ /AI0X4eVqBECV0CpVgqpImQdlKaM68LRMlpTFKcay9XRmfrKGgDpWX6DcQeVcPO818FG UMLcN9z8ECSQrgCZrqgb3JY8YBBSjS7t53jYICiQoYMWT0QDsuG/zOjamjrtbIPSI/eK VD7dCpbdFddrjiNGsbqRmyefp9QbHdkK5M+TtHgyOg4LIB5GnGviQ7tOHm4V8jSCpRMX omekrlskThYbDu/t1kEPK3uuOYamw9FgmrV9DYkHsw2VQsGRvvdJybisrWLJ6VtCJeUe YfSA== X-Gm-Message-State: AOAM533xvFoBPigi22d87R+PmliwidTbGwF9vw3l2C7Ims4+VftxPk8L wJtsOanVXRrhjqD09ixJDF4nYcqOOrWZ4VCnVoA75pdBED3oXa7aAe0/dh1Y/bLnr7/FUTyCXFk E25FVlsOqn3Dzdw== X-Received: by 2002:a1c:a444:: with SMTP id n65mr1086746wme.122.1601573166025; Thu, 01 Oct 2020 10:26:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyG03ZWCX+2RGVdAvVKNtgNRTORtKILai3qPVLS8aDuZfv5UP6Jpb73AoiO5jK0zbO+Up/kyQ== X-Received: by 2002:a1c:a444:: with SMTP id n65mr1086726wme.122.1601573165799; Thu, 01 Oct 2020 10:26:05 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 09/16] dma: Let dma_memory_set() take MemTxAttrs argument Date: Thu, 1 Oct 2020 19:25:12 +0200 Message-Id: <20201001172519.1620782-10-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) 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 ++- dma-helpers.c | 5 ++--- hw/nvram/fw_cfg.c | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index ed28db6604..a8d6c55953 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 a5cd7a98ff..608393d1b6 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/dma-helpers.c b/dma-helpers.c index 4a9e37d6d0..6a9735386d 100644 --- a/dma-helpers.c +++ b/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; } diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 0e95d057fd..b10e05f527 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -397,7 +397,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; } } --=20 2.26.2