From patchwork Thu Dec 23 11:55:32 2021 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: 12698156 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8BCD2C433EF for ; Thu, 23 Dec 2021 12:10:07 +0000 (UTC) Received: from localhost ([::1]:52046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0Mv8-0000ss-ER for qemu-devel@archiver.kernel.org; Thu, 23 Dec 2021 07:10:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0Mhv-0006Am-6m for qemu-devel@nongnu.org; Thu, 23 Dec 2021 06:56:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38322) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0Mhs-0000bh-NW for qemu-devel@nongnu.org; Thu, 23 Dec 2021 06:56:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640260584; 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=DFluRvBp6z9QVaCBe8Ue+D5WXYJ9sfHm6PVL8XfDVUM=; b=IiY0ix8b8hNNbvlIUp807OJwaNtSYXMdiisgsS2RHogIau5kuj/8dd4tXds2lRcKJQZRsf FNwKDhfUcwTJKscMOToCwp/1/1mg9x2nq8cKJaDlNZS3FB5z0kvpT2GuCFSi6Vgjuy+4L9 TEEifZxB44FeTqrp1PYtgBCd6v66/Ww= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-346-J6zAEB5IOAmipWWUvESePQ-1; Thu, 23 Dec 2021 06:56:23 -0500 X-MC-Unique: J6zAEB5IOAmipWWUvESePQ-1 Received: by mail-wm1-f69.google.com with SMTP id r10-20020a1c440a000000b003456b2594e0so1925069wma.8 for ; Thu, 23 Dec 2021 03:56:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DFluRvBp6z9QVaCBe8Ue+D5WXYJ9sfHm6PVL8XfDVUM=; b=X6TNk1G+F6YwsTBwyyVyjBU7B/L4rdiDqPqfb/k12lJa11UiFnDfHk29QDKgV6yXQm EXHfhAU2C19coZvxwn78RFRGkQxXXIxX/Q7NiUQHA6BSrj3Uu5KWDMCQSZYo1RWILy4t HH3YzoAdQGMpIkTXEv6AUFQAZRvfzb2bs3VTYbVPxWUZpg7KbM8MMvZWh5YQH19vwyEf CRef/ev0dYIP4PM4g9JUZ1+KPlHSrwGCB7VgSABCfels1aGIVw6A7GhT5c27SAsed8pM KfNz0X/w+O7PXUJOgas8t1isVDUgR2GimT+X2qQr2ZxsJoczg+oP2d1/NHXEtLyEUHhl 64LA== X-Gm-Message-State: AOAM532yJQz/jftSUfcbLSaKKSwSdyiFQnBKz8rtWHarcIlE4hFgZB2T F7R/+YE53VnLTwHlfB+PhBU0AqAUQW9oS4z3zRYviBDoqriZwcDZv64Fw6EGylkvIaBBQmVX8uv fNVIfJMyRf5GLqR5Q/ZjMB00lu6RiuSXPX5mWUoRVWeSyRtLWYB32lmh4niKOWqkg X-Received: by 2002:a05:600c:24c:: with SMTP id 12mr1498491wmj.191.1640260581523; Thu, 23 Dec 2021 03:56:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBokRYK6ALM3HGg1JCXxCJgsw/1xEQICWEVfpoFNmRzR/YDKv4JTspeT2MSnEe13aTG1tZmQ== X-Received: by 2002:a05:600c:24c:: with SMTP id 12mr1498440wmj.191.1640260581327; Thu, 23 Dec 2021 03:56:21 -0800 (PST) Received: from x1w.. (33.red-193-152-124.dynamicip.rima-tde.net. [193.152.124.33]) by smtp.gmail.com with ESMTPSA id g1sm4915702wri.103.2021.12.23.03.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Dec 2021 03:56:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 01/23] dma: Let dma_memory_valid() take MemTxAttrs argument Date: Thu, 23 Dec 2021 12:55:32 +0100 Message-Id: <20211223115554.3155328-2-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211223115554.3155328-1-philmd@redhat.com> References: <20211223115554.3155328-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 Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.203, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , Dmitry Fleytman , "Michael S. Tsirkin" , Jason Wang , Bin Meng , David Hildenbrand , Peter Xu , Gerd Hoffmann , Klaus Jensen , "Edgar E. Iglesias" , Sven Schnelle , "Edgar E . Iglesias" , Hannes Reinecke , qemu-block@nongnu.org, Daniel Henrique Barboza , Li Qiang , Havard Skinnemoen , Joel Stanley , Stefan Weil , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , Alistair Francis , Richard Henderson , Greg Kurz , Beniamino Galvani , Eric Auger , qemu-arm@nongnu.org, Jan Kiszka , =?utf-8?q?C=C3=A9dric_?= =?utf-8?q?Le_Goater?= , Stefan Hajnoczi , Keith Busch , John Snow , David Gibson , Eduardo Habkost , Andrew Jeffery , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Andrew Baumann , Tyrone Ting , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é Acked-by: Stefan Hajnoczi Message-Id: <20210702092439.989969-2-philmd@redhat.com> --- 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 4bea87f39cc..4c45f1579fa 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 *dev) 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_UNSPECIFIED); } 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 3201e7901db..296f3b57c9c 100644 --- a/include/sysemu/dma.h +++ b/include/sysemu/dma.h @@ -73,11 +73,11 @@ static inline void dma_barrier(AddressSpace *as, DMADirection 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 == DMA_DIRECTION_FROM_DEVICE, - MEMTXATTRS_UNSPECIFIED); + attrs); } static inline MemTxResult dma_memory_rw_relaxed(AddressSpace *as,