Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp813933ybt; Wed, 1 Jul 2020 10:37:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO8lT+dovFYpLtdaJLDCsCOxG1hVG39B7K786gxGM0jZNrGdeInRfXgUy5B7OdFbmU5eQ2 X-Received: by 2002:a17:906:edb3:: with SMTP id sa19mr23484971ejb.21.1593625048298; Wed, 01 Jul 2020 10:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593625048; cv=none; d=google.com; s=arc-20160816; b=rgNRdYjxhnnd7P6YufeG7fRAQ9zaECtZHLcjjLlszNH8KB45XBu6OyrsyRFroNyRxZ XoSGyUFOZcpGbM19EBSToHJD8VjGFD9Ln8syGnkDX5aTCxH84bhTYU/TDxMvOmBl/nJD 9UVbjvpvCTCbYzjDQcwUxQ1tj0SwM5w5tM/BBWK+HiTNNiFzbuIIF+hGvRVOK2lKwrcf d8f6AfjiQnEyzyNcZQs52a7uws3Ak2kzIx4PMKT4rN0n3XKnHVk0XWMoWTKbkG99VJSX 6Vy3z8s1g6CnA5APTv8EZXTMa8k0WP2nt/PjVslGYDVhVQ2FC2tGB53AfSdc0KofRMRw vnQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=yunqpV6sHgtlwRvXfz8ounK4GAfzT6CMIjOILSSWbmo=; b=QP2pdsu3tbGj5LDHcHoj3bfvXl0GAf/mXzyZIUemvITfdbqmZS1Pct0KqHdnfNd8so vM5P6PDIBW2I45Xn8wGoHJwsae6NN1DWBdZ+YIWca1t8OxXriuet+EU3gkSjpWyYARD5 mQjp96yuqpuftCQJWdvRBT6nAvGN6MBIO1QAVuW470bcglAIjsjDG+VbdKAVUpbtlrSQ OQuGsCHk7l5V8QJPB0hRl63eja1IxhGcWGaOg9UD3c7tLZXdj3zsc12LopWoePEiROUg b1/vPNaCGswctSvlnWByerJRI6Rs9PsPh26A2s9O9PEKElRH5FxV/GuOpjdropEuNykh AwAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s4JTo+sH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si4285765ejq.296.2020.07.01.10.37.04; Wed, 01 Jul 2020 10:37:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s4JTo+sH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732137AbgGARe4 (ORCPT + 99 others); Wed, 1 Jul 2020 13:34:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:40520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbgGARez (ORCPT ); Wed, 1 Jul 2020 13:34:55 -0400 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 5CDCB20781; Wed, 1 Jul 2020 17:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593624894; bh=7gRGt637RJr7xqh8m9IFhKHH4colOY8f4NtES4RwwhY=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=s4JTo+sHZ5kueHTuTEAo2QGy2uhqmeAHdidNDEG2j3pV3VxRg5Xv6wKav2TR+6t4b XUiS73u1pvO97HpBjUcfEuJ+XpBhQ0M0mFiLtwwqKmYcxdiCP4RGhschpBHp6VSQJP m93SVv9K90jHvPW8nUrDpWPn4XcEaTHFUj4sKDZM= Date: Wed, 1 Jul 2020 10:34:53 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Christoph Hellwig cc: Stefano Stabellini , jgross@suse.com, Peng Fan , x86@kernel.org, konrad.wilk@oracle.com, jasowang@redhat.com, "Michael S. Tsirkin" , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, iommu@lists.linux-foundation.org, linux-imx@nxp.com, xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] xen: introduce xen_vring_use_dma In-Reply-To: <20200701133456.GA23888@infradead.org> Message-ID: References: <20200624091732.23944-1-peng.fan@nxp.com> <20200624050355-mutt-send-email-mst@kernel.org> <20200624163940-mutt-send-email-mst@kernel.org> <20200624181026-mutt-send-email-mst@kernel.org> <20200626110629-mutt-send-email-mst@kernel.org> <20200701133456.GA23888@infradead.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 Jul 2020, Christoph Hellwig wrote: > On Mon, Jun 29, 2020 at 04:46:09PM -0700, Stefano Stabellini wrote: > > > I could imagine some future Xen hosts setting a flag somewhere in the > > > platform capability saying "no xen specific flag, rely on > > > "VIRTIO_F_ACCESS_PLATFORM". Then you set that accordingly in QEMU. > > > How about that? > > > > Yes, that would be fine and there is no problem implementing something > > like that when we get virtio support in Xen. Today there are still no > > virtio interfaces provided by Xen to ARM guests (no virtio-block/net, > > etc.) > > > > In fact, in both cases we are discussing virtio is *not* provided by > > Xen; it is a firmware interface to something entirely different: > > > > 1) virtio is used to talk to a remote AMP processor (RPMesg) > > 2) virtio is used to talk to a secure-world firmware/OS (Trusty) > > > > VIRTIO_F_ACCESS_PLATFORM is not set by Xen in these cases but by RPMesg > > and by Trusty respectively. I don't know if Trusty should or should not > > set VIRTIO_F_ACCESS_PLATFORM, but I think Linux should still work > > without issues. > > > > Any virtio implementation that is not in control of the memory map > (aka not the hypervisor) absolutely must set VIRTIO_F_ACCESS_PLATFORM, > else it is completely broken. Lots of broken virtio implementations out there it would seem :-( > > The xen_domain() check in Linux makes it so that vring_use_dma_api > > returns the opposite value on native Linux compared to Linux as Xen/ARM > > DomU by "accident". By "accident" because there is no architectural > > reason why Linux Xen/ARM DomU should behave differently compared to > > native Linux in this regard. > > > > I hope that now it is clearer why I think the if (xen_domain()) check > > needs to be improved anyway, even if we fix generic dma_ops with virtio > > interfaces missing VIRTIO_F_ACCESS_PLATFORM. > > IMHO that Xen quirk should never have been added in this form.. Would you be in favor of a more flexible check along the lines of the one proposed in the patch that started this thread: if (xen_vring_use_dma()) return true; xen_vring_use_dma would be implemented so that it returns true when xen_swiotlb is required and false otherwise.