Re: [PATCH] xen: introduce xen_vring_use_dma

2020-07-11 Thread Michael S. Tsirkin
On Fri, Jul 10, 2020 at 10:23:22AM -0700, Stefano Stabellini wrote:
> Sorry for the late reply -- a couple of conferences kept me busy.
> 
> 
> On Wed, 1 Jul 2020, Michael S. Tsirkin wrote:
> > On Wed, Jul 01, 2020 at 10:34:53AM -0700, Stefano Stabellini wrote:
> > > 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.
> > 
> > Just to stress - with a patch like this virtio can *still* use DMA API
> > if PLATFORM_ACCESS is set. So if DMA API is broken on some platforms
> > as you seem to be saying, you guys should fix it before doing something
> > like this..
> 
> Yes, DMA API is broken with some interfaces (specifically: rpmesg and
> trusty), but for them PLATFORM_ACCESS is never set. That is why the
> errors weren't reported before. Xen special case aside, there is no
> problem under normal circumstances.

So why not fix DMA API? Then this patch is not needed.


> 
> If you are OK with this patch (after a little bit of clean-up), Peng,
> are you OK with sending an update or do you want me to?

___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


[vhost:config-endian 33/36] drivers/vdpa/vdpa_sim/vdpa_sim.c:335:21: sparse: sparse: incorrect type in assignment (different base types)

2020-07-11 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git 
config-endian
head:   6aef2378a564fea8e69c0419d94dc3ad9b4b7a99
commit: 0cf222ef876b95893406eebe685e595d88de0950 [33/36] virtio_net: correct 
tags for config space fields
config: parisc-randconfig-s032-20200710 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-37-gc9676a3b-dirty
git checkout 0cf222ef876b95893406eebe685e595d88de0950
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=parisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 


sparse warnings: (new ones prefixed by >>)

>> drivers/vdpa/vdpa_sim/vdpa_sim.c:335:21: sparse: sparse: incorrect type in 
>> assignment (different base types) @@ expected restricted __virtio16 
>> [usertype] mtu @@ got int @@
>> drivers/vdpa/vdpa_sim/vdpa_sim.c:335:21: sparse: expected restricted 
>> __virtio16 [usertype] mtu
>> drivers/vdpa/vdpa_sim/vdpa_sim.c:335:21: sparse: got int
>> drivers/vdpa/vdpa_sim/vdpa_sim.c:336:24: sparse: sparse: incorrect type in 
>> assignment (different base types) @@ expected restricted __virtio16 
>> [usertype] status @@ got int @@
>> drivers/vdpa/vdpa_sim/vdpa_sim.c:336:24: sparse: expected restricted 
>> __virtio16 [usertype] status
   drivers/vdpa/vdpa_sim/vdpa_sim.c:336:24: sparse: got int

vim +335 drivers/vdpa/vdpa_sim/vdpa_sim.c

2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
306  
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
307  static struct vdpasim *vdpasim_create(void)
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
308  {
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
309   struct virtio_net_config *config;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
310   struct vdpasim *vdpasim;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
311   struct device *dev;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
312   int ret = -ENOMEM;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
313  
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
314   vdpasim = vdpa_alloc_device(struct vdpasim, vdpa, NULL,
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
315   &vdpasim_net_config_ops);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
316   if (!vdpasim)
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
317   goto err_alloc;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
318  
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
319   INIT_WORK(&vdpasim->work, vdpasim_work);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
320   spin_lock_init(&vdpasim->lock);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
321  
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
322   dev = &vdpasim->vdpa.dev;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
323   dev->coherent_dma_mask = DMA_BIT_MASK(64);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
324   set_dma_ops(dev, &vdpasim_dma_ops);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
325  
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
326   vdpasim->iommu = vhost_iotlb_alloc(2048, 0);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
327   if (!vdpasim->iommu)
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
328   goto err_iommu;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
329  
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
330   vdpasim->buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
331   if (!vdpasim->buffer)
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
332   goto err_iommu;
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
333  
2c53d0f64c06f4 drivers/virtio/vdpa/vdpa_sim/vdpa_sim.c Jason Wang 2020-03-26  
334   config = &vdpasim->config;
2c53d0f64c06f4 drivers/virtio/v