From mboxrd@z Thu Jan 1 00:00:00 1970 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=-11.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 59D08C433E0 for ; Tue, 4 Aug 2020 23:23:32 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 3814E2073E for ; Tue, 4 Aug 2020 23:23:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="rVBS4T8w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3814E2073E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k36HE-0001sB-0U; Tue, 04 Aug 2020 23:23:24 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k36HC-0001rm-Gn for xen-devel@lists.xenproject.org; Tue, 04 Aug 2020 23:23:22 +0000 X-Inumbo-ID: eb4875ce-fcfe-48c7-96bf-150906aea421 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id eb4875ce-fcfe-48c7-96bf-150906aea421; Tue, 04 Aug 2020 23:23:22 +0000 (UTC) Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 283EB2073E; Tue, 4 Aug 2020 23:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596583401; bh=Ey9+1CdkZ+XZ6lcXk7hQ6Np+Ap3ZTgAwJFD9LKmfTY8=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=rVBS4T8w8ATJdRgP7xazg4QONFEdi9ALNGbkmeGNGFnOKgkrGK4CIfr/+JJNiM+g0 /GALs+GN7IclAoL75vGL4/UERPztygHx48vFaI7YLD4wTTkUxurAyv4U7zkfg1BGuU Tk2q72UCB8Fhrkl+TX0lDc3h7t/Co0U3Lb3JsBFc= Date: Tue, 4 Aug 2020 16:23:20 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Oleksandr Tyshchenko Subject: Re: [RFC PATCH V1 11/12] libxl: Insert "dma-coherent" property into virtio-mmio device node In-Reply-To: <1596478888-23030-12-git-send-email-olekstysh@gmail.com> Message-ID: References: <1596478888-23030-1-git-send-email-olekstysh@gmail.com> <1596478888-23030-12-git-send-email-olekstysh@gmail.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Ian Jackson , Oleksandr Tyshchenko , Anthony PERARD , xen-devel@lists.xenproject.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On Mon, 3 Aug 2020, Oleksandr Tyshchenko wrote: > From: Oleksandr Tyshchenko > > Without "dma-coherent" property present in virtio-mmio device node, > guest assumes it is non-coherent and making non-cacheable accesses > to the vring when the DMA API is used for vring operations. > But virtio-mmio device which runs at the host size is making cacheable > accesses to vring. This all may result in a loss of coherency between > the guest and host. > > With this patch we can avoid modifying guest at all, otherwise we > need to force VirtIO framework to not use DMA API for vring operations. > > Signed-off-by: Oleksandr Tyshchenko This should also be folded in the first patch for libxl > --- > tools/libxl/libxl_arm.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c > index 469a8b0..a68fb14 100644 > --- a/tools/libxl/libxl_arm.c > +++ b/tools/libxl/libxl_arm.c > @@ -726,6 +726,9 @@ static int make_virtio_mmio_node(libxl__gc *gc, void *fdt, > res = fdt_property_interrupts(gc, fdt, &intr, 1); > if (res) return res; > > + res = fdt_property(fdt, "dma-coherent", NULL, 0); > + if (res) return res; > + > res = fdt_end_node(fdt); > if (res) return res; > > -- > 2.7.4 >