Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4588411imw; Tue, 19 Jul 2022 09:20:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tdFVwzG6L6H343WQTp24Yq+zSDDTTRHHAjPXRSEnk/SX6DwUMg5LAmTwgkjt1QbT9o4scC X-Received: by 2002:a17:906:106:b0:722:e997:a365 with SMTP id 6-20020a170906010600b00722e997a365mr31088950eje.169.1658247623829; Tue, 19 Jul 2022 09:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658247623; cv=none; d=google.com; s=arc-20160816; b=Oe3wa4Fm6h6jvY8+JfWDVEMDYWV04pqXrmN3pInbcgZPQIflghZeaNB7f84UUoCKjZ ITLNCbSut+9XC0vD5T82fv0//7oEpiAJMQC1fuWxZfgcEDao41zwTtKNoqihfzNwB8pL WnkRyRsmJvm3zh5wtuqM3buLm2vFEOJH+5geJjNHdVn63BLxpXJQUGnKQ5mgOsfAMhlY MdXbqCQkDeD6Us7vh/L88p4vhvBoPagKWv4tTGmCezSUWoNS4y8Jv/KcTqT4k4QrBViM 6xXpQIcP195tv++86tQtioF/CHuo/xuNsbdBiK+Sjp9GPjI3psjK5jUkdoW04AHgPLlK lhNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CsovjpFx2Rs2Y0JFrLb+Hq4dc68dG3XV8rFC1Zq84T8=; b=lqLyI34Kccke7iKLFXLnGRwU6IP3OFt5kMlHan1UGHfHxnP/q4fNzT4rlv+aNHd+WD OvPfj5I551rWhyaQnmb2S+rPBJhWdHxL2/qiV9Wlweg3cgDbwrclRKUnCiDaGGJvV6Db EcORxLW0znU+QgHEfVjX1TGuCpNNdZfWHpfkuksCE3hhau3cU7k2teVs1k008DA4rBAV eGBzkDlhSMwSjjUX6WlxroFMb3wzVZouanmyS6+MdWDK6dTtcKm6oOsWR3fB5Pino0Vs FiTAGfwXK+vplfQV2BUfHI0W5lb7qflhQJDjYzXLpDMVzOqYqhV9+dcJ7pxbHtWsgGLs SJiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=doQnWADh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y23-20020a170906915700b0070f8f93e1f5si17472357ejw.306.2022.07.19.09.19.59; Tue, 19 Jul 2022 09:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=doQnWADh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238226AbiGSQL6 (ORCPT + 99 others); Tue, 19 Jul 2022 12:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbiGSQL5 (ORCPT ); Tue, 19 Jul 2022 12:11:57 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F8CE4C612 for ; Tue, 19 Jul 2022 09:11:56 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id n185so9247981wmn.4 for ; Tue, 19 Jul 2022 09:11:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=CsovjpFx2Rs2Y0JFrLb+Hq4dc68dG3XV8rFC1Zq84T8=; b=doQnWADhaKk6qPTy26R7f5MIzve9vJhXF3Pak5oSaaSNwW90wBu9A6OKr8C/8egNZ1 dwW9WdCSEOZn71NWqZhPkHIju9obYIpXF3xni+tV7zIE83l4kNSnjtbOeUL5UvT6wyUw x73INVpNYZaOvIl02K1HXEwiiG2N0jYrUwcLTmZAXm9L8HqX9gkzmE3e2yt94FkT93+6 Gx46+FmUwX2x4KZ+MH4Syl4pR+ty+TdHJeIZD8FdUNG3YywrSn5lcVfAnBlVrHn5dVai yGt/YUFVpG75EFp9KsJ/x9LJqQoAe4DdJynOASaNBxXXWe04ioeu3Jo5Fz3PGZwQnL2G /dsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CsovjpFx2Rs2Y0JFrLb+Hq4dc68dG3XV8rFC1Zq84T8=; b=JCMGJ1TPQ4X5bw0ATM6mpElA3xWPkGOjTEVLlsHzHdbmluXQ8J1OkxzM/r/Ap5uOqq p+dCYbxNQkbh1E/CeB826TJG+pSll8Kozlx6TWa3jbGddt/wFM33XNr9PMhp3O1IKme8 fy8UCTTyHEVitFVZDuJKKhMV0upOvKk5TmWlznU9/hcV0g6DO7v5FWuWvJBONZzcBwmk zGbHgDsKlUBbmxeA+rMjpv1TOHIahqFYBv735s2HkqWJcSpiIr6cHEkvtp1K+O5SVUbJ NlAboDdG1AeyxWcSdFWI87oikj6C8losvj9PN7tw0dgz/Auxk3HbBTQ++/0JdEQk2kgI DyYw== X-Gm-Message-State: AJIora9DwOZqfF8r5U3a72A+Gd/kQuNwCiE2gX8uPIPHtbe+4vOV8ZEl ppRgcoB/w7nU2+YbpmkDV8e3nA== X-Received: by 2002:a05:600c:511f:b0:3a3:254c:b079 with SMTP id o31-20020a05600c511f00b003a3254cb079mr87507wms.68.1658247114885; Tue, 19 Jul 2022 09:11:54 -0700 (PDT) Received: from google.com (88.140.78.34.bc.googleusercontent.com. [34.78.140.88]) by smtp.gmail.com with ESMTPSA id n125-20020a1ca483000000b003a02de5de80sm2056042wme.4.2022.07.19.09.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 09:11:54 -0700 (PDT) Date: Tue, 19 Jul 2022 16:11:50 +0000 From: Keir Fraser To: Christoph Hellwig Cc: "Michael S. Tsirkin" , Jason Wang , kernel-team@android.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] virtio: Force DMA restricted devices through DMA API Message-ID: References: <20220719100256.419780-1-keirf@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 Tue, Jul 19, 2022 at 08:51:54AM -0700, Christoph Hellwig wrote: > On Tue, Jul 19, 2022 at 03:46:08PM +0000, Keir Fraser wrote: > > However, if the general idea at least is acceptable, would the > > implementation be acceptable if I add an explicit API for this to the > > DMA subsystem, and hide the detail there? > > I don't think so. The right thing to key off is > VIRTIO_F_ACCESS_PLATFORM, which really should be set in any modern > virtio device after all the problems we had with the lack of it. Ok. Certainly the flag description in virtio spec fits the bill. > > Or a completely different approach would be to revert the patch > > e41b1355508d which clears VIRTIO_F_ACCESS_PLATFORM in the balloon > > driver. MST: That's back in your court, as it's your patch! > > Which also means this needs to be addresses, but I don't think a > simple revert is enough. Well here are two possible approaches: 1. Revert e41b1355508d outright. I'm not even sure what it would mean for reported pages to go through IOMMU. And VIRTIO_F_ACCESS_PLATFORM is no longer IOMMU-specific anyway. 2. Continue to clear the flag during virtio_balloon negotiation, but remember that it was offered, and test for that in vring_use_dma_api() as well as, or instead of, virtio_has_dma_quirk(). Do either of those appeal?