From nobody Sun May 19 14:14:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1601573133; cv=none; d=zohomail.com; s=zohoarc; b=XISfPZ02nuZqjfWCzyDmO6XWbXwQGLnS4DKUI16NkoYkFi4stjLdjFukU52jxg+eD7T9F80OO+siycRo2FUTaLGKqPHbZMn0BuDfjq+prPE9GskttKhDHpLoBQOsIfyKvOrYT5oZhORXj0t6Mqydyz9oc4+WleHCzJXJuP4wERE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573133; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=kDqdtq58pQ4zoZVkr3FaloUPfNhxdNZfP/qYUQHcHb8=; b=lU1zHeFMFplhl9Zu+Fi/Ri+aXdcc/cZxwuRZPGGihpjAbQ/dqqz5z9XgSvD4myyfzkDtZn9TPoAjcy1n6MbGSz0FjK5Dxm8LajEl5Yked8BJOWqZZbvmuoE16ExTwJt3+Mxcpy4QG84u1eilNsK3NvT6WKKUXJlxjqbmVDowpbk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1601573133223510.18068149356316; Thu, 1 Oct 2020 10:25:33 -0700 (PDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-Qa5v5aUaO9iCUGPbQtjsKg-1; Thu, 01 Oct 2020 13:25:27 -0400 Received: by mail-wm1-f72.google.com with SMTP id a25so1119269wmb.2 for ; Thu, 01 Oct 2020 10:25:27 -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 c4sm911793wme.27.2020.10.01.10.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573131; 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=kDqdtq58pQ4zoZVkr3FaloUPfNhxdNZfP/qYUQHcHb8=; b=iLMOgZ3p7+fxfZNC8pCJvSVfRixYnduzAj1u95TLe2E5LIMdE4ahvYv9msVSyjY2pDxXEi 9I4FVSg/cUqR/AKjwJPMy0fW2mKLfP7mSIaXfuhihS5RUXbIZNjh3dUYjorNVDOxpktf9D dqOmCjOpmeL9HAf76F3lcdY1FK4H4Rw= X-MC-Unique: Qa5v5aUaO9iCUGPbQtjsKg-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=kDqdtq58pQ4zoZVkr3FaloUPfNhxdNZfP/qYUQHcHb8=; b=kpgwwdUBG1fs6vK7WeOINN2YcYBNgJT1dV4FFK2TZPb4vstTkZu9iCOrteNY0K8rgR r77LCeeS0D8kFRkgI/KBx8hWCaIyPukNowUCcb/F39dgIJYFIMwUBZ/aCKtjexTZu5AJ wBVQk/G+Zs5HBLX4Sn7f1yqmWCw1i53w+Xli7WoA3Nj6i/vFovcyrBz3MXHcxFLl3VjJ dfGm5QssFnWM8UIagn12nQc7nBtxYfJ5pR5DhXX6mf8lW7Q87Ibp0SMrkg9WkdEtwd4x 6t1tJpLm18dIQJPtNQYO83MX2pIkqbEyGsPFDoC3qeJ2HCVhmKkAsnmr41rgORQtZWvS FktQ== X-Gm-Message-State: AOAM530R/A5H4FKt7awfRZvscFcqEb44bep8IlAhOkfTqwr7BzHqGYlp 3FprFlq3PGz3VI7VA2Ltw6Ms1tV879jLVQL926SMhw7tNfmP/ag08a1zd6TScx4fKq38CxvNt3i Yk37g9RJJMRNSkw== X-Received: by 2002:a5d:67d0:: with SMTP id n16mr11075384wrw.198.1601573126594; Thu, 01 Oct 2020 10:25:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySZMM33BbdJ0sR0nGXiOX6FWsXB2b32Yq56EZPV+x7b/7t27gSDw9A3CcKwp1NY4quCUxtNQ== X-Received: by 2002:a5d:67d0:: with SMTP id n16mr11075373wrw.198.1601573126441; Thu, 01 Oct 2020 10:25:26 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 01/16] pci: pass along the return value of dma_memory_rw Date: Thu, 1 Oct 2020 19:25:04 +0200 Message-Id: <20201001172519.1620782-2-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) From: Klaus Jensen Some might actually care about the return value of dma_memory_rw. So let us pass it along instead of ignoring it. There are no existing users of the return value, so this patch should be safe. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Michael S. Tsirkin Acked-by: Keith Busch Message-Id: <20191011070141.188713-2-its@irrelevant.dk> Reviewed-by: Richard Henderson Reviewed-by: Li Qiang Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci/pci.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 0a59a06b14..f19ffe6b4f 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -783,8 +783,7 @@ static inline AddressSpace *pci_get_address_space(PCIDe= vice *dev) static inline int pci_dma_rw(PCIDevice *dev, dma_addr_t addr, void *buf, dma_addr_t len, DMADirection dir) { - dma_memory_rw(pci_get_address_space(dev), addr, buf, len, dir); - return 0; + return dma_memory_rw(pci_get_address_space(dev), addr, buf, len, dir); } =20 static inline int pci_dma_read(PCIDevice *dev, dma_addr_t addr, --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1601573142; cv=none; d=zohomail.com; s=zohoarc; b=FsEM1Rwe1yEprVNahtDwPXycjs6QotdyT45ujIQh5uvX5e1jD4RWePa+gq2yrEdfLfQ9Kn1znaQY6kDSn2BrtPdlH1JbHwKZjpKthzxqXggYLot0HMMIReaDFFoSVRHFYAX2QPEfQs3fSSsS10pyERfLcWdhLJzKsezem1KXhjk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573142; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=D38Rl8stPDowIAHnj4YR4yXUaHyYT1kHxdVb7Vz4dLo=; b=WSGxN/zQ3kuLpYQo4PJ5YadEYIX1FhASJgY8lxLXMP16U5Nr2pjVbkFJD9c7j0s2XWEy9jyCY6rQQIK5A8LRxQ+5lw7EnYtYettQWjKMLr0DzgCB7OVznq+Z+Sj25L3RfbNqzm590rQmakrqCHuLLC1i8COwOGMZG9Md01+JqyU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1601573142534932.3028250093929; Thu, 1 Oct 2020 10:25:42 -0700 (PDT) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-521-ZqvRzWWNNryhLicNGpUdkw-1; Thu, 01 Oct 2020 13:25:32 -0400 Received: by mail-wr1-f72.google.com with SMTP id g6so2335316wrv.3 for ; Thu, 01 Oct 2020 10:25:32 -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 e19sm2388302wme.2.2020.10.01.10.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:25:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573140; 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=D38Rl8stPDowIAHnj4YR4yXUaHyYT1kHxdVb7Vz4dLo=; b=PMOWJdbqjXNYs02vgSEqvA9lXvAkduPoql4yCYttHJdRVN5YLQ+yCXQZtlLKLFewRlh8WQ S6jotmprv+b7/KMgeA4OmdW63Z9zWZqfBDmCPc6N6v77m63SZzvFIy8pPMXP69IIr+e3S2 8XHQGPQKeiOHLN3AyP8YciWFI63H4tY= X-MC-Unique: ZqvRzWWNNryhLicNGpUdkw-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=D38Rl8stPDowIAHnj4YR4yXUaHyYT1kHxdVb7Vz4dLo=; b=D4IsHkgaFPzQQEYfQUd+MJviar4irOg2nHUWecclimx+16vW6Tee1+6UVYCydNM1t3 Oh22b8nY4anhKrFxfVpg7Y9k181RM99vxAUx/Rspbg3WH4Ic1o6w5HucJzj9NfmGhqZ1 rjdl+ZXx+SP6el3kUa6Kr8POkm+0iROC4n0ZZsJ5sgthIvL8l88z/CdJxM66fZMJN8ec n6mRb1lmxaTxLA+KJjaped3k0S02eot81+SD4jumEK4weaW2mgNv76PQJ3OQ5Pw3aLxc pVKX+RHyvEosPZnCBM6x0iP8+zdGzeXW7HTaU+FcsB2hqFbNbSSTnNQPRFkAh93TqyJE KsuA== X-Gm-Message-State: AOAM533KDt8PyldhoGkXiqjiZ6mjKGWijnRWR1v1ZmJMkq1eFdzD+mtG ZL8RG6r+3G+KIQ5MfCJMMHwXm+1rLlpmVRsvlcIbzbynKcVM9EIp/sr2vY+gthm4SEQ9onYXuN8 ow6hSPU9t9PAzRQ== X-Received: by 2002:adf:f80a:: with SMTP id s10mr10826934wrp.351.1601573131718; Thu, 01 Oct 2020 10:25:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5u1Y98czRZyz399fxOS74PBTWqTEND2+WAOqwJU68kXF1PABB8dUoiALGfqLUPtLwxKerGA== X-Received: by 2002:adf:f80a:: with SMTP id s10mr10826918wrp.351.1601573131504; Thu, 01 Oct 2020 10:25:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 02/16] docs/devel/loads-stores: Add regexp for DMA functions Date: Thu, 1 Oct 2020 19:25:05 +0200 Message-Id: <20201001172519.1620782-3-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) Reviewed-by: Richard Henderson Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- docs/devel/loads-stores.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/devel/loads-stores.rst b/docs/devel/loads-stores.rst index 9a944ef1af..5b20f907e4 100644 --- a/docs/devel/loads-stores.rst +++ b/docs/devel/loads-stores.rst @@ -477,6 +477,8 @@ make sure our existing code is doing things correctly. =20 Regexes for git grep - ``\`` + - ``\`` + - ``\`` =20 ``pci_dma_*`` and ``{ld,st}*_pci_dma`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 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=1601573142; cv=none; d=zohomail.com; s=zohoarc; b=MU1/DW/QzKjRXpufuU0IVDgrgzfzHEpukjvTUUXRoh8kiuMALwJNnStYLZO0CDg3XNdmzYoD4ybHVi7cNY47BKLrApXOFgwTU9bQntNIKycWgSPoldmxLjYK2ApcXg6GVQTY59nNcc5ZrijGJKhx7iIzvVFLYVdVx3lZtxMxyU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573142; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=pWyri9vRLYeVqvreYWHFron9sHPrhWm4LYtp0EVZkVA=; b=XL0UNRxbqYkq6w399DSQ0q9XeDNmygQc40DrZrtVzxeNfQYVP/eyPS1cFh7K/q5lWbvRY/pBDtR4tWvlGWjTpNUM4Y5NZlXf/UKO0M/+zb6ZH5R6XUVBuIV1YL6eZ23dmf25u6oCB1MtTl1HuMfjCLH0qikcPp8QCL8w9Y4JbC4= 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 160157314200521.642622305750592; Thu, 1 Oct 2020 10:25:42 -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-308-oLZUS-NUNl2z5AKyKytyJw-1; Thu, 01 Oct 2020 13:25:37 -0400 Received: by mail-wm1-f69.google.com with SMTP id l26so1109542wmg.7 for ; Thu, 01 Oct 2020 10:25:37 -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 a3sm740469wmb.46.2020.10.01.10.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:25:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573139; 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=pWyri9vRLYeVqvreYWHFron9sHPrhWm4LYtp0EVZkVA=; b=JZwJQYTx7zruB/n8AX9/hVtyc/1k9J5cn95O5RiFdYrCpp6ogvUypWMlwXvYG+RvZ7htzN fjmxpFFjx/JyUTUnsz9NOtoVuqmIwKc4cyFZenbfdsTQYR6EO7NRvqEv2msAju/OuK142A nesKybgYboFVgHpjnpqARDom+tI4Ptc= X-MC-Unique: oLZUS-NUNl2z5AKyKytyJw-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=pWyri9vRLYeVqvreYWHFron9sHPrhWm4LYtp0EVZkVA=; b=H64/IqvVzO7107amelyIdgnFLFB81TraTxAiNRAsI0XV4Pau8qUT9A9NABCbtKK/pe K0diqd2kxYY0wX2+EWRdMpwOwSDSlB5AVSIt8XBGkgsVXIT5UnP8zG4jZHW3tQwRIP8n a5LYt1qjurerdNaltkhjDxo9iTcZpP2flAGbMprC7kZTNCLbMaFpkYmXcBysIykOH+Xa D+TK6On5idN0TuqPqxpeO+meOuXnMq8BeuwZ6nu9GCli4swMoQMcMz11rOmcAOVUKX2c nZ4trYP/YUxHnYDqrze0X6tnLQABay0tvd0lyvd/imRPEm8gOWeHJF6QR49VzG8j7Hgx 1IoA== X-Gm-Message-State: AOAM530xgExWQnVGSsIS+Z06CF2/b5fhDfsllkXAL2HscYoObjk+1etv WeY5s23vsBbpB/n09kQWBFgrNo7kH+dFHPOQM/F3Zj4AjafwRMVQILE+FQiIupZnC13dcsGbplz ygPKAHvH0RcxjPw== X-Received: by 2002:a1c:7d55:: with SMTP id y82mr1098818wmc.100.1601573136396; Thu, 01 Oct 2020 10:25:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgsQMLP8oKgBuvYpoK/ukXPuEKW1rtgM9KCvEL+VHK3idIPhPT4YLEHb2KfaY2WirmsjiRqw== X-Received: by 2002:a1c:7d55:: with SMTP id y82mr1098811wmc.100.1601573136206; Thu, 01 Oct 2020 10:25:36 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 03/16] dma: Document address_space_map/address_space_unmap() prototypes Date: Thu, 1 Oct 2020 19:25:06 +0200 Message-Id: <20201001172519.1620782-4-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) Add documentation based on address_space_map / address_space_unmap. Reviewed-by: Richard Henderson Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/dma.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 80c5bc3e02..c6e12b4c24 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -1,7 +1,7 @@ /* * DMA helper functions * - * Copyright (c) 2009 Red Hat + * Copyright (c) 2009, 2020 Red Hat * * This work is licensed under the terms of the GNU General Public License * (GNU GPL), version 2 or later. @@ -125,6 +125,19 @@ static inline int dma_memory_write(AddressSpace *as, d= ma_addr_t addr, =20 int dma_memory_set(AddressSpace *as, dma_addr_t addr, uint8_t c, dma_addr_= t len); =20 +/** + * address_space_map: Map a physical memory region into a host virtual add= ress. + * + * May map a subset of the requested range, given by and returned in @plen. + * May return %NULL and set *@plen to zero(0), if resources needed to perf= orm + * the mapping are exhausted. + * Use only for reads OR writes - not for read-modify-write operations. + * + * @as: #AddressSpace to be accessed + * @addr: address within that address space + * @len: pointer to length of buffer; updated on return + * @dir: indicates the transfer direction + */ static inline void *dma_memory_map(AddressSpace *as, dma_addr_t addr, dma_addr_t *len, DMADirection dir) @@ -138,6 +151,20 @@ static inline void *dma_memory_map(AddressSpace *as, return p; } =20 +/** + * address_space_unmap: Unmaps a memory region previously mapped + * by dma_memory_map() + * + * Will also mark the memory as dirty if @dir =3D=3D %DMA_DIRECTION_FROM_D= EVICE. + * @access_len gives the amount of memory that was actually read or written + * by the caller. + * + * @as: #AddressSpace used + * @buffer: host pointer as returned by address_space_map() + * @len: buffer length as returned by address_space_map() + * @dir: indicates the transfer direction + * @access_len: amount of data actually transferred + */ static inline void dma_memory_unmap(AddressSpace *as, void *buffer, dma_addr_t len, DMADirection dir, dma_addr_t access_le= n) --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1601573145; cv=none; d=zohomail.com; s=zohoarc; b=TVnUfYH889xlNvLwK/t3EbVl0JZyc/qcz9o9/7RwSYU5WBL6LsgXH4rf9Sh61U1i3++sCjcb6v4hSRrehvRsRpFmj57R1XPcB5NYhfX8lqX00VcNNhYuxgkc1QLfUS2x5NO5NXZf5QZPtuQVXzw9Tw17lDebvLm11hbBdbgkNHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573145; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=syzgIAtLlC36RSXNl4EdRCuwS9HfcthXywFIirAhFNM=; b=Xj3Zhg01mXs+/xPkLlgaIoB8D2+rFXWn+8pP/n6JuuNas/6WmNI3BGl/wwc+WHkLtWUFJ/dKgKjm3DWVZGCMS0+8M0LZC4sjJQCDh9oodghmlgn54cEcUOKP+WkeL0g6FpDpQOosPFa7VGeihkJgq4g4pzN7K0iiwz1sWx+zhe8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1601573145640446.60818901620723; Thu, 1 Oct 2020 10:25:45 -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-65-krzPsY8pORyTr2bsB82-iw-1; Thu, 01 Oct 2020 13:25:42 -0400 Received: by mail-wr1-f70.google.com with SMTP id v12so2323678wrm.9 for ; Thu, 01 Oct 2020 10:25:42 -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 b64sm945627wmh.13.2020.10.01.10.25.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573144; 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=syzgIAtLlC36RSXNl4EdRCuwS9HfcthXywFIirAhFNM=; b=EWPDPvczxu9GEXyhLjQFc6R/IpAJQ7wQh5XgHHf7msTdbsnqNOwBlc/ymig1HXP1nz7A2B KGBQXW+6Z5RMKnxf7FiZUWq0gdKLH3Z2kUWgsIO8f+C5vhGy4IYI2HxGMThXNLVeuDhb3X WhFNIQmVVlSUYBRPWqEeUiok2ggYEo0= X-MC-Unique: krzPsY8pORyTr2bsB82-iw-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=syzgIAtLlC36RSXNl4EdRCuwS9HfcthXywFIirAhFNM=; b=Lty7FtUEC4H6yPq261bGI4Mew/u9OaYNbkrNaSv0EbCyizMY2j3DYk4Vxfoitw/glq vzNjuLrguCFVEPe8NHakoiqB6HQhcMPtrS6P8yxfbhRpTqHTILVo7fgK+nlE+kJY07hW RNCcJWegfy2QeiKlQcm1RtptWcAZUBmr06JejUD+uj1KaGR/NfWXx5v15WwOKw3j1KUO stKnuzJzx5J/ikYoQSPC4CMgauHtUgrc7HktGJh7glxO6DVob7NupHVw0qVQpISCoBh8 5vImu/o3DsaK77053YkQwcjYq3p4VrPJO8gpxrGC0HI4zRgfle4l+2Qei1ojkhaz0mYW bANA== X-Gm-Message-State: AOAM532vUj5j5AZVsw0aZjA24MWz/rsSl1dFZzX9rO2yuIFB11Hl2BZK BVPAG2i+lGrLiIYFHFAZWc8Pq8da48VId8zvfjN33CrIsGAEaX4jcXrgmww9bY+LTMNsDz/jxAx kfsqYwo60rUCdmQ== X-Received: by 2002:adf:f0c7:: with SMTP id x7mr9970697wro.315.1601573141269; Thu, 01 Oct 2020 10:25:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyORzUqm86VflKRIN/MDCkXBpeF2kgb9g6JuA9aFdZahBI9GJjEq3Qii1zONXyEFBJEarPzLQ== X-Received: by 2002:adf:f0c7:: with SMTP id x7mr9970683wro.315.1601573141086; Thu, 01 Oct 2020 10:25:41 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 04/16] dma: Let dma_memory_set() propagate MemTxResult Date: Thu, 1 Oct 2020 19:25:07 +0200 Message-Id: <20201001172519.1620782-5-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) address_space_write() returns a MemTxResult type. Do not discard it, return it to the caller. Reviewed-by: Richard Henderson Reviewed-by: Li Qiang Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/dma.h | 15 ++++++++++++++- dma-helpers.c | 7 ++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index c6e12b4c24..37cd9f1121 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -123,7 +123,20 @@ static inline int dma_memory_write(AddressSpace *as, d= ma_addr_t addr, DMA_DIRECTION_FROM_DEVICE); } =20 -int dma_memory_set(AddressSpace *as, dma_addr_t addr, uint8_t c, dma_addr_= t len); +/** + * dma_memory_set: Fill memory with a constant byte from DMA controller. + * + * Return a MemTxResult indicating whether the operation succeeded + * or failed (eg unassigned memory, device rejected the transaction, + * IOMMU fault). + * + * @as: #AddressSpace to be accessed + * @addr: address within that address space + * @c: constant byte to fill the memory + * @len: the number of bytes to fill with the constant byte + */ +MemTxResult dma_memory_set(AddressSpace *as, dma_addr_t addr, + uint8_t c, dma_addr_t len); =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 41ef24a63b..4a9e37d6d0 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -1,7 +1,7 @@ /* * DMA helper functions * - * Copyright (c) 2009 Red Hat + * Copyright (c) 2009,2020 Red Hat * * This work is licensed under the terms of the GNU General Public License * (GNU GPL), version 2 or later. @@ -18,14 +18,15 @@ =20 /* #define DEBUG_IOMMU */ =20 -int dma_memory_set(AddressSpace *as, dma_addr_t addr, uint8_t c, dma_addr_= t len) +MemTxResult dma_memory_set(AddressSpace *as, dma_addr_t addr, + uint8_t c, dma_addr_t len) { dma_barrier(as, DMA_DIRECTION_FROM_DEVICE); =20 #define FILLBUF_SIZE 512 uint8_t fillbuf[FILLBUF_SIZE]; int l; - bool error =3D false; + MemTxResult error =3D MEMTX_OK; =20 memset(fillbuf, c, FILLBUF_SIZE); while (len > 0) { --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1601573151; cv=none; d=zohomail.com; s=zohoarc; b=LjH8nCm03v0ij2BheFZEHX6dKnnmdlNEofrwJf9pALs1UtlrmW26lBe0B80jAdUEm2BKQyJHlh1Zg//Bp2aq+KegNlfJtwom7D1JjdQLxDFyyvUQbhqJv/wuNrvu1FzQHa42wRQIykWWNQcbC07H3vKHEkW0y3QjkUKmJ5u1xC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573151; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=7v9DMG4y2YQic36rWlYyposJbVK+Y5f+qipPBVV3YB0=; b=DbVf1BFYapYrOGYdBWZ1CCUGgQYYeQOOaxDhZuimtTGWNuZqszhtIqOdQljtbsrL6AjTyE6USdd7sZNDQZwSkypV7en+BUPEqKfCuUj0UVIDOMfEAlI72tzDhJoiN1dSV2LUNn1rCh11WBL//VSkQB+PNw95GntHQJejXSi9BR4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 160157315152355.984915488434126; Thu, 1 Oct 2020 10:25:51 -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-205-iuhmd6hZMLK_R9iQYF7IYQ-1; Thu, 01 Oct 2020 13:25:47 -0400 Received: by mail-wr1-f70.google.com with SMTP id b7so2334132wrn.6 for ; Thu, 01 Oct 2020 10:25:47 -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 t202sm964651wmt.14.2020.10.01.10.25.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573150; 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=7v9DMG4y2YQic36rWlYyposJbVK+Y5f+qipPBVV3YB0=; b=Wod3zl8nkToKe8+GHvJbLK5Rg/Wk7TuLsOs/RnmwZCRLOh2ge4d7OIOCrquKI9a8Y3Lv5z w2NhkVOQ9fsmXIfUMDUFU+TN1YIBz+PNMRHxOfjdBw7fJpF85QuxZZO8oG/szE7AzuIYHc yOxcNOvI2qI9Jb33GTfrJ+i6JE+Jdqo= X-MC-Unique: iuhmd6hZMLK_R9iQYF7IYQ-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=7v9DMG4y2YQic36rWlYyposJbVK+Y5f+qipPBVV3YB0=; b=mrhh3gVKmzQtzRgjDcti12mzzCISA7AY6Jyc8It4NAMMHHx393sNQnLayMEJlPOBBX Len9obTMH4XxU6l1AMb+7FOVKuFA7ZjQvSKJA8b+3mQ0KXFjCA3pRsZgDevJwumM7CB9 4YCnFWwFlXpdYW7M4xNLemwCO5MmfQ8vM27TR7CsMYm4WSCGi9vmuu4IkRwSWqzTFGjQ 0nvPFXAt+WJs/zgVVEDMiiNqjWyUv/h1YO9O5gYWk7dfRBeQ+aqQxDHoVumVuDE+BZEa elqbSSHuYOnZJGhPRobslE+EzbW7gQcWLoltVklv6EGUV4jM0HvqgzzfX7pK/kE5jkuO 1ibA== X-Gm-Message-State: AOAM532wp6IPvoininDIG4PQPy3qbbcPSiM5/D8AAC+w2UuKxuPij5ZU Pi2wlMtziWGdjT7llOSYpWRCs8LZX+ADAMkccyP3y5JYPoXPC5PJQ1Et6gSEQLHCBYr6Mle3scp kluJYKzGwb30New== X-Received: by 2002:a1c:408a:: with SMTP id n132mr1013262wma.45.1601573146318; Thu, 01 Oct 2020 10:25:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4MC9kQdd9yQsBPBSvY6hQkXKAQjPlgUSNTJfxBi1lN3ymzU7o++7Mxayaa49BcnFN50Q/tA== X-Received: by 2002:a1c:408a:: with SMTP id n132mr1013255wma.45.1601573146153; Thu, 01 Oct 2020 10:25:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 05/16] dma: Let dma_memory_rw() propagate MemTxResult Date: Thu, 1 Oct 2020 19:25:08 +0200 Message-Id: <20201001172519.1620782-6-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) address_space_rw() returns a MemTxResult type. Do not discard it, return it to the caller. Reviewed-by: Richard Henderson Reviewed-by: Li Qiang Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/dma.h | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 37cd9f1121..04687d8825 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -80,12 +80,13 @@ static inline bool dma_memory_valid(AddressSpace *as, MEMTXATTRS_UNSPECIFIED); } =20 -static inline int dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr, - void *buf, dma_addr_t len, - DMADirection dir) +static inline MemTxResult dma_memory_rw_relaxed(AddressSpace *as, + dma_addr_t addr, + void *buf, dma_addr_t len, + DMADirection dir) { - return (bool)address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, - buf, len, dir =3D=3D DMA_DIRECTION_FROM_= DEVICE); + return address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, + buf, len, dir =3D=3D DMA_DIRECTION_FROM_DEVICE= ); } =20 static inline int dma_memory_read_relaxed(AddressSpace *as, dma_addr_t add= r, @@ -101,9 +102,22 @@ static inline int dma_memory_write_relaxed(AddressSpac= e *as, dma_addr_t addr, DMA_DIRECTION_FROM_DEVICE); } =20 -static inline int dma_memory_rw(AddressSpace *as, dma_addr_t addr, - void *buf, dma_addr_t len, - DMADirection dir) +/** + * dma_memory_rw: Read from or write to an address space from DMA controll= er. + * + * Return a MemTxResult indicating whether the operation succeeded + * or failed (eg unassigned memory, device rejected the transaction, + * IOMMU fault). + * + * @as: #AddressSpace to be accessed + * @addr: address within that address space + * @buf: buffer with the data transferred + * @len: the number of bytes to read or write + * @dir: indicates the transfer direction + */ +static inline MemTxResult dma_memory_rw(AddressSpace *as, dma_addr_t addr, + void *buf, dma_addr_t len, + DMADirection dir) { dma_barrier(as, dir); =20 --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 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=1601573157; cv=none; d=zohomail.com; s=zohoarc; b=i3/8zNrSHGZ4KE5CRcJlMZ6+K5k2jZSAkpIQ4iOtNGI269u0oD8en/1IDK+qQafiLHn0i4siQRfl2b57ZNW7+Ndt8V+F1PLOH1+/57UX1wO8PWLSrF5ECTYTStnk0Suy6JQPk4i+CyHKQr0eTya8g1h+kMVyoENw36BdcK3hRbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573157; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=llB4vOCcjwlWR9vH+bHBQFNfVDmAnYp9O2qmiiAuZn4=; b=YXfFlTPzFpKC4f10/hjFX8i/JQTd2bw9wAGG2W1Y1LR+FqlmMhjVJcYy0VIsOf/ijJT9NvumxKyQktxFaJQJrr4IdqChz8zid3mZw9gxK1C/hrQZ0cWcj+DFn0mHKVvFL22vErP/hiuLNlUx4dr2GtknaHT2ruYU3V/iOdmj1ro= 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 1601573157014466.2393583666467; Thu, 1 Oct 2020 10:25:57 -0700 (PDT) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-SEOeLMPPOV6rL09B2cHSyQ-1; Thu, 01 Oct 2020 13:25:52 -0400 Received: by mail-wr1-f69.google.com with SMTP id b7so2334215wrn.6 for ; Thu, 01 Oct 2020 10:25:52 -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 a13sm853119wme.26.2020.10.01.10.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573154; 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=llB4vOCcjwlWR9vH+bHBQFNfVDmAnYp9O2qmiiAuZn4=; b=RYPhUUJgmvAutUfrVolA354ziS7zf/0EasbOlRZFpFyAYD1jBjFjvcti3RCQ2T6oYII8nS IkVUOt/SLk6FWGL7d63ZwiKKbQKRmzUlPyvl5ZXWEgLoXoJxOoim77Cm0/1PVjBlpgHsbm zV6tguePB1mQeiBCSKtzzw88+AyYGlE= X-MC-Unique: SEOeLMPPOV6rL09B2cHSyQ-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=llB4vOCcjwlWR9vH+bHBQFNfVDmAnYp9O2qmiiAuZn4=; b=EN01WCQiHs6fQL1xouDp94vl8FgGW0cxMvA0B9zAtb+i+vwQMJZec5ct4eTS0LCGyo l+mD7SBs++aQOb7WNhfKZtPH1OWQA4pfW/kweyW2u0LpwpZFpESZ3zZHNEm2CggLh6M/ 4W6QrYn0TRKsx5OGZKZ5K98B3O96TA7p1k8Xsa0BJUmTs8VqDNJ7bfyaC5/LBth6AxC7 SToXgUuCh3q/zpsWw6JUvBg25x3H8nLoZnXR8oGOd7aF6yjKMG68o+BEJDcPwb8y3FO0 lD+ULCwUwl3TfstGrXv0a8SCakMnDx6Nf4SGg+N4TS7NU1Fzw21C8eQidPvZtMOagnqv WgjQ== X-Gm-Message-State: AOAM533gUVgqdnE/DBfJrpTODGSt6p1K1W133VH6Noax62TvsAt6BEHw M3/qbT5ALRtr1O25vERMsLu3GL6eBSM4baUmYVPICqmwxvCG/9Ve2zfmFEi/qz7sDrab8WDpLmt 65bbdlweJqXAf8A== X-Received: by 2002:a1c:48c3:: with SMTP id v186mr1218513wma.16.1601573151251; Thu, 01 Oct 2020 10:25:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiH9BrvCDzygapUQgoS7+TVvPomrWUpV0pHMapa8C71iR1ww7iiptp7ggFFu2E7lmPTxosbA== X-Received: by 2002:a1c:48c3:: with SMTP id v186mr1218492wma.16.1601573151065; Thu, 01 Oct 2020 10:25:51 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 06/16] dma: Let dma_memory_read() propagate MemTxResult Date: Thu, 1 Oct 2020 19:25:09 +0200 Message-Id: <20201001172519.1620782-7-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) dma_memory_rw_relaxed() returns a MemTxResult type. Do not discard it, return it to the caller. Reviewed-by: Richard Henderson Reviewed-by: Li Qiang Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- 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 04687d8825..df170047eb 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 From nobody Sun May 19 14:14:29 2024 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=1601573162; cv=none; d=zohomail.com; s=zohoarc; b=BkbYi4zDyIx0HpK3xYofpz5DIcIF/MfLe4Ykwd8yP/DMFoy7PONYTurFJ5KpEwnELk+JganpWO/IWEXGJ4bGX5T9GiMnSpLe6yvIj9BLguJ19YHoe/yqSP+/MgdFyCFRD6Atmz3Skca8sk0D/9Kb+Qf6b/qaQKI57c0T5WTzYys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573162; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=14wd1LoJqDrIDTmO66J1bZUDTtxJuvJH1RTglxmFjpE=; b=mqYFl8HkyoJfytrADTmogusrFbJwwnyI6Wjz3L49NEb8uIgd7Sow7/meDsYOm2lmzcNwMiiMl1kbeIzkYexBUzJ5PlLU+2ybgKA9QXb2XGnljU7NvvK+nLjMd9CB5c67mhB52nw74oOVRByd4YIhrWg5Xxdo3xLGtM0pVi7KWqE= 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 1601573162793666.0599711950812; Thu, 1 Oct 2020 10:26:02 -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-476-cXpsWc_OPauFa-7t4HOFdQ-1; Thu, 01 Oct 2020 13:25:57 -0400 Received: by mail-wr1-f70.google.com with SMTP id f18so2320640wrv.19 for ; Thu, 01 Oct 2020 10:25:57 -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 n2sm977308wma.29.2020.10.01.10.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573161; 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=14wd1LoJqDrIDTmO66J1bZUDTtxJuvJH1RTglxmFjpE=; b=XzgEuls+D9dnQjGNZKbWx1QKvvo1m9jIzBVLfOVjYg7Q01tcoAKOgadep/vA/mxBsEwl2F 0LAwAShdx8k7TbZNjSTnmqE3nj6GIiv2zNpTpw9AcVtFpgkHiiT3lOQugc0lZxAufm3KPE xNemtAMTZ+z813juGYl1rTNxcK4tNYI= X-MC-Unique: cXpsWc_OPauFa-7t4HOFdQ-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=14wd1LoJqDrIDTmO66J1bZUDTtxJuvJH1RTglxmFjpE=; b=rLWPEAs77EAp79Khz0elFYmtJC3Z8MxVT/du9jbKjzWU7EuvDRPd+YzLhwebrrFGmD YgedjSOIoQDiRDcZNvnNzKt8WAzn23Ke3FT4UfiHcyPVlWFA7zoR/kK0RGVHfNN7sejm nk0fsz07fC6/cffKuzQxJ7GdGem+lbGA2dAcNWU28zBWwnOONk48qwVRogCvswfGTXRF 3MD5b4gEhXc0OKyS5C1hOxhx04IryCBvkfpfcF7Aqp4uh0A9oz7N4bn5VBAi7EgBsLUx e0VKkOT5W2YdHjj8I58KC8K1q+A5VW4ZQcARbGxxYqUDE/SDFcILGsPJ+yiT8bkdeeLD 1IlQ== X-Gm-Message-State: AOAM533s1PlD0g0DlcqdOXtziKsWeuqA7XuN/TSlFij9PtRWplhYn7Qz NyoMF1uegTJvQuLS6EY2bZiFPIISA9skGb/VCyqHrTUGaLZXCSScjACK3EVZFUoL+Fkpq5Wss7c bb9MAPxnuUK6P1w== X-Received: by 2002:a1c:4d12:: with SMTP id o18mr1114872wmh.177.1601573156388; Thu, 01 Oct 2020 10:25:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzTp+6eot3LZUdkaA24Hp014HJhDuGOas8MQ2FtVbQRG69xK2oop5m0br/4ML+XHsvN0Q5jw== X-Received: by 2002:a1c:4d12:: with SMTP id o18mr1114857wmh.177.1601573156212; Thu, 01 Oct 2020 10:25:56 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 07/16] dma: Let dma_memory_write() propagate MemTxResult Date: Thu, 1 Oct 2020 19:25:10 +0200 Message-Id: <20201001172519.1620782-8-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) dma_memory_rw_relaxed() returns a MemTxResult type. Do not discard it, return it to the caller. Reviewed-by: Richard Henderson Reviewed-by: Li Qiang Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/dma.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index df170047eb..a052f7bca3 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -96,8 +96,10 @@ static inline MemTxResult dma_memory_read_relaxed(Addres= sSpace *as, return dma_memory_rw_relaxed(as, addr, buf, len, DMA_DIRECTION_TO_DEVI= CE); } =20 -static inline int dma_memory_write_relaxed(AddressSpace *as, dma_addr_t ad= dr, - const void *buf, dma_addr_t len) +static inline MemTxResult dma_memory_write_relaxed(AddressSpace *as, + dma_addr_t addr, + const void *buf, + dma_addr_t len) { return dma_memory_rw_relaxed(as, addr, (void *)buf, len, DMA_DIRECTION_FROM_DEVICE); @@ -143,8 +145,20 @@ static inline MemTxResult dma_memory_read(AddressSpace= *as, dma_addr_t addr, return dma_memory_rw(as, addr, buf, len, DMA_DIRECTION_TO_DEVICE); } =20 -static inline int dma_memory_write(AddressSpace *as, dma_addr_t addr, - const void *buf, dma_addr_t len) +/** + * address_space_write: Write to address space from DMA controller. + * + * Return a MemTxResult indicating whether the operation succeeded + * or failed (eg unassigned memory, device rejected the transaction, + * IOMMU fault). + * + * @as: #AddressSpace to be accessed + * @addr: address within that address space + * @buf: buffer with the data transferred + * @len: the number of bytes to write + */ +static inline MemTxResult dma_memory_write(AddressSpace *as, dma_addr_t ad= dr, + const void *buf, dma_addr_t len) { return dma_memory_rw(as, addr, (void *)buf, len, DMA_DIRECTION_FROM_DEVICE); --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 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=1601573165; cv=none; d=zohomail.com; s=zohoarc; b=hFdB+1d0lmTdqvZh4gfz6CcM+lb0oWXqo/GrEnEafUDbixHkTxcQou7hINNP0CmF9/xJ8kn2Wm4z9cdTo6Tqbo9WQCmIKa6g+TzEdz5XnRpMxr4auZBjH4zjgb97bQ+KhwJM2JGyeuzlmQeocVBatpXghZJE4A6VorByxLAk1uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573165; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Td0iuQpd/0gjq4nbB5FibsTRyGIsuc4AdlendQEjyys=; b=eEwl5zqjEeW0UQ6BbvAIFVy0vora995VlYT2/c+Bq4omXlzDuF9v3pyKYo6Ykq8zyfO190ijPil+GsXBlDcGVktxpsVxiyRCB5IFwZN2nq0Ia/za1qYjYHPv81JyFC8DXNxb57+XmUCxJILJbrrfGp4eeBImu9IvXxnAogOPRGE= 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 1601573165186326.43564691702215; Thu, 1 Oct 2020 10:26:05 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-568-YbSR3hHPPCG_IF-FQOSS6A-1; Thu, 01 Oct 2020 13:26:02 -0400 Received: by mail-wr1-f71.google.com with SMTP id v5so2298675wrs.17 for ; Thu, 01 Oct 2020 10:26:02 -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 63sm10732704wrh.71.2020.10.01.10.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573164; 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=Td0iuQpd/0gjq4nbB5FibsTRyGIsuc4AdlendQEjyys=; b=ADqR7LsbKgpqxjBiJwjsLXuU3UOm3hhtlodrMrQJLUOZrzeyVr0DoAVsg0wkP8WSy1kpYl GLHpKczKtiru1HMWQLNz47EjHIgl7kw6ojYZBSOSmy6FETP9jslvL6kg/MqWfWPjibQR3x 0REwJCZhUCva8bhucjscrLRdNCB0vqo= X-MC-Unique: YbSR3hHPPCG_IF-FQOSS6A-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=Td0iuQpd/0gjq4nbB5FibsTRyGIsuc4AdlendQEjyys=; b=hMkFNgzHWyrVCxd13AntzWlty0UKOltj5InHl7UYt5N58oLasziZMBrOiO0Fzlf6Rx YV/tYCoUDkyxI38og4zOyaWUkbmv/ObeBZNakeaXALJpJr7bAKq42wGXhx4TndNKFZBw aHGd5XhvcDhKd5JxCV1RmPMShLr5yU7ga+LtRLokdZi5HGB2lJinY2r8g7vKghkUuZNM tLdHFpofEbgbGH0KfKR6Y7PXN4eUc1X5oU54A6npaXfpjOsB24KEznCqHNMt1aDdzHWe 60p7CHtSuc0yuAqyMxcRaqMP7ag2WuQs3u97ttINUBcgp0e3Cbafp7U73A3XdADZoJ+P t0Jg== X-Gm-Message-State: AOAM530cVBG4WyF3HyNOQ/Uv1LD9udhbgSgQXaDCtAOduDUj9W7UkuFT FqhpYwMG4zoI538Qg1igcTxdh9k8sc/h221clNM+sl3ldXzhyy/DLhXoyKEyInGvR4bKpzUi6+w 1AgR8FIbYP3WYaQ== X-Received: by 2002:a5d:468f:: with SMTP id u15mr10078893wrq.336.1601573161125; Thu, 01 Oct 2020 10:26:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtrJe/UEvJEzIc8E+jwu+aTsJnp16PrGtTb5Rmwt9+xxJDYQBadebLBBdxSGR1JCjVpjzDjQ== X-Received: by 2002:a5d:468f:: with SMTP id u15mr10078878wrq.336.1601573160917; Thu, 01 Oct 2020 10:26:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 08/16] dma: Let dma_memory_valid() take MemTxAttrs argument Date: Thu, 1 Oct 2020 19:25:11 +0200 Message-Id: <20201001172519.1620782-9-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_valid(). 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 | 2 +- include/sysemu/dma.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index 356751e2d7..ed28db6604 100644 --- a/include/hw/ppc/spapr_vio.h +++ b/include/hw/ppc/spapr_vio.h @@ -91,7 +91,7 @@ static inline void spapr_vio_irq_pulse(SpaprVioDevice *de= v) static inline bool spapr_vio_dma_valid(SpaprVioDevice *dev, uint64_t taddr, uint32_t size, DMADirection dir) { - return dma_memory_valid(&dev->as, taddr, size, dir); + return dma_memory_valid(&dev->as, taddr, size, dir, MEMTXATTRS_UNSPECI= FIED); } =20 static inline int spapr_vio_dma_read(SpaprVioDevice *dev, uint64_t taddr, diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index a052f7bca3..a5cd7a98ff 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -73,11 +73,11 @@ static inline void dma_barrier(AddressSpace *as, DMADir= ection dir) * dma_memory_{read,write}() and check for errors */ static inline bool dma_memory_valid(AddressSpace *as, dma_addr_t addr, dma_addr_t len, - DMADirection dir) + DMADirection dir, MemTxAttrs attrs) { return address_space_access_valid(as, addr, len, dir =3D=3D DMA_DIRECTION_FROM_DEVICE, - MEMTXATTRS_UNSPECIFIED); + attrs); } =20 static inline MemTxResult dma_memory_rw_relaxed(AddressSpace *as, --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 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 From nobody Sun May 19 14:14:29 2024 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=1601573174; cv=none; d=zohomail.com; s=zohoarc; b=ekAjYFU//u9e92k8zY1DnwvA1O7bOtaFUJohn9pe/QMu20vjxGHqalu03Jl84XnEZzbEtc6ly/hp0B9/3CWdYWIIUwRD3XrMrJ8okEQGLzOAUCfcoaZ5pFm2ya633LyOciPBjOlhvffTUbu6QRSfDmvPaJvzYgUGa6Dv6PO+8dM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573174; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=DE77vjLAXxwClEJ7RgdDUv8monpyieaGAVYLnjVrC+s=; b=cCAHxjc9VZSKOAV+hgQsMI+OEZ27pYLgJoFml0QSs2K/kKl5c7KpHnrnozGAyqcSFyBQIY8EC6au4NT4STOvcCA9DVIRtfTtP95bIv6CiQ3wDiWewW8++jy39WgHHYwCIaXqxNVAyDT9ltlU27rfnqHcLbzyYc+CnI5N0gAiVS0= 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 1601573174866753.1316913937345; Thu, 1 Oct 2020 10:26:14 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-536-MivmnfKMP7awCC0uCklRBA-1; Thu, 01 Oct 2020 13:26:12 -0400 Received: by mail-wm1-f71.google.com with SMTP id y83so229219wmc.8 for ; Thu, 01 Oct 2020 10:26:11 -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 h4sm11741661wrm.54.2020.10.01.10.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573173; 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=DE77vjLAXxwClEJ7RgdDUv8monpyieaGAVYLnjVrC+s=; b=HgI3hdhcro8NhEl3oePn3WfOTX3MzjM5zRm8LuvG2L4yyC32QcdmiGmeMtQwiCiDxyYHOU a4hDUen+quzH5rEeY5afLaNEJyrW0X7Sz08HIsVT7a0SMzAQTeU+eu3xsWlKqJpg6duE5u UHlDL0Nc0z7TxFdPki/JvhOvC7p51lo= X-MC-Unique: MivmnfKMP7awCC0uCklRBA-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=DE77vjLAXxwClEJ7RgdDUv8monpyieaGAVYLnjVrC+s=; b=nAS83eZgWNiuPLMC51qPvb2S9N8qpqLE1sMycU//SaTHGUwjtCBDLGQ2J19H7eQT1Q uVfH8g8RS4L398OgbjrsozXeYqG0FzyOGDvZXRMIFSAcHS1FwtZP7YZLcK6A+4+BRzgo 6vkb1+D6h+yDKMZIBsaqr+Njn49GlT5EaDKb3Jy4qxS9YECZah43u5aHS538AZCnhAk8 BKWr9qgRazwHcpMZQv2COCSPOvx61nZIqnSSRzMN4NLjVdRTG8tBifRowwi7WukuM0hB vYtzNIuzTiMIVkXTvpWj1WWc+6u3dUPa2XWpEkGSOX6dg6u47O3QWxJxg2p6S63yIW9J n2mQ== X-Gm-Message-State: AOAM533aqJ3gx6lnAaoN18hVopWx3b8MXv5hMb42ROcrzFj21qmPl/Cr YHKeJPgcK5moe1JSRQBlqBAHbPw2pRX1iXGxGywKqYVRRZYXI9Wr49ddNJrUQz/2sq6a4eFtpAd Za03sxtlISwqErA== X-Received: by 2002:adf:e9c7:: with SMTP id l7mr10102296wrn.212.1601573170716; Thu, 01 Oct 2020 10:26:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhYa2pIYBNENWsjY/M8YHJaHnQ5Yxot6kNXp1e6URKTGVbkXFfjBglMcEzmpsPTpDw3oVhsg== X-Received: by 2002:adf:e9c7:: with SMTP id l7mr10102286wrn.212.1601573170577; Thu, 01 Oct 2020 10:26:10 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 10/16] dma: Let dma_memory_rw_relaxed() take MemTxAttrs argument Date: Thu, 1 Oct 2020 19:25:13 +0200 Message-Id: <20201001172519.1620782-11-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) We will add the MemTxAttrs argument to dma_memory_rw() in the next commit. Since dma_memory_rw_relaxed() is only used by dma_memory_rw(), modify it first in a separate commit to keep the next commit easier to review. Reviewed-by: Richard Henderson Reviewed-by: Li Qiang Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/sysemu/dma.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 608393d1b6..936b2c902b 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -83,9 +83,10 @@ static inline bool dma_memory_valid(AddressSpace *as, static inline MemTxResult dma_memory_rw_relaxed(AddressSpace *as, dma_addr_t addr, void *buf, dma_addr_t len, - DMADirection dir) + DMADirection dir, + MemTxAttrs attrs) { - return address_space_rw(as, addr, MEMTXATTRS_UNSPECIFIED, + return address_space_rw(as, addr, attrs, buf, len, dir =3D=3D DMA_DIRECTION_FROM_DEVICE= ); } =20 @@ -93,7 +94,9 @@ static inline MemTxResult dma_memory_read_relaxed(Address= Space *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); + return dma_memory_rw_relaxed(as, addr, buf, len, + DMA_DIRECTION_TO_DEVICE, + MEMTXATTRS_UNSPECIFIED); } =20 static inline MemTxResult dma_memory_write_relaxed(AddressSpace *as, @@ -102,7 +105,8 @@ static inline MemTxResult dma_memory_write_relaxed(Addr= essSpace *as, dma_addr_t len) { return dma_memory_rw_relaxed(as, addr, (void *)buf, len, - DMA_DIRECTION_FROM_DEVICE); + DMA_DIRECTION_FROM_DEVICE, + MEMTXATTRS_UNSPECIFIED); } =20 /** @@ -124,7 +128,8 @@ static inline MemTxResult dma_memory_rw(AddressSpace *a= s, dma_addr_t addr, { dma_barrier(as, dir); =20 - return dma_memory_rw_relaxed(as, addr, buf, len, dir); + return dma_memory_rw_relaxed(as, addr, buf, len, dir, + MEMTXATTRS_UNSPECIFIED); } =20 /** --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 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=1601573179; cv=none; d=zohomail.com; s=zohoarc; b=BMEWn+RMUz//RTS7nXUogd39Mp6K3+lnxd4CCoDDMqzvtCEpjvSY4MyiA9jvklrRd4anJeliVqxMo3UaB9VBZmBhGM6T2oi7z6HoRWPMyaD8g6prUA/ZD6HSbJF9ndtVMxA8vQc/tJ5BK6r/Qzg9+dsMaRp+FsXrsgJKKCp2UFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573179; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=iHoKvflLPOyGFs0hwO3aTtF1QkwEnyiuL0EYPF9JCq0=; b=cOkbVyfjj7/bsJS7oqtBvuvXQKpW1nnstkEnPoQE9ZlG8rNNZ1ScEx3/F1zwy3JB7WGGfzSefuNTMR8hTnMWR/67Wk2bNHWjhJM0aBfp85VKCvzv5kMpjno08hSW33d0ysKOSQ4l6tyWQfQkwGaZnxa6H9j7p+h4xHcjiVAQzQk= 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 1601573179955541.4154616720341; Thu, 1 Oct 2020 10:26:19 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-264-KeJLECKJPDm4PQbt28l9ow-1; Thu, 01 Oct 2020 13:26:17 -0400 Received: by mail-wm1-f71.google.com with SMTP id x6so1421497wmi.1 for ; Thu, 01 Oct 2020 10:26:17 -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 h8sm9734998wrw.68.2020.10.01.10.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573178; 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=iHoKvflLPOyGFs0hwO3aTtF1QkwEnyiuL0EYPF9JCq0=; b=gQQ/cbokDKSg3jW/Es2Fb3uUmTRqvotSzL1pwsP071B7DM2w96IHebbqxewaGrYXDMZ1Px uVmFxUn+K8KweJg+RSJRjLvtCLhA5JT5DqEH8qgK0804E9a6k3qfG24DIjZvMw3lw3dCEH 6HjFQz18DqnjsMuNeJGEaosCqDjZMUU= X-MC-Unique: KeJLECKJPDm4PQbt28l9ow-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=iHoKvflLPOyGFs0hwO3aTtF1QkwEnyiuL0EYPF9JCq0=; b=oK1i1Ga0ZRDTGdU3GV2n4R5RoA4lONHBlti9nDXqCpJq9ybrEGRHxQGYx/2j97RB/a rvFZljmwg5ERIRzpqJ4cy8LJau9bt6a1E1IRCA2S6WN94w3tXvRz4x5/hw0hOa+/TPz8 6vOsIpxPCacJSLEMz521BirSnonJyEKPjAJrMDEMofw/PWb20ZaS13gXyt7D/HT5rzZy rwAeR9pnb+Ahksblzt//ftI7kVTJ2p4fdzVMYlEizPv9QI6UeYdKIkIEvCTghD4IGDbF JngzUM5puFNsFVVxNVpeabbwYEvD0Qer90+wCrK6AU0VrQiMeTryL0IY4VVUTHqFqDGl YhtA== X-Gm-Message-State: AOAM532j4A78BcPRi5nfz8rJcojAsGNqGGi1xmMlZTtPOuCCydd0pjOT S1QtYJ2PYn9ESdXIoVd7ANhCWMEicMt3QazwJMsM36qFt3BECOUE4dLT1J8PmaHciqaV4BtWN9w yq6UeFMYCLvOAeQ== X-Received: by 2002:a5d:4151:: with SMTP id c17mr10946443wrq.302.1601573175621; Thu, 01 Oct 2020 10:26:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPuA1W5Xsqt/m9mc3n8zdA5NGpBzumdi0T7r8mX2ogfgATAiqa8xHgwOtB9XI+dqNAn4QU1Q== X-Received: by 2002:a5d:4151:: with SMTP id c17mr10946421wrq.302.1601573175415; Thu, 01 Oct 2020 10:26:15 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 11/16] dma: Let dma_memory_rw() take MemTxAttrs argument Date: Thu, 1 Oct 2020 19:25:14 +0200 Message-Id: <20201001172519.1620782-12-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_rw(). Reviewed-by: Richard Henderson Reviewed-by: Li Qiang Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci/pci.h | 3 ++- include/sysemu/dma.h | 11 ++++++----- dma-helpers.c | 3 ++- hw/intc/spapr_xive.c | 3 ++- hw/usb/hcd-ohci.c | 10 ++++++---- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index f19ffe6b4f..8f23a24cf9 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -783,7 +783,8 @@ static inline AddressSpace *pci_get_address_space(PCIDe= vice *dev) static inline int pci_dma_rw(PCIDevice *dev, dma_addr_t addr, void *buf, dma_addr_t len, DMADirection dir) { - return dma_memory_rw(pci_get_address_space(dev), addr, buf, len, dir); + return dma_memory_rw(pci_get_address_space(dev), addr, buf, len, + dir, MEMTXATTRS_UNSPECIFIED); } =20 static inline int pci_dma_read(PCIDevice *dev, dma_addr_t addr, diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 936b2c902b..e5885dfc91 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -121,15 +121,15 @@ static inline MemTxResult dma_memory_write_relaxed(Ad= dressSpace *as, * @buf: buffer with the data transferred * @len: the number of bytes to read or write * @dir: indicates the transfer direction + * @attrs: memory transaction attributes */ static inline MemTxResult dma_memory_rw(AddressSpace *as, dma_addr_t addr, void *buf, dma_addr_t len, - DMADirection dir) + DMADirection dir, MemTxAttrs attrs) { dma_barrier(as, dir); =20 - return dma_memory_rw_relaxed(as, addr, buf, len, dir, - MEMTXATTRS_UNSPECIFIED); + return dma_memory_rw_relaxed(as, addr, buf, len, dir, attrs); } =20 /** @@ -147,7 +147,8 @@ static inline MemTxResult dma_memory_rw(AddressSpace *a= s, dma_addr_t addr, 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); + return dma_memory_rw(as, addr, buf, len, + DMA_DIRECTION_TO_DEVICE, MEMTXATTRS_UNSPECIFIED); } =20 /** @@ -166,7 +167,7 @@ static inline MemTxResult dma_memory_write(AddressSpace= *as, dma_addr_t addr, const void *buf, dma_addr_t len) { return dma_memory_rw(as, addr, (void *)buf, len, - DMA_DIRECTION_FROM_DEVICE); + DMA_DIRECTION_FROM_DEVICE, MEMTXATTRS_UNSPECIFIED= ); } =20 /** diff --git a/dma-helpers.c b/dma-helpers.c index 6a9735386d..6c3b2200f1 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -305,7 +305,8 @@ static uint64_t dma_buf_rw(uint8_t *ptr, int32_t len, Q= EMUSGList *sg, while (len > 0) { ScatterGatherEntry entry =3D sg->sg[sg_cur_index++]; int32_t xfer =3D MIN(len, entry.len); - dma_memory_rw(sg->as, entry.base, ptr, xfer, dir); + dma_memory_rw(sg->as, entry.base, ptr, xfer, dir, + MEMTXATTRS_UNSPECIFIED); ptr +=3D xfer; len -=3D xfer; resid -=3D xfer; diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 1fa09f287a..7a383c9dc4 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -1661,7 +1661,8 @@ static target_ulong h_int_esb(PowerPCCPU *cpu, mmio_addr =3D xive->vc_base + xive_source_esb_mgmt(xsrc, lisn) + o= ffset; =20 if (dma_memory_rw(&address_space_memory, mmio_addr, &data, 8, - (flags & SPAPR_XIVE_ESB_STORE))) { + (flags & SPAPR_XIVE_ESB_STORE), + MEMTXATTRS_UNSPECIFIED)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: failed to access ESB @0x= %" HWADDR_PRIx "\n", mmio_addr); return H_HARDWARE; diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 8b912e95d3..67a92153e9 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -586,7 +586,8 @@ static int ohci_copy_td(OHCIState *ohci, struct ohci_td= *td, if (n > len) n =3D len; =20 - if (dma_memory_rw(ohci->as, ptr + ohci->localmem_base, buf, n, dir)) { + if (dma_memory_rw(ohci->as, ptr + ohci->localmem_base, buf, + n, dir, MEMTXATTRS_UNSPECIFIED)) { return -1; } if (n =3D=3D len) { @@ -595,7 +596,7 @@ static int ohci_copy_td(OHCIState *ohci, struct ohci_td= *td, ptr =3D td->be & ~0xfffu; buf +=3D n; if (dma_memory_rw(ohci->as, ptr + ohci->localmem_base, buf, - len - n, dir)) { + len - n, dir, MEMTXATTRS_UNSPECIFIED)) { return -1; } return 0; @@ -613,7 +614,8 @@ static int ohci_copy_iso_td(OHCIState *ohci, if (n > len) n =3D len; =20 - if (dma_memory_rw(ohci->as, ptr + ohci->localmem_base, buf, n, dir)) { + if (dma_memory_rw(ohci->as, ptr + ohci->localmem_base, buf, + n, dir, MEMTXATTRS_UNSPECIFIED)) { return -1; } if (n =3D=3D len) { @@ -622,7 +624,7 @@ static int ohci_copy_iso_td(OHCIState *ohci, ptr =3D end_addr & ~0xfffu; buf +=3D n; if (dma_memory_rw(ohci->as, ptr + ohci->localmem_base, buf, - len - n, dir)) { + len - n, dir, MEMTXATTRS_UNSPECIFIED)) { return -1; } return 0; --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 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=1601573189; cv=none; d=zohomail.com; s=zohoarc; b=SOiNAuWzZ4fZiJIfRf9iuQ37wT6+YU5azcOi6eRRU4PQlqc+lB29k5ALYPG0Dk6avC67czN70Xn0KelFQ24e2BQjz+UQL9uhQRkzrU/hjK5EOGVQDSTOirV4NJeCZUmaQWiL2S0QCY/Fo3V0EVWm+Usb8HJUEN34QSnUFban5HA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573189; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ugBkHQlnhK+sDMi9/8WFXRb9nZeInd3I5yt0DFb3ciE=; b=asj3ykk7Z9r5G2jsep/UN+HDN77bg0AxYhICibjQmZGIRy8n2V2mKmiwT+BAzXM3sfXJh7P0WqQ7N0sbgU/iYfMwND3jLpa9j65XRymFV4iRBP+zUFc/IjS82QE0s47iN1xbkEZjT23eyomJ1zyYMQHPIPrmI71rvUQkDGTZVuU= 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 1601573189513664.1224819090595; Thu, 1 Oct 2020 10:26:29 -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-298-xTZ7d66nOWmQws3ZdiWQBA-1; Thu, 01 Oct 2020 13:26:23 -0400 Received: by mail-wr1-f70.google.com with SMTP id j7so2341607wro.14 for ; Thu, 01 Oct 2020 10:26:23 -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 e18sm10070785wrx.50.2020.10.01.10.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573188; 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=ugBkHQlnhK+sDMi9/8WFXRb9nZeInd3I5yt0DFb3ciE=; b=TARIaT0bSU8WrY0tsiZUU8KVgNWgelkeYrKgEW7c7Q3Yb2uaCD5rLdfUaXqZIBKcaYxy2f kKdk6vf6RYpfgmEimcG6Dq/SG0szdRf+mPTurJqYrjemYCFQLJYii1LOoOH0DYRfK7B56h W8AOoVCkStXmhDvnX08TgNPoiD/7fDM= X-MC-Unique: xTZ7d66nOWmQws3ZdiWQBA-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=ugBkHQlnhK+sDMi9/8WFXRb9nZeInd3I5yt0DFb3ciE=; b=IT4MYZi7Xxj0pWvUYScy4dHx5QHaeVg5wdkWN1loiQLJV0EqRS3JJgiTtPXFlYL2T/ hT6OQBaPakQw5LAITH11rzDKJ/wY2rndCB/W68fnWtRcrbiRntB2D8fmBuMWDXfJdjBz doOZQGt1epk6oa0xQPP1TXlG8iuE32ZIvcgR2N/jZczRODLPpJp6AZNqu9ry5OAH83gB up4FRdWszUB8amkI75k3Nytvh9J3pCm0vkcrwoEJzRIZd9RmJSC9+VFynIFveghFpQpW eQozveS5bxfBOxpDwT3IX0iuDAC26ram5pwdHjN0+xbjXxsTB64Pws97MwDKKNXbTPjx F/EA== X-Gm-Message-State: AOAM530CBEFz3sZdJ1raZVh4IQdIwJcCUxF+tOUlDtYzlastBvjhT9Jq n7tma0g3rQZPdWvMJrPVWn2S2G2xzl/xxZ25Hxi3IdvqWAKJMlEngv6Slfp7eo3sQ5PVwgaAZL/ 1H8Y1Hs8lfM1n4A== X-Received: by 2002:adf:e7c4:: with SMTP id e4mr9991549wrn.113.1601573181052; Thu, 01 Oct 2020 10:26:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8c/QxLsFNJrliOAPNtzPnWKXdJ1sMmn2TslUnma55ltBlhF/SpwZ9c4qe2zfR3qy0VmsjUA== X-Received: by 2002:adf:e7c4:: with SMTP id e4mr9991510wrn.113.1601573180448; Thu, 01 Oct 2020 10:26:20 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 12/16] dma: Let dma_memory_read/write() take MemTxAttrs argument Date: Thu, 1 Oct 2020 19:25:15 +0200 Message-Id: <20201001172519.1620782-13-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_read() or dma_memory_write(). Patch created mechanically using spatch with this script: @@ expression E1, E2, E3, E4; @@ ( - dma_memory_read(E1, E2, E3, E4) + dma_memory_read(E1, E2, E3, E4, MEMTXATTRS_UNSPECIFIED) | - dma_memory_write(E1, E2, E3, E4) + dma_memory_write(E1, E2, E3, E4, MEMTXATTRS_UNSPECIFIED) ) 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 | 6 ++++-- include/sysemu/dma.h | 20 ++++++++++++-------- hw/arm/musicpal.c | 13 +++++++------ hw/arm/smmu-common.c | 3 ++- hw/arm/smmuv3.c | 14 +++++++++----- hw/core/generic-loader.c | 3 ++- hw/dma/pl330.c | 12 ++++++++---- hw/dma/sparc32_dma.c | 16 ++++++++++------ hw/dma/xlnx-zynq-devcfg.c | 6 ++++-- hw/dma/xlnx_dpdma.c | 10 ++++++---- hw/i386/amd_iommu.c | 16 +++++++++------- hw/i386/intel_iommu.c | 28 +++++++++++++++++----------- hw/ide/macio.c | 2 +- hw/intc/xive.c | 7 ++++--- hw/misc/bcm2835_property.c | 3 ++- hw/misc/macio/mac_dbdma.c | 10 ++++++---- hw/net/allwinner-sun8i-emac.c | 21 ++++++++++++++------- hw/net/ftgmac100.c | 25 ++++++++++++++++--------- hw/net/imx_fec.c | 32 ++++++++++++++++++++------------ hw/nvram/fw_cfg.c | 9 ++++++--- hw/pci-host/pnv_phb3.c | 5 +++-- hw/pci-host/pnv_phb3_msi.c | 9 ++++++--- hw/pci-host/pnv_phb4.c | 7 ++++--- hw/sd/allwinner-sdhost.c | 14 ++++++++------ hw/sd/sdhci.c | 35 ++++++++++++++++++++++------------- hw/usb/hcd-dwc2.c | 8 ++++---- hw/usb/hcd-ehci.c | 6 ++++-- hw/usb/hcd-ohci.c | 18 +++++++++++------- hw/usb/hcd-xhci.c | 18 +++++++++++------- 29 files changed, 232 insertions(+), 144 deletions(-) diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index a8d6c55953..45f47598bc 100644 --- a/include/hw/ppc/spapr_vio.h +++ b/include/hw/ppc/spapr_vio.h @@ -97,14 +97,16 @@ static inline bool spapr_vio_dma_valid(SpaprVioDevice *= dev, uint64_t taddr, static inline int spapr_vio_dma_read(SpaprVioDevice *dev, uint64_t taddr, void *buf, uint32_t size) { - return (dma_memory_read(&dev->as, taddr, buf, size) !=3D 0) ? + return (dma_memory_read(&dev->as, taddr, + buf, size, MEMTXATTRS_UNSPECIFIED) !=3D 0) ? H_DEST_PARM : H_SUCCESS; } =20 static inline int spapr_vio_dma_write(SpaprVioDevice *dev, uint64_t taddr, const void *buf, uint32_t size) { - return (dma_memory_write(&dev->as, taddr, buf, size) !=3D 0) ? + return (dma_memory_write(&dev->as, taddr, + buf, size, MEMTXATTRS_UNSPECIFIED) !=3D 0) ? H_DEST_PARM : H_SUCCESS; } =20 diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index e5885dfc91..343d755ca1 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -143,12 +143,14 @@ static inline MemTxResult dma_memory_rw(AddressSpace = *as, dma_addr_t addr, * @addr: address within that address space * @buf: buffer with the data transferred * @len: length of the data transferred + * @attrs: memory transaction attributes */ static inline MemTxResult dma_memory_read(AddressSpace *as, dma_addr_t add= r, - void *buf, dma_addr_t len) + void *buf, dma_addr_t len, + MemTxAttrs attrs) { return dma_memory_rw(as, addr, buf, len, - DMA_DIRECTION_TO_DEVICE, MEMTXATTRS_UNSPECIFIED); + DMA_DIRECTION_TO_DEVICE, attrs); } =20 /** @@ -162,12 +164,14 @@ static inline MemTxResult dma_memory_read(AddressSpac= e *as, dma_addr_t addr, * @addr: address within that address space * @buf: buffer with the data transferred * @len: the number of bytes to write + * @attrs: memory transaction attributes */ static inline MemTxResult dma_memory_write(AddressSpace *as, dma_addr_t ad= dr, - const void *buf, dma_addr_t len) + const void *buf, dma_addr_t len, + MemTxAttrs attrs) { return dma_memory_rw(as, addr, (void *)buf, len, - DMA_DIRECTION_FROM_DEVICE, MEMTXATTRS_UNSPECIFIED= ); + DMA_DIRECTION_FROM_DEVICE, attrs); } =20 /** @@ -239,7 +243,7 @@ static inline void dma_memory_unmap(AddressSpace *as, dma_addr_t add= r) \ { \ uint##_bits##_t val; \ - dma_memory_read(as, addr, &val, (_bits) / 8); \ + dma_memory_read(as, addr, &val, (_bits) / 8, MEMTXATTRS_UNSPECIFIE= D); \ return _end##_bits##_to_cpu(val); \ } \ static inline void st##_sname##_##_end##_dma(AddressSpace *as, \ @@ -247,20 +251,20 @@ static inline void dma_memory_unmap(AddressSpace *as, uint##_bits##_t val) \ { \ val =3D cpu_to_##_end##_bits(val); \ - dma_memory_write(as, addr, &val, (_bits) / 8); \ + dma_memory_write(as, addr, &val, (_bits) / 8, MEMTXATTRS_UNSPECIFI= ED); \ } =20 static inline uint8_t ldub_dma(AddressSpace *as, dma_addr_t addr) { uint8_t val; =20 - dma_memory_read(as, addr, &val, 1); + dma_memory_read(as, addr, &val, 1, MEMTXATTRS_UNSPECIFIED); return val; } =20 static inline void stb_dma(AddressSpace *as, dma_addr_t addr, uint8_t val) { - dma_memory_write(as, addr, &val, 1); + dma_memory_write(as, addr, &val, 1, MEMTXATTRS_UNSPECIFIED); } =20 DEFINE_LDST_DMA(uw, w, 16, le); diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 5eb3f969fb..e9c646c347 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -187,13 +187,13 @@ static void eth_rx_desc_put(AddressSpace *dma_as, uin= t32_t addr, cpu_to_le16s(&desc->buffer_size); cpu_to_le32s(&desc->buffer); cpu_to_le32s(&desc->next); - dma_memory_write(dma_as, addr, desc, sizeof(*desc)); + dma_memory_write(dma_as, addr, desc, sizeof(*desc), MEMTXATTRS_UNSPECI= FIED); } =20 static void eth_rx_desc_get(AddressSpace *dma_as, uint32_t addr, mv88w8618_rx_desc *desc) { - dma_memory_read(dma_as, addr, desc, sizeof(*desc)); + dma_memory_read(dma_as, addr, desc, sizeof(*desc), MEMTXATTRS_UNSPECIF= IED); le32_to_cpus(&desc->cmdstat); le16_to_cpus(&desc->bytes); le16_to_cpus(&desc->buffer_size); @@ -217,7 +217,7 @@ static ssize_t eth_receive(NetClientState *nc, const ui= nt8_t *buf, size_t size) eth_rx_desc_get(&s->dma_as, desc_addr, &desc); if ((desc.cmdstat & MP_ETH_RX_OWN) && desc.buffer_size >=3D si= ze) { dma_memory_write(&s->dma_as, desc.buffer + s->vlan_header, - buf, size); + buf, size, MEMTXATTRS_UNSPECIFIED); desc.bytes =3D size + s->vlan_header; desc.cmdstat &=3D ~MP_ETH_RX_OWN; s->cur_rx[i] =3D desc.next; @@ -243,13 +243,13 @@ static void eth_tx_desc_put(AddressSpace *dma_as, uin= t32_t addr, cpu_to_le16s(&desc->bytes); cpu_to_le32s(&desc->buffer); cpu_to_le32s(&desc->next); - dma_memory_write(dma_as, addr, desc, sizeof(*desc)); + dma_memory_write(dma_as, addr, desc, sizeof(*desc), MEMTXATTRS_UNSPECI= FIED); } =20 static void eth_tx_desc_get(AddressSpace *dma_as, uint32_t addr, mv88w8618_tx_desc *desc) { - dma_memory_read(dma_as, addr, desc, sizeof(*desc)); + dma_memory_read(dma_as, addr, desc, sizeof(*desc), MEMTXATTRS_UNSPECIF= IED); le32_to_cpus(&desc->cmdstat); le16_to_cpus(&desc->res); le16_to_cpus(&desc->bytes); @@ -271,7 +271,8 @@ static void eth_send(mv88w8618_eth_state *s, int queue_= index) if (desc.cmdstat & MP_ETH_TX_OWN) { len =3D desc.bytes; if (len < 2048) { - dma_memory_read(&s->dma_as, desc.buffer, buf, len); + dma_memory_read(&s->dma_as, desc.buffer, buf, len, + MEMTXATTRS_UNSPECIFIED); qemu_send_packet(qemu_get_queue(s->nic), buf, len); } desc.cmdstat &=3D ~MP_ETH_TX_OWN; diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index 3838db1395..f42ee23720 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -188,7 +188,8 @@ static int get_pte(dma_addr_t baseaddr, uint32_t index,= uint64_t *pte, dma_addr_t addr =3D baseaddr + index * sizeof(*pte); =20 /* TODO: guarantee 64-bit single-copy atomicity */ - ret =3D dma_memory_read(&address_space_memory, addr, pte, sizeof(*pte)= ); + ret =3D dma_memory_read(&address_space_memory, addr, pte, sizeof(*pte), + MEMTXATTRS_UNSPECIFIED); =20 if (ret !=3D MEMTX_OK) { info->type =3D SMMU_PTW_ERR_WALK_EABT; diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index 0122700e72..71d0eea2af 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -101,7 +101,8 @@ static inline MemTxResult queue_read(SMMUQueue *q, void= *data) { dma_addr_t addr =3D Q_CONS_ENTRY(q); =20 - return dma_memory_read(&address_space_memory, addr, data, q->entry_siz= e); + return dma_memory_read(&address_space_memory, addr, data, q->entry_siz= e, + MEMTXATTRS_UNSPECIFIED); } =20 static MemTxResult queue_write(SMMUQueue *q, void *data) @@ -109,7 +110,8 @@ static MemTxResult queue_write(SMMUQueue *q, void *data) dma_addr_t addr =3D Q_PROD_ENTRY(q); MemTxResult ret; =20 - ret =3D dma_memory_write(&address_space_memory, addr, data, q->entry_s= ize); + ret =3D dma_memory_write(&address_space_memory, addr, data, q->entry_s= ize, + MEMTXATTRS_UNSPECIFIED); if (ret !=3D MEMTX_OK) { return ret; } @@ -283,7 +285,8 @@ static int smmu_get_ste(SMMUv3State *s, dma_addr_t addr= , STE *buf, =20 trace_smmuv3_get_ste(addr); /* TODO: guarantee 64-bit single-copy atomicity */ - ret =3D dma_memory_read(&address_space_memory, addr, buf, sizeof(*buf)= ); + ret =3D dma_memory_read(&address_space_memory, addr, buf, sizeof(*buf), + MEMTXATTRS_UNSPECIFIED); if (ret !=3D MEMTX_OK) { qemu_log_mask(LOG_GUEST_ERROR, "Cannot fetch pte at address=3D0x%"PRIx64"\n", addr); @@ -304,7 +307,8 @@ static int smmu_get_cd(SMMUv3State *s, STE *ste, uint32= _t ssid, =20 trace_smmuv3_get_cd(addr); /* TODO: guarantee 64-bit single-copy atomicity */ - ret =3D dma_memory_read(&address_space_memory, addr, buf, sizeof(*buf)= ); + ret =3D dma_memory_read(&address_space_memory, addr, buf, sizeof(*buf), + MEMTXATTRS_UNSPECIFIED); if (ret !=3D MEMTX_OK) { qemu_log_mask(LOG_GUEST_ERROR, "Cannot fetch pte at address=3D0x%"PRIx64"\n", addr); @@ -409,7 +413,7 @@ static int smmu_find_ste(SMMUv3State *s, uint32_t sid, = STE *ste, l1ptr =3D (dma_addr_t)(strtab_base + l1_ste_offset * sizeof(l1std)= ); /* TODO: guarantee 64-bit single-copy atomicity */ ret =3D dma_memory_read(&address_space_memory, l1ptr, &l1std, - sizeof(l1std)); + sizeof(l1std), MEMTXATTRS_UNSPECIFIED); if (ret !=3D MEMTX_OK) { qemu_log_mask(LOG_GUEST_ERROR, "Could not read L1PTR at 0X%"PRIx64"\n", l1ptr); diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c index a242c076f6..ba48ebae99 100644 --- a/hw/core/generic-loader.c +++ b/hw/core/generic-loader.c @@ -57,7 +57,8 @@ static void generic_loader_reset(void *opaque) =20 if (s->data_len) { assert(s->data_len < sizeof(s->data)); - dma_memory_write(s->cpu->as, s->addr, &s->data, s->data_len); + dma_memory_write(s->cpu->as, s->addr, &s->data, s->data_len, + MEMTXATTRS_UNSPECIFIED); } } =20 diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c index 944ba296b0..e10d424890 100644 --- a/hw/dma/pl330.c +++ b/hw/dma/pl330.c @@ -1108,7 +1108,8 @@ static inline const PL330InsnDesc *pl330_fetch_insn(P= L330Chan *ch) uint8_t opcode; int i; =20 - dma_memory_read(&address_space_memory, ch->pc, &opcode, 1); + dma_memory_read(&address_space_memory, ch->pc, &opcode, 1, + MEMTXATTRS_UNSPECIFIED); for (i =3D 0; insn_desc[i].size; i++) { if ((opcode & insn_desc[i].opmask) =3D=3D insn_desc[i].opcode) { return &insn_desc[i]; @@ -1122,7 +1123,8 @@ static inline void pl330_exec_insn(PL330Chan *ch, con= st PL330InsnDesc *insn) uint8_t buf[PL330_INSN_MAXSIZE]; =20 assert(insn->size <=3D PL330_INSN_MAXSIZE); - dma_memory_read(&address_space_memory, ch->pc, buf, insn->size); + dma_memory_read(&address_space_memory, ch->pc, buf, insn->size, + MEMTXATTRS_UNSPECIFIED); insn->exec(ch, buf[0], &buf[1], insn->size - 1); } =20 @@ -1186,7 +1188,8 @@ static int pl330_exec_cycle(PL330Chan *channel) if (q !=3D NULL && q->len <=3D pl330_fifo_num_free(&s->fifo)) { int len =3D q->len - (q->addr & (q->len - 1)); =20 - dma_memory_read(&address_space_memory, q->addr, buf, len); + dma_memory_read(&address_space_memory, q->addr, buf, len, + MEMTXATTRS_UNSPECIFIED); trace_pl330_exec_cycle(q->addr, len); if (trace_event_get_state_backends(TRACE_PL330_HEXDUMP)) { pl330_hexdump(buf, len); @@ -1217,7 +1220,8 @@ static int pl330_exec_cycle(PL330Chan *channel) fifo_res =3D pl330_fifo_get(&s->fifo, buf, len, q->tag); } if (fifo_res =3D=3D PL330_FIFO_OK || q->z) { - dma_memory_write(&address_space_memory, q->addr, buf, len); + dma_memory_write(&address_space_memory, q->addr, buf, len, + MEMTXATTRS_UNSPECIFIED); trace_pl330_exec_cycle(q->addr, len); if (trace_event_get_state_backends(TRACE_PL330_HEXDUMP)) { pl330_hexdump(buf, len); diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c index d20a5bc065..5e3cf5ff9a 100644 --- a/hw/dma/sparc32_dma.c +++ b/hw/dma/sparc32_dma.c @@ -81,11 +81,11 @@ void ledma_memory_read(void *opaque, hwaddr addr, addr |=3D s->dmaregs[3]; trace_ledma_memory_read(addr, len); if (do_bswap) { - dma_memory_read(&is->iommu_as, addr, buf, len); + dma_memory_read(&is->iommu_as, addr, buf, len, MEMTXATTRS_UNSPECIF= IED); } else { addr &=3D ~1; len &=3D ~1; - dma_memory_read(&is->iommu_as, addr, buf, len); + dma_memory_read(&is->iommu_as, addr, buf, len, MEMTXATTRS_UNSPECIF= IED); for(i =3D 0; i < len; i +=3D 2) { bswap16s((uint16_t *)(buf + i)); } @@ -103,7 +103,8 @@ void ledma_memory_write(void *opaque, hwaddr addr, addr |=3D s->dmaregs[3]; trace_ledma_memory_write(addr, len); if (do_bswap) { - dma_memory_write(&is->iommu_as, addr, buf, len); + dma_memory_write(&is->iommu_as, addr, buf, len, + MEMTXATTRS_UNSPECIFIED); } else { addr &=3D ~1; len &=3D ~1; @@ -114,7 +115,8 @@ void ledma_memory_write(void *opaque, hwaddr addr, for(i =3D 0; i < l; i +=3D 2) { tmp_buf[i >> 1] =3D bswap16(*(uint16_t *)(buf + i)); } - dma_memory_write(&is->iommu_as, addr, tmp_buf, l); + dma_memory_write(&is->iommu_as, addr, tmp_buf, l, + MEMTXATTRS_UNSPECIFIED); len -=3D l; buf +=3D l; addr +=3D l; @@ -148,7 +150,8 @@ void espdma_memory_read(void *opaque, uint8_t *buf, int= len) IOMMUState *is =3D (IOMMUState *)s->iommu; =20 trace_espdma_memory_read(s->dmaregs[1], len); - dma_memory_read(&is->iommu_as, s->dmaregs[1], buf, len); + dma_memory_read(&is->iommu_as, s->dmaregs[1], buf, len, + MEMTXATTRS_UNSPECIFIED); s->dmaregs[1] +=3D len; } =20 @@ -158,7 +161,8 @@ void espdma_memory_write(void *opaque, uint8_t *buf, in= t len) IOMMUState *is =3D (IOMMUState *)s->iommu; =20 trace_espdma_memory_write(s->dmaregs[1], len); - dma_memory_write(&is->iommu_as, s->dmaregs[1], buf, len); + dma_memory_write(&is->iommu_as, s->dmaregs[1], buf, len, + MEMTXATTRS_UNSPECIFIED); s->dmaregs[1] +=3D len; } =20 diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c index e33112b6f0..f5ad1a0d22 100644 --- a/hw/dma/xlnx-zynq-devcfg.c +++ b/hw/dma/xlnx-zynq-devcfg.c @@ -161,12 +161,14 @@ static void xlnx_zynq_devcfg_dma_go(XlnxZynqDevcfg *s) btt =3D MIN(btt, dmah->dest_len); } DB_PRINT("reading %x bytes from %x\n", btt, dmah->src_addr); - dma_memory_read(&address_space_memory, dmah->src_addr, buf, btt); + dma_memory_read(&address_space_memory, dmah->src_addr, buf, btt, + MEMTXATTRS_UNSPECIFIED); dmah->src_len -=3D btt; dmah->src_addr +=3D btt; if (loopback && (dmah->src_len || dmah->dest_len)) { DB_PRINT("writing %x bytes from %x\n", btt, dmah->dest_addr); - dma_memory_write(&address_space_memory, dmah->dest_addr, buf, = btt); + dma_memory_write(&address_space_memory, dmah->dest_addr, buf, = btt, + MEMTXATTRS_UNSPECIFIED); dmah->dest_len -=3D btt; dmah->dest_addr +=3D btt; } diff --git a/hw/dma/xlnx_dpdma.c b/hw/dma/xlnx_dpdma.c index 967548abd3..2d7eae72cd 100644 --- a/hw/dma/xlnx_dpdma.c +++ b/hw/dma/xlnx_dpdma.c @@ -652,7 +652,7 @@ size_t xlnx_dpdma_start_operation(XlnxDPDMAState *s, ui= nt8_t channel, } =20 if (dma_memory_read(&address_space_memory, desc_addr, &desc, - sizeof(DPDMADescriptor))) { + sizeof(DPDMADescriptor), MEMTXATTRS_UNSPECIFIE= D)) { s->registers[DPDMA_EISR] |=3D ((1 << 1) << channel); xlnx_dpdma_update_irq(s); s->operation_finished[channel] =3D true; @@ -708,7 +708,8 @@ size_t xlnx_dpdma_start_operation(XlnxDPDMAState *s, ui= nt8_t channel, if (dma_memory_read(&address_space_memory, source_addr[0], &s->data[channel][ptr], - line_size)) { + line_size, + MEMTXATTRS_UNSPECIFIED)) { s->registers[DPDMA_ISR] |=3D ((1 << 12) << channel= ); xlnx_dpdma_update_irq(s); DPRINTF("Can't get data.\n"); @@ -736,7 +737,8 @@ size_t xlnx_dpdma_start_operation(XlnxDPDMAState *s, ui= nt8_t channel, if (dma_memory_read(&address_space_memory, source_addr[frag], &(s->data[channel][ptr]), - fragment_len)) { + fragment_len, + MEMTXATTRS_UNSPECIFIED)) { s->registers[DPDMA_ISR] |=3D ((1 << 12) << channel= ); xlnx_dpdma_update_irq(s); DPRINTF("Can't get data.\n"); @@ -754,7 +756,7 @@ size_t xlnx_dpdma_start_operation(XlnxDPDMAState *s, ui= nt8_t channel, DPRINTF("update the descriptor with the done flag set.\n"); xlnx_dpdma_desc_set_done(&desc); dma_memory_write(&address_space_memory, desc_addr, &desc, - sizeof(DPDMADescriptor)); + sizeof(DPDMADescriptor), MEMTXATTRS_UNSPECIFI= ED); } =20 if (xlnx_dpdma_desc_completion_interrupt(&desc)) { diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c index 74a93a5d93..3c2a1a61db 100644 --- a/hw/i386/amd_iommu.c +++ b/hw/i386/amd_iommu.c @@ -181,7 +181,7 @@ static void amdvi_log_event(AMDVIState *s, uint64_t *ev= t) } =20 if (dma_memory_write(&address_space_memory, s->evtlog + s->evtlog_tail, - evt, AMDVI_EVENT_LEN)) { + evt, AMDVI_EVENT_LEN, MEMTXATTRS_UNSPECIFIED)) { trace_amdvi_evntlog_fail(s->evtlog, s->evtlog_tail); } =20 @@ -376,7 +376,8 @@ static void amdvi_completion_wait(AMDVIState *s, uint64= _t *cmd) } if (extract64(cmd[0], 0, 1)) { if (dma_memory_write(&address_space_memory, addr, &data, - AMDVI_COMPLETION_DATA_SIZE)) { + AMDVI_COMPLETION_DATA_SIZE, + MEMTXATTRS_UNSPECIFIED)) { trace_amdvi_completion_wait_fail(addr); } } @@ -502,7 +503,7 @@ static void amdvi_cmdbuf_exec(AMDVIState *s) uint64_t cmd[2]; =20 if (dma_memory_read(&address_space_memory, s->cmdbuf + s->cmdbuf_head, - cmd, AMDVI_COMMAND_SIZE)) { + cmd, AMDVI_COMMAND_SIZE, MEMTXATTRS_UNSPECIFIED)) { trace_amdvi_command_read_fail(s->cmdbuf, s->cmdbuf_head); amdvi_log_command_error(s, s->cmdbuf + s->cmdbuf_head); return; @@ -836,7 +837,7 @@ static bool amdvi_get_dte(AMDVIState *s, int devid, uin= t64_t *entry) uint32_t offset =3D devid * AMDVI_DEVTAB_ENTRY_SIZE; =20 if (dma_memory_read(&address_space_memory, s->devtab + offset, entry, - AMDVI_DEVTAB_ENTRY_SIZE)) { + AMDVI_DEVTAB_ENTRY_SIZE, MEMTXATTRS_UNSPECIFIED)) { trace_amdvi_dte_get_fail(s->devtab, offset); /* log error accessing dte */ amdvi_log_devtab_error(s, devid, s->devtab + offset, 0); @@ -881,7 +882,8 @@ static inline uint64_t amdvi_get_pte_entry(AMDVIState *= s, uint64_t pte_addr, { uint64_t pte; =20 - if (dma_memory_read(&address_space_memory, pte_addr, &pte, sizeof(pte)= )) { + if (dma_memory_read(&address_space_memory, pte_addr, + &pte, sizeof(pte), MEMTXATTRS_UNSPECIFIED)) { trace_amdvi_get_pte_hwerror(pte_addr); amdvi_log_pagetab_error(s, devid, pte_addr, 0); pte =3D 0; @@ -1048,7 +1050,7 @@ static int amdvi_get_irte(AMDVIState *s, MSIMessage *= origin, uint64_t *dte, trace_amdvi_ir_irte(irte_root, offset); =20 if (dma_memory_read(&address_space_memory, irte_root + offset, - irte, sizeof(*irte))) { + irte, sizeof(*irte), MEMTXATTRS_UNSPECIFIED)) { trace_amdvi_ir_err("failed to get irte"); return -AMDVI_IR_GET_IRTE; } @@ -1108,7 +1110,7 @@ static int amdvi_get_irte_ga(AMDVIState *s, MSIMessag= e *origin, uint64_t *dte, trace_amdvi_ir_irte(irte_root, offset); =20 if (dma_memory_read(&address_space_memory, irte_root + offset, - irte, sizeof(*irte))) { + irte, sizeof(*irte), MEMTXATTRS_UNSPECIFIED)) { trace_amdvi_ir_err("failed to get irte_ga"); return -AMDVI_IR_GET_IRTE; } diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 749eb6ad63..8de57dd995 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -570,7 +570,8 @@ static int vtd_get_root_entry(IntelIOMMUState *s, uint8= _t index, dma_addr_t addr; =20 addr =3D s->root + index * sizeof(*re); - if (dma_memory_read(&address_space_memory, addr, re, sizeof(*re))) { + if (dma_memory_read(&address_space_memory, addr, + re, sizeof(*re), MEMTXATTRS_UNSPECIFIED)) { re->lo =3D 0; return -VTD_FR_ROOT_TABLE_INV; } @@ -603,7 +604,8 @@ static int vtd_get_context_entry_from_root(IntelIOMMUSt= ate *s, } =20 addr =3D addr + index * ce_size; - if (dma_memory_read(&address_space_memory, addr, ce, ce_size)) { + if (dma_memory_read(&address_space_memory, addr, + ce, ce_size, MEMTXATTRS_UNSPECIFIED)) { return -VTD_FR_CONTEXT_TABLE_INV; } =20 @@ -640,8 +642,8 @@ static uint64_t vtd_get_slpte(dma_addr_t base_addr, uin= t32_t index) assert(index < VTD_SL_PT_ENTRY_NR); =20 if (dma_memory_read(&address_space_memory, - base_addr + index * sizeof(slpte), &slpte, - sizeof(slpte))) { + base_addr + index * sizeof(slpte), + &slpte, sizeof(slpte), MEMTXATTRS_UNSPECIFIED)) { slpte =3D (uint64_t)-1; return slpte; } @@ -705,7 +707,8 @@ static int vtd_get_pdire_from_pdir_table(dma_addr_t pas= id_dir_base, index =3D VTD_PASID_DIR_INDEX(pasid); entry_size =3D VTD_PASID_DIR_ENTRY_SIZE; addr =3D pasid_dir_base + index * entry_size; - if (dma_memory_read(&address_space_memory, addr, pdire, entry_size)) { + if (dma_memory_read(&address_space_memory, addr, + pdire, entry_size, MEMTXATTRS_UNSPECIFIED)) { return -VTD_FR_PASID_TABLE_INV; } =20 @@ -729,7 +732,8 @@ static int vtd_get_pe_in_pasid_leaf_table(IntelIOMMUSta= te *s, index =3D VTD_PASID_TABLE_INDEX(pasid); entry_size =3D VTD_PASID_ENTRY_SIZE; addr =3D addr + index * entry_size; - if (dma_memory_read(&address_space_memory, addr, pe, entry_size)) { + if (dma_memory_read(&address_space_memory, addr, + pe, entry_size, MEMTXATTRS_UNSPECIFIED)) { return -VTD_FR_PASID_TABLE_INV; } =20 @@ -2262,7 +2266,8 @@ static bool vtd_get_inv_desc(IntelIOMMUState *s, uint32_t dw =3D s->iq_dw ? 32 : 16; dma_addr_t addr =3D base_addr + offset * dw; =20 - if (dma_memory_read(&address_space_memory, addr, inv_desc, dw)) { + if (dma_memory_read(&address_space_memory, addr, + inv_desc, dw, MEMTXATTRS_UNSPECIFIED)) { error_report_once("Read INV DESC failed."); return false; } @@ -2295,8 +2300,9 @@ static bool vtd_process_wait_desc(IntelIOMMUState *s,= VTDInvDesc *inv_desc) dma_addr_t status_addr =3D inv_desc->hi; trace_vtd_inv_desc_wait_sw(status_addr, status_data); status_data =3D cpu_to_le32(status_data); - if (dma_memory_write(&address_space_memory, status_addr, &status_d= ata, - sizeof(status_data))) { + if (dma_memory_write(&address_space_memory, status_addr, + &status_data, sizeof(status_data), + MEMTXATTRS_UNSPECIFIED)) { trace_vtd_inv_desc_wait_write_fail(inv_desc->hi, inv_desc->lo); return false; } @@ -3106,8 +3112,8 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint1= 6_t index, } =20 addr =3D iommu->intr_root + index * sizeof(*entry); - if (dma_memory_read(&address_space_memory, addr, entry, - sizeof(*entry))) { + if (dma_memory_read(&address_space_memory, addr, + entry, sizeof(*entry), MEMTXATTRS_UNSPECIFIED)) { error_report_once("%s: read failed: ind=3D0x%x addr=3D0x%" PRIx64, __func__, index, addr); return -VTD_FR_IR_ROOT_INVAL; diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 62a599a075..a93a2b75a8 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -97,7 +97,7 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int = ret) /* Non-block ATAPI transfer - just copy to RAM */ s->io_buffer_size =3D MIN(s->io_buffer_size, io->len); dma_memory_write(&address_space_memory, io->addr, s->io_buffer, - s->io_buffer_size); + s->io_buffer_size, MEMTXATTRS_UNSPECIFIED); io->len =3D 0; ide_atapi_cmd_ok(s); m->dma_active =3D false; diff --git a/hw/intc/xive.c b/hw/intc/xive.c index 489e6256ef..8e8618c1ab 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -1236,8 +1236,8 @@ void xive_end_queue_pic_print_info(XiveEND *end, uint= 32_t width, Monitor *mon) uint64_t qaddr =3D qaddr_base + (qindex << 2); uint32_t qdata =3D -1; =20 - if (dma_memory_read(&address_space_memory, qaddr, &qdata, - sizeof(qdata))) { + if (dma_memory_read(&address_space_memory, qaddr, + &qdata, sizeof(qdata), MEMTXATTRS_UNSPECIFIED)= ) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: failed to read EQ @0x%" HWADDR_PRIx "\n", qaddr); return; @@ -1300,7 +1300,8 @@ static void xive_end_enqueue(XiveEND *end, uint32_t d= ata) uint32_t qdata =3D cpu_to_be32((qgen << 31) | (data & 0x7fffffff)); uint32_t qentries =3D 1 << (qsize + 10); =20 - if (dma_memory_write(&address_space_memory, qaddr, &qdata, sizeof(qdat= a))) { + if (dma_memory_write(&address_space_memory, qaddr, + &qdata, sizeof(qdata), MEMTXATTRS_UNSPECIFIED)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: failed to write END data @0x= %" HWADDR_PRIx "\n", qaddr); return; diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c index 73941bdae9..76ea511d53 100644 --- a/hw/misc/bcm2835_property.c +++ b/hw/misc/bcm2835_property.c @@ -69,7 +69,8 @@ static void bcm2835_property_mbox_push(BCM2835PropertySta= te *s, uint32_t value) break; case 0x00010003: /* Get board MAC address */ resplen =3D sizeof(s->macaddr.a); - dma_memory_write(&s->dma_as, value + 12, s->macaddr.a, resplen= ); + dma_memory_write(&s->dma_as, value + 12, s->macaddr.a, resplen, + MEMTXATTRS_UNSPECIFIED); break; case 0x00010004: /* Get board serial */ qemu_log_mask(LOG_UNIMP, diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c index e220f1a927..efcc02609f 100644 --- a/hw/misc/macio/mac_dbdma.c +++ b/hw/misc/macio/mac_dbdma.c @@ -94,7 +94,7 @@ static void dbdma_cmdptr_load(DBDMA_channel *ch) DBDMA_DPRINTFCH(ch, "dbdma_cmdptr_load 0x%08x\n", ch->regs[DBDMA_CMDPTR_LO]); dma_memory_read(&address_space_memory, ch->regs[DBDMA_CMDPTR_LO], - &ch->current, sizeof(dbdma_cmd)); + &ch->current, sizeof(dbdma_cmd), MEMTXATTRS_UNSPECIFIE= D); } =20 static void dbdma_cmdptr_save(DBDMA_channel *ch) @@ -104,7 +104,7 @@ static void dbdma_cmdptr_save(DBDMA_channel *ch) le16_to_cpu(ch->current.xfer_status), le16_to_cpu(ch->current.res_count)); dma_memory_write(&address_space_memory, ch->regs[DBDMA_CMDPTR_LO], - &ch->current, sizeof(dbdma_cmd)); + &ch->current, sizeof(dbdma_cmd), MEMTXATTRS_UNSPECIFI= ED); } =20 static void kill_channel(DBDMA_channel *ch) @@ -371,7 +371,8 @@ static void load_word(DBDMA_channel *ch, int key, uint3= 2_t addr, return; } =20 - dma_memory_read(&address_space_memory, addr, ¤t->cmd_dep, len); + dma_memory_read(&address_space_memory, addr, ¤t->cmd_dep, len, + MEMTXATTRS_UNSPECIFIED); =20 if (conditional_wait(ch)) goto wait; @@ -403,7 +404,8 @@ static void store_word(DBDMA_channel *ch, int key, uint= 32_t addr, return; } =20 - dma_memory_write(&address_space_memory, addr, ¤t->cmd_dep, len); + dma_memory_write(&address_space_memory, addr, ¤t->cmd_dep, len, + MEMTXATTRS_UNSPECIFIED); =20 if (conditional_wait(ch)) goto wait; diff --git a/hw/net/allwinner-sun8i-emac.c b/hw/net/allwinner-sun8i-emac.c index 38d328587e..5189ad7752 100644 --- a/hw/net/allwinner-sun8i-emac.c +++ b/hw/net/allwinner-sun8i-emac.c @@ -345,7 +345,8 @@ static uint32_t allwinner_sun8i_emac_next_desc(AwSun8iE= macState *s, { uint32_t paddr =3D desc->next; =20 - dma_memory_read(&s->dma_as, paddr, desc, sizeof(*desc)); + dma_memory_read(&s->dma_as, paddr, desc, sizeof(*desc), + MEMTXATTRS_UNSPECIFIED); =20 if ((desc->status & DESC_STATUS_CTL) && (desc->status2 & DESC_STATUS2_BUF_SIZE_MASK) >=3D min_size) { @@ -364,7 +365,8 @@ static uint32_t allwinner_sun8i_emac_get_desc(AwSun8iEm= acState *s, =20 /* Note that the list is a cycle. Last entry points back to the head. = */ while (desc_addr !=3D 0) { - dma_memory_read(&s->dma_as, desc_addr, desc, sizeof(*desc)); + dma_memory_read(&s->dma_as, desc_addr, desc, sizeof(*desc), + MEMTXATTRS_UNSPECIFIED); =20 if ((desc->status & DESC_STATUS_CTL) && (desc->status2 & DESC_STATUS2_BUF_SIZE_MASK) >=3D min_size) { @@ -397,7 +399,8 @@ static void allwinner_sun8i_emac_flush_desc(AwSun8iEmac= State *s, FrameDescriptor *desc, uint32_t phys_addr) { - dma_memory_write(&s->dma_as, phys_addr, desc, sizeof(*desc)); + dma_memory_write(&s->dma_as, phys_addr, desc, sizeof(*desc), + MEMTXATTRS_UNSPECIFIED); } =20 static bool allwinner_sun8i_emac_can_receive(NetClientState *nc) @@ -455,7 +458,8 @@ static ssize_t allwinner_sun8i_emac_receive(NetClientSt= ate *nc, << RX_DESC_STATUS_FRM_LEN_SHIFT; } =20 - dma_memory_write(&s->dma_as, desc.addr, buf, desc_bytes); + dma_memory_write(&s->dma_as, desc.addr, buf, desc_bytes, + MEMTXATTRS_UNSPECIFIED); allwinner_sun8i_emac_flush_desc(s, &desc, s->rx_desc_curr); trace_allwinner_sun8i_emac_receive(s->rx_desc_curr, desc.addr, desc_bytes); @@ -506,7 +510,8 @@ static void allwinner_sun8i_emac_transmit(AwSun8iEmacSt= ate *s) desc.status |=3D TX_DESC_STATUS_LENGTH_ERR; break; } - dma_memory_read(&s->dma_as, desc.addr, packet_buf + packet_bytes, = bytes); + dma_memory_read(&s->dma_as, desc.addr, packet_buf + packet_bytes, + bytes, MEMTXATTRS_UNSPECIFIED); packet_bytes +=3D bytes; desc.status &=3D ~DESC_STATUS_CTL; allwinner_sun8i_emac_flush_desc(s, &desc, s->tx_desc_curr); @@ -628,7 +633,8 @@ static uint64_t allwinner_sun8i_emac_read(void *opaque,= hwaddr offset, break; case REG_TX_CUR_BUF: /* Transmit Current Buffer */ if (s->tx_desc_curr !=3D 0) { - dma_memory_read(&s->dma_as, s->tx_desc_curr, &desc, sizeof(des= c)); + dma_memory_read(&s->dma_as, s->tx_desc_curr, &desc, sizeof(des= c), + MEMTXATTRS_UNSPECIFIED); value =3D desc.addr; } else { value =3D 0; @@ -641,7 +647,8 @@ static uint64_t allwinner_sun8i_emac_read(void *opaque,= hwaddr offset, break; case REG_RX_CUR_BUF: /* Receive Current Buffer */ if (s->rx_desc_curr !=3D 0) { - dma_memory_read(&s->dma_as, s->rx_desc_curr, &desc, sizeof(des= c)); + dma_memory_read(&s->dma_as, s->rx_desc_curr, &desc, sizeof(des= c), + MEMTXATTRS_UNSPECIFIED); value =3D desc.addr; } else { value =3D 0; diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c index 782ff192ce..ee2da50094 100644 --- a/hw/net/ftgmac100.c +++ b/hw/net/ftgmac100.c @@ -453,7 +453,8 @@ static void do_phy_ctl(FTGMAC100State *s) =20 static int ftgmac100_read_bd(FTGMAC100Desc *bd, dma_addr_t addr) { - if (dma_memory_read(&address_space_memory, addr, bd, sizeof(*bd))) { + if (dma_memory_read(&address_space_memory, addr, + bd, sizeof(*bd), MEMTXATTRS_UNSPECIFIED)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: failed to read descriptor @ 0x= %" HWADDR_PRIx "\n", __func__, addr); return -1; @@ -473,7 +474,8 @@ static int ftgmac100_write_bd(FTGMAC100Desc *bd, dma_ad= dr_t addr) lebd.des1 =3D cpu_to_le32(bd->des1); lebd.des2 =3D cpu_to_le32(bd->des2); lebd.des3 =3D cpu_to_le32(bd->des3); - if (dma_memory_write(&address_space_memory, addr, &lebd, sizeof(lebd))= ) { + if (dma_memory_write(&address_space_memory, addr, + &lebd, sizeof(lebd), MEMTXATTRS_UNSPECIFIED)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: failed to write descriptor @ 0= x%" HWADDR_PRIx "\n", __func__, addr); return -1; @@ -554,7 +556,8 @@ static void ftgmac100_do_tx(FTGMAC100State *s, uint32_t= tx_ring, len =3D sizeof(s->frame) - frame_size; } =20 - if (dma_memory_read(&address_space_memory, bd.des3, ptr, len)) { + if (dma_memory_read(&address_space_memory, bd.des3, + ptr, len, MEMTXATTRS_UNSPECIFIED)) { qemu_log_mask(LOG_GUEST_ERROR, "%s: failed to read packet @ 0x= %x\n", __func__, bd.des3); s->isr |=3D FTGMAC100_INT_AHB_ERR; @@ -1019,20 +1022,24 @@ static ssize_t ftgmac100_receive(NetClientState *nc= , const uint8_t *buf, bd.des1 =3D lduw_be_p(buf + 14) | FTGMAC100_RXDES1_VLANTAG_AVA= IL; =20 if (s->maccr & FTGMAC100_MACCR_RM_VLAN) { - dma_memory_write(&address_space_memory, buf_addr, buf, 12); - dma_memory_write(&address_space_memory, buf_addr + 12, buf= + 16, - buf_len - 16); + dma_memory_write(&address_space_memory, buf_addr, buf, 12, + MEMTXATTRS_UNSPECIFIED); + dma_memory_write(&address_space_memory, buf_addr + 12, + buf + 16, buf_len - 16, + MEMTXATTRS_UNSPECIFIED); } else { - dma_memory_write(&address_space_memory, buf_addr, buf, buf= _len); + dma_memory_write(&address_space_memory, buf_addr, buf, + buf_len, MEMTXATTRS_UNSPECIFIED); } } else { bd.des1 =3D 0; - dma_memory_write(&address_space_memory, buf_addr, buf, buf_len= ); + dma_memory_write(&address_space_memory, buf_addr, buf, buf_len, + MEMTXATTRS_UNSPECIFIED); } buf +=3D buf_len; if (size < 4) { dma_memory_write(&address_space_memory, buf_addr + buf_len, - crc_ptr, 4 - size); + crc_ptr, 4 - size, MEMTXATTRS_UNSPECIFIED); crc_ptr +=3D 4 - size; } =20 diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c index 2c14804041..ff4c345f09 100644 --- a/hw/net/imx_fec.c +++ b/hw/net/imx_fec.c @@ -389,19 +389,22 @@ static void imx_phy_write(IMXFECState *s, int reg, ui= nt32_t val) =20 static void imx_fec_read_bd(IMXFECBufDesc *bd, dma_addr_t addr) { - dma_memory_read(&address_space_memory, addr, bd, sizeof(*bd)); + dma_memory_read(&address_space_memory, addr, bd, sizeof(*bd), + MEMTXATTRS_UNSPECIFIED); =20 trace_imx_fec_read_bd(addr, bd->flags, bd->length, bd->data); } =20 static void imx_fec_write_bd(IMXFECBufDesc *bd, dma_addr_t addr) { - dma_memory_write(&address_space_memory, addr, bd, sizeof(*bd)); + dma_memory_write(&address_space_memory, addr, bd, sizeof(*bd), + MEMTXATTRS_UNSPECIFIED); } =20 static void imx_enet_read_bd(IMXENETBufDesc *bd, dma_addr_t addr) { - dma_memory_read(&address_space_memory, addr, bd, sizeof(*bd)); + dma_memory_read(&address_space_memory, addr, bd, sizeof(*bd), + MEMTXATTRS_UNSPECIFIED); =20 trace_imx_enet_read_bd(addr, bd->flags, bd->length, bd->data, bd->option, bd->status); @@ -409,7 +412,8 @@ static void imx_enet_read_bd(IMXENETBufDesc *bd, dma_ad= dr_t addr) =20 static void imx_enet_write_bd(IMXENETBufDesc *bd, dma_addr_t addr) { - dma_memory_write(&address_space_memory, addr, bd, sizeof(*bd)); + dma_memory_write(&address_space_memory, addr, bd, sizeof(*bd), + MEMTXATTRS_UNSPECIFIED); } =20 static void imx_eth_update(IMXFECState *s) @@ -476,7 +480,8 @@ static void imx_fec_do_tx(IMXFECState *s) len =3D ENET_MAX_FRAME_SIZE - frame_size; s->regs[ENET_EIR] |=3D ENET_INT_BABT; } - dma_memory_read(&address_space_memory, bd.data, ptr, len); + dma_memory_read(&address_space_memory, bd.data, ptr, len, + MEMTXATTRS_UNSPECIFIED); ptr +=3D len; frame_size +=3D len; if (bd.flags & ENET_BD_L) { @@ -557,7 +562,8 @@ static void imx_enet_do_tx(IMXFECState *s, uint32_t ind= ex) len =3D ENET_MAX_FRAME_SIZE - frame_size; s->regs[ENET_EIR] |=3D ENET_INT_BABT; } - dma_memory_read(&address_space_memory, bd.data, ptr, len); + dma_memory_read(&address_space_memory, bd.data, ptr, len, + MEMTXATTRS_UNSPECIFIED); ptr +=3D len; frame_size +=3D len; if (bd.flags & ENET_BD_L) { @@ -1109,11 +1115,12 @@ static ssize_t imx_fec_receive(NetClientState *nc, = const uint8_t *buf, buf_len +=3D size - 4; } buf_addr =3D bd.data; - dma_memory_write(&address_space_memory, buf_addr, buf, buf_len); + dma_memory_write(&address_space_memory, buf_addr, buf, buf_len, + MEMTXATTRS_UNSPECIFIED); buf +=3D buf_len; if (size < 4) { dma_memory_write(&address_space_memory, buf_addr + buf_len, - crc_ptr, 4 - size); + crc_ptr, 4 - size, MEMTXATTRS_UNSPECIFIED); crc_ptr +=3D 4 - size; } bd.flags &=3D ~ENET_BD_E; @@ -1216,8 +1223,8 @@ static ssize_t imx_enet_receive(NetClientState *nc, c= onst uint8_t *buf, */ const uint8_t zeros[2] =3D { 0 }; =20 - dma_memory_write(&address_space_memory, buf_addr, - zeros, sizeof(zeros)); + dma_memory_write(&address_space_memory, buf_addr, zeros, + sizeof(zeros), MEMTXATTRS_UNSPECIFIED); =20 buf_addr +=3D sizeof(zeros); buf_len -=3D sizeof(zeros); @@ -1226,11 +1233,12 @@ static ssize_t imx_enet_receive(NetClientState *nc,= const uint8_t *buf, shift16 =3D false; } =20 - dma_memory_write(&address_space_memory, buf_addr, buf, buf_len); + dma_memory_write(&address_space_memory, buf_addr, buf, buf_len, + MEMTXATTRS_UNSPECIFIED); buf +=3D buf_len; if (size < 4) { dma_memory_write(&address_space_memory, buf_addr + buf_len, - crc_ptr, 4 - size); + crc_ptr, 4 - size, MEMTXATTRS_UNSPECIFIED); crc_ptr +=3D 4 - size; } bd.flags &=3D ~ENET_BD_E; diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index b10e05f527..b18f3a1598 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -355,7 +355,8 @@ static void fw_cfg_dma_transfer(FWCfgState *s) dma_addr =3D s->dma_addr; s->dma_addr =3D 0; =20 - if (dma_memory_read(s->dma_as, dma_addr, &dma, sizeof(dma))) { + 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); return; @@ -417,7 +418,8 @@ static void fw_cfg_dma_transfer(FWCfgState *s) */ if (read) { if (dma_memory_write(s->dma_as, dma.address, - &e->data[s->cur_offset], len)) { + &e->data[s->cur_offset], len, + MEMTXATTRS_UNSPECIFIED)) { dma.control |=3D FW_CFG_DMA_CTL_ERROR; } } @@ -425,7 +427,8 @@ static void fw_cfg_dma_transfer(FWCfgState *s) if (!e->allow_write || len !=3D dma.length || dma_memory_read(s->dma_as, dma.address, - &e->data[s->cur_offset], len)) { + &e->data[s->cur_offset], len, + MEMTXATTRS_UNSPECIFIED)) { dma.control |=3D FW_CFG_DMA_CTL_ERROR; } else if (e->write_cb) { e->write_cb(e->callback_opaque, s->cur_offset, len); diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index a7f9685005..947efa77dc 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -715,7 +715,8 @@ static bool pnv_phb3_resolve_pe(PnvPhb3DMASpace *ds) bus_num =3D pci_bus_num(ds->bus); addr =3D rtt & PHB_RTT_BASE_ADDRESS_MASK; addr +=3D 2 * ((bus_num << 8) | ds->devfn); - if (dma_memory_read(&address_space_memory, addr, &rte, sizeof(rte))) { + if (dma_memory_read(&address_space_memory, addr, &rte, + sizeof(rte), MEMTXATTRS_UNSPECIFIED)) { phb3_error(ds->phb, "Failed to read RTT entry at 0x%"PRIx64, addr); /* Set error bits ? fence ? ... */ return false; @@ -794,7 +795,7 @@ static void pnv_phb3_translate_tve(PnvPhb3DMASpace *ds,= hwaddr addr, /* Grab the TCE address */ taddr =3D base | (((addr >> sh) & ((1ul << tbl_shift) - 1)) <<= 3); if (dma_memory_read(&address_space_memory, taddr, &tce, - sizeof(tce))) { + sizeof(tce), MEMTXATTRS_UNSPECIFIED)) { phb3_error(phb, "Failed to read TCE at 0x%"PRIx64, taddr); return; } diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c index 099d2092a2..8bcbc2cc4f 100644 --- a/hw/pci-host/pnv_phb3_msi.c +++ b/hw/pci-host/pnv_phb3_msi.c @@ -53,7 +53,8 @@ static bool phb3_msi_read_ive(PnvPHB3 *phb, int srcno, ui= nt64_t *out_ive) return false; } =20 - if (dma_memory_read(&address_space_memory, ive_addr, &ive, sizeof(ive)= )) { + if (dma_memory_read(&address_space_memory, ive_addr, + &ive, sizeof(ive), MEMTXATTRS_UNSPECIFIED)) { qemu_log_mask(LOG_GUEST_ERROR, "Failed to read IVE at 0x%" PRIx64, ive_addr); return false; @@ -73,7 +74,8 @@ static void phb3_msi_set_p(Phb3MsiState *msi, int srcno, = uint8_t gen) return; } =20 - if (dma_memory_write(&address_space_memory, ive_addr + 4, &p, 1)) { + if (dma_memory_write(&address_space_memory, ive_addr + 4, + &p, 1, MEMTXATTRS_UNSPECIFIED)) { qemu_log_mask(LOG_GUEST_ERROR, "Failed to write IVE (set P) at 0x%" PRIx64, ive_add= r); } @@ -89,7 +91,8 @@ static void phb3_msi_set_q(Phb3MsiState *msi, int srcno) return; } =20 - if (dma_memory_write(&address_space_memory, ive_addr + 5, &q, 1)) { + if (dma_memory_write(&address_space_memory, ive_addr + 5, + &q, 1, MEMTXATTRS_UNSPECIFIED)) { qemu_log_mask(LOG_GUEST_ERROR, "Failed to write IVE (set Q) at 0x%" PRIx64, ive_add= r); } diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 03daf40a23..2a782182f5 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -890,7 +890,8 @@ static bool pnv_phb4_resolve_pe(PnvPhb4DMASpace *ds) bus_num =3D pci_bus_num(ds->bus); addr =3D rtt & PHB_RTT_BASE_ADDRESS_MASK; addr +=3D 2 * ((bus_num << 8) | ds->devfn); - if (dma_memory_read(&address_space_memory, addr, &rte, sizeof(rte))) { + if (dma_memory_read(&address_space_memory, addr, + &rte, sizeof(rte), MEMTXATTRS_UNSPECIFIED)) { phb_error(ds->phb, "Failed to read RTT entry at 0x%"PRIx64, addr); /* Set error bits ? fence ? ... */ return false; @@ -959,8 +960,8 @@ static void pnv_phb4_translate_tve(PnvPhb4DMASpace *ds,= hwaddr addr, while ((lev--) >=3D 0) { /* Grab the TCE address */ taddr =3D base | (((addr >> sh) & ((1ul << tbl_shift) - 1)) <<= 3); - if (dma_memory_read(&address_space_memory, taddr, &tce, - sizeof(tce))) { + if (dma_memory_read(&address_space_memory, taddr, + &tce, sizeof(tce), MEMTXATTRS_UNSPECIFIED)= ) { phb_error(ds->phb, "Failed to read TCE at 0x%"PRIx64, tadd= r); return; } diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c index bea6d97ef8..f2db73025d 100644 --- a/hw/sd/allwinner-sdhost.c +++ b/hw/sd/allwinner-sdhost.c @@ -311,7 +311,8 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostS= tate *s, uint8_t buf[1024]; =20 /* Read descriptor */ - dma_memory_read(&s->dma_as, desc_addr, desc, sizeof(*desc)); + dma_memory_read(&s->dma_as, desc_addr, desc, sizeof(*desc), + MEMTXATTRS_UNSPECIFIED); if (desc->size =3D=3D 0) { desc->size =3D klass->max_desc_size; } else if (desc->size > klass->max_desc_size) { @@ -337,23 +338,24 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHos= tState *s, /* Write to SD bus */ if (is_write) { dma_memory_read(&s->dma_as, - (desc->addr & DESC_SIZE_MASK) + num_done, - buf, buf_bytes); + (desc->addr & DESC_SIZE_MASK) + num_done, buf, + buf_bytes, MEMTXATTRS_UNSPECIFIED); sdbus_write_data(&s->sdbus, buf, buf_bytes); =20 /* Read from SD bus */ } else { sdbus_read_data(&s->sdbus, buf, buf_bytes); dma_memory_write(&s->dma_as, - (desc->addr & DESC_SIZE_MASK) + num_done, - buf, buf_bytes); + (desc->addr & DESC_SIZE_MASK) + num_done, buf, + buf_bytes, MEMTXATTRS_UNSPECIFIED); } num_done +=3D buf_bytes; } =20 /* Clear hold flag and flush descriptor */ desc->status &=3D ~DESC_STATUS_HOLD; - dma_memory_write(&s->dma_as, desc_addr, desc, sizeof(*desc)); + dma_memory_write(&s->dma_as, desc_addr, desc, sizeof(*desc), + MEMTXATTRS_UNSPECIFIED); =20 return num_done; } diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 6900213083..cf66d0815a 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -607,8 +607,8 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState= *s) s->blkcnt--; } } - dma_memory_write(s->dma_as, s->sdmasysad, - &s->fifo_buffer[begin], s->data_count - begin= ); + dma_memory_write(s->dma_as, s->sdmasysad, &s->fifo_buffer[begi= n], + s->data_count - begin, MEMTXATTRS_UNSPECIFIED= ); s->sdmasysad +=3D s->data_count - begin; if (s->data_count =3D=3D block_size) { s->data_count =3D 0; @@ -629,8 +629,8 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIState= *s) s->data_count =3D block_size; boundary_count -=3D block_size - begin; } - dma_memory_read(s->dma_as, s->sdmasysad, - &s->fifo_buffer[begin], s->data_count - begin); + dma_memory_read(s->dma_as, s->sdmasysad, &s->fifo_buffer[begin= ], + s->data_count - begin, MEMTXATTRS_UNSPECIFIED); s->sdmasysad +=3D s->data_count - begin; if (s->data_count =3D=3D block_size) { sdbus_write_data(&s->sdbus, s->fifo_buffer, block_size); @@ -662,9 +662,11 @@ static void sdhci_sdma_transfer_single_block(SDHCIStat= e *s) =20 if (s->trnmod & SDHC_TRNS_READ) { sdbus_read_data(&s->sdbus, s->fifo_buffer, datacnt); - dma_memory_write(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt); + dma_memory_write(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt, + MEMTXATTRS_UNSPECIFIED); } else { - dma_memory_read(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt); + dma_memory_read(s->dma_as, s->sdmasysad, s->fifo_buffer, datacnt, + MEMTXATTRS_UNSPECIFIED); sdbus_write_data(&s->sdbus, s->fifo_buffer, datacnt); } s->blkcnt--; @@ -686,7 +688,8 @@ static void get_adma_description(SDHCIState *s, ADMADes= cr *dscr) hwaddr entry_addr =3D (hwaddr)s->admasysaddr; switch (SDHC_DMA_TYPE(s->hostctl1)) { case SDHC_CTRL_ADMA2_32: - dma_memory_read(s->dma_as, entry_addr, &adma2, sizeof(adma2)); + dma_memory_read(s->dma_as, entry_addr, &adma2, sizeof(adma2), + MEMTXATTRS_UNSPECIFIED); adma2 =3D le64_to_cpu(adma2); /* The spec does not specify endianness of descriptor table. * We currently assume that it is LE. @@ -697,7 +700,8 @@ static void get_adma_description(SDHCIState *s, ADMADes= cr *dscr) dscr->incr =3D 8; break; case SDHC_CTRL_ADMA1_32: - dma_memory_read(s->dma_as, entry_addr, &adma1, sizeof(adma1)); + dma_memory_read(s->dma_as, entry_addr, &adma1, sizeof(adma1), + MEMTXATTRS_UNSPECIFIED); adma1 =3D le32_to_cpu(adma1); dscr->addr =3D (hwaddr)(adma1 & 0xFFFFF000); dscr->attr =3D (uint8_t)extract32(adma1, 0, 7); @@ -709,10 +713,13 @@ static void get_adma_description(SDHCIState *s, ADMAD= escr *dscr) } break; case SDHC_CTRL_ADMA2_64: - dma_memory_read(s->dma_as, entry_addr, &dscr->attr, 1); - dma_memory_read(s->dma_as, entry_addr + 2, &dscr->length, 2); + dma_memory_read(s->dma_as, entry_addr, &dscr->attr, 1, + MEMTXATTRS_UNSPECIFIED); + dma_memory_read(s->dma_as, entry_addr + 2, &dscr->length, 2, + MEMTXATTRS_UNSPECIFIED); dscr->length =3D le16_to_cpu(dscr->length); - dma_memory_read(s->dma_as, entry_addr + 4, &dscr->addr, 8); + dma_memory_read(s->dma_as, entry_addr + 4, &dscr->addr, 8, + MEMTXATTRS_UNSPECIFIED); dscr->addr =3D le64_to_cpu(dscr->addr); dscr->attr &=3D (uint8_t) ~0xC0; dscr->incr =3D 12; @@ -770,7 +777,8 @@ static void sdhci_do_adma(SDHCIState *s) } dma_memory_write(s->dma_as, dscr.addr, &s->fifo_buffer[begin], - s->data_count - begin); + s->data_count - begin, + MEMTXATTRS_UNSPECIFIED); dscr.addr +=3D s->data_count - begin; if (s->data_count =3D=3D block_size) { s->data_count =3D 0; @@ -794,7 +802,8 @@ static void sdhci_do_adma(SDHCIState *s) } dma_memory_read(s->dma_as, dscr.addr, &s->fifo_buffer[begin], - s->data_count - begin); + s->data_count - begin, + MEMTXATTRS_UNSPECIFIED); dscr.addr +=3D s->data_count - begin; if (s->data_count =3D=3D block_size) { sdbus_write_data(&s->sdbus, s->fifo_buffer, block_= size); diff --git a/hw/usb/hcd-dwc2.c b/hw/usb/hcd-dwc2.c index 97688d21bf..fe684f92b7 100644 --- a/hw/usb/hcd-dwc2.c +++ b/hw/usb/hcd-dwc2.c @@ -261,8 +261,8 @@ static void dwc2_handle_packet(DWC2State *s, uint32_t d= evadr, USBDevice *dev, =20 if (pid !=3D USB_TOKEN_IN) { trace_usb_dwc2_memory_read(hcdma, tlen); - if (dma_memory_read(&s->dma_as, hcdma, - s->usb_buf[chan], tlen) !=3D MEMTX_OK) { + if (dma_memory_read(&s->dma_as, hcdma, s->usb_buf[chan], tlen, + MEMTXATTRS_UNSPECIFIED) !=3D MEMTX_OK) { qemu_log_mask(LOG_GUEST_ERROR, "%s: dma_memory_read failed= \n", __func__); } @@ -317,8 +317,8 @@ babble: =20 if (pid =3D=3D USB_TOKEN_IN) { trace_usb_dwc2_memory_write(hcdma, actual); - if (dma_memory_write(&s->dma_as, hcdma, s->usb_buf[chan], - actual) !=3D MEMTX_OK) { + if (dma_memory_write(&s->dma_as, hcdma, s->usb_buf[chan], actu= al, + MEMTXATTRS_UNSPECIFIED) !=3D MEMTX_OK) { qemu_log_mask(LOG_GUEST_ERROR, "%s: dma_memory_write faile= d\n", __func__); } diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 2b995443fb..03ea5279f9 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -383,7 +383,8 @@ static inline int get_dwords(EHCIState *ehci, uint32_t = addr, } =20 for (i =3D 0; i < num; i++, buf++, addr +=3D sizeof(*buf)) { - dma_memory_read(ehci->as, addr, buf, sizeof(*buf)); + dma_memory_read(ehci->as, addr, buf, sizeof(*buf), + MEMTXATTRS_UNSPECIFIED); *buf =3D le32_to_cpu(*buf); } =20 @@ -405,7 +406,8 @@ static inline int put_dwords(EHCIState *ehci, uint32_t = addr, =20 for (i =3D 0; i < num; i++, buf++, addr +=3D sizeof(*buf)) { uint32_t tmp =3D cpu_to_le32(*buf); - dma_memory_write(ehci->as, addr, &tmp, sizeof(tmp)); + dma_memory_write(ehci->as, addr, &tmp, sizeof(tmp), + MEMTXATTRS_UNSPECIFIED); } =20 return num; diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 67a92153e9..b1e61cbc63 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -452,7 +452,8 @@ static inline int get_dwords(OHCIState *ohci, addr +=3D ohci->localmem_base; =20 for (i =3D 0; i < num; i++, buf++, addr +=3D sizeof(*buf)) { - if (dma_memory_read(ohci->as, addr, buf, sizeof(*buf))) { + if (dma_memory_read(ohci->as, addr, + buf, sizeof(*buf), MEMTXATTRS_UNSPECIFIED)) { return -1; } *buf =3D le32_to_cpu(*buf); @@ -471,7 +472,8 @@ static inline int put_dwords(OHCIState *ohci, =20 for (i =3D 0; i < num; i++, buf++, addr +=3D sizeof(*buf)) { uint32_t tmp =3D cpu_to_le32(*buf); - if (dma_memory_write(ohci->as, addr, &tmp, sizeof(tmp))) { + if (dma_memory_write(ohci->as, addr, + &tmp, sizeof(tmp), MEMTXATTRS_UNSPECIFIED)) { return -1; } } @@ -488,7 +490,8 @@ static inline int get_words(OHCIState *ohci, addr +=3D ohci->localmem_base; =20 for (i =3D 0; i < num; i++, buf++, addr +=3D sizeof(*buf)) { - if (dma_memory_read(ohci->as, addr, buf, sizeof(*buf))) { + if (dma_memory_read(ohci->as, addr, + buf, sizeof(*buf), MEMTXATTRS_UNSPECIFIED)) { return -1; } *buf =3D le16_to_cpu(*buf); @@ -507,7 +510,8 @@ static inline int put_words(OHCIState *ohci, =20 for (i =3D 0; i < num; i++, buf++, addr +=3D sizeof(*buf)) { uint16_t tmp =3D cpu_to_le16(*buf); - if (dma_memory_write(ohci->as, addr, &tmp, sizeof(tmp))) { + if (dma_memory_write(ohci->as, addr, + &tmp, sizeof(tmp), MEMTXATTRS_UNSPECIFIED)) { return -1; } } @@ -537,8 +541,8 @@ static inline int ohci_read_iso_td(OHCIState *ohci, static inline int ohci_read_hcca(OHCIState *ohci, dma_addr_t addr, struct ohci_hcca *hcca) { - return dma_memory_read(ohci->as, addr + ohci->localmem_base, - hcca, sizeof(*hcca)); + return dma_memory_read(ohci->as, addr + ohci->localmem_base, hcca, + sizeof(*hcca), MEMTXATTRS_UNSPECIFIED); } =20 static inline int ohci_put_ed(OHCIState *ohci, @@ -572,7 +576,7 @@ static inline int ohci_put_hcca(OHCIState *ohci, return dma_memory_write(ohci->as, addr + ohci->localmem_base + HCCA_WRITEBACK_OF= FSET, (char *)hcca + HCCA_WRITEBACK_OFFSET, - HCCA_WRITEBACK_SIZE); + HCCA_WRITEBACK_SIZE, MEMTXATTRS_UNSPECIFIED); } =20 /* Read/Write the contents of a TD from/to main memory. */ diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 5e8bed9ef9..edbcc9d78d 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -489,7 +489,7 @@ static inline void xhci_dma_read_u32s(XHCIState *xhci, = dma_addr_t addr, =20 assert((len % sizeof(uint32_t)) =3D=3D 0); =20 - dma_memory_read(xhci->as, addr, buf, len); + dma_memory_read(xhci->as, addr, buf, len, MEMTXATTRS_UNSPECIFIED); =20 for (i =3D 0; i < (len / sizeof(uint32_t)); i++) { buf[i] =3D le32_to_cpu(buf[i]); @@ -509,7 +509,7 @@ static inline void xhci_dma_write_u32s(XHCIState *xhci,= dma_addr_t addr, for (i =3D 0; i < n; i++) { tmp[i] =3D cpu_to_le32(buf[i]); } - dma_memory_write(xhci->as, addr, tmp, len); + dma_memory_write(xhci->as, addr, tmp, len, MEMTXATTRS_UNSPECIFIED); } =20 static XHCIPort *xhci_lookup_port(XHCIState *xhci, struct USBPort *uport) @@ -616,7 +616,7 @@ static void xhci_write_event(XHCIState *xhci, XHCIEvent= *event, int v) ev_trb.status, ev_trb.control); =20 addr =3D intr->er_start + TRB_SIZE*intr->er_ep_idx; - dma_memory_write(xhci->as, addr, &ev_trb, TRB_SIZE); + dma_memory_write(xhci->as, addr, &ev_trb, TRB_SIZE, MEMTXATTRS_UNSPECI= FIED); =20 intr->er_ep_idx++; if (intr->er_ep_idx >=3D intr->er_size) { @@ -677,7 +677,8 @@ static TRBType xhci_ring_fetch(XHCIState *xhci, XHCIRin= g *ring, XHCITRB *trb, =20 while (1) { TRBType type; - dma_memory_read(xhci->as, ring->dequeue, trb, TRB_SIZE); + dma_memory_read(xhci->as, ring->dequeue, trb, TRB_SIZE, + MEMTXATTRS_UNSPECIFIED); trb->addr =3D ring->dequeue; trb->ccs =3D ring->ccs; le64_to_cpus(&trb->parameter); @@ -724,7 +725,8 @@ static int xhci_ring_chain_length(XHCIState *xhci, cons= t XHCIRing *ring) =20 while (1) { TRBType type; - dma_memory_read(xhci->as, dequeue, &trb, TRB_SIZE); + dma_memory_read(xhci->as, dequeue, &trb, TRB_SIZE, + MEMTXATTRS_UNSPECIFIED); le64_to_cpus(&trb.parameter); le32_to_cpus(&trb.status); le32_to_cpus(&trb.control); @@ -779,7 +781,8 @@ static void xhci_er_reset(XHCIState *xhci, int v) xhci_die(xhci); return; } - dma_memory_read(xhci->as, erstba, &seg, sizeof(seg)); + dma_memory_read(xhci->as, erstba, &seg, sizeof(seg), + MEMTXATTRS_UNSPECIFIED); le32_to_cpus(&seg.addr_low); le32_to_cpus(&seg.addr_high); le32_to_cpus(&seg.size); @@ -2393,7 +2396,8 @@ static TRBCCode xhci_get_port_bandwidth(XHCIState *xh= ci, uint64_t pctx) /* TODO: actually implement real values here */ bw_ctx[0] =3D 0; memset(&bw_ctx[1], 80, xhci->numports); /* 80% */ - dma_memory_write(xhci->as, ctx, bw_ctx, sizeof(bw_ctx)); + dma_memory_write(xhci->as, ctx, bw_ctx, sizeof(bw_ctx), + MEMTXATTRS_UNSPECIFIED); =20 return CC_SUCCESS; } --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 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=1601573189; cv=none; d=zohomail.com; s=zohoarc; b=VwJkYfITDEDqlWHPWk73lWgwd6h2amVchJdhGrla4fZfClAGoqPdVzDMRmWj8060wGOghcq//oACLRU/g9BRNU15bNOKPGBb1L2GorKxuJxYmmn/HVl+pw9c2PWUSNK9derZ3rlAgfObcO2HbYWemwUNPAuVR86p9SdpNHQLrj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573189; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=eV2Eyk05/xr0skmY13jKAtV+sH0+1zzEkuYodiaAlp8=; b=QYtl4NwWZ57/OAV0wczHNg316zuIAsJdCtH85EC+9EdP7slOs8E7Gp2cbbJUXoMXe/ymTQWqEAd3ujiobGbUmLY014x9Nokv95Swy6v5FPB6MM93Y6yBnv22BAtdERBJMXDij2FB/PQMaFvz47ULeRdxtu3c4tGOeLsUNU8qlKw= 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 1601573189988550.164490899233; Thu, 1 Oct 2020 10:26:29 -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-84-orI0zlkQM8qswCKFf3GzOw-1; Thu, 01 Oct 2020 13:26:26 -0400 Received: by mail-wm1-f69.google.com with SMTP id a7so1421596wmc.2 for ; Thu, 01 Oct 2020 10:26:26 -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 o129sm944676wmb.25.2020.10.01.10.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573188; 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=eV2Eyk05/xr0skmY13jKAtV+sH0+1zzEkuYodiaAlp8=; b=H1iSi1It2p0/tZzzN7myeYECSYNXeC0K7xG0H05tQCnHdYgwmSViqazjbmEBMN+3fC/aLm lo4ys9kYJYvNpcnhSpV+aGWSxw02BUeQ8SQIjPdIPxqQNpQHYqzJFxgssn96hkO/YqB+xk EFAeL3brP3zEgilW1fiJ1mdwpbCzb2A= X-MC-Unique: orI0zlkQM8qswCKFf3GzOw-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=eV2Eyk05/xr0skmY13jKAtV+sH0+1zzEkuYodiaAlp8=; b=HBueuleyRqMSJu538vxnMWxVLBcuSyY02rVut+NsvbhR4rAe68scK79lRPNyizr26+ GHJ9Hi4HPvnHFle1p1LuTgyFP/id4M9MUlv7T4E8MCl1Ld68CZdYxyNTJky51YCal00m jGSyb8cxh6gipFWvm0aGwiDQVE5FEintJWzPukOeYY5ZZZJUkX/h7sHBs3ClzmN/AfcM iVLP9Ss/rTfLQ1K/WibmYLro0ohg9itLHS7ics9dV8YX6EWI3QLuUnqHVWHYreoN8gWl 1PHKBRfBA63EOxf7mvtuFh/EO2PHizhLmMYKg7Qq8S7ifQ6AJXDK/W1+tU9gHuqryvka cF+Q== X-Gm-Message-State: AOAM531s8fsQkuA1aRy8Ww88IhJO6Q+MuYIgfmcsPxihVt24J7KdDfAX yy1fgySCiWa7oMPnSPsgsbHOBBPkqUKGcmHCzHclkZjlH3FmsMc55CMexXrvYQd82KwhspR6xB7 +hKKiNrD+hqlhQw== X-Received: by 2002:a5d:4151:: with SMTP id c17mr10947201wrq.302.1601573185416; Thu, 01 Oct 2020 10:26:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv5zeY807BCPPwVhDBjdjtddKEnPLZgwPQ4pxIMsMPlT8B+Sdwa1wZX+mJqFchiSdb53G9ZQ== X-Received: by 2002:a5d:4151:: with SMTP id c17mr10947176wrq.302.1601573185139; Thu, 01 Oct 2020 10:26:25 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 13/16] dma: Let dma_memory_map() take MemTxAttrs argument Date: Thu, 1 Oct 2020 19:25:16 +0200 Message-Id: <20201001172519.1620782-14-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_map(). Patch created mechanically using spatch with this script: @@ expression E1, E2, E3, E4; @@ - dma_memory_map(E1, E2, E3, E4) + dma_memory_map(E1, E2, E3, E4, MEMTXATTRS_UNSPECIFIED) Reviewed-by: Richard Henderson Reviewed-by: Li Qiang Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci/pci.h | 3 ++- include/sysemu/dma.h | 5 +++-- dma-helpers.c | 3 ++- hw/display/virtio-gpu.c | 8 ++++++-- hw/hyperv/vmbus.c | 8 +++++--- hw/ide/ahci.c | 9 ++++++--- hw/usb/libhw.c | 3 ++- hw/virtio/virtio.c | 6 ++++-- 8 files changed, 30 insertions(+), 15 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 8f23a24cf9..dc1799b519 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -826,7 +826,8 @@ static inline void *pci_dma_map(PCIDevice *dev, dma_add= r_t addr, { void *buf; =20 - buf =3D dma_memory_map(pci_get_address_space(dev), addr, plen, dir); + buf =3D dma_memory_map(pci_get_address_space(dev), addr, plen, dir, + MEMTXATTRS_UNSPECIFIED); return buf; } =20 diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h index 343d755ca1..6524137ecd 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -202,16 +202,17 @@ MemTxResult dma_memory_set(AddressSpace *as, dma_addr= _t addr, * @addr: address within that address space * @len: pointer to length of buffer; updated on return * @dir: indicates the transfer direction + * @attrs: memory attributes */ static inline void *dma_memory_map(AddressSpace *as, dma_addr_t addr, dma_addr_t *len, - DMADirection dir) + DMADirection dir, MemTxAttrs attrs) { hwaddr xlen =3D *len; void *p; =20 p =3D address_space_map(as, addr, &xlen, dir =3D=3D DMA_DIRECTION_FROM= _DEVICE, - MEMTXATTRS_UNSPECIFIED); + attrs); *len =3D xlen; return p; } diff --git a/dma-helpers.c b/dma-helpers.c index 6c3b2200f1..0507a6f95b 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -143,7 +143,8 @@ static void dma_blk_cb(void *opaque, int ret) while (dbs->sg_cur_index < dbs->sg->nsg) { cur_addr =3D dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byt= e; cur_len =3D dbs->sg->sg[dbs->sg_cur_index].len - dbs->sg_cur_byte; - mem =3D dma_memory_map(dbs->sg->as, cur_addr, &cur_len, dbs->dir); + mem =3D dma_memory_map(dbs->sg->as, cur_addr, &cur_len, dbs->dir, + MEMTXATTRS_UNSPECIFIED); /* * Make reads deterministic in icount mode. Windows sometimes issu= es * disk read requests with overlapping SGs. It leads diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index f3b71fa9c7..fd0de93111 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -649,7 +649,9 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g, uint32_t l =3D le32_to_cpu(ents[i].length); hwaddr len =3D l; (*iov)[i].iov_base =3D dma_memory_map(VIRTIO_DEVICE(g)->dma_as, - a, &len, DMA_DIRECTION_TO_DEVI= CE); + a, &len, + DMA_DIRECTION_TO_DEVICE, + MEMTXATTRS_UNSPECIFIED); (*iov)[i].iov_len =3D len; if (addr) { (*addr)[i] =3D a; @@ -1054,7 +1056,9 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size, hwaddr len =3D res->iov[i].iov_len; res->iov[i].iov_base =3D dma_memory_map(VIRTIO_DEVICE(g)->dma_as, - res->addrs[i], &len, DMA_DIRECTION_TO_DEVIC= E); + res->addrs[i], &len, + DMA_DIRECTION_TO_DEVICE, + MEMTXATTRS_UNSPECIFIED); =20 if (!res->iov[i].iov_base || len !=3D res->iov[i].iov_len) { /* Clean up the half-a-mapping we just created... */ diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c index 896e981f85..7447b3745e 100644 --- a/hw/hyperv/vmbus.c +++ b/hw/hyperv/vmbus.c @@ -372,7 +372,8 @@ static ssize_t gpadl_iter_io(GpadlIter *iter, void *buf= , uint32_t len) =20 maddr =3D (iter->gpadl->gfns[idx] << TARGET_PAGE_BITS) | off_i= n_page; =20 - iter->map =3D dma_memory_map(iter->as, maddr, &mlen, iter->dir= ); + iter->map =3D dma_memory_map(iter->as, maddr, &mlen, iter->dir, + MEMTXATTRS_UNSPECIFIED); if (mlen !=3D pgleft) { dma_memory_unmap(iter->as, iter->map, mlen, iter->dir, 0); iter->map =3D NULL; @@ -489,7 +490,8 @@ int vmbus_map_sgl(VMBusChanReq *req, DMADirection dir, = struct iovec *iov, goto err; } =20 - iov[ret_cnt].iov_base =3D dma_memory_map(sgl->as, a, &l, dir); + iov[ret_cnt].iov_base =3D dma_memory_map(sgl->as, a, &l, dir, + MEMTXATTRS_UNSPECIFIED); if (!l) { ret =3D -EFAULT; goto err; @@ -565,7 +567,7 @@ static vmbus_ring_buffer *ringbuf_map_hdr(VMBusRingBufC= ommon *ringbuf) dma_addr_t mlen =3D sizeof(*rb); =20 rb =3D dma_memory_map(ringbuf->as, ringbuf->rb_addr, &mlen, - DMA_DIRECTION_FROM_DEVICE); + DMA_DIRECTION_FROM_DEVICE, MEMTXATTRS_UNSPECIFIED); if (mlen !=3D sizeof(*rb)) { dma_memory_unmap(ringbuf->as, rb, mlen, DMA_DIRECTION_FROM_DEVICE, 0); diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index ee1d47ff75..92180b811d 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -249,7 +249,8 @@ static void map_page(AddressSpace *as, uint8_t **ptr, u= int64_t addr, dma_memory_unmap(as, *ptr, len, DMA_DIRECTION_FROM_DEVICE, len); } =20 - *ptr =3D dma_memory_map(as, addr, &len, DMA_DIRECTION_FROM_DEVICE); + *ptr =3D dma_memory_map(as, addr, &len, DMA_DIRECTION_FROM_DEVICE, + MEMTXATTRS_UNSPECIFIED); if (len < wanted) { dma_memory_unmap(as, *ptr, len, DMA_DIRECTION_FROM_DEVICE, len); *ptr =3D NULL; @@ -938,7 +939,8 @@ static int ahci_populate_sglist(AHCIDevice *ad, QEMUSGL= ist *sglist, =20 /* map PRDT */ if (!(prdt =3D dma_memory_map(ad->hba->as, prdt_addr, &prdt_len, - DMA_DIRECTION_TO_DEVICE))){ + DMA_DIRECTION_TO_DEVICE, + MEMTXATTRS_UNSPECIFIED))) { trace_ahci_populate_sglist_no_map(ad->hba, ad->port_no); return -1; } @@ -1299,7 +1301,8 @@ static int handle_cmd(AHCIState *s, int port, uint8_t= slot) tbl_addr =3D le64_to_cpu(cmd->tbl_addr); cmd_len =3D 0x80; cmd_fis =3D dma_memory_map(s->as, tbl_addr, &cmd_len, - DMA_DIRECTION_FROM_DEVICE); + DMA_DIRECTION_FROM_DEVICE, + MEMTXATTRS_UNSPECIFIED); if (!cmd_fis) { trace_handle_cmd_badfis(s, port); return -1; diff --git a/hw/usb/libhw.c b/hw/usb/libhw.c index 9c33a1640f..f350eae443 100644 --- a/hw/usb/libhw.c +++ b/hw/usb/libhw.c @@ -36,7 +36,8 @@ int usb_packet_map(USBPacket *p, QEMUSGList *sgl) =20 while (len) { dma_addr_t xlen =3D len; - mem =3D dma_memory_map(sgl->as, base, &xlen, dir); + mem =3D dma_memory_map(sgl->as, base, &xlen, dir, + MEMTXATTRS_UNSPECIFIED); if (!mem) { goto err; } diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 6f8f865aff..af85b262b1 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1320,7 +1320,8 @@ static bool virtqueue_map_desc(VirtIODevice *vdev, un= signed int *p_num_sg, iov[num_sg].iov_base =3D dma_memory_map(vdev->dma_as, pa, &len, is_write ? DMA_DIRECTION_FROM_DEVICE : - DMA_DIRECTION_TO_DEVICE); + DMA_DIRECTION_TO_DEVICE, + MEMTXATTRS_UNSPECIFIED); if (!iov[num_sg].iov_base) { virtio_error(vdev, "virtio: bogus descriptor or out of resourc= es"); goto out; @@ -1369,7 +1370,8 @@ static void virtqueue_map_iovec(VirtIODevice *vdev, s= truct iovec *sg, sg[i].iov_base =3D dma_memory_map(vdev->dma_as, addr[i], &len, is_write ? DMA_DIRECTION_FROM_DEVICE : - DMA_DIRECTION_TO_DEVICE); + DMA_DIRECTION_TO_DEVICE, + MEMTXATTRS_UNSPECIFIED); if (!sg[i].iov_base) { error_report("virtio: error trying to map MMIO memory"); exit(1); --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 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=1601573194; cv=none; d=zohomail.com; s=zohoarc; b=fdjGwWH3+qTwZHeW9tRHCg0x8plJ6HhM8AWnADcEkRgiaIOqHsGIqYAKvlBYQXnDczFOhdjSqss3bLmwEwJtAYD+rG2ynR+aZdcWCiIOR0VDjeSbICrmPmrQvuDGG5LGLI6l9+o5HIsDzXoONygZNdmjVVm++qMutHVfK2QaDng= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573194; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=/PF6nhOiKuc0/NQNRc+aC6XALs0M14l/UELS8Wkj5yQ=; b=fefNfoplLqzmYq7kRpLaMF7jx0nhuQwxGjN7jDz9LAbSNtZxQMpcGW7K1oTx7RmI2VbmS6g8zMBZOk6TxRkvQLDpYDr6JA4ZwlByUKKLXNL2jA9MVMycHbjd07y9fFRIIcOpz2kgAHjChFgbvf4WiMU/H9dgK+oT2rAO0VgukcM= 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 1601573194889799.7980132981397; Thu, 1 Oct 2020 10:26:34 -0700 (PDT) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-C6pftWXCMBiNSOVuIqe2yg-1; Thu, 01 Oct 2020 13:26:31 -0400 Received: by mail-wr1-f72.google.com with SMTP id j7so2341745wro.14 for ; Thu, 01 Oct 2020 10:26:31 -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 c14sm9985434wrm.64.2020.10.01.10.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573193; 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=/PF6nhOiKuc0/NQNRc+aC6XALs0M14l/UELS8Wkj5yQ=; b=WfqsL01xXirYQ31Zz/02TOWpCTFMen2k82DCguLNmJMeJfAupR7bhTJ8mx2s5dC7hA5PzR rYU3A8eMWBgB7o4F/HPwYz5fALcNX6IeqiZyT6wp1wuXMHUtzGnCDq1S+KGsPvdfN92Rr+ dB0apX4E0en5JZSCwb8UkuwbyxDwBwM= X-MC-Unique: C6pftWXCMBiNSOVuIqe2yg-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=/PF6nhOiKuc0/NQNRc+aC6XALs0M14l/UELS8Wkj5yQ=; b=FZRaflb1daf2SwUyHF2xVepl5Vk9uX2L0WCYu0q1UfTY38MSfiS+y8hu7ZYmbqzwzr w2cefJ+9H6ydsE02x1kb1NK03qhOMI6nKfQ8g/3RyE1EKKVnHRV4XUbsCEbMsK8zx1mX 4CEdout1i7pMqxF6ucpTvRgMlf6Vv61Ntymow/Hl+GoAyn+/IVqRWDMWykZuVdS21bNY v4ULeoZ/ERwa+cYkV7PELBliZixJvePycGuiYfdG7upvg9mZAaYyo4SNbLkWQJPFbFyb Wgrb7kySAIc0n2Ce7J/86Z6zcXWr05LRdEEbWwDmwO33njkSIORm5ufaHsfY/zM0hZzw WQQw== X-Gm-Message-State: AOAM531blxMg/7mckIbewT0YBxzwn9N/FywXJztiOscncuPwVZYdkCPW U7Ca2VijGig0QU1g6VJmMYR0wKcRyfA7ShSdfNsKrpqdjbXFPH6azTtM2tJH3tT7W2Vwn6Saex4 k9dQ5QGN7yf+z0w== X-Received: by 2002:a5d:634d:: with SMTP id b13mr10553189wrw.324.1601573189952; Thu, 01 Oct 2020 10:26:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIoEmG/G5FJTaG28c1zrQb/RRt+r8pbfSAI5BCK7unghT/ZRlB5FuKOir/mKgqiaqaLh2vTw== X-Received: by 2002:a5d:634d:: with SMTP id b13mr10553182wrw.324.1601573189791; Thu, 01 Oct 2020 10:26:29 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 14/16] pci: Let pci_dma_rw() propagate MemTxResult Date: Thu, 1 Oct 2020 19:25:17 +0200 Message-Id: <20201001172519.1620782-15-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) dma_memory_rw() returns a MemTxResult type. Do not discard it, return it to the caller. Reviewed-by: Li Qiang Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci/pci.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index dc1799b519..f77f4e49e4 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -780,8 +780,22 @@ static inline AddressSpace *pci_get_address_space(PCID= evice *dev) return &dev->bus_master_as; } =20 -static inline int pci_dma_rw(PCIDevice *dev, dma_addr_t addr, - void *buf, dma_addr_t len, DMADirection dir) +/** + * pci_dma_rw: Read from or write to an address space from PCI device. + * + * Return a MemTxResult indicating whether the operation succeeded + * or failed (eg unassigned memory, device rejected the transaction, + * IOMMU fault). + * + * @dev: #PCIDevice doing the memory access + * @addr: address within the #PCIDevice address space + * @buf: buffer with the data transferred + * @len: the number of bytes to read or write + * @dir: indicates the transfer direction + */ +static inline MemTxResult pci_dma_rw(PCIDevice *dev, dma_addr_t addr, + void *buf, dma_addr_t len, + DMADirection dir) { return dma_memory_rw(pci_get_address_space(dev), addr, buf, len, dir, MEMTXATTRS_UNSPECIFIED); --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1601573198; cv=none; d=zohomail.com; s=zohoarc; b=eXZJjUeZhvgrOE01kIACJvMiS8DejTAgrbRP2VrEm2AvBKMZj1NNz/8eP3fCdUGsxlv6wlP/Vn+T67k0shEyKU6FN92q84qIu7EC39QmcTnlBYxoDkwW1mXyxBpQKEMrXynspBZRoDlyig63Y1pyXti0sCKRpz/SfJZqLTQK1sE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573198; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=F6SBWdzgqMBgYw89U+cEUD8cCJrdzloVUjao1tlyNDc=; b=LheIxsxewDybPFwsOvkh7rukKgOfXZf7NWIRrXpFvUwHQucz36Y4jxr8uJa/5SE/v97/lOg8Cb2OeSkPtjwIQqYIkRepZuOxGHRo90TzpF8TQxe1MZ7aP35aOlPqKP0laXSX2aTIymnVaQ6ZF2Jvf2y60DForQNsDcj56weJiwE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1601573198819407.6402513026627; Thu, 1 Oct 2020 10:26:38 -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-595-kGbnGb-CMWa3TUmjUmMgrw-1; Thu, 01 Oct 2020 13:26:35 -0400 Received: by mail-wm1-f69.google.com with SMTP id 73so1414137wma.5 for ; Thu, 01 Oct 2020 10:26:35 -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 91sm10566746wrq.9.2020.10.01.10.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573197; 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=F6SBWdzgqMBgYw89U+cEUD8cCJrdzloVUjao1tlyNDc=; b=EQkKIZW9t+rt7Z7iY5h5Ekw9tBDcrcYxV4GqlS36Qy3QaqB75RxW0EFiMGgyIAzBp+pNXD XiQBVJrknq58qiPtzbg26uUTuGJH6dfvQ9R1rsXt04Vs42+V7cG+fojgzM7D/W9zkzsI9A LwWrqRfPYPESAe1ZkgKrT95DGtsvUAU= X-MC-Unique: kGbnGb-CMWa3TUmjUmMgrw-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=F6SBWdzgqMBgYw89U+cEUD8cCJrdzloVUjao1tlyNDc=; b=QIslIJvsV0lO4lrVZKnGSVxRn+S385FmMTB3Ws9rA/wNvdoxQqYRZgYR9tb/f1VKPn gDCnDS2d5ULppvrJREpBl5fdg1SiF9Tacb+r4XmREsO5RBFTTxp84P5YiAqeLlDKXoLY l9O5F1NgV8+x8rvkyQNOddWGUmxIdVR/iKZk/heUiDe2uRtww2nmJdtg93vDtgCYWZHJ 2V9NapBLsyfK0VkDiaWmUwJnduDrqBuJdNBbkv/kKJpcQLLrKaqoIeX1KHggxFfjPttr ky9iUFor2n2C5EGFLKAR1lmK8COSjKbZSZvZ8FhjThrN7yah/Psm/gdoFLCZ7Oc2slwS Xmnw== X-Gm-Message-State: AOAM530DmOijSWHFTPQFgJK68CICIa20iLQf5DJNUZMXxgdMrcKtHoW5 xEiskrOoIFQlh25W7nUBP5/K7Y2q4/BnHNGqKyOY3eKu3BpyFqHlM0YYVSD5Z0pNO038UoaHaek 0TNt/ehz9pPWwIQ== X-Received: by 2002:a5d:444b:: with SMTP id x11mr10198219wrr.402.1601573194746; Thu, 01 Oct 2020 10:26:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8qPOM1Udi/2cBugLloC9divrpOXmVTglaNEW/vT5l+SfLuO6e76tELiU7VXg3D4iewNv2Lw== X-Received: by 2002:a5d:444b:: with SMTP id x11mr10198199wrr.402.1601573194566; Thu, 01 Oct 2020 10:26:34 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 15/16] pci: Let pci_dma_read() propagate MemTxResult Date: Thu, 1 Oct 2020 19:25:18 +0200 Message-Id: <20201001172519.1620782-16-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) pci_dma_rw() returns a MemTxResult type. Do not discard it, return it to the caller. Reviewed-by: Li Qiang Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci/pci.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index f77f4e49e4..299df068c9 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -801,8 +801,20 @@ static inline MemTxResult pci_dma_rw(PCIDevice *dev, d= ma_addr_t addr, dir, MEMTXATTRS_UNSPECIFIED); } =20 -static inline int pci_dma_read(PCIDevice *dev, dma_addr_t addr, - void *buf, dma_addr_t len) +/** + * pci_dma_read: Read from an address space from PCI device. + * + * Return a MemTxResult indicating whether the operation succeeded + * or failed (eg unassigned memory, device rejected the transaction, + * IOMMU fault). Called within RCU critical section. + * + * @dev: #PCIDevice doing the memory access + * @addr: address within the #PCIDevice address space + * @buf: buffer with the data transferred + * @len: length of the data transferred + */ +static inline MemTxResult pci_dma_read(PCIDevice *dev, dma_addr_t addr, + void *buf, dma_addr_t len) { return pci_dma_rw(dev, addr, buf, len, DMA_DIRECTION_TO_DEVICE); } --=20 2.26.2 From nobody Sun May 19 14:14:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1601573203; cv=none; d=zohomail.com; s=zohoarc; b=NWo9bnmOHOJLOHpTSn0Nxen0YanvZVu2a0dkljisoHV3ZAdpT18QB3rapRxrTyWPIOUoARahlmO7m46oLBjW7HigYrG1dppYWqSGFS28KypnRvU5NvDtd94E0701F+d02JZrcs3DRmovsds4vQqSixPPyMrl9wFRMU3JV+BePYg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601573203; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=udJNOTd9q8GWTxGSfD4yywYFkssNr+3yEzfBj0bq7Uw=; b=XKYFv/jGzqpFycOh3yrFgTluDYYJYg9Yo/mssjLS6LUNaB9uiTuCX+7K4zDp1fWUY1oEqs8biTQ7oo9xDqj1GpdHFy8o0+2W+WlGEML8B7EB/67XLazssriBWpRGda8Li41nuhm6pu2C1SxEEKy2bWAvFKazNihXo8tz84TnpGM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1601573203745877.3938059301128; Thu, 1 Oct 2020 10:26:43 -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-69-xS5gKZZaPeONi9QwkU4cPA-1; Thu, 01 Oct 2020 13:26:40 -0400 Received: by mail-wr1-f70.google.com with SMTP id l17so2299723wrw.11 for ; Thu, 01 Oct 2020 10:26:40 -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 a3sm743859wmb.46.2020.10.01.10.26.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601573202; 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=udJNOTd9q8GWTxGSfD4yywYFkssNr+3yEzfBj0bq7Uw=; b=g0ksy9mo2y7q/1ALScjEE8EdQe1fQUW2ZcTrk80QEsz1MF26v9pvbZa3Lkhr38fqR4RR+w BjY92Y6qv4XvB9SEeKH3763qfBBITWxEMWVBgB3hWTVaAwDljXp27/Z/CuB0eAYTahfS3M 45kQYQhr3CZUghcUV+AlMu9EeisceXo= X-MC-Unique: xS5gKZZaPeONi9QwkU4cPA-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=udJNOTd9q8GWTxGSfD4yywYFkssNr+3yEzfBj0bq7Uw=; b=WKHBaInTgD+1U3I41XgHb+1OZslcZcX54+8aTHTcO/FLF1talC7GPQt/ahQYHX0eZ5 onsdrmtMJDkrOQEWPPO23+cRMx8/ZyXdmxbP+Fpt1Zr2jkq2ufBYrz8bw5LMFAaNthtA sKJsMaftuPOBsNedg0wJxCDMGD8aEvRU0fZOf9ne1R1nZna2CsFRVPsg0hSboSXXgQVI GZO7oOyc+kRdED2rNV9nMDmNzYbN0qJs4a81UtNrdoS29jxZLzL4pIkyczTBXnPAH/W3 URYErsyRaOKnwASySr1TxVYRVziEveSYeiqjBzDUn3c8vwITL1rhp0SUlpNuHGjK1Pcb DXuQ== X-Gm-Message-State: AOAM533zENegBnLhEYTXfG/B4C+g/vqX5OC5JhwXdqPBb/ZGchSMm0lO hlaUZklTlG6VM/VZM5Y0GT5LnyrNpwvNGlqj0+1qB9DmMPArmvwj+Itm+FHbS0Nc47XjF3kycUF dbmwLwpUsJJSlqg== X-Received: by 2002:adf:e8ce:: with SMTP id k14mr10951567wrn.394.1601573199490; Thu, 01 Oct 2020 10:26:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHAOFaVzMVe3u6Zt67rdUHxGDTQuwilaRI88YshzAZU0I90dK71V6KCoZrlm3vyB3o66M6xQ== X-Received: by 2002:adf:e8ce:: with SMTP id k14mr10951545wrn.394.1601573199267; Thu, 01 Oct 2020 10:26:39 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini Subject: [PATCH RESEND v2 16/16] pci: Let pci_dma_write() propagate MemTxResult Date: Thu, 1 Oct 2020 19:25:19 +0200 Message-Id: <20201001172519.1620782-17-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) pci_dma_rw() returns a MemTxResult type. Do not discard it, return it to the caller. Reviewed-by: Li Qiang Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci/pci.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 299df068c9..8114313e1e 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -819,8 +819,20 @@ static inline MemTxResult pci_dma_read(PCIDevice *dev,= dma_addr_t addr, return pci_dma_rw(dev, addr, buf, len, DMA_DIRECTION_TO_DEVICE); } =20 -static inline int pci_dma_write(PCIDevice *dev, dma_addr_t addr, - const void *buf, dma_addr_t len) +/** + * pci_dma_write: Write to address space from PCI device. + * + * Return a MemTxResult indicating whether the operation succeeded + * or failed (eg unassigned memory, device rejected the transaction, + * IOMMU fault). + * + * @dev: #PCIDevice doing the memory access + * @addr: address within the #PCIDevice address space + * @buf: buffer with the data transferred + * @len: the number of bytes to write + */ +static inline MemTxResult pci_dma_write(PCIDevice *dev, dma_addr_t addr, + const void *buf, dma_addr_t len) { return pci_dma_rw(dev, addr, (void *) buf, len, DMA_DIRECTION_FROM_DEV= ICE); } --=20 2.26.2