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=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 A8BBAC433E0 for ; Wed, 1 Jul 2020 20:50:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DA2B2082F for ; Wed, 1 Jul 2020 20:50:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VfFIRYhy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726432AbgGAUrm (ORCPT ); Wed, 1 Jul 2020 16:47:42 -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-Google-Smtp-Source: ABdhPJzi4/QeFIvFvIhW8MFrahcm+NHf1Nr8du8L4WlMn+iG6s23576AuHveqgE2W9yZnAvkgrNyJg== 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 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=-0.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 21848C433DF for ; Wed, 1 Jul 2020 20:47:48 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 DB4F720853 for ; Wed, 1 Jul 2020 20:47:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EcVf4PX8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB4F720853 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 9139D303CD; Wed, 1 Jul 2020 20:47:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CJDGIIFCx8Og; Wed, 1 Jul 2020 20:47:46 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 3E1A3266BD; Wed, 1 Jul 2020 20:47:46 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2A3BBC0865; Wed, 1 Jul 2020 20:47:46 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 68F6AC0733 for ; Wed, 1 Jul 2020 20:47:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 2DFC0265F1 for ; Wed, 1 Jul 2020 20:47:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kPoPx8EHWXDD for ; Wed, 1 Jul 2020 20:47:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by silver.osuosl.org (Postfix) with ESMTPS id F2330265B2 for ; Wed, 1 Jul 2020 20:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593636460; 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=EcVf4PX8QJc0r25MhOFc1NxheBhBUF1n0HSsBUvQv5AZvGQn7BVcYnSZtAgYS5zabfLcvo TSYXJ2zuZB8j8vLi/1/tS9SFRm4DqJvyWJMEQFi6mKTQVgM6W1TWKrG4toyamZ/qIcEgNv NE0r4vhyahqydk8cPhj3MIy0oIze7dQ= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-457-UUDMozEVO4KAsAfewibyqw-1; Wed, 01 Jul 2020 16:47:36 -0400 X-MC-Unique: UUDMozEVO4KAsAfewibyqw-1 Received: by mail-wm1-f72.google.com with SMTP id t145so25259037wmt.2 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=szxReFg+20TYT9ZPUBZhnpz+ax4FXFLHNOSP0QGAnSsVunie1SQOi29F4N+pA8ASVL xVMgamBc4i8B7XULSNSiG2p+KskV+Xq/Pwm34xZYCQeYzNr/khot14oBqbItuGO3JQsP fQpIBqEtLrBiv6l46jiFHwhpq3PUqgL4uZrxe60rCT2B8LaiOcBigrDCEm9o3B1RAKQA qxgeQOkkZ+I10dTZFeKJ67hguddmcAoLNVrHM810CKLQJVwN5apLcB2xVnlV0EE+x36r RW5KPX8EtnT3rQYrCCfMSmZ9ZM/P1Hms58cG0Hv4/Qrnvi2mdNQ1FhHZQlHxmK4uBwZ+ BRtA== X-Gm-Message-State: AOAM532ZEfbPUIqn0mVdMJpuz9c1h0Os1pIcsLQlHt1kTb9c/CGHSRrd /sE21ZTRSazTNM8u4DuIiyghKVjEssaLh+xwGu1YIrXm6MNrLgKuCly3CrXfI97xz5s+Ae8g0vZ gzLf01uWDyWRm938m4nQE/MibYID+Fw== X-Received: by 2002:adf:ed47:: with SMTP id u7mr30433380wro.201.1593636455541; Wed, 01 Jul 2020 13:47:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi4/QeFIvFvIhW8MFrahcm+NHf1Nr8du8L4WlMn+iG6s23576AuHveqgE2W9yZnAvkgrNyJg== 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 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 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Cc: jgross@suse.com, Peng Fan , konrad.wilk@oracle.com, jasowang@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Christoph Hellwig , iommu@lists.linux-foundation.org, linux-imx@nxp.com, xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com, linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" 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 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH] xen: introduce xen_vring_use_dma Date: Wed, 1 Jul 2020 16:47:29 -0400 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-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" To: Stefano Stabellini Cc: jgross@suse.com, Peng Fan , konrad.wilk@oracle.com, x86@kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Christoph Hellwig , iommu@lists.linux-foundation.org, linux-imx@nxp.com, xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com, linux-arm-kernel@lists.infradead.org List-Id: virtualization@lists.linuxfoundation.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 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=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 45E4CC433E0 for ; Wed, 1 Jul 2020 20:49:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 123F820853 for ; Wed, 1 Jul 2020 20:49:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pHfGTyg4"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VfFIRYhy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 123F820853 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=61MHJlvh9+B0nynwEs1knDbxaCMLrvrI2kyOhDbwP8E=; b=pHfGTyg4+hytHagj1oCiYnyZL PZZlmQreLohlmQNKPSo0MfAufc10N52J3dnRygXXlfdpb9+4dz+bDx4lsLtoqtN8XsUhTWcPeIhMW No9sE7zuA6bS4vT5HDxwz1KRnyE7Waj+95ByYW+S2PlI9OK/eehjaPMoqHoo0DPyfumvQiSQpC9pt 7mjVAf9sqfBfNxbUrKc08g8gwGOhZ3/PV7RYxb7NraC1lTBXO6hppX/2oAp+iQjCJeVzIPgj7SDkP w7C5pCyVkqeka15F1V5crz3l5bQA59ESKhPBpA5CwMxtPM1iWVBzrjaa6bxA9Emh76lBGfrBTdwxp qiIiTFxYA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqjdt-00080Z-V7; Wed, 01 Jul 2020 20:47:41 +0000 Received: from us-smtp-1.mimecast.com ([205.139.110.61] helo=us-smtp-delivery-1.mimecast.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqjdr-0007yr-BV for linux-arm-kernel@lists.infradead.org; Wed, 01 Jul 2020 20:47:40 +0000 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-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-440-AqF_8VFkMGyuyPvMuSqPjQ-1; Wed, 01 Jul 2020 16:47:36 -0400 X-MC-Unique: AqF_8VFkMGyuyPvMuSqPjQ-1 Received: by mail-wm1-f72.google.com with SMTP id v11so6565907wmb.1 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=W3e+vhaDnLBSdETYw707Vv+quuggQ6k02JNGdg0kIKBCqPOXfuNu10InO7whXrve7H WM3cch6eyMpO+ZaPadT+nNFrAJZEnu48au01obW1Y26Ugb+89gQw3pTYmMvygExt9pfL a6RlCI5Xq3cu9LZOQng5q/4m4tmt+iV2CaPfxJ2/LVl1j/YbHETO3EcKNz1I1WVBONcJ ceBCW0h9im2lDVco9m86K16xGjebVqbGwbuDxC1LsZfsMIaxR3MISzF+kb4AP5PZVTGf akl7pHAuDPOe78si5s0VsjPnHmi8fVp2hVTP8fneplCwKnqgv0hmaeXWyPS4PQkI6Q6G 6LrQ== X-Gm-Message-State: AOAM533BEDOq8jEhiYtfU0TWEpDuUU81rSCFye//zRoRed7w4A+k+AFw +tfML6B5MdWrToUvQvigO4GDrqhId+NC0gv5EZy3P7scU6kfMhw7tOdTkmktTz5u/nLoxv2wgpg LQHGJsiqcph3oExVmRaarEud4QCYgdB3i4GA= X-Received: by 2002:adf:ed47:: with SMTP id u7mr30433366wro.201.1593636455515; Wed, 01 Jul 2020 13:47:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi4/QeFIvFvIhW8MFrahcm+NHf1Nr8du8L4WlMn+iG6s23576AuHveqgE2W9yZnAvkgrNyJg== 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 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 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200701_164739_593206_3A386DD9 X-CRM114-Status: GOOD ( 28.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jgross@suse.com, Peng Fan , konrad.wilk@oracle.com, jasowang@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Christoph Hellwig , iommu@lists.linux-foundation.org, linux-imx@nxp.com, xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-0.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 22458C433DF for ; Wed, 1 Jul 2020 20:48:06 +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 E7D70208B8 for ; Wed, 1 Jul 2020 20:48:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VfFIRYhy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7D70208B8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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 1jqjdx-0007gK-Jp; Wed, 01 Jul 2020 20:47:45 +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 1jqjdv-0007gF-QM for xen-devel@lists.xenproject.org; Wed, 01 Jul 2020 20:47:43 +0000 X-Inumbo-ID: 1998bf1f-bbdc-11ea-877f-12813bfff9fa Received: from us-smtp-1.mimecast.com (unknown [205.139.110.120]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 1998bf1f-bbdc-11ea-877f-12813bfff9fa; Wed, 01 Jul 2020 20:47:38 +0000 (UTC) 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-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-178-pzifr3PYPOaCxAU1JTkHBA-1; Wed, 01 Jul 2020 16:47:36 -0400 X-MC-Unique: pzifr3PYPOaCxAU1JTkHBA-1 Received: by mail-wm1-f72.google.com with SMTP id g6so19422509wmk.4 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=T9LXlIa4WkX/hNvS0JTUDTVhQ4Nuc5ygJvRgicYzdxV67DOIf8Ji3HodbouPDyoK7U 8ClqaP1WvvlE16QJBDaP3RXfKhNQYDKGKmK/GmdbD3gwLPuwU2CO4RJgGfOYF674IcBx YT8Px/md2ChNNIiCYehDlh2meoAfkD3qtddjVbiUdscLs8dBRN9bVWRoVxCNO39borUH tUGqBusPnrb/gvewWec1N6+7deeW0V0sojEd0PhKzHG95K2ptPS4d7olq3PEi0a6nmGK +vooptsiIizrk7X4uIb85kN6rYXdIonPpztChNiIDFIekrXL4pnEQRCqoxOqr6xiz7gC gTlg== X-Gm-Message-State: AOAM533wwWHQnNmAjierE0nmdqzKhKdnFdhz9NsBHPplt+XxtZlcaVn7 NdTxvNQTGC2d2s1zhPjKg3mvG7BOD9hVzx9zHmpKL7fuCv6YNWMakUEfExigk/vrig8QThHjNIw EmyMVksT8/8VY76RxV9/emUKDZ84= X-Received: by 2002:adf:ed47:: with SMTP id u7mr30433368wro.201.1593636455515; Wed, 01 Jul 2020 13:47:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi4/QeFIvFvIhW8MFrahcm+NHf1Nr8du8L4WlMn+iG6s23576AuHveqgE2W9yZnAvkgrNyJg== 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 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 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: jgross@suse.com, Peng Fan , konrad.wilk@oracle.com, jasowang@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Christoph Hellwig , iommu@lists.linux-foundation.org, linux-imx@nxp.com, xen-devel@lists.xenproject.org, boris.ostrovsky@oracle.com, linux-arm-kernel@lists.infradead.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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