Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp931637ybt; Wed, 1 Jul 2020 13:49:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdLo69mwYFErXXh+Ww/S8pjHwJRl6iLNrMkH4QkrvmKdl8JmT+o0W9fMxbe/kiKljkbFOh X-Received: by 2002:a17:907:2105:: with SMTP id qn5mr18180800ejb.308.1593636557946; Wed, 01 Jul 2020 13:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593636557; cv=none; d=google.com; s=arc-20160816; b=E5FCW2ADMr7ljz/O7am7ODoWH9jH9QRCLheGP5a/8BIZkOCUgsH4b/sfFDGqDu5TYb oeKP5HDHhNYvcf9WB/p+dSMmTmwa/TCAegpJg3LJ7IPspPGnzf1g3TR60aNAuW9dXbyk Kz44KpQRjIvUNXrxR5ECDwxFI2FzMb9Fmg9xEZ6hHOBK0o4h6D28FDZvkKPm0COjYJXw NtdkQBcZ9Qk0DR538pYuAC5kSmQtE3LwEder6hmU4RMcU7L6FNMMGq1TuBUpTPOHwk6s 7S5ggBpjbAh0TNXeodJecIgwHu70Loa7/S+6gshMdgVtpoynDtXhRpIBEJAZkLVFyt+P T1MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=MbiyraTJ4trv3FWb4qCBJhr5R70RrnDBw9rQbrUZ784=; b=s96UNz1BTSWDm5jb+7JwwN7y7a1h0l0elHb3b4a4zmkcdhHL26NMgm+U4hZcC2lr+p hvbmMJHBud1v3DZMbfdij0pxTEkLBVoqjZH6Yl8w619k88fAvYuOl273znOf69o7SIeX RylwYW4zJ3MAjlpXogi79yAL9GQYTeOa7OU4hsaPYdRYXxb6CxBwd0PMiR0EYAaobP1m xACmsTwFX8fBYJQk9WrXdAKJfGUY43AcwpIGQ3fbGL+WNwU2PQqT2PCB++1RO3E5U6hG ANSOyw0cMIZNJ4KamR+pbxNpo3KwOp/zcK42vHYKS6YD+kYbZbdW0kgvr/X+Ut9c44Tl LmlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VfFIRYhy; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lg19si4520507ejb.138.2020.07.01.13.48.52; Wed, 01 Jul 2020 13:49:17 -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=@redhat.com header.s=mimecast20190719 header.b=VfFIRYhy; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726208AbgGAUrl (ORCPT + 99 others); Wed, 1 Jul 2020 16:47:41 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:34065 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725535AbgGAUrk (ORCPT ); Wed, 1 Jul 2020 16:47:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593636458; 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: in-reply-to:in-reply-to:references:references; bh=MbiyraTJ4trv3FWb4qCBJhr5R70RrnDBw9rQbrUZ784=; b=VfFIRYhyN7UAlCmU4ycy3YjrdUnZaix3K83yEmCJ4yw+0MKL3BwuvHujojAeGw/KHJUYyy Y6SsKzUGNYq4BV0q2xfZCxCjGX4LJA3yWuprFF0sVrh4rQU/MTjyXc6+cmBsvv5uUMLYRf 309S+3va0D9/K/zDx6wiFR3gKOdZ6+w= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-HysxjhcjMOOVN17aKfk3VA-1; Wed, 01 Jul 2020 16:47:36 -0400 X-MC-Unique: HysxjhcjMOOVN17aKfk3VA-1 Received: by mail-wm1-f71.google.com with SMTP id o13so25176897wmh.9 for ; Wed, 01 Jul 2020 13:47:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=MbiyraTJ4trv3FWb4qCBJhr5R70RrnDBw9rQbrUZ784=; b=Gm1dPRrwCgoL9T10X6SbBKszogGlI46IpOFEzypGef6pQP96s7UbcCmHZxykr/IbKI 8pVw+K5rU4BKDVte/jKO5OIoX4+VN5QH/zwNN69yr+aTAjME+O4ImfKnTX8DJsw6Cj2Z ww3mPvZdEk2WERDtKSOQFQ8QoSXe1Vfn1oeLe525vJ22II6fMVast+SSEs0jrQNUhQ81 3KXqeY/EyBF90GTApvfZSqHmrbZVD5cKXFW2HPASfFYEbz/7rT3slmCf7u1YyJO3ehGa 0Tahey7JxRTQNqqC1aQa4MWQ5iXBnGxw/n68xCk9aPPTGN/uRf8LpvkkuKgufzMm3vP0 yGAA== X-Gm-Message-State: AOAM5302EBlwxSdEMok5tqIYmi784S4rwN/2ZRUrRSacl7d99R5H1+vh Ta9P3NGZmEU0TTHewqj/RHgtD3vOpMVvHGr2d2uWFA41lCJ76oacMxIcEXno2/PzgQyPGawoKpB aVeejgGBfdCkYg3hQ0uyERwNu X-Received: by 2002:adf:ed47:: with SMTP id u7mr30433374wro.201.1593636455515; Wed, 01 Jul 2020 13:47:35 -0700 (PDT) X-Received: by 2002:adf:ed47:: with SMTP id u7mr30433344wro.201.1593636455219; Wed, 01 Jul 2020 13:47:35 -0700 (PDT) Received: from redhat.com (bzq-79-182-31-92.red.bezeqint.net. [79.182.31.92]) by smtp.gmail.com with ESMTPSA id h2sm8337653wrw.62.2020.07.01.13.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 13:47:32 -0700 (PDT) Date: Wed, 1 Jul 2020 16:47:29 -0400 From: "Michael S. Tsirkin" To: Stefano Stabellini Cc: Christoph Hellwig , jgross@suse.com, Peng Fan , x86@kernel.org, konrad.wilk@oracle.com, jasowang@redhat.com, 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 Message-ID: <20200701164501-mutt-send-email-mst@kernel.org> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 01, 2020 at 10:34:53AM -0700, Stefano Stabellini wrote: > 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 :-( Not really, most of virtio implementations are in full control of memory, being part of the hypervisor. > > > > 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. I'll need to think about it. Sounds reasonable on the surface ... -- MST