From patchwork Thu Oct 1 17:21:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 272271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89B76C4727E for ; Thu, 1 Oct 2020 17:27:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC40C2085B for ; Thu, 1 Oct 2020 17:27:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Vhs6ZsVH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC40C2085B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kO2Mi-00067C-MG for qemu-devel@archiver.kernel.org; Thu, 01 Oct 2020 13:27:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58870) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kO2HR-00009F-1T for qemu-devel@nongnu.org; Thu, 01 Oct 2020 13:22:09 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:52343) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kO2HL-0003lC-V9 for qemu-devel@nongnu.org; Thu, 01 Oct 2020 13:22:05 -0400 Received: by mail-wm1-x32a.google.com with SMTP id q9so3719182wmj.2 for ; Thu, 01 Oct 2020 10:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kDqdtq58pQ4zoZVkr3FaloUPfNhxdNZfP/qYUQHcHb8=; b=Vhs6ZsVHXkgiTL/gA6uzAoHzPB8+ToNsdRBEXq9O3VZ7w0p/EFUmBaHTNYl6RVztgh 31a94BhkEuiUnEKJ/vvAide5m35GHr8dqiDpZOc0iiSlKf4UVnLrRxHTIX7dHfEcVuJJ jQxzQ6JjdZJF5LJV0Nx29RK+6MMmhMx+kUc47wbKka4snI7mLY5Nb/liDosIx0P53mGs IUOO1VUDVI494QKbA1Vm4S05PktrCCD5qW0jIgyQI0U3QTx9vHvEGMu8XL0svGeCE/at G+mMJdxGHoCUm+YgJrEcPJmC47faBXt3o8vtj+t0nEKJy4FFNjz/iZSwILZ57LPpS7az Kl3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=kDqdtq58pQ4zoZVkr3FaloUPfNhxdNZfP/qYUQHcHb8=; b=ZG9YYjFluKDg5S5NAlbQTcDpB8QPHUHpcJFEJn3/16ypDs+vHQfLuHxeANJnjX89mu Z+6a0nWq7H5bPYRGXbl/gSna3uXFpnZxE3ltBmVonHit8iVU7WD0C12W8n7QqQCnIDNO uibowfhW4CfukLhq9hGB3IXJaJap1sNgUE7WhZOEWsNf1cUDpmeRo5WmPa4AXVW1t10Z uW1qquRNpEOEKvqwiM0W48sMspeNtGQVb/8pqVN+BgXaw1CD5rHso6SCL3zuop1uKgeO xBHnixkxYJSOo6KrH1sOyqCd/pioo0MhbFoOjPzxdkIrSyGguBaVUKadSjHW7uVN6z6s MXXQ== X-Gm-Message-State: AOAM532Tgec0jLakHxKVgn3vg2s6KfXZYjzYm0sYa1mlvstBWOTL91bP dvBDTsiiACwoeopUjWr3M0Fl1D/JpWY= X-Google-Smtp-Source: ABdhPJwRXWkLxB5yGFcYjfcTdhHvZ4non+ldeJpKxlmsLPjHZZyqPb2u6XMVfoz8vdTAxl70WAdwoQ== X-Received: by 2002:a1c:4c05:: with SMTP id z5mr998857wmf.47.1601572921754; Thu, 01 Oct 2020 10:22:01 -0700 (PDT) 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 h8sm9719625wrw.68.2020.10.01.10.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:22:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 01/16] pci: pass along the return value of dma_memory_rw Date: Thu, 1 Oct 2020 19:21:44 +0200 Message-Id: <20201001172159.1619456-2-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201001172159.1619456-1-f4bug@amsat.org> References: <20201001172159.1619456-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x32a.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é 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é --- 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(PCIDevice *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); } static inline int pci_dma_read(PCIDevice *dev, dma_addr_t addr, From patchwork Thu Oct 1 17:21:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 272270 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6849C4727E for ; Thu, 1 Oct 2020 17:29:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 292362085B for ; Thu, 1 Oct 2020 17:29:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tC94X1gM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 292362085B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kO2Oi-0000Uk-2d for qemu-devel@archiver.kernel.org; Thu, 01 Oct 2020 13:29:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kO2HT-0000Ax-3R for qemu-devel@nongnu.org; Thu, 01 Oct 2020 13:22:11 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:37894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kO2HM-0003lN-QQ for qemu-devel@nongnu.org; Thu, 01 Oct 2020 13:22:09 -0400 Received: by mail-wr1-x432.google.com with SMTP id g4so6730168wrs.5 for ; Thu, 01 Oct 2020 10:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BQ2HYlkFRvbptmqlMrFxBt3vI0MTw53Fkp63PNsOdso=; b=tC94X1gM9bqOBAe1QTyuhuYCYcTNB7+BOstdaEl16ESSaJjV7V+5qMR8deeR0KDvOy ncJA943zbJcQ6WewtlMCUewk4e/tvcdwGKyWdxBckjT9zozNRuX9PeWU/O2KaCBiBkw2 E0Np3mYAeSAulcSV9aysMMZVyvxN0emQVh2BVfgeXAwO2L+d6U/Eg7vPEokBPiKTjwy/ Ic2metiQEGUCILGBJYpDlc/ZZ9/St7B9bmA7G4rRU3dw877o03hAYlHPu0PUQ4GarxN2 vjLeZcfFEDGdXu+LeV8qAePXR/B386TzBID2bsSAIm3Miw9Gipn0QkPzIjiLXqzhBArb CSww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BQ2HYlkFRvbptmqlMrFxBt3vI0MTw53Fkp63PNsOdso=; b=DFzwI3hRzTi5MvUfvNSYH8po8m50sZcPKAsR5g3kvEUMBTkBqZIb2VPNauvXfjDRN0 2gjewMEDPDqO4eXNRBdnCg29SjkoGlNXz+VHvWmsN2jwRe1nUj9GBRn88XPawYfHlfsX 12ZVNkz9A/PY7SkcdJzTHZtnry/KfPPlnyQlmuDmbgOMdP/NV6F5LnlGVueSeeo/7rV8 LmHPc1zNgaSDLFim43uV4tpgdmuVojMfyzMKW/5KC2sSbPpmZqJF51wQMLKIyx9YIoZt 5v7quv/hhl9pZdqzXWsMTjSejG9tylX6ZYtQ6NjGNGbNctPDmFA4tcc2raMb8lqjKbTS AbbA== X-Gm-Message-State: AOAM533lxJiHfukTLTaaIdJn3ixiocowoP7IYYkMKTHO4LkcAyW8pdao bq4DUX6SVrhXVkGMxFCjMWNzdyxoIyk= X-Google-Smtp-Source: ABdhPJytAqyjG/UjlOqNwfkfYgT9aNIZsYDCWwAxhJglP6ylSTxwL/m0wkbFvGQzmP2tVFp0+iHjgw== X-Received: by 2002:a5d:574a:: with SMTP id q10mr10050678wrw.127.1601572923035; Thu, 01 Oct 2020 10:22:03 -0700 (PDT) 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 h8sm9719625wrw.68.2020.10.01.10.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:22:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 02/16] docs/devel/loads-stores: Add regexp for DMA functions Date: Thu, 1 Oct 2020 19:21:45 +0200 Message-Id: <20201001172159.1619456-3-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201001172159.1619456-1-f4bug@amsat.org> References: <20201001172159.1619456-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x432.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Edgar E. Iglesias Signed-off-by: Philippe Mathieu-Daudé --- 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. Regexes for git grep - ``\`` + - ``\`` + - ``\`` ``pci_dma_*`` and ``{ld,st}*_pci_dma`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From patchwork Thu Oct 1 17:21:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 303899 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B765C4727E for ; Thu, 1 Oct 2020 17:30:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7AFB52085B for ; Thu, 1 Oct 2020 17:30:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bTocxs39" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AFB52085B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kO2P5-0001Ks-AG for qemu-devel@archiver.kernel.org; Thu, 01 Oct 2020 13:30:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kO2HT-0000Aw-2s for qemu-devel@nongnu.org; Thu, 01 Oct 2020 13:22:11 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:38727) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kO2HQ-0003ln-PA for qemu-devel@nongnu.org; Thu, 01 Oct 2020 13:22:10 -0400 Received: by mail-wm1-x344.google.com with SMTP id v12so3979385wmh.3 for ; Thu, 01 Oct 2020 10:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SMVif/eExjf/jyAhzIbCEhUo+yNRaSCxJPYg7Mv/KEQ=; b=bTocxs39IM9Y18bZrfeHKR61dkYrY173s8+/Fz08JfdW3ml/G1odg227f9BdHr/XoN vRvxiERHbEKIHwoHwfx5c2zuCuAsnXFSAW6khef+6uru5L4gZujdDm1/wel6cN7JxOf7 yinWkPZprbmvsZRTJvJP/Y+HUb8mVYHahTd19FCSgB8GvEEDg8XxEmLY75HsY60yEGRo wq5p6g005Q0YXNTpjRos0QrVRemgkw3jgZHqfG8wU8dAmoTftHQ6r9YSafk/H8xVOhl4 bdIeTgcO5Hoqi0vepVhG0GB6uumkhA1iLJG+eJC0mpjfJqWO+K1sCNeuabuqhzBRKwF1 lM3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=SMVif/eExjf/jyAhzIbCEhUo+yNRaSCxJPYg7Mv/KEQ=; b=EoZpm3uC37DLhOTrPN/kobJzWfMicIzC+DpruFdPFSdip+dRPHN6hnfIkgUUbO1w6P 8/DdOZ13fv09/KMW5hCWYgxL9cfH3gqqC45OlE3bmXv2JPkF7+FfCrbW6HobVvOCKCST hGhcQ7lHU9CYS6rzQo2eTwzvJ6kb84wFzLwSMVRPzBpLKuVZsVk2uS3EVxBpkvxOhYrZ DoexCH6ZYg+fsP6qyfyl1hnNubgGDqyBzCH+ZtO/MyS7R4udWWPJyu3Qen1leANyEkrB 1NLpELHJcRnXo7g/WJPOdJZmSHrJT9UB3mA466mAQNfW31qDtYmIC1n0+4LNi1en9lu6 SAug== X-Gm-Message-State: AOAM5315MKovdJeFMHCT2CsEKEvQuuWgLXXkjDdaCqFwlsi/qfdmp7fm 7ISj6vV6Ui6WYc96lEI94ipmpIcTBgw= X-Google-Smtp-Source: ABdhPJx7x9GPGnneH3KMgnKIXVNpcUxP+GeDh9WRHIztzy0J3qnvMB+ASKIdVkCLuhtGK3BMy953Lw== X-Received: by 2002:a7b:c0c4:: with SMTP id s4mr1063503wmh.181.1601572924191; Thu, 01 Oct 2020 10:22:04 -0700 (PDT) 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 h8sm9719625wrw.68.2020.10.01.10.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:22:03 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 03/16] dma: Document address_space_map/address_space_unmap() prototypes Date: Thu, 1 Oct 2020 19:21:46 +0200 Message-Id: <20201001172159.1619456-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201001172159.1619456-1-f4bug@amsat.org> References: <20201001172159.1619456-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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é --- 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, dma_addr_t addr, int dma_memory_set(AddressSpace *as, dma_addr_t addr, uint8_t c, dma_addr_t len); +/** + * address_space_map: Map a physical memory region into a host virtual address. + * + * 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 perform + * 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; } +/** + * address_space_unmap: Unmaps a memory region previously mapped + * by dma_memory_map() + * + * Will also mark the memory as dirty if @dir == %DMA_DIRECTION_FROM_DEVICE. + * @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_len) From patchwork Thu Oct 1 17:21:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 303901 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 381E6C4727E for ; Thu, 1 Oct 2020 17:24:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD24920872 for ; Thu, 1 Oct 2020 17:24:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B+n7lMB4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD24920872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kO2JT-0001GS-Jt for qemu-devel@archiver.kernel.org; Thu, 01 Oct 2020 13:24:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kO2HT-0000Az-F2 for qemu-devel@nongnu.org; Thu, 01 Oct 2020 13:22:11 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:43520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kO2HQ-0003m1-PI for qemu-devel@nongnu.org; Thu, 01 Oct 2020 13:22:11 -0400 Received: by mail-wr1-x443.google.com with SMTP id k15so6705781wrn.10 for ; Thu, 01 Oct 2020 10:22:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+6y9SStSTnN9ITmv25hC1Xnc3CSF+ES6LDmfkf2yvN0=; b=B+n7lMB4E+Kh7A3+lIgqPSfaxJb8wpYZcuRGDJKDZObkWjo0BFYJIB2pTpICCvHHJT wxRNm8TuTm2lHbd0r2UiYU80YQ3dlffa1VODm7pSPQY4ptYQ9YTsfqUHmb9Al/VzCgwT XnzZS7PzLBx1KkJr0uRxJ9JbU7SFak5ByMoP6DYXCNJtpOunynoYoKJWxbV+DxhIp8ft L0axCGyQa77eygR7XW+2vxC3aK2A7uGVfGeMb8LBd/e30NQstNCsWQa9uTPc2PBXocFU TuVODKOGQ1ELgvCI8Kl1QHCudrOsUhj5KXLsXv3+7k0TedcjVzrz6AFqRfJ8woB5K2UR 10bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=+6y9SStSTnN9ITmv25hC1Xnc3CSF+ES6LDmfkf2yvN0=; b=pGS4zLpBCOXSjJmD/4Fmo/btT7Bco72jLjNonVeQ5t2TAtFpC0efydx6EPoRvzMlKM w4Ta+mWMdWDioN25jcYEK18YjuVbXL1+IoEPsI4mT1L1KKilRARQSfyuOk/+pfo+rCJo y7bm0i2zNpUFDZv4kvLkfYjFUGW785PU06OdQ3Vm/srUAyvw1aJW0+3zgMH9VDfHM+6X pXPEriHIBw6F7AD8Rpa9Z2u2UoVK+ud6997zP19IzBdWXm0XVImwCHaTdfMCRNV8YgcN NsRR5+lhW9/aD65BHT1PGGJl8wBBiXfXO5oZvny+dJ4DgTcaRgpbjfyOpABYe7PrhK5Q Q1VQ== X-Gm-Message-State: AOAM531SVoLdoJXbEHl5MiRPOzuf0Tm/hJN8C2BV4D6QnkLqoOqzTHQn Ke8vq3xtlLvyGmklb6VjfCcT6ma6oSw= X-Google-Smtp-Source: ABdhPJz5v+5FS5wJpM3Gu0TPxIodutB3X1LWsbo99w/oDxaJoIEstqP5lEqxAaGCcN5Ew1rOMhuAIA== X-Received: by 2002:adf:dd0b:: with SMTP id a11mr9964746wrm.422.1601572925659; Thu, 01 Oct 2020 10:22:05 -0700 (PDT) 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 h8sm9719625wrw.68.2020.10.01.10.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 10:22:05 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 04/16] dma: Let dma_memory_set() propagate MemTxResult Date: Thu, 1 Oct 2020 19:21:47 +0200 Message-Id: <20201001172159.1619456-5-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201001172159.1619456-1-f4bug@amsat.org> References: <20201001172159.1619456-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé 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é --- 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, dma_addr_t addr, DMA_DIRECTION_FROM_DEVICE); } -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); /** * address_space_map: Map a physical memory region into a host virtual address. 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 @@ /* #define DEBUG_IOMMU */ -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); #define FILLBUF_SIZE 512 uint8_t fillbuf[FILLBUF_SIZE]; int l; - bool error = false; + MemTxResult error = MEMTX_OK; memset(fillbuf, c, FILLBUF_SIZE); while (len > 0) {