From nobody Sun Feb 8 23:56:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639839082; cv=none; d=zohomail.com; s=zohoarc; b=MlMRESSshhyzNEO8J9xagse5+nDplFR1Rhjlet11uD6BtlRH1JsiNdszyldEpYOwd8wyyz5v+IU2a4sqYIeq2HgO2nnj8LMtZ7bSKZ/4Md8+vo3CWp5HlA8J8M1IOeIZEMkZgyYgQWBaDXi618HFhH+adFJwn8yV/Xh7An0zxZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639839082; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=cj78Ig3zcSuXURlmDuOC50tEy22RP0C60QMqu5xK6c8=; b=U4ty4Z75LY+MKqXHzL/ylsHLvyef4zuFCi57iDOC/gLg5xtyv4cy2IaCeIByYgk7uztsQBMhswsYil1GbWIx5yuxBP9ql1JhEpLrlX4bDkRPs9rNdpRp+X1vJ/gz6xPtIabr6xpw+5N5ePUnSIz90PaQIxVI5D26g7oEs12xmbQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1639839082841663.0259586135747; Sat, 18 Dec 2021 06:51:22 -0800 (PST) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-511--nr0eGFTP4SCMkSXZYAOcA-1; Sat, 18 Dec 2021 09:51:20 -0500 Received: by mail-wr1-f70.google.com with SMTP id o4-20020adfca04000000b0018f07ad171aso1484477wrh.20 for ; Sat, 18 Dec 2021 06:51:19 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (174.red-83-50-185.dynamicip.rima-tde.net. [83.50.185.174]) by smtp.gmail.com with ESMTPSA id s189sm11843684wme.0.2021.12.18.06.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Dec 2021 06:51:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639839081; 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=cj78Ig3zcSuXURlmDuOC50tEy22RP0C60QMqu5xK6c8=; b=VIAaLPnm7VMjLSB5B2U/ZS14Aus1Fdhrw54SHlIBAd1txKDzXAX9pp775OQXT7cnaEgRoL VBWk9u8cnYw2UP6tWxb70UzlLOrNo1rt4DGLW6gH3aLDQ0K2QYlcB8s7cgfFgTz3w5fdaz g6lvcvzHKI3FAsQj+XnM+emhX6sbKyg= X-MC-Unique: -nr0eGFTP4SCMkSXZYAOcA-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=cj78Ig3zcSuXURlmDuOC50tEy22RP0C60QMqu5xK6c8=; b=BpOykkhvGg++/Q/D6FrJ2mqZHgmzz/E8005yfAi6v+eLtu0moY+3fKpeZKAMBCTtFn IGAFnMiQrtbYUZ7HlwBspjn1GN9XhQcJ90hVDB/v/t/nIP0eag71VleRD/TWRnd/Mh1N Ffctcqtao6TvLXh1xM5xYjdRo4niqbt2xaLVcD7sAE/4YGVwsSTOZjii1loXRzrXVt7N JoyGW+OX8YblmC8KewgzYYN3DjXEFqsoT0RQ9WsI3FiGRx/WcEjvSzXOHydVbH/arOOD 7futiixWM8Vppb7RCzkKiiprZdyZqz3g5lipuy/d990nfk6fvDNXxDBi9QsCCfNc8Xye rYNA== X-Gm-Message-State: AOAM531KsSBwtYVUS7dxl14N0Ci04XV9seFG/4e6AAo/VkE2T2G5RYHA DXIYbRlqVFbdou9du6UZl+dEcaxBQc1AhIAcs6gd+n0x9kQDAWCUDHXF0Nn3mKUoUwz3w5WmZcj QXSQpdZmdp3w0Fg== X-Received: by 2002:a5d:6211:: with SMTP id y17mr6440725wru.97.1639839078863; Sat, 18 Dec 2021 06:51:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyuzqQ3MZZhZfqDwy2doqVexd/8MwBZq24K2nHz43rjeHmozHa2G953/fGs7lvvN8oA2T/LLA== X-Received: by 2002:a5d:6211:: with SMTP id y17mr6440706wru.97.1639839078714; Sat, 18 Dec 2021 06:51:18 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , qemu-ppc@nongnu.org, Peter Xu , Alexander Bulekov , Qiuhao Li , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Li Qiang , Greg Kurz , Paolo Bonzini , Gerd Hoffmann , David Gibson , Daniel Henrique Barboza , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 1/4] dma: Let st*_dma() take MemTxAttrs argument Date: Sat, 18 Dec 2021 15:51:08 +0100 Message-Id: <20211218145111.1540114-2-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211218145111.1540114-1-philmd@redhat.com> References: <20211218145111.1540114-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: 1639839084107100001 Let devices specify transaction attributes when calling st*_dma(). Keep the default MEMTXATTRS_UNSPECIFIED in the few callers. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Richard Henderson --- include/hw/pci/pci.h | 3 ++- include/hw/ppc/spapr_vio.h | 12 ++++++++---- include/sysemu/dma.h | 10 ++++++---- hw/nvram/fw_cfg.c | 4 ++-- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index a751ab5a75d..d07e9707b48 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -859,7 +859,8 @@ static inline MemTxResult pci_dma_write(PCIDevice *dev,= dma_addr_t addr, static inline void st##_s##_pci_dma(PCIDevice *dev, \ dma_addr_t addr, uint##_bits##_t v= al) \ { \ - st##_s##_dma(pci_get_address_space(dev), addr, val); \ + st##_s##_dma(pci_get_address_space(dev), addr, val, \ + MEMTXATTRS_UNSPECIFIED); \ } =20 PCI_DMA_DEFINE_LDST(ub, b, 8); diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index 5d2ea8e6656..e87f8e6f596 100644 --- a/include/hw/ppc/spapr_vio.h +++ b/include/hw/ppc/spapr_vio.h @@ -118,10 +118,14 @@ static inline int spapr_vio_dma_set(SpaprVioDevice *d= ev, uint64_t taddr, H_DEST_PARM : H_SUCCESS; } =20 -#define vio_stb(_dev, _addr, _val) (stb_dma(&(_dev)->as, (_addr), (_val))) -#define vio_sth(_dev, _addr, _val) (stw_be_dma(&(_dev)->as, (_addr), (_val= ))) -#define vio_stl(_dev, _addr, _val) (stl_be_dma(&(_dev)->as, (_addr), (_val= ))) -#define vio_stq(_dev, _addr, _val) (stq_be_dma(&(_dev)->as, (_addr), (_val= ))) +#define vio_stb(_dev, _addr, _val) \ + (stb_dma(&(_dev)->as, (_addr), (_val), MEMTXATTRS_UNSPECIFIED)) +#define vio_sth(_dev, _addr, _val) \ + (stw_be_dma(&(_dev)->as, (_addr), (_val), MEMTXATTRS_UNSPECIFIED)) +#define vio_stl(_dev, _addr, _val) \ + (stl_be_dma(&(_dev)->as, (_addr), (_val), MEMTXATTRS_UNSPECIFIED)) +#define vio_stq(_dev, _addr, _val) \ + (stq_be_dma(&(_dev)->as, (_addr), (_val), MEMTXATTRS_UNSPECIFIED)) #define vio_ldq(_dev, _addr) (ldq_be_dma(&(_dev)->as, (_addr))) =20 int spapr_vio_send_crq(SpaprVioDevice *dev, uint8_t *crq); diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 9f998edbea4..2a60d2c5d61 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -250,10 +250,11 @@ static inline void dma_memory_unmap(AddressSpace *as, } \ static inline void st##_sname##_##_end##_dma(AddressSpace *as, \ dma_addr_t addr, \ - uint##_bits##_t val) \ + uint##_bits##_t val, \ + MemTxAttrs attrs) \ { \ val =3D cpu_to_##_end##_bits(val); \ - dma_memory_write(as, addr, &val, (_bits) / 8, MEMTXATTRS_UNSPECIFI= ED); \ + dma_memory_write(as, addr, &val, (_bits) / 8, attrs); \ } =20 static inline uint8_t ldub_dma(AddressSpace *as, dma_addr_t addr) @@ -264,9 +265,10 @@ static inline uint8_t ldub_dma(AddressSpace *as, dma_a= ddr_t addr) return val; } =20 -static inline void stb_dma(AddressSpace *as, dma_addr_t addr, uint8_t val) +static inline void stb_dma(AddressSpace *as, dma_addr_t addr, + uint8_t val, MemTxAttrs attrs) { - dma_memory_write(as, addr, &val, 1, MEMTXATTRS_UNSPECIFIED); + dma_memory_write(as, addr, &val, 1, attrs); } =20 DEFINE_LDST_DMA(uw, w, 16, le); diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 9b91b15cb08..e5f3c981841 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -360,7 +360,7 @@ static void fw_cfg_dma_transfer(FWCfgState *s) if (dma_memory_read(s->dma_as, dma_addr, &dma, sizeof(dma), MEMTXATTRS_UNSPECIFIED)) { stl_be_dma(s->dma_as, dma_addr + offsetof(FWCfgDmaAccess, control), - FW_CFG_DMA_CTL_ERROR); + FW_CFG_DMA_CTL_ERROR, MEMTXATTRS_UNSPECIFIED); return; } =20 @@ -446,7 +446,7 @@ static void fw_cfg_dma_transfer(FWCfgState *s) } =20 stl_be_dma(s->dma_as, dma_addr + offsetof(FWCfgDmaAccess, control), - dma.control); + dma.control, MEMTXATTRS_UNSPECIFIED); =20 trace_fw_cfg_read(s, 0); } --=20 2.33.1 From nobody Sun Feb 8 23:56:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639839086; cv=none; d=zohomail.com; s=zohoarc; b=i4wB5furquDVx66d4iPVwEOYYdFO9veHeT0LtCiDiKJ4ns3YXIU60foq3xkUHjB/0UoPrFVDl4VqoVpZkyA1qG4oOX9JdvsqaR6fJrhVi/iwZ5KctY7S/EWKHfQc0tOO+GAZL5NonD5Sywg211DqScUhIbx7aBX5XqZNYuf++lI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639839086; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=bxXh1e9uR1KdSHTOMds7EyxV50BzcbCDpkVbWnbmGRU=; b=AYjljcu1BgTUxaw9kw/gbaeWEoR6Q+W0rs6f9W+Olc6qEoTs2yfUJDQqRGmoytH9F+aGEQdiZXFbyx7PnASGWqJg4BrmMt0s9HpJfj4bg4KFKS0VvyspzXkkldeZ/R2gdbIb4QZA5LueMjt8+mz6bxQyEnumhSOxcvp0IBRrwxY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1639839086750821.7894373165777; Sat, 18 Dec 2021 06:51:26 -0800 (PST) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-161-zQXCaiVuMcC9XvD1Upybrg-1; Sat, 18 Dec 2021 09:51:24 -0500 Received: by mail-wr1-f71.google.com with SMTP id p15-20020adfaa0f000000b001a240b45c1fso1481124wrd.4 for ; Sat, 18 Dec 2021 06:51:24 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (174.red-83-50-185.dynamicip.rima-tde.net. [83.50.185.174]) by smtp.gmail.com with ESMTPSA id t8sm13573464wmq.32.2021.12.18.06.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Dec 2021 06:51:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639839085; 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=bxXh1e9uR1KdSHTOMds7EyxV50BzcbCDpkVbWnbmGRU=; b=dIN3O3rEqVq/ZBo3l+GCLKYysZBbnRrStm4Sg3F++zgQ9m1ZGqOAB3Mklcs4hB4sJzW38F cJvVm3pFthgtJR/hmd9J9pdTVm2BFF1YB56W0ezmVMGXNHfx/j1YsqsQG7bxc/jx26apuN eCsESX+tUalyTTR1+XGDu+1/0zoRHqk= X-MC-Unique: zQXCaiVuMcC9XvD1Upybrg-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=bxXh1e9uR1KdSHTOMds7EyxV50BzcbCDpkVbWnbmGRU=; b=r8gyeNKRPi3ELUAKXGyZUfTxoRorxBq7enl0vzoIzeS7XYy8djpJl+14XSLzpxxexj 9oR6a06EnEQh6yhaVL5ZazzXTj6S/9XjyArL4eyxjshzuKiluvLvZE3G6hLOpd55Gg/6 0XcVjFeZpUCmbR5iWvns8LcGTSk+N+xcBG6CKOT3mAtNF9yLxXpKjn/WDK+Ik673YhEf BfoX3Fi2P2bz+rqLKcUdSsMPfsr5wn0VvzQ90bsKfCWvt1PkayC2NhGSy8qNi6xZf1V+ 6KoVivbYQnA7JuDPMufz4ufPVzV25LwpurnYI0V4X4W2FR6ZLu3zw+WYeAT6lU1tC0zN 8AWw== X-Gm-Message-State: AOAM533tT8dEGmlQt7ZwkbQoKyt+gSuDmOrQY8EXS43HLib9MmvW796n 9D2VAaVsOKZmLIs5cTujMuTY+yWMG5a+KhFDyJfDBz/Ab9aJmajRHSzBnhtWf+wdz5EpnsdIomu X1TmBRnPQ+feGSQ== X-Received: by 2002:a05:600c:4e91:: with SMTP id f17mr7024730wmq.195.1639839083482; Sat, 18 Dec 2021 06:51:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzL6TyP6/rkdxsCrYt4gNZ19Dy2WBm2NXceq2ru8HCXlZbolaZPYlQJ0NQwCf6LLBY7hPuYDA== X-Received: by 2002:a05:600c:4e91:: with SMTP id f17mr7024714wmq.195.1639839083327; Sat, 18 Dec 2021 06:51:23 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , qemu-ppc@nongnu.org, Peter Xu , Alexander Bulekov , Qiuhao Li , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Li Qiang , Greg Kurz , Paolo Bonzini , Gerd Hoffmann , David Gibson , Daniel Henrique Barboza , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/4] dma: Let ld*_dma() take MemTxAttrs argument Date: Sat, 18 Dec 2021 15:51:09 +0100 Message-Id: <20211218145111.1540114-3-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211218145111.1540114-1-philmd@redhat.com> References: <20211218145111.1540114-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: 1639839089004100001 Let devices specify transaction attributes when calling ld*_dma(). Keep the default MEMTXATTRS_UNSPECIFIED in the few callers. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Richard Henderson --- include/hw/pci/pci.h | 3 ++- include/hw/ppc/spapr_vio.h | 3 ++- include/sysemu/dma.h | 11 ++++++----- hw/intc/pnv_xive.c | 7 ++++--- hw/usb/hcd-xhci.c | 6 +++--- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index d07e9707b48..0613308b1b6 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -854,7 +854,8 @@ static inline MemTxResult pci_dma_write(PCIDevice *dev,= dma_addr_t addr, static inline uint##_bits##_t ld##_l##_pci_dma(PCIDevice *dev, \ dma_addr_t addr) \ { \ - return ld##_l##_dma(pci_get_address_space(dev), addr); \ + return ld##_l##_dma(pci_get_address_space(dev), addr, \ + MEMTXATTRS_UNSPECIFIED); \ } \ static inline void st##_s##_pci_dma(PCIDevice *dev, \ dma_addr_t addr, uint##_bits##_t v= al) \ diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index e87f8e6f596..d2ec9b0637f 100644 --- a/include/hw/ppc/spapr_vio.h +++ b/include/hw/ppc/spapr_vio.h @@ -126,7 +126,8 @@ static inline int spapr_vio_dma_set(SpaprVioDevice *dev= , uint64_t taddr, (stl_be_dma(&(_dev)->as, (_addr), (_val), MEMTXATTRS_UNSPECIFIED)) #define vio_stq(_dev, _addr, _val) \ (stq_be_dma(&(_dev)->as, (_addr), (_val), MEMTXATTRS_UNSPECIFIED)) -#define vio_ldq(_dev, _addr) (ldq_be_dma(&(_dev)->as, (_addr))) +#define vio_ldq(_dev, _addr) \ + (ldq_be_dma(&(_dev)->as, (_addr), MEMTXATTRS_UNSPECIFIED)) =20 int spapr_vio_send_crq(SpaprVioDevice *dev, uint8_t *crq); =20 diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 2a60d2c5d61..b711d390a4f 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -242,10 +242,11 @@ static inline void dma_memory_unmap(AddressSpace *as, =20 #define DEFINE_LDST_DMA(_lname, _sname, _bits, _end) \ static inline uint##_bits##_t ld##_lname##_##_end##_dma(AddressSpace *= as, \ - dma_addr_t add= r) \ + dma_addr_t add= r, \ + MemTxAttrs att= rs) \ { \ uint##_bits##_t val; \ - dma_memory_read(as, addr, &val, (_bits) / 8, MEMTXATTRS_UNSPECIFIE= D); \ + dma_memory_read(as, addr, &val, (_bits) / 8, attrs); \ return _end##_bits##_to_cpu(val); \ } \ static inline void st##_sname##_##_end##_dma(AddressSpace *as, \ @@ -254,14 +255,14 @@ static inline void dma_memory_unmap(AddressSpace *as, MemTxAttrs attrs) \ { \ val =3D cpu_to_##_end##_bits(val); \ - dma_memory_write(as, addr, &val, (_bits) / 8, attrs); \ + dma_memory_write(as, addr, &val, (_bits) / 8, attrs); \ } =20 -static inline uint8_t ldub_dma(AddressSpace *as, dma_addr_t addr) +static inline uint8_t ldub_dma(AddressSpace *as, dma_addr_t addr, MemTxAtt= rs attrs) { uint8_t val; =20 - dma_memory_read(as, addr, &val, 1, MEMTXATTRS_UNSPECIFIED); + dma_memory_read(as, addr, &val, 1, attrs); return val; } =20 diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c index ad43483612e..d9249bbc0c1 100644 --- a/hw/intc/pnv_xive.c +++ b/hw/intc/pnv_xive.c @@ -172,7 +172,7 @@ static uint64_t pnv_xive_vst_addr_indirect(PnvXive *xiv= e, uint32_t type, =20 /* Get the page size of the indirect table. */ vsd_addr =3D vsd & VSD_ADDRESS_MASK; - vsd =3D ldq_be_dma(&address_space_memory, vsd_addr); + vsd =3D ldq_be_dma(&address_space_memory, vsd_addr, MEMTXATTRS_UNSPECI= FIED); =20 if (!(vsd & VSD_ADDRESS_MASK)) { #ifdef XIVE_DEBUG @@ -195,7 +195,8 @@ static uint64_t pnv_xive_vst_addr_indirect(PnvXive *xiv= e, uint32_t type, /* Load the VSD we are looking for, if not already done */ if (vsd_idx) { vsd_addr =3D vsd_addr + vsd_idx * XIVE_VSD_SIZE; - vsd =3D ldq_be_dma(&address_space_memory, vsd_addr); + vsd =3D ldq_be_dma(&address_space_memory, vsd_addr, + MEMTXATTRS_UNSPECIFIED); =20 if (!(vsd & VSD_ADDRESS_MASK)) { #ifdef XIVE_DEBUG @@ -542,7 +543,7 @@ static uint64_t pnv_xive_vst_per_subpage(PnvXive *xive,= uint32_t type) =20 /* Get the page size of the indirect table. */ vsd_addr =3D vsd & VSD_ADDRESS_MASK; - vsd =3D ldq_be_dma(&address_space_memory, vsd_addr); + vsd =3D ldq_be_dma(&address_space_memory, vsd_addr, MEMTXATTRS_UNSPECI= FIED); =20 if (!(vsd & VSD_ADDRESS_MASK)) { #ifdef XIVE_DEBUG diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index ed2b9ea456e..d960b814587 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -2062,7 +2062,7 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, un= signed int slotid, assert(slotid >=3D 1 && slotid <=3D xhci->numslots); =20 dcbaap =3D xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high); - poctx =3D ldq_le_dma(xhci->as, dcbaap + 8 * slotid); + poctx =3D ldq_le_dma(xhci->as, dcbaap + 8 * slotid, MEMTXATTRS_UNSPECI= FIED); ictx =3D xhci_mask64(pictx); octx =3D xhci_mask64(poctx); =20 @@ -3437,8 +3437,8 @@ static int usb_xhci_post_load(void *opaque, int versi= on_id) if (!slot->addressed) { continue; } - slot->ctx =3D - xhci_mask64(ldq_le_dma(xhci->as, dcbaap + 8 * slotid)); + slot->ctx =3D xhci_mask64(ldq_le_dma(xhci->as, dcbaap + 8 * slotid, + MEMTXATTRS_UNSPECIFIED)); xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx)); slot->uport =3D xhci_lookup_uport(xhci, slot_ctx); if (!slot->uport) { --=20 2.33.1 From nobody Sun Feb 8 23:56:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639839093; cv=none; d=zohomail.com; s=zohoarc; b=l/8kIYKygVsZhk2z31j0VbB1rJZL7tSxMWwHFDO6WsFZp29oMLKS+q+yZQLFrD89xY+Ecu8Ecb7e/8Xee6QSh5QpnHJsZWh3lZFWGo6UVimo+LTRexdokn3BT/g2PmDbr5G1J4pdxUAfwdKp6i0M+4yC2bT86+k1aW7OwcPUTWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639839093; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Z0wxGg120YyeF7AD5AshLrhx/8IEHK5hXeX4znVMwbA=; b=FL/fV6ADeCer4BDvHjk2B7yzOEFV4wWwrtHqDoTT3c2Ux75IyKduT9v5qWdOWAz4ddimxLl0hr4P6eJ6qFXe2OrrNOcv9HoHDo4vm+Zgq3lmmx3TT3VHVpmLWyGLMCV/gmmAxdCBg13klYZ9JjeKrRxH5LlvXh0j2CbjKmwQvfg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1639839093543583.0491157633159; Sat, 18 Dec 2021 06:51:33 -0800 (PST) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-277-A86pDIsKPOKUnN9VvPWnsg-1; Sat, 18 Dec 2021 09:51:29 -0500 Received: by mail-wr1-f70.google.com with SMTP id l13-20020adfbd8d000000b001a23a990dbfso1495106wrh.5 for ; Sat, 18 Dec 2021 06:51:29 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (174.red-83-50-185.dynamicip.rima-tde.net. [83.50.185.174]) by smtp.gmail.com with ESMTPSA id o64sm10566299wme.28.2021.12.18.06.51.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Dec 2021 06:51:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639839092; 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=Z0wxGg120YyeF7AD5AshLrhx/8IEHK5hXeX4znVMwbA=; b=FwM9MmGZrsbf/A0zSa+oD58I8Yk6zNKOTiz5/dWG8vPm94/eyj8oN8St68CShrXDM626xX kGIQ3vDYh5bEEfWl20Ay12AFx0tCilSN4JxVlLs1U7hftTw1bpOAVFBPIo8Qp9fbPbsiq5 Xx+2zbXhHrVKGB0lhnZInHlubFLxSmY= X-MC-Unique: A86pDIsKPOKUnN9VvPWnsg-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=Z0wxGg120YyeF7AD5AshLrhx/8IEHK5hXeX4znVMwbA=; b=ewUoMtqZzwsxq7N+A2mEMiJp5OgNsFz9Ecy2wyCr2fRnu3jgRMjqti7O8gsN/zHysc 6IySsKvl+DOBHY3ESx2GK2e/b79etwpf+i97T/x6mF4vlUAz9iKXMfTUcuvbMctKAK60 BpNCztOSJms4+UJtXcSo6RqMDYF037Tm+VJP5lNieABtTfZYDRtlfklLdFvsnyzXG1oa 1C5RGmZDyopF86/7vjSvPkKBoZmaDQXXg+32uMMnWr2n+VYpXzuSZ8+aBi2xw3mTnubD iwyxqW1cA0CusW8ylZOIbXcmlIxLNFwhDQl42LDquO9cjKaJg9TRXC318Ork8dqbhJ3D Jx6A== X-Gm-Message-State: AOAM530g5fztIjH3XQEY/itG2sfIgIevv4bub1h4CqGSY+JOgh7CIV5B nAh+euSOt84eIUf1xzWY7uUv7Dpxl21romqyoU4Bkma4YRg5udzqy2zeQPqyJnWClcBS23SdGxt ZghO099tlTbusDA== X-Received: by 2002:a5d:460d:: with SMTP id t13mr6667411wrq.44.1639839088222; Sat, 18 Dec 2021 06:51:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTUALNby17VArSwVhgi2Rd5e5bePTtubSqB/nhxUQypN3GuJLWE13uk2WnAO47OERY/aFYUg== X-Received: by 2002:a5d:460d:: with SMTP id t13mr6667399wrq.44.1639839088080; Sat, 18 Dec 2021 06:51:28 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , qemu-ppc@nongnu.org, Peter Xu , Alexander Bulekov , Qiuhao Li , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Li Qiang , Greg Kurz , Paolo Bonzini , Gerd Hoffmann , David Gibson , Daniel Henrique Barboza , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 3/4] dma: Let st*_dma() propagate MemTxResult Date: Sat, 18 Dec 2021 15:51:10 +0100 Message-Id: <20211218145111.1540114-4-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211218145111.1540114-1-philmd@redhat.com> References: <20211218145111.1540114-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: 1639839094910100001 dma_memory_write() returns a MemTxResult type. Do not discard it, return it to the caller. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Richard Henderson --- include/sysemu/dma.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index b711d390a4f..191cf0b271a 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -249,13 +249,13 @@ static inline void dma_memory_unmap(AddressSpace *as, dma_memory_read(as, addr, &val, (_bits) / 8, attrs); \ return _end##_bits##_to_cpu(val); \ } \ - static inline void st##_sname##_##_end##_dma(AddressSpace *as, \ - dma_addr_t addr, \ - uint##_bits##_t val, \ - MemTxAttrs attrs) \ - { \ - val =3D cpu_to_##_end##_bits(val); \ - dma_memory_write(as, addr, &val, (_bits) / 8, attrs); \ + static inline MemTxResult st##_sname##_##_end##_dma(AddressSpace *as, \ + dma_addr_t addr, \ + uint##_bits##_t va= l, \ + MemTxAttrs attrs) \ + { \ + val =3D cpu_to_##_end##_bits(val); \ + return dma_memory_write(as, addr, &val, (_bits) / 8, attrs); \ } =20 static inline uint8_t ldub_dma(AddressSpace *as, dma_addr_t addr, MemTxAtt= rs attrs) @@ -266,10 +266,10 @@ static inline uint8_t ldub_dma(AddressSpace *as, dma_= addr_t addr, MemTxAttrs att return val; } =20 -static inline void stb_dma(AddressSpace *as, dma_addr_t addr, - uint8_t val, MemTxAttrs attrs) +static inline MemTxResult stb_dma(AddressSpace *as, dma_addr_t addr, + uint8_t val, MemTxAttrs attrs) { - dma_memory_write(as, addr, &val, 1, attrs); + return dma_memory_write(as, addr, &val, 1, attrs); } =20 DEFINE_LDST_DMA(uw, w, 16, le); --=20 2.33.1 From nobody Sun Feb 8 23:56:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639839096; cv=none; d=zohomail.com; s=zohoarc; b=SB7AUjyQbGn5F1p/6MRYZo799NROTJYnshKknmU0XO1Kox21agfbMTTZYI+Z0TA9ya1d+aNu/aTQavHHZfnkEmJ1zA1wQdRB5bR8cYoAzOQsnkHksQz2qQZ25VkVPvBw4PGS7xHGF1nMaoi6J/G3gl6115F4yX4vso0YyVpIAY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639839096; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=lwuMNYmPqW0fbpZsvUbQKEX1kWascSWCJJ2e+GlDMBU=; b=frb+wnBh1qm0qeHukzJy6Q5LtsMDaB3MZ6s9rDRNrlrcWgsxToDooPJ5wCUUcFtcZMTauY/W+RNFo1hYtKzRAfGMcJhvaf14LD8F9nlIKEwHwM8zdpU3DW80mfIYfYWMU4CiALhoKJW5p+ZrftAjPJYrcatkB/lsFRc6rAF7LYI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1639839096133145.03660481511008; Sat, 18 Dec 2021 06:51:36 -0800 (PST) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-475-oQ45ZPhoOLSXkPsuR3V4qg-1; Sat, 18 Dec 2021 09:51:34 -0500 Received: by mail-wr1-f69.google.com with SMTP id s30-20020adfa29e000000b001a25caee635so1073644wra.19 for ; Sat, 18 Dec 2021 06:51:33 -0800 (PST) Return-Path: Return-Path: Received: from x1w.. (174.red-83-50-185.dynamicip.rima-tde.net. [83.50.185.174]) by smtp.gmail.com with ESMTPSA id b19sm15251052wmb.38.2021.12.18.06.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Dec 2021 06:51:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639839095; 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=lwuMNYmPqW0fbpZsvUbQKEX1kWascSWCJJ2e+GlDMBU=; b=M+lBSB+hQGD0/7IZ3Kfqs5+erlb8HgaBKK28vCnvfv4B37/4Ob1FlCrR0gdDkRwRaugZP3 7IkjS0fHp0cgPhVHzh0bT/TKGHEOXJNBI7TMhU4mwXDUsiznfY0OTe4bYkKebOjMzW3k7Z gRCwf/hWDWHoTrjruL1bnBnxh5F4rQE= X-MC-Unique: oQ45ZPhoOLSXkPsuR3V4qg-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=lwuMNYmPqW0fbpZsvUbQKEX1kWascSWCJJ2e+GlDMBU=; b=t2fUtuABU2SbQb0N2Xd+UswSnkP4Wj/o8z/vvOs91mFOIYP/RN8UtlsaypJuD9/8oJ KkUzt8cBU0+0VBR16Ez1tauRJl+o6sbD/b4igR7DAexpQwiO5n5FkqY3L9DJphnqoWm4 d96wMksuCtH45qeZE7PJDKLDDq3TiQe8ezuQ43bWFYIAnZ/x8f+BV43w4B3cB2Xt34qW IbMkl0LGf8/eojWyj7VOL8U863+1+FltXd/TQays7FCEoAZrY3TMvWiZ9g5bZiErw/J8 DbNSMuqB7qiEY6vSOyjlNyguwlxBJB4jEbqNam/H4E6sCW1CtUpS6Gk9qTC8pboRsjkK WiTQ== X-Gm-Message-State: AOAM531TWeSWER9lDeuh7JV5dvgLvUkr3kAEFqNyixFBAPao+yxi/J6w vxkxatAA1aiQUy6ITUGKPPExGGxXfnAZKvpINrfjKk0VL6rQEwAUc2xkS1Lzw4S+kdJOVRfpbbO csTvmDHQTGrdQXA== X-Received: by 2002:a05:600c:3c8a:: with SMTP id bg10mr14056886wmb.106.1639839092910; Sat, 18 Dec 2021 06:51:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFLcNRcGt4ZE5z08uJasHzzpZSDG2Um+vg3uCowbYMYZi9QDqqGYomFZ8suyc0N1Lg5pi3/Q== X-Received: by 2002:a05:600c:3c8a:: with SMTP id bg10mr14056868wmb.106.1639839092614; Sat, 18 Dec 2021 06:51:32 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , David Hildenbrand , "Michael S. Tsirkin" , qemu-ppc@nongnu.org, Peter Xu , Alexander Bulekov , Qiuhao Li , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Li Qiang , Greg Kurz , Paolo Bonzini , Gerd Hoffmann , David Gibson , Daniel Henrique Barboza , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 4/4] dma: Let ld*_dma() propagate MemTxResult Date: Sat, 18 Dec 2021 15:51:11 +0100 Message-Id: <20211218145111.1540114-5-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211218145111.1540114-1-philmd@redhat.com> References: <20211218145111.1540114-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: 1639839097017100001 dma_memory_read() returns a MemTxResult type. Do not discard it, return it to the caller. Update the few callers. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Richard Henderson --- include/hw/pci/pci.h | 6 ++++-- include/hw/ppc/spapr_vio.h | 6 +++++- include/sysemu/dma.h | 25 ++++++++++++------------- hw/intc/pnv_xive.c | 8 ++++---- hw/usb/hcd-xhci.c | 7 ++++--- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 0613308b1b6..8c5f2ed5054 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -854,8 +854,10 @@ static inline MemTxResult pci_dma_write(PCIDevice *dev= , dma_addr_t addr, static inline uint##_bits##_t ld##_l##_pci_dma(PCIDevice *dev, \ dma_addr_t addr) \ { \ - return ld##_l##_dma(pci_get_address_space(dev), addr, \ - MEMTXATTRS_UNSPECIFIED); \ + uint##_bits##_t val; \ + ld##_l##_dma(pci_get_address_space(dev), addr, &val, \ + MEMTXATTRS_UNSPECIFIED); \ + return val; \ } \ static inline void st##_s##_pci_dma(PCIDevice *dev, \ dma_addr_t addr, uint##_bits##_t v= al) \ diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index d2ec9b0637f..7eae1a48478 100644 --- a/include/hw/ppc/spapr_vio.h +++ b/include/hw/ppc/spapr_vio.h @@ -127,7 +127,11 @@ static inline int spapr_vio_dma_set(SpaprVioDevice *de= v, uint64_t taddr, #define vio_stq(_dev, _addr, _val) \ (stq_be_dma(&(_dev)->as, (_addr), (_val), MEMTXATTRS_UNSPECIFIED)) #define vio_ldq(_dev, _addr) \ - (ldq_be_dma(&(_dev)->as, (_addr), MEMTXATTRS_UNSPECIFIED)) + ({ \ + uint64_t _val; \ + ldq_be_dma(&(_dev)->as, (_addr), &_val, MEMTXATTRS_UNSPECIFIED= ); \ + _val; \ + }) =20 int spapr_vio_send_crq(SpaprVioDevice *dev, uint8_t *crq); =20 diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 191cf0b271a..589f5ba52a2 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -241,14 +241,15 @@ static inline void dma_memory_unmap(AddressSpace *as, } =20 #define DEFINE_LDST_DMA(_lname, _sname, _bits, _end) \ - static inline uint##_bits##_t ld##_lname##_##_end##_dma(AddressSpace *= as, \ - dma_addr_t add= r, \ - MemTxAttrs att= rs) \ - { \ - uint##_bits##_t val; \ - dma_memory_read(as, addr, &val, (_bits) / 8, attrs); \ - return _end##_bits##_to_cpu(val); \ - } \ + static inline MemTxResult ld##_lname##_##_end##_dma(AddressSpace *as, \ + dma_addr_t addr, \ + uint##_bits##_t *p= val, \ + MemTxAttrs attrs) \ + { \ + MemTxResult res =3D dma_memory_read(as, addr, pval, (_bits) / 8, a= ttrs); \ + _end##_bits##_to_cpus(pval); \ + return res; \ + } \ static inline MemTxResult st##_sname##_##_end##_dma(AddressSpace *as, \ dma_addr_t addr, \ uint##_bits##_t va= l, \ @@ -258,12 +259,10 @@ static inline void dma_memory_unmap(AddressSpace *as, return dma_memory_write(as, addr, &val, (_bits) / 8, attrs); \ } =20 -static inline uint8_t ldub_dma(AddressSpace *as, dma_addr_t addr, MemTxAtt= rs attrs) +static inline MemTxResult ldub_dma(AddressSpace *as, dma_addr_t addr, + uint8_t *val, MemTxAttrs attrs) { - uint8_t val; - - dma_memory_read(as, addr, &val, 1, attrs); - return val; + return dma_memory_read(as, addr, val, 1, attrs); } =20 static inline MemTxResult stb_dma(AddressSpace *as, dma_addr_t addr, diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c index d9249bbc0c1..bb207514f2d 100644 --- a/hw/intc/pnv_xive.c +++ b/hw/intc/pnv_xive.c @@ -172,7 +172,7 @@ static uint64_t pnv_xive_vst_addr_indirect(PnvXive *xiv= e, uint32_t type, =20 /* Get the page size of the indirect table. */ vsd_addr =3D vsd & VSD_ADDRESS_MASK; - vsd =3D ldq_be_dma(&address_space_memory, vsd_addr, MEMTXATTRS_UNSPECI= FIED); + ldq_be_dma(&address_space_memory, vsd_addr, &vsd, MEMTXATTRS_UNSPECIFI= ED); =20 if (!(vsd & VSD_ADDRESS_MASK)) { #ifdef XIVE_DEBUG @@ -195,8 +195,8 @@ static uint64_t pnv_xive_vst_addr_indirect(PnvXive *xiv= e, uint32_t type, /* Load the VSD we are looking for, if not already done */ if (vsd_idx) { vsd_addr =3D vsd_addr + vsd_idx * XIVE_VSD_SIZE; - vsd =3D ldq_be_dma(&address_space_memory, vsd_addr, - MEMTXATTRS_UNSPECIFIED); + ldq_be_dma(&address_space_memory, vsd_addr, &vsd, + MEMTXATTRS_UNSPECIFIED); =20 if (!(vsd & VSD_ADDRESS_MASK)) { #ifdef XIVE_DEBUG @@ -543,7 +543,7 @@ static uint64_t pnv_xive_vst_per_subpage(PnvXive *xive,= uint32_t type) =20 /* Get the page size of the indirect table. */ vsd_addr =3D vsd & VSD_ADDRESS_MASK; - vsd =3D ldq_be_dma(&address_space_memory, vsd_addr, MEMTXATTRS_UNSPECI= FIED); + ldq_be_dma(&address_space_memory, vsd_addr, &vsd, MEMTXATTRS_UNSPECIFI= ED); =20 if (!(vsd & VSD_ADDRESS_MASK)) { #ifdef XIVE_DEBUG diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index d960b814587..da5a4072107 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -2062,7 +2062,7 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, un= signed int slotid, assert(slotid >=3D 1 && slotid <=3D xhci->numslots); =20 dcbaap =3D xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high); - poctx =3D ldq_le_dma(xhci->as, dcbaap + 8 * slotid, MEMTXATTRS_UNSPECI= FIED); + ldq_le_dma(xhci->as, dcbaap + 8 * slotid, &poctx, MEMTXATTRS_UNSPECIFI= ED); ictx =3D xhci_mask64(pictx); octx =3D xhci_mask64(poctx); =20 @@ -3429,6 +3429,7 @@ static int usb_xhci_post_load(void *opaque, int versi= on_id) uint32_t slot_ctx[4]; uint32_t ep_ctx[5]; int slotid, epid, state; + uint64_t addr; =20 dcbaap =3D xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high); =20 @@ -3437,8 +3438,8 @@ static int usb_xhci_post_load(void *opaque, int versi= on_id) if (!slot->addressed) { continue; } - slot->ctx =3D xhci_mask64(ldq_le_dma(xhci->as, dcbaap + 8 * slotid, - MEMTXATTRS_UNSPECIFIED)); + ldq_le_dma(xhci->as, dcbaap + 8 * slotid, &addr, MEMTXATTRS_UNSPEC= IFIED); + slot->ctx =3D xhci_mask64(addr); xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx)); slot->uport =3D xhci_lookup_uport(xhci, slot_ctx); if (!slot->uport) { --=20 2.33.1