Re: [PATCH] uapi: add SPDX identifier to vm_sockets_diag.h

2017-11-24 Thread Stefan Hajnoczi
On Fri, Nov 24, 2017 at 8:08 PM, Stephen Hemminger
 wrote:
> New file seems to have missed the SPDX license scan and update.
>
> Signed-off-by: Stephen Hemminger 
> ---
>  include/uapi/linux/vm_sockets_diag.h | 1 +
>  1 file changed, 1 insertion(+)

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


[PATCH] uapi: add SPDX identifier to vm_sockets_diag.h

2017-11-24 Thread Stephen Hemminger
New file seems to have missed the SPDX license scan and update.

Signed-off-by: Stephen Hemminger 
---
 include/uapi/linux/vm_sockets_diag.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/vm_sockets_diag.h 
b/include/uapi/linux/vm_sockets_diag.h
index 14cd7dc5a187..0b4dd54f3d1e 100644
--- a/include/uapi/linux/vm_sockets_diag.h
+++ b/include/uapi/linux/vm_sockets_diag.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 /* AF_VSOCK sock_diag(7) interface for querying open sockets */
 
 #ifndef _UAPI__VM_SOCKETS_DIAG_H__
-- 
2.11.0

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


[PATCH 08/13] drm/virtio: use simpler remove_conflicting_pci_framebuffers()

2017-11-24 Thread Michał Mirosław
Signed-off-by: Michał Mirosław 
---
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 24 +++-
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c 
b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
index 7df8d0c9026a..115ed546ca4e 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drm_bus.c
@@ -28,26 +28,6 @@
 
 #include "virtgpu_drv.h"
 
-static void virtio_pci_kick_out_firmware_fb(struct pci_dev *pci_dev)
-{
-   struct apertures_struct *ap;
-   bool primary;
-
-   ap = alloc_apertures(1);
-   if (!ap)
-   return;
-
-   ap->ranges[0].base = pci_resource_start(pci_dev, 0);
-   ap->ranges[0].size = pci_resource_len(pci_dev, 0);
-
-   primary = pci_dev->resource[PCI_ROM_RESOURCE].flags
-   & IORESOURCE_ROM_SHADOW;
-
-   drm_fb_helper_remove_conflicting_framebuffers(ap, "virtiodrmfb", 
primary);
-
-   kfree(ap);
-}
-
 int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev)
 {
struct drm_device *dev;
@@ -69,7 +49,9 @@ int drm_virtio_init(struct drm_driver *driver, struct 
virtio_device *vdev)
 pname);
dev->pdev = pdev;
if (vga)
-   virtio_pci_kick_out_firmware_fb(pdev);
+   drm_fb_helper_remove_conflicting_pci_framebuffers(pdev,
+ 0,
+ 
"virtiodrmfb");
 
snprintf(unique, sizeof(unique), "pci:%s", pname);
ret = drm_dev_set_unique(dev, unique);
-- 
2.11.0

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

[PATCH 00/13] remove_conflicting_framebuffers() cleanup

2017-11-24 Thread Michał Mirosław
This series cleans up duplicated code for replacing firmware FB
driver with proper DRI driver and adds handover support to
Tegra driver.

The last patch is here because it uses new semantics of
remove_conflicting_framebuffers() from this series. This
can be considered independently, though.

---

Michał Mirosław (13):
  fbdev: show fbdev number for debugging
  fbdev: add remove_conflicting_pci_framebuffers()
  drm/amdgpu: use simpler remove_conflicting_pci_framebuffers()
  drm/bochs: use simpler remove_conflicting_pci_framebuffers()
  drm/cirrus: use simpler remove_conflicting_pci_framebuffers()
  drm/mgag200: use simpler remove_conflicting_pci_framebuffers()
  drm/radeon: use simpler remove_conflicting_pci_framebuffers()
  drm/virtio: use simpler remove_conflicting_pci_framebuffers()
  staging: sm750fb: use simpler remove_conflicting_pci_framebuffers()
  fbdev: allow apertures == NULL in remove_conflicting_framebuffers()
  drm/vc4: use simpler remove_conflicting_framebuffers(NULL)
  drm/sun4i: use simpler remove_conflicting_framebuffers(NULL)
  drm/tegra: kick out simplefb

 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 23 +-
 drivers/gpu/drm/bochs/bochs_drv.c| 18 +-
 drivers/gpu/drm/cirrus/cirrus_drv.c  | 23 +-
 drivers/gpu/drm/mgag200/mgag200_drv.c| 21 +
 drivers/gpu/drm/mgag200/mgag200_main.c   |  9 ---
 drivers/gpu/drm/radeon/radeon_drv.c  | 23 +-
 drivers/gpu/drm/sun4i/sun4i_drv.c| 18 +-
 drivers/gpu/drm/tegra/drm.c  |  4 
 drivers/gpu/drm/vc4/vc4_drv.c| 20 +---
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 24 +++
 drivers/staging/sm750fb/sm750.c  | 22 +-
 drivers/video/fbdev/core/fbmem.c | 40 ++--
 include/drm/drm_fb_helper.h  | 12 ++
 include/linux/fb.h   |  2 ++
 14 files changed, 67 insertions(+), 192 deletions(-)

-- 
2.11.0

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

[PATCH 04/13] drm/bochs: use simpler remove_conflicting_pci_framebuffers()

2017-11-24 Thread Michał Mirosław
Signed-off-by: Michał Mirosław 
---
 drivers/gpu/drm/bochs/bochs_drv.c | 18 +-
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_drv.c 
b/drivers/gpu/drm/bochs/bochs_drv.c
index 7b20318483e4..c61b40c72b62 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -143,22 +143,6 @@ static const struct dev_pm_ops bochs_pm_ops = {
 /* -- */
 /* pci interface  */
 
-static int bochs_kick_out_firmware_fb(struct pci_dev *pdev)
-{
-   struct apertures_struct *ap;
-
-   ap = alloc_apertures(1);
-   if (!ap)
-   return -ENOMEM;
-
-   ap->ranges[0].base = pci_resource_start(pdev, 0);
-   ap->ranges[0].size = pci_resource_len(pdev, 0);
-   drm_fb_helper_remove_conflicting_framebuffers(ap, "bochsdrmfb", false);
-   kfree(ap);
-
-   return 0;
-}
-
 static int bochs_pci_probe(struct pci_dev *pdev,
   const struct pci_device_id *ent)
 {
@@ -171,7 +155,7 @@ static int bochs_pci_probe(struct pci_dev *pdev,
return -ENOMEM;
}
 
-   ret = bochs_kick_out_firmware_fb(pdev);
+   ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, 
"bochsdrmfb");
if (ret)
return ret;
 
-- 
2.11.0

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

[PATCH 02/13] fbdev: add remove_conflicting_pci_framebuffers()

2017-11-24 Thread Michał Mirosław
Almost all drivers using remove_conflicting_framebuffers() wrap it with
the same code. Extract common part from PCI drivers into separate
remove_conflicting_pci_framebuffers().

Signed-off-by: Michał Mirosław 
---
 drivers/video/fbdev/core/fbmem.c | 22 ++
 include/drm/drm_fb_helper.h  | 12 
 include/linux/fb.h   |  2 ++
 3 files changed, 36 insertions(+)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 30a18d4c9de4..5ea980e5d3b7 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -1788,6 +1789,27 @@ int remove_conflicting_framebuffers(struct 
apertures_struct *a,
 }
 EXPORT_SYMBOL(remove_conflicting_framebuffers);
 
+int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, 
const char *name)
+{
+   struct apertures_struct *ap;
+   bool primary = false;
+
+   ap = alloc_apertures(1);
+   if (!ap)
+   return -ENOMEM;
+
+   ap->ranges[0].base = pci_resource_start(pdev, res_id);
+   ap->ranges[0].size = pci_resource_len(pdev, res_id);
+#ifdef CONFIG_X86
+   primary = pdev->resource[PCI_ROM_RESOURCE].flags &
+   IORESOURCE_ROM_SHADOW;
+#endif
+   remove_conflicting_framebuffers(ap, name, primary);
+   kfree(ap);
+   return 0;
+}
+EXPORT_SYMBOL(remove_conflicting_pci_framebuffers);
+
 /**
  * register_framebuffer - registers a frame buffer device
  * @fb_info: frame buffer info structure
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 33fe95927742..ac3412290289 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -520,4 +520,16 @@ drm_fb_helper_remove_conflicting_framebuffers(struct 
apertures_struct *a,
 #endif
 }
 
+static inline int
+drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
+ int resource_id,
+ const char *name)
+{
+#if IS_REACHABLE(CONFIG_FB)
+   return remove_conflicting_pci_framebuffers(pdev, resource_id, name);
+#else
+   return 0;
+#endif
+}
+
 #endif
diff --git a/include/linux/fb.h b/include/linux/fb.h
index f4386b0ccf40..4196cb09e58e 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -624,6 +624,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const 
char __user *buf,
 extern int register_framebuffer(struct fb_info *fb_info);
 extern int unregister_framebuffer(struct fb_info *fb_info);
 extern int unlink_framebuffer(struct fb_info *fb_info);
+extern int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int 
res_id,
+  const char *name);
 extern int remove_conflicting_framebuffers(struct apertures_struct *a,
   const char *name, bool primary);
 extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
-- 
2.11.0

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

[PATCH 05/13] drm/cirrus: use simpler remove_conflicting_pci_framebuffers()

2017-11-24 Thread Michał Mirosław
Signed-off-by: Michał Mirosław 
---
 drivers/gpu/drm/cirrus/cirrus_drv.c | 23 +--
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c 
b/drivers/gpu/drm/cirrus/cirrus_drv.c
index 69c4e352dd78..85ed8657c862 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -42,33 +42,12 @@ static const struct pci_device_id pciidlist[] = {
 };
 
 
-static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev)
-{
-   struct apertures_struct *ap;
-   bool primary = false;
-
-   ap = alloc_apertures(1);
-   if (!ap)
-   return -ENOMEM;
-
-   ap->ranges[0].base = pci_resource_start(pdev, 0);
-   ap->ranges[0].size = pci_resource_len(pdev, 0);
-
-#ifdef CONFIG_X86
-   primary = pdev->resource[PCI_ROM_RESOURCE].flags & 
IORESOURCE_ROM_SHADOW;
-#endif
-   drm_fb_helper_remove_conflicting_framebuffers(ap, "cirrusdrmfb", 
primary);
-   kfree(ap);
-
-   return 0;
-}
-
 static int cirrus_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
 {
int ret;
 
-   ret = cirrus_kick_out_firmware_fb(pdev);
+   ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, 
"cirrusdrmfb");
if (ret)
return ret;
 
-- 
2.11.0

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

[PATCH v2] VSOCK: Don't call vsock_stream_has_data in atomic context

2017-11-24 Thread Jorgen Hansen
When using the host personality, VMCI will grab a mutex for any
queue pair access. In the detach callback for the vmci vsock
transport, we call vsock_stream_has_data while holding a spinlock,
and vsock_stream_has_data will access a queue pair.

To avoid this, we can simply omit calling vsock_stream_has_data
for host side queue pairs, since the QPs are empty per default
when the guest has detached.

This bug affects users of VMware Workstation using kernel version
4.4 and later.

Testing: Ran vsock tests between guest and host, and verified that
with this change, the host isn't calling vsock_stream_has_data
during detach. Ran mixedTest between guest and host using both
guest and host as server.

v2: Rebased on top of recent change to sk_state values
Reviewed-by: Adit Ranadive 
Reviewed-by: Aditya Sarwade 
Reviewed-by: Stefan Hajnoczi 
Signed-off-by: Jorgen Hansen 
---
 net/vmw_vsock/vmci_transport.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index 391775e..56573dc 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -797,9 +797,13 @@ static void vmci_transport_handle_detach(struct sock *sk)
 
/* We should not be sending anymore since the peer won't be
 * there to receive, but we can still receive if there is data
-* left in our consume queue.
+* left in our consume queue. If the local endpoint is a host,
+* we can't call vsock_stream_has_data, since that may block,
+* but a host endpoint can't read data once the VM has
+* detached, so there is no available data in that case.
 */
-   if (vsock_stream_has_data(vsk) <= 0) {
+   if (vsk->local_addr.svm_cid == VMADDR_CID_HOST ||
+   vsock_stream_has_data(vsk) <= 0) {
sk->sk_state = TCP_CLOSE;
 
if (sk->sk_state == TCP_SYN_SENT) {
@@ -2144,7 +2148,7 @@ static void __exit vmci_transport_exit(void)
 
 MODULE_AUTHOR("VMware, Inc.");
 MODULE_DESCRIPTION("VMCI transport for Virtual Sockets");
-MODULE_VERSION("1.0.4.0-k");
+MODULE_VERSION("1.0.5.0-k");
 MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("vmware_vsock");
 MODULE_ALIAS_NETPROTO(PF_VSOCK);
-- 
1.7.0

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