Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1016427pxb; Fri, 22 Apr 2022 16:53:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJv+xqE6bgb4/URI4pGjRsvuvk/MIkZR3Y/q+KvIfUn9viPhMAXlwQ8sO/ssSbWt5WPaun X-Received: by 2002:a17:90b:4b89:b0:1c8:105a:2262 with SMTP id lr9-20020a17090b4b8900b001c8105a2262mr8107808pjb.225.1650671635660; Fri, 22 Apr 2022 16:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650671635; cv=none; d=google.com; s=arc-20160816; b=NKrkDfzRgQr3PGTQQuSy/peMsdmTtDwe4rC+pckgh7zq55Uu9X1At5Kr/M5/Hadvdq VzDGjhHxgVYQs2sYC3E6WH9oabALDpGtBh8N+JUQqccle6FXDmNkiSxQzFRJx1aw03ze /A8l/KMSo/J28ju9TZkctBYjSzCkO6OElWN4+bXE8U5W4uQIZjIGvLDm6Ijmsxu1zJNQ W3+NVTex77uEJQ6XtD+SMJn+Eo4ZVpwn0w4d6lfCxDOlJHUPf6ow7Jinsn4idXbBEi8a hejiqeDovo007DjZs6Xu3raKbGFx1DklvftfWvpnrr2KKjLpw57Iabk39qICA4W/rxMC pOiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=eIxtTJnEH2pMf9hvml5ep5kELaoUtmx4QXOPzdQfSlo=; b=I99KbwW/8GHOm3erfKbk1per1rD52J+6tm3Nv7KfK6cJECrqohEjloP8GBKjGt4A6o fsb0ORyfhqG5U5NzgMh3/qt1Cpo/k0JRGFxOni//0r3KSB5D6L+xR8OJZ11bWk6IKQJq 7UO2l46O5deSNnmrIgdTxr0r+MEK6Rjp9mqkds0uzN8bazy0laWFF0V6neCBOpDA0nc+ xsfa2cEv21tz0an41JJ2qxkHXGauNbdaSma58m0lXwtOzwowGl4fuQP3TUpx3he5uHkm gEoeDrDDOfYZF+V5bL88P3ImHq3Csa48Dhvyf6e0JlwqA4V8/KMIuLCqIetqXNnWlB7Q L5uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pbkp72Sy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a63-20020a639042000000b003aa7b51672dsi7135180pge.92.2022.04.22.16.53.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 16:53:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pbkp72Sy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8A89D20BCA; Fri, 22 Apr 2022 16:23:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbiDVX0I (ORCPT + 99 others); Fri, 22 Apr 2022 19:26:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbiDVXZb (ORCPT ); Fri, 22 Apr 2022 19:25:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A1CF80234 for ; Fri, 22 Apr 2022 16:00:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 214BAB83305 for ; Fri, 22 Apr 2022 23:00:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B6B6C385A0; Fri, 22 Apr 2022 23:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650668453; bh=Tt3wwME8ZrAnjoqNSv/eny+SL/xKTMCNW0YOwL5HtmU=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=pbkp72Syh6ze1/sVyi2ZMLT+cvAgwDIUvVnmDhf93VYSNywj5WeHzORptbyE6qnCp Kj0veLD6zjTWSl2azkAW3joi+nFnQJPt4r/40N62vmTbpV8HQk0UAypHp4iJt9mvhb VbCPtoxYVel6jnB7YSXPTl1xFeMsUV7fkRz+W0JFs6lfFbQiORL+7ALl8VgRQFMwzz WgbYAr7QXc/+YIBuhsGqgGJ/aWpcXxJ3bmWsmxsHklj4NSJDY+EbVYRYxltALvFvFn bOoCfKQq8f7CkYyjMLMJ9/2i1c3g7V8uz0QOmYsPhnz29cg0NlwTAulTy+D9D5kY0I zZC4ySq0Nur6w== Date: Fri, 22 Apr 2022 16:00:53 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@ubuntu-linux-20-04-desktop 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 In-Reply-To: <1650646263-22047-7-git-send-email-olekstysh@gmail.com> Message-ID: References: <1650646263-22047-1-git-send-email-olekstysh@gmail.com> <1650646263-22047-7-git-send-email-olekstysh@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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, 22 Apr 2022, Oleksandr Tyshchenko wrote: > From: Oleksandr Tyshchenko > > As the main (and single at the moment) purpose of xen-grant > DMA devices is to enable using virtio devices in Xen guests > in a safe manner, assign xen-grant DMA ops only if restricted > access to the guest memory is enabled. > > Signed-off-by: Oleksandr Tyshchenko Reviewed-by: Stefano Stabellini > --- > Changes RFC -> V1: > - update commit subject/description > - remove #ifdef CONFIG_XEN_VIRTIO > - re-organize the check taking into the account that > swiotlb and virtio cases are mutually exclusive > - update according to the new naming scheme: > s/virtio/grant_dma > --- > include/xen/arm/xen-ops.h | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/include/xen/arm/xen-ops.h b/include/xen/arm/xen-ops.h > index 288deb1..26954e5 100644 > --- a/include/xen/arm/xen-ops.h > +++ b/include/xen/arm/xen-ops.h > @@ -2,12 +2,17 @@ > #ifndef _ASM_ARM_XEN_OPS_H > #define _ASM_ARM_XEN_OPS_H > > +#include > #include > +#include > > 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()) > dev->dma_ops = &xen_swiotlb_dma_ops; > #endif > } > -- > 2.7.4 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >