From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [RFC 1/2] virtio_console: Add support for DMA memory allocation Date: Wed, 5 Sep 2012 17:35:58 +0300 Message-ID: <20120905143558.GB10925@redhat.com> References: <1346680277-5887-1-git-send-email-sjur.brandeland@stericsson.com> <20120903143018.GA5353@redhat.com> <20120903202737.GD6181@redhat.com> <87zk56e2xc.fsf@rustcorp.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Sjur =?iso-8859-1?Q?Br=E6ndeland?= Cc: Linus Walleij , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Amit Shah , Sjur =?iso-8859-1?Q?Br=E6ndeland?= List-Id: virtualization@lists.linuxfoundation.org On Wed, Sep 05, 2012 at 03:00:20PM +0200, Sjur Br=E6ndeland wrote: > > The driver certainly shouldn't offer VIRTIO_CONSOLE_F_DMA_MEM if you > > don't have DMA! > = > OK, so the feature table could be done like this: > = > static unsigned int features[] =3D { > VIRTIO_CONSOLE_F_SIZE, > VIRTIO_CONSOLE_F_MULTIPORT, > #if VIRTIO_CONSOLE_HAS_DMA > VIRTIO_CONSOLE_F_DMA_MEM, > #endif > } > = > If the device then asks for VIRTIO_CONSOLE_F_DMA_MEM > when DMA is not supported, virtio will do BUG_ON() from > virtio_check_driver_offered_feature(). > = > Is this acceptable or should we add a check in virtcons_probe() > and let the probing fail instead? > = > E.g: > /* Refuse to bind if F_DMA_MEM request cannot be met */ > if (!VIRTIO_CONSOLE_HAS_DMA && > (vdev->config->get_features(vdev) & (1 << VIRTIO_CONSOLE_F_DMA_MEM))= ){ > dev_err(&vdev->dev, > "DMA_MEM requested, but arch does not support DMA\n"); > err =3D -EINVAL; > goto fail; > } > = > Regards, > Sjur Failing probe would be cleaner. But there is still a problem: old driver will happily bind to that device and then fail to work, right? virtio pci has revision id for this, but remoteproc doesn't seem to have anything similar. Or did I miss it? If not - we probably need to use a different device id, and not a feature bit. -- = MST