Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1910983pxb; Sat, 23 Apr 2022 22:15:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+5m7lR2WP9UrSls4IXPKvVF8zyw6RI7NzM33N9O0/RaYlx6UE2RPBlJxFTZhaM6vN8H/k X-Received: by 2002:a17:90b:1807:b0:1d5:540d:4b6a with SMTP id lw7-20020a17090b180700b001d5540d4b6amr13808875pjb.240.1650777341902; Sat, 23 Apr 2022 22:15:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650777341; cv=none; d=google.com; s=arc-20160816; b=LCA7oHeBxpYImyVWc5CzmOfoznIpnDYrNQZ5OupUJbQZy26yxK220iMpXEhO1zsIKz BjGNOJybxaYIj8GijHGBDkTrfH54SbraEJ5/0TfldWx/phmLb7VDIprd2OvCuUJZkmxA 7qahk4w/ZX0g/bdeid3c0hsuRA0EEb1mFZBwtoQMZWZkg3uzz+EPOiasbthG3C8boxKu 8k5uCdoECtzjRz8JkVQ4bsIxSxOZrP3ipu6vAhD1W2CR53sWYKNvRY/4MrUI6pcOmpcQ AF05PH33ntTFSgoycwR8+YxfgpOJ2fIPTqpQhHbOi31WfI7rh+nmnAI9HbLTU7RelwFr VD+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BbU4qU1u+ib3z06jcjxtpWxewOhWeGRACT3SUClYfQU=; b=aL+N3CBV9oPmfWT5w7BDpN4oN70txfkwvpevLK+E830XUC0KCNlbfweyQhnwyQp4oi yfi/GZyuBhx7fkSH5UDccZJ4zqcy1K8NKaDP1gkiKyqY9E9DCAvpdtrmVBFH//bVHTJZ yZMaqJ3SsEldGRHFBxCkJAT10Jw74kezzP9Xh38Bm1krx3UTw4RR8XQlLtBCGcQ9JVyL pFAXWhvAD1s+H7GgmaSSNK0j3ORSyGp5iv3D/cweqCNZfOTrYZQfzorKvL/2XWguT5Uj zDBsAWXYisf1Dwz6d672X3FYrqfRbq5lYytV89Zy5z3ycTw4gjB5gIsTlLdolUrstVxG ijmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=AhrDqdLN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pj8-20020a17090b4f4800b001cb4d9e17c6si12999261pjb.84.2022.04.23.22.15.24; Sat, 23 Apr 2022 22:15:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=AhrDqdLN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236466AbiDWQpT (ORCPT + 99 others); Sat, 23 Apr 2022 12:45:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236443AbiDWQpR (ORCPT ); Sat, 23 Apr 2022 12:45:17 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DF1B3D1D4 for ; Sat, 23 Apr 2022 09:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BbU4qU1u+ib3z06jcjxtpWxewOhWeGRACT3SUClYfQU=; b=AhrDqdLN83fA5xLD4BM2GP2cPe ZPFamzRoBUWgZ6TueAJd/LnTpCkqpIraOwxxnFdhh10vSqfwomorASN5nrlTp8V9Dry0dnGRxjjEw v7JuhY6ox9FidKp5Hlp3HLTXDr3Vz4TBvr3dE48LvKPTfesNhxqNIb3L+LJJZDQI1E1E05OFk7nZJ fdgfnxdUNoQrEcTt1wwc5Cy5Dh82uK7C4oGDIf7aO2Wy+2OHkl7W87Jqi1aFlc6+I3039Se/GEDo3 evKCQOC1ENaEsIIIjNzCQtGidYDx7645wDthEjcAzr29ZEXmNny8nn/OVrakWVtN9qIAf8TKvLahV rbi2qx6g==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1niIpu-004etX-T8; Sat, 23 Apr 2022 16:42:18 +0000 Date: Sat, 23 Apr 2022 09:42:18 -0700 From: Christoph Hellwig To: Oleksandr Tyshchenko Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Oleksandr Tyshchenko , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Julien Grall , "Michael S. Tsirkin" , Christoph Hellwig Subject: Re: [PATCH V1 6/6] arm/xen: Assign xen-grant DMA ops for xen-grant DMA devices Message-ID: References: <1650646263-22047-1-git-send-email-olekstysh@gmail.com> <1650646263-22047-7-git-send-email-olekstysh@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1650646263-22047-7-git-send-email-olekstysh@gmail.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 22, 2022 at 07:51:03PM +0300, Oleksandr Tyshchenko wrote: > static inline void xen_setup_dma_ops(struct device *dev) > { > #ifdef CONFIG_XEN > - if (xen_swiotlb_detect()) > + if (arch_has_restricted_virtio_memory_access() && > + xen_is_grant_dma_device(dev)) > + xen_grant_setup_dma_ops(dev); > + else if (xen_swiotlb_detect()) I don't think that arch_has_restricted_virtio_memory_access check should be there as it still is a bit of a layering violation.