* [PATCH] vhost: fix VHOST_GET_BACKEND_FEATURES ioctl request definition
From: Gleb Fotengauer-Malinovskiy @ 2018-09-03 17:59 UTC (permalink / raw)
To: Michael S. Tsirkin, Jason Wang, David S. Miller, kvm,
virtualization, netdev, linux-kernel
The _IOC_READ flag fits this ioctl request more because this request
actually only writes to, but doesn't read from userspace.
See NOTEs in include/uapi/asm-generic/ioctl.h for more information.
Fixes: 429711aec282 ("vhost: switch to use new message format")
Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
---
include/uapi/linux/vhost.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
index b1e22c40c4b6..84c3de89696a 100644
--- a/include/uapi/linux/vhost.h
+++ b/include/uapi/linux/vhost.h
@@ -176,7 +176,7 @@ struct vhost_memory {
#define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
#define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64)
-#define VHOST_GET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x26, __u64)
+#define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64)
/* VHOST_NET specific defines */
--
glebfm
^ permalink raw reply related
* Re: [PATCH] drm/virtio: track virtual output state
From: Dave Airlie @ 2018-09-03 23:42 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: Dave Airlie, LKML, dri-devel, open list:VIRTIO CORE, NET...
In-Reply-To: <20180813152855.12863-1-kraxel@redhat.com>
On Tue, 14 Aug 2018 at 01:30, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> Track whenever an virtual output (crtc) is enabled or disabled.
>
> On atomic updates check for both framebuffer being present and crtc
> being enabled to figure whenever the output is active or not.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
> ---
> drivers/gpu/drm/virtio/virtgpu_drv.h | 1 +
> drivers/gpu/drm/virtio/virtgpu_display.c | 4 ++++
> drivers/gpu/drm/virtio/virtgpu_plane.c | 2 +-
> 3 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
> index 65605e207b..d46f10e656 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.h
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
> @@ -114,6 +114,7 @@ struct virtio_gpu_output {
> struct virtio_gpu_update_cursor cursor;
> int cur_x;
> int cur_y;
> + bool enabled;
> };
> #define drm_crtc_to_virtio_gpu_output(x) \
> container_of(x, struct virtio_gpu_output, crtc)
> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
> index 25503b9335..9f1e0a669d 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
> @@ -109,6 +109,9 @@ static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc)
> static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc,
> struct drm_crtc_state *old_state)
> {
> + struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
> +
> + output->enabled = true;
> }
>
> static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc,
> @@ -119,6 +122,7 @@ static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc,
> struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc);
>
> virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0);
> + output->enabled = false;
> }
>
> static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc,
> diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
> index dc5b5b2b7a..88f2fb8c61 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
> @@ -152,7 +152,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
> if (WARN_ON(!output))
> return;
>
> - if (plane->state->fb) {
> + if (plane->state->fb && output->enabled) {
> vgfb = to_virtio_gpu_framebuffer(plane->state->fb);
> bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]);
> handle = bo->hw_res_handle;
> --
> 2.9.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* Re: [virtio-dev] [PATCH 2/2] drm/virtio: add iommu support.
From: Dave Airlie @ 2018-09-03 23:50 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: Dave Airlie, virtio-dev, LKML, dri-devel,
open list:VIRTIO CORE, NET...
In-Reply-To: <20180829122026.27012-3-kraxel@redhat.com>
For the series,
Reviewed-by: Dave Airlie <airlied@redhat.com>
On Wed, 29 Aug 2018 at 22:20, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> Use the dma mapping api and properly add iommu mappings for
> objects, unless virtio is in iommu quirk mode.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> drivers/gpu/drm/virtio/virtgpu_drv.h | 1 +
> drivers/gpu/drm/virtio/virtgpu_vq.c | 46 +++++++++++++++++++++++++++++-------
> 2 files changed, 38 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h
> index cbbff01077..ec9a38f995 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.h
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
> @@ -57,6 +57,7 @@ struct virtio_gpu_object {
> uint32_t hw_res_handle;
>
> struct sg_table *pages;
> + uint32_t mapped;
> void *vmap;
> bool dumb;
> struct ttm_place placement_code;
> diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c
> index af24e91267..bf631d32d4 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_vq.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
> @@ -424,7 +424,8 @@ void virtio_gpu_cmd_unref_resource(struct virtio_gpu_device *vgdev,
> }
>
> static void virtio_gpu_cmd_resource_inval_backing(struct virtio_gpu_device *vgdev,
> - uint32_t resource_id)
> + uint32_t resource_id,
> + struct virtio_gpu_fence **fence)
> {
> struct virtio_gpu_resource_detach_backing *cmd_p;
> struct virtio_gpu_vbuffer *vbuf;
> @@ -435,7 +436,7 @@ static void virtio_gpu_cmd_resource_inval_backing(struct virtio_gpu_device *vgde
> cmd_p->hdr.type = cpu_to_le32(VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING);
> cmd_p->resource_id = cpu_to_le32(resource_id);
>
> - virtio_gpu_queue_ctrl_buffer(vgdev, vbuf);
> + virtio_gpu_queue_fenced_ctrl_buffer(vgdev, vbuf, &cmd_p->hdr, fence);
> }
>
> void virtio_gpu_cmd_set_scanout(struct virtio_gpu_device *vgdev,
> @@ -848,9 +849,10 @@ int virtio_gpu_object_attach(struct virtio_gpu_device *vgdev,
> uint32_t resource_id,
> struct virtio_gpu_fence **fence)
> {
> + bool use_dma_api = !virtio_has_iommu_quirk(vgdev->vdev);
> struct virtio_gpu_mem_entry *ents;
> struct scatterlist *sg;
> - int si;
> + int si, nents;
>
> if (!obj->pages) {
> int ret;
> @@ -860,23 +862,33 @@ int virtio_gpu_object_attach(struct virtio_gpu_device *vgdev,
> return ret;
> }
>
> + if (use_dma_api) {
> + obj->mapped = dma_map_sg(vgdev->vdev->dev.parent,
> + obj->pages->sgl, obj->pages->nents,
> + DMA_TO_DEVICE);
> + nents = obj->mapped;
> + } else {
> + nents = obj->pages->nents;
> + }
> +
> /* gets freed when the ring has consumed it */
> - ents = kmalloc_array(obj->pages->nents,
> - sizeof(struct virtio_gpu_mem_entry),
> + ents = kmalloc_array(nents, sizeof(struct virtio_gpu_mem_entry),
> GFP_KERNEL);
> if (!ents) {
> DRM_ERROR("failed to allocate ent list\n");
> return -ENOMEM;
> }
>
> - for_each_sg(obj->pages->sgl, sg, obj->pages->nents, si) {
> - ents[si].addr = cpu_to_le64(sg_phys(sg));
> + for_each_sg(obj->pages->sgl, sg, nents, si) {
> + ents[si].addr = cpu_to_le64(use_dma_api
> + ? sg_dma_address(sg)
> + : sg_phys(sg));
> ents[si].length = cpu_to_le32(sg->length);
> ents[si].padding = 0;
> }
>
> virtio_gpu_cmd_resource_attach_backing(vgdev, resource_id,
> - ents, obj->pages->nents,
> + ents, nents,
> fence);
> obj->hw_res_handle = resource_id;
> return 0;
> @@ -885,7 +897,23 @@ int virtio_gpu_object_attach(struct virtio_gpu_device *vgdev,
> void virtio_gpu_object_detach(struct virtio_gpu_device *vgdev,
> struct virtio_gpu_object *obj)
> {
> - virtio_gpu_cmd_resource_inval_backing(vgdev, obj->hw_res_handle);
> + bool use_dma_api = !virtio_has_iommu_quirk(vgdev->vdev);
> + struct virtio_gpu_fence *fence;
> +
> + if (use_dma_api && obj->mapped) {
> + /* detach backing and wait for the host process it ... */
> + virtio_gpu_cmd_resource_inval_backing(vgdev, obj->hw_res_handle, &fence);
> + dma_fence_wait(&fence->f, true);
> + dma_fence_put(&fence->f);
> +
> + /* ... then tear down iommu mappings */
> + dma_unmap_sg(vgdev->vdev->dev.parent,
> + obj->pages->sgl, obj->mapped,
> + DMA_TO_DEVICE);
> + obj->mapped = 0;
> + } else {
> + virtio_gpu_cmd_resource_inval_backing(vgdev, obj->hw_res_handle, NULL);
> + }
> }
>
> void virtio_gpu_cursor_ping(struct virtio_gpu_device *vgdev,
> --
> 2.9.3
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
>
^ permalink raw reply
* Re: [PATCH] vhost: fix VHOST_GET_BACKEND_FEATURES ioctl request definition
From: Michael S. Tsirkin @ 2018-09-04 2:22 UTC (permalink / raw)
To: Gleb Fotengauer-Malinovskiy
Cc: kvm, netdev, linux-kernel, virtualization, David S. Miller
In-Reply-To: <20180903175906.GA11529@glebfm.cloud.tilaa.com>
On Mon, Sep 03, 2018 at 08:59:13PM +0300, Gleb Fotengauer-Malinovskiy wrote:
> The _IOC_READ flag fits this ioctl request more because this request
> actually only writes to, but doesn't read from userspace.
> See NOTEs in include/uapi/asm-generic/ioctl.h for more information.
>
> Fixes: 429711aec282 ("vhost: switch to use new message format")
> Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Hmm it does make sense, and it's not too late to fix this up.
Jason, what's your take on this? Was _IOW intentional?
> ---
> include/uapi/linux/vhost.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
> index b1e22c40c4b6..84c3de89696a 100644
> --- a/include/uapi/linux/vhost.h
> +++ b/include/uapi/linux/vhost.h
> @@ -176,7 +176,7 @@ struct vhost_memory {
> #define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
>
> #define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64)
> -#define VHOST_GET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x26, __u64)
> +#define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64)
>
> /* VHOST_NET specific defines */
>
>
> --
> glebfm
^ permalink raw reply
* Re: [PATCH] vhost: fix VHOST_GET_BACKEND_FEATURES ioctl request definition
From: Jason Wang @ 2018-09-04 3:08 UTC (permalink / raw)
To: Michael S. Tsirkin, Gleb Fotengauer-Malinovskiy
Cc: netdev, linux-kernel, David S. Miller, kvm, virtualization
In-Reply-To: <20180903222127-mutt-send-email-mst@kernel.org>
On 2018年09月04日 10:22, Michael S. Tsirkin wrote:
> On Mon, Sep 03, 2018 at 08:59:13PM +0300, Gleb Fotengauer-Malinovskiy wrote:
>> The _IOC_READ flag fits this ioctl request more because this request
>> actually only writes to, but doesn't read from userspace.
>> See NOTEs in include/uapi/asm-generic/ioctl.h for more information.
>>
>> Fixes: 429711aec282 ("vhost: switch to use new message format")
>> Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
> Hmm it does make sense, and it's not too late to fix this up.
> Jason, what's your take on this? Was _IOW intentional?
My bad, not intentional. And I agree that fixing this is not too late.
So
Acked-by: Jason Wang <jasowang@redhat.com>
>
>> ---
>> include/uapi/linux/vhost.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
>> index b1e22c40c4b6..84c3de89696a 100644
>> --- a/include/uapi/linux/vhost.h
>> +++ b/include/uapi/linux/vhost.h
>> @@ -176,7 +176,7 @@ struct vhost_memory {
>> #define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
>>
>> #define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64)
>> -#define VHOST_GET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x26, __u64)
>> +#define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64)
>>
>> /* VHOST_NET specific defines */
>>
>>
>> --
>> glebfm
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH] vhost: fix VHOST_GET_BACKEND_FEATURES ioctl request definition
From: Michael S. Tsirkin @ 2018-09-04 3:11 UTC (permalink / raw)
To: Jason Wang
Cc: kvm, netdev, Gleb Fotengauer-Malinovskiy, linux-kernel,
virtualization, David S. Miller
In-Reply-To: <a9ea89ac-4816-96a1-7de4-caf9884da876@redhat.com>
On Tue, Sep 04, 2018 at 11:08:40AM +0800, Jason Wang wrote:
>
>
> On 2018年09月04日 10:22, Michael S. Tsirkin wrote:
> > On Mon, Sep 03, 2018 at 08:59:13PM +0300, Gleb Fotengauer-Malinovskiy wrote:
> > > The _IOC_READ flag fits this ioctl request more because this request
> > > actually only writes to, but doesn't read from userspace.
> > > See NOTEs in include/uapi/asm-generic/ioctl.h for more information.
> > >
> > > Fixes: 429711aec282 ("vhost: switch to use new message format")
> > > Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
> > Hmm it does make sense, and it's not too late to fix this up.
> > Jason, what's your take on this? Was _IOW intentional?
>
> My bad, not intentional. And I agree that fixing this is not too late.
>
> So
>
> Acked-by: Jason Wang <jasowang@redhat.com>
OK then
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> >
> > > ---
> > > include/uapi/linux/vhost.h | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h
> > > index b1e22c40c4b6..84c3de89696a 100644
> > > --- a/include/uapi/linux/vhost.h
> > > +++ b/include/uapi/linux/vhost.h
> > > @@ -176,7 +176,7 @@ struct vhost_memory {
> > > #define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
> > > #define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64)
> > > -#define VHOST_GET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x26, __u64)
> > > +#define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64)
> > > /* VHOST_NET specific defines */
> > >
> > > --
> > > glebfm
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH] vhost: fix VHOST_GET_BACKEND_FEATURES ioctl request definition
From: David Miller @ 2018-09-04 4:23 UTC (permalink / raw)
To: mst; +Cc: kvm, netdev, glebfm, linux-kernel, virtualization
In-Reply-To: <20180903231102-mutt-send-email-mst@kernel.org>
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Mon, 3 Sep 2018 23:11:11 -0400
> On Tue, Sep 04, 2018 at 11:08:40AM +0800, Jason Wang wrote:
>>
>>
>> On 2018年09月04日 10:22, Michael S. Tsirkin wrote:
>> > On Mon, Sep 03, 2018 at 08:59:13PM +0300, Gleb Fotengauer-Malinovskiy wrote:
>> > > The _IOC_READ flag fits this ioctl request more because this request
>> > > actually only writes to, but doesn't read from userspace.
>> > > See NOTEs in include/uapi/asm-generic/ioctl.h for more information.
>> > >
>> > > Fixes: 429711aec282 ("vhost: switch to use new message format")
>> > > Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
>> > Hmm it does make sense, and it's not too late to fix this up.
>> > Jason, what's your take on this? Was _IOW intentional?
>>
>> My bad, not intentional. And I agree that fixing this is not too late.
>>
>> So
>>
>> Acked-by: Jason Wang <jasowang@redhat.com>
>
>
> OK then
>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
Applied, thanks everyone.
^ permalink raw reply
* Re: [PATCH v3 04/13] fbdev: add remove_conflicting_pci_framebuffers()
From: kbuild test robot @ 2018-09-04 15:40 UTC (permalink / raw)
To: Michał Mirosław
Cc: linux-fbdev, amd-gfx, Bartlomiej Zolnierkiewicz, David Airlie,
dri-devel, Jonathan Hunter, Alex Deucher, Thierry Reding,
kbuild-all, linux-tegra, Dave Airlie, Maxime Ripard,
virtualization, linux-arm-kernel
In-Reply-To: <7db1c278276de420eb45a1b71d06b5eb6bbd49ef.1535810304.git.mirq-linux@rere.qmqm.pl>
[-- Attachment #1: Type: text/plain, Size: 25151 bytes --]
Hi Michał,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v4.19-rc2 next-20180831]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Micha-Miros-aw/remove_conflicting_framebuffers-cleanup/20180903-094322
reproduce: make htmldocs
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
All warnings (new ones prefixed by >>):
WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
include/linux/srcu.h:175: warning: Function parameter or member 'p' not described in 'srcu_dereference_notrace'
include/linux/srcu.h:175: warning: Function parameter or member 'sp' not described in 'srcu_dereference_notrace'
include/linux/gfp.h:1: warning: no structured comments found
include/net/cfg80211.h:4381: warning: Function parameter or member 'wext.ibss' not described in 'wireless_dev'
include/net/cfg80211.h:4381: warning: Function parameter or member 'wext.connect' not described in 'wireless_dev'
include/net/cfg80211.h:4381: warning: Function parameter or member 'wext.keys' not described in 'wireless_dev'
include/net/cfg80211.h:4381: warning: Function parameter or member 'wext.ie' not described in 'wireless_dev'
include/net/cfg80211.h:4381: warning: Function parameter or member 'wext.ie_len' not described in 'wireless_dev'
include/net/cfg80211.h:4381: warning: Function parameter or member 'wext.bssid' not described in 'wireless_dev'
include/net/cfg80211.h:4381: warning: Function parameter or member 'wext.ssid' not described in 'wireless_dev'
include/net/cfg80211.h:4381: warning: Function parameter or member 'wext.default_key' not described in 'wireless_dev'
include/net/cfg80211.h:4381: warning: Function parameter or member 'wext.default_mgmt_key' not described in 'wireless_dev'
include/net/cfg80211.h:4381: warning: Function parameter or member 'wext.prev_bssid_valid' not described in 'wireless_dev'
include/net/mac80211.h:2328: warning: Function parameter or member 'radiotap_timestamp.units_pos' not described in 'ieee80211_hw'
include/net/mac80211.h:2328: warning: Function parameter or member 'radiotap_timestamp.accuracy' not described in 'ieee80211_hw'
include/net/mac80211.h:977: warning: Function parameter or member 'control.rates' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'control.rts_cts_rate_idx' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'control.use_rts' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'control.use_cts_prot' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'control.short_preamble' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'control.skip_table' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'control.jiffies' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'control.vif' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'control.hw_key' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'control.flags' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'control.enqueue_time' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'ack' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'ack.cookie' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'status.rates' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'status.ack_signal' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'status.ampdu_ack_len' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'status.ampdu_len' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'status.antenna' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'status.tx_time' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'status.is_valid_ack_signal' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'status.status_driver_data' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'driver_rates' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'pad' not described in 'ieee80211_tx_info'
include/net/mac80211.h:977: warning: Function parameter or member 'rate_driver_data' not described in 'ieee80211_tx_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'rx_stats_avg' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'rx_stats_avg.signal' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'rx_stats_avg.chain_signal' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.filtered' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.retry_failed' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.retry_count' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.lost_packets' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.last_tdls_pkt_time' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.msdu_retries' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.msdu_failed' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.last_ack' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.last_ack_signal' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.ack_signal_filled' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.avg_ack_signal' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.packets' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.bytes' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.last_rate' not described in 'sta_info'
net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.msdu' not described in 'sta_info'
include/linux/mod_devicetable.h:763: warning: Function parameter or member 'driver_data' not described in 'typec_device_id'
kernel/sched/fair.c:3371: warning: Function parameter or member 'flags' not described in 'attach_entity_load_avg'
arch/x86/include/asm/atomic.h:84: warning: Excess function parameter 'i' description in 'arch_atomic_sub_and_test'
arch/x86/include/asm/atomic.h:84: warning: Excess function parameter 'v' description in 'arch_atomic_sub_and_test'
arch/x86/include/asm/atomic.h:96: warning: Excess function parameter 'v' description in 'arch_atomic_inc'
arch/x86/include/asm/atomic.h:109: warning: Excess function parameter 'v' description in 'arch_atomic_dec'
arch/x86/include/asm/atomic.h:124: warning: Excess function parameter 'v' description in 'arch_atomic_dec_and_test'
arch/x86/include/asm/atomic.h:138: warning: Excess function parameter 'v' description in 'arch_atomic_inc_and_test'
arch/x86/include/asm/atomic.h:153: warning: Excess function parameter 'i' description in 'arch_atomic_add_negative'
arch/x86/include/asm/atomic.h:153: warning: Excess function parameter 'v' description in 'arch_atomic_add_negative'
include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_excl.cb' not described in 'dma_buf'
include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_excl.poll' not described in 'dma_buf'
include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_excl.active' not described in 'dma_buf'
include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_shared.cb' not described in 'dma_buf'
include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_shared.poll' not described in 'dma_buf'
include/linux/dma-buf.h:304: warning: Function parameter or member 'cb_shared.active' not described in 'dma_buf'
include/linux/dma-fence-array.h:54: warning: Function parameter or member 'work' not described in 'dma_fence_array'
>> drivers/video/fbdev/core/fbmem.c:1848: warning: Function parameter or member 'res_id' not described in 'remove_conflicting_pci_framebuffers'
drivers/video/fbdev/core/fbmem.c:1848: warning: Excess function parameter 'resource_id' description in 'remove_conflicting_pci_framebuffers'
include/linux/gpio/driver.h:142: warning: Function parameter or member 'request_key' not described in 'gpio_irq_chip'
include/linux/iio/hw-consumer.h:1: warning: no structured comments found
include/linux/input/sparse-keymap.h:46: warning: Function parameter or member 'sw' not described in 'key_entry'
drivers/pci/pci.c:218: warning: Excess function parameter 'p' description in 'pci_dev_str_match_path'
include/linux/regulator/driver.h:227: warning: Function parameter or member 'resume' not described in 'regulator_ops'
drivers/regulator/core.c:4479: warning: Excess function parameter 'state' description in 'regulator_suspend'
arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw0' not described in 'irb'
arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw1' not described in 'irb'
arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw2' not described in 'irb'
arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.esw3' not described in 'irb'
arch/s390/include/asm/cio.h:245: warning: Function parameter or member 'esw.eadm' not described in 'irb'
drivers/slimbus/stream.c:1: warning: no structured comments found
drivers/target/target_core_device.c:1: warning: no structured comments found
drivers/usb/dwc3/gadget.c:510: warning: Excess function parameter 'dwc' description in 'dwc3_gadget_start_config'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/bus.c:1: warning: no structured comments found
drivers/usb/typec/bus.c:268: warning: Function parameter or member 'mode' not described in 'typec_match_altmode'
drivers/usb/typec/class.c:1497: warning: Excess function parameter 'drvdata' description in 'typec_port_register_altmode'
drivers/usb/typec/class.c:1: warning: no structured comments found
include/linux/w1.h:281: warning: Function parameter or member 'of_match_table' not described in 'w1_family'
fs/direct-io.c:257: warning: Excess function parameter 'offset' description in 'dio_complete'
fs/file_table.c:1: warning: no structured comments found
fs/libfs.c:477: warning: Excess function parameter 'available' description in 'simple_write_end'
fs/posix_acl.c:646: warning: Function parameter or member 'inode' not described in 'posix_acl_update_mode'
fs/posix_acl.c:646: warning: Function parameter or member 'mode_p' not described in 'posix_acl_update_mode'
fs/posix_acl.c:646: warning: Function parameter or member 'acl' not described in 'posix_acl_update_mode'
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:183: warning: Function parameter or member 'blockable' not described in 'amdgpu_mn_read_lock'
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:254: warning: Function parameter or member 'blockable' not described in 'amdgpu_mn_invalidate_range_start_gfx'
drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:302: warning: Function parameter or member 'blockable' not described in 'amdgpu_mn_invalidate_range_start_hsa'
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:3011: warning: Excess function parameter 'dev' description in 'amdgpu_vm_get_task_info'
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:3012: warning: Function parameter or member 'adev' not described in 'amdgpu_vm_get_task_info'
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:3012: warning: Excess function parameter 'dev' description in 'amdgpu_vm_get_task_info'
include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_pin' not described in 'drm_driver'
include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_unpin' not described in 'drm_driver'
include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_res_obj' not described in 'drm_driver'
include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_get_sg_table' not described in 'drm_driver'
include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_import_sg_table' not described in 'drm_driver'
include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_vmap' not described in 'drm_driver'
include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_vunmap' not described in 'drm_driver'
include/drm/drm_drv.h:610: warning: Function parameter or member 'gem_prime_mmap' not described in 'drm_driver'
include/drm/drm_panel.h:98: warning: Function parameter or member 'link' not described in 'drm_panel'
drivers/gpu/drm/i915/i915_vma.h:49: warning: cannot understand function prototype: 'struct i915_vma '
drivers/gpu/drm/i915/i915_vma.h:1: warning: no structured comments found
drivers/gpu/drm/i915/intel_guc_fwif.h:553: warning: cannot understand function prototype: 'struct guc_log_buffer_state '
drivers/gpu/drm/i915/i915_trace.h:1: warning: no structured comments found
include/linux/skbuff.h:860: warning: Function parameter or member 'dev_scratch' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'list' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'ip_defrag_offset' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'skb_mstamp' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member '__cloned_offset' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'head_frag' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member '__pkt_type_offset' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'encapsulation' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'encap_hdr_csum' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'csum_valid' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'csum_complete_sw' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'csum_level' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'inner_protocol_type' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'remcsum_offload' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'offload_fwd_mark' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'offload_mr_fwd_mark' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'sender_cpu' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'reserved_tailroom' not described in 'sk_buff'
include/linux/skbuff.h:860: warning: Function parameter or member 'inner_ipproto' not described in 'sk_buff'
include/net/sock.h:238: warning: Function parameter or member 'skc_addrpair' not described in 'sock_common'
include/net/sock.h:238: warning: Function parameter or member 'skc_portpair' not described in 'sock_common'
include/net/sock.h:238: warning: Function parameter or member 'skc_ipv6only' not described in 'sock_common'
include/net/sock.h:238: warning: Function parameter or member 'skc_net_refcnt' not described in 'sock_common'
include/net/sock.h:238: warning: Function parameter or member 'skc_v6_daddr' not described in 'sock_common'
include/net/sock.h:238: warning: Function parameter or member 'skc_v6_rcv_saddr' not described in 'sock_common'
include/net/sock.h:238: warning: Function parameter or member 'skc_cookie' not described in 'sock_common'
include/net/sock.h:238: warning: Function parameter or member 'skc_listener' not described in 'sock_common'
include/net/sock.h:238: warning: Function parameter or member 'skc_tw_dr' not described in 'sock_common'
include/net/sock.h:238: warning: Function parameter or member 'skc_rcv_wnd' not described in 'sock_common'
include/net/sock.h:238: warning: Function parameter or member 'skc_tw_rcv_nxt' not described in 'sock_common'
include/net/sock.h:509: warning: Function parameter or member 'sk_backlog.rmem_alloc' not described in 'sock'
include/net/sock.h:509: warning: Function parameter or member 'sk_backlog.len' not described in 'sock'
include/net/sock.h:509: warning: Function parameter or member 'sk_backlog.head' not described in 'sock'
include/net/sock.h:509: warning: Function parameter or member 'sk_backlog.tail' not described in 'sock'
include/net/sock.h:509: warning: Function parameter or member 'sk_wq_raw' not described in 'sock'
include/net/sock.h:509: warning: Function parameter or member 'tcp_rtx_queue' not described in 'sock'
include/net/sock.h:509: warning: Function parameter or member 'sk_route_forced_caps' not described in 'sock'
include/net/sock.h:509: warning: Function parameter or member 'sk_txtime_report_errors' not described in 'sock'
include/net/sock.h:509: warning: Function parameter or member 'sk_validate_xmit_skb' not described in 'sock'
include/linux/netdevice.h:2018: warning: Function parameter or member 'adj_list.upper' not described in 'net_device'
include/linux/netdevice.h:2018: warning: Function parameter or member 'adj_list.lower' not described in 'net_device'
include/linux/netdevice.h:2018: warning: Function parameter or member 'gso_partial_features' not described in 'net_device'
include/linux/netdevice.h:2018: warning: Function parameter or member 'switchdev_ops' not described in 'net_device'
# https://github.com/0day-ci/linux/commit/eed1edfa16cb1ed0b7530c47d080859c9a2036ec
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout eed1edfa16cb1ed0b7530c47d080859c9a2036ec
vim +1848 drivers/video/fbdev/core/fbmem.c
712f3147 drivers/video/fbmem.c Linus Torvalds 2011-05-13 1833
712f3147 drivers/video/fbmem.c Linus Torvalds 2011-05-13 1834 /**
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1835 * remove_conflicting_pci_framebuffers - remove firmware-configured framebuffers for PCI devices
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1836 * @pdev: PCI device
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1837 * @resource_id: index of PCI BAR configuring framebuffer memory
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1838 * @name: requesting driver name
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1839 *
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1840 * This function removes framebuffer devices (eg. initialized by firmware)
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1841 * using memory range configured for @pdev's BAR @resource_id.
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1842 *
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1843 * The function assumes that PCI device with shadowed ROM drives a primary
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1844 * display and so kicks out vga16fb.
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1845 */
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1846 int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, const char *name)
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1847 {
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 @1848 struct apertures_struct *ap;
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1849 bool primary = false;
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1850 int err;
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1851
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1852 ap = alloc_apertures(1);
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1853 if (!ap)
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1854 return -ENOMEM;
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1855
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1856 ap->ranges[0].base = pci_resource_start(pdev, res_id);
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1857 ap->ranges[0].size = pci_resource_len(pdev, res_id);
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1858 #ifdef CONFIG_X86
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1859 primary = pdev->resource[PCI_ROM_RESOURCE].flags &
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1860 IORESOURCE_ROM_SHADOW;
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1861 #endif
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1862 err = remove_conflicting_framebuffers(ap, name, primary);
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1863 kfree(ap);
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1864 return err;
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1865 }
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1866 EXPORT_SYMBOL(remove_conflicting_pci_framebuffers);
eed1edfa drivers/video/fbdev/core/fbmem.c Michał Mirosław 2018-09-01 1867
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 6587 bytes --]
[-- Attachment #3: Type: text/plain, Size: 183 bytes --]
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* [PATCH v2 5/6] drm/bochs: fix DRM_FORMAT_* handling for big endian machines.
From: Gerd Hoffmann @ 2018-09-05 6:04 UTC (permalink / raw)
To: dri-devel
Cc: David Airlie, michel, open list,
open list:DRM DRIVER FOR BOCHS VIRTUAL GPU, imirkin
In-Reply-To: <20180905060445.15008-1-kraxel@redhat.com>
Use DRM_FORMAT_HOST_XRGB8888, so we are using the correct format code
on bigendian machines. Also set the quirk_addfb_prefer_host_byte_order
mode_config bit so drm_mode_addfb() asks for the correct format code.
Create our own plane and use drm_crtc_init_with_planes() instead of
depending on the default created by drm_crtc_init(). That way the plane
format list is correct on bigendian machines.
With this patch applied both ADDFB and ADDFB2 ioctls work correctly in
the bochs-drm.ko driver on big endian machines. Without the patch only
ADDFB (which still seems to be used by the majority of userspace) works
correctly.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
drivers/gpu/drm/bochs/bochs_fbdev.c | 5 ++---
drivers/gpu/drm/bochs/bochs_kms.c | 34 +++++++++++++++++++++++++++++++++-
drivers/gpu/drm/bochs/bochs_mm.c | 2 +-
3 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c
index 14eb8d0d5a..bf728790fa 100644
--- a/drivers/gpu/drm/bochs/bochs_fbdev.c
+++ b/drivers/gpu/drm/bochs/bochs_fbdev.c
@@ -64,9 +64,8 @@ static int bochsfb_create(struct drm_fb_helper *helper,
mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height;
- mode_cmd.pitches[0] = mode_cmd.width * ((sizes->surface_bpp + 7) / 8);
- mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
- sizes->surface_depth);
+ mode_cmd.pitches[0] = sizes->surface_width * 4;
+ mode_cmd.pixel_format = DRM_FORMAT_HOST_XRGB8888;
size = mode_cmd.pitches[0] * mode_cmd.height;
/* alloc, pin & map bo */
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
index ca5a9afdd5..b40077d04b 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -129,12 +129,43 @@ static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
.commit = bochs_crtc_commit,
};
+static const uint32_t bochs_formats[] = {
+ DRM_FORMAT_HOST_XRGB8888,
+};
+
+static struct drm_plane *bochs_primary_plane(struct drm_device *dev)
+{
+ struct drm_plane *primary;
+ int ret;
+
+ primary = kzalloc(sizeof(*primary), GFP_KERNEL);
+ if (primary == NULL) {
+ DRM_DEBUG_KMS("Failed to allocate primary plane\n");
+ return NULL;
+ }
+
+ ret = drm_universal_plane_init(dev, primary, 0,
+ &drm_primary_helper_funcs,
+ bochs_formats,
+ ARRAY_SIZE(bochs_formats),
+ NULL,
+ DRM_PLANE_TYPE_PRIMARY, NULL);
+ if (ret) {
+ kfree(primary);
+ primary = NULL;
+ }
+
+ return primary;
+}
+
static void bochs_crtc_init(struct drm_device *dev)
{
struct bochs_device *bochs = dev->dev_private;
struct drm_crtc *crtc = &bochs->crtc;
+ struct drm_plane *primary = bochs_primary_plane(dev);
- drm_crtc_init(dev, crtc, &bochs_crtc_funcs);
+ drm_crtc_init_with_planes(dev, crtc, primary, NULL,
+ &bochs_crtc_funcs, NULL);
drm_crtc_helper_add(crtc, &bochs_helper_funcs);
}
@@ -253,6 +284,7 @@ int bochs_kms_init(struct bochs_device *bochs)
bochs->dev->mode_config.fb_base = bochs->fb_base;
bochs->dev->mode_config.preferred_depth = 24;
bochs->dev->mode_config.prefer_shadow = 0;
+ bochs->dev->mode_config.quirk_addfb_prefer_host_byte_order = true;
bochs->dev->mode_config.funcs = &bochs_mode_funcs;
diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c
index c9c7097030..fdf151fbdb 100644
--- a/drivers/gpu/drm/bochs/bochs_mm.c
+++ b/drivers/gpu/drm/bochs/bochs_mm.c
@@ -506,7 +506,7 @@ bochs_user_framebuffer_create(struct drm_device *dev,
(mode_cmd->pixel_format >> 16) & 0xff,
(mode_cmd->pixel_format >> 24) & 0xff);
- if (mode_cmd->pixel_format != DRM_FORMAT_XRGB8888)
+ if (mode_cmd->pixel_format != DRM_FORMAT_HOST_XRGB8888)
return ERR_PTR(-ENOENT);
obj = drm_gem_object_lookup(filp, mode_cmd->handles[0]);
--
2.9.3
^ permalink raw reply related
* [PATCH v2 6/6] drm/virtio: fix DRM_FORMAT_* handling
From: Gerd Hoffmann @ 2018-09-05 6:04 UTC (permalink / raw)
To: dri-devel
Cc: David Airlie, michel, open list, open list:VIRTIO GPU DRIVER,
imirkin
In-Reply-To: <20180905060445.15008-1-kraxel@redhat.com>
Use DRM_FORMAT_HOST_XRGB8888, so we are using the correct format code
on bigendian machines. Also set the quirk_addfb_prefer_host_byte_order
mode_config bit so drm_mode_addfb() asks for the correct format code.
Both DRM_FORMAT_* and VIRTIO_GPU_FORMAT_* are defined to be little
endian, so using a different mapping on bigendian machines is wrong.
It's there because of broken drm_mode_addfb() behavior. So with
drm_mode_addfb() being fixed we can fix this too.
While wading through the code I've noticed we have a little issue in
virtio: We attach a format to the bo when it is created
(DRM_IOCTL_MODE_CREATE_DUMB), not when we map it as framebuffer
(DRM_IOCTL_MODE_ADDFB). Easy way out: Support a single format only.
Pick DRM_FORMAT_HOST_XRGB8888, it is the only one actually used in
practice. Drop unused mappings in virtio_gpu_translate_format().
With this patch applied both ADDFB and ADDFB2 ioctls work correctly in
the virtio-gpu.ko driver on big endian machines. Without the patch only
ADDFB (which still seems to be used by the majority of userspace) works
correctly.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
drivers/gpu/drm/virtio/virtgpu_display.c | 5 +++
drivers/gpu/drm/virtio/virtgpu_fb.c | 2 +-
drivers/gpu/drm/virtio/virtgpu_gem.c | 7 +++--
drivers/gpu/drm/virtio/virtgpu_plane.c | 54 ++------------------------------
4 files changed, 13 insertions(+), 55 deletions(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 25503b9335..14a13edc02 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -306,6 +306,10 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,
struct virtio_gpu_framebuffer *virtio_gpu_fb;
int ret;
+ if (mode_cmd->pixel_format != DRM_FORMAT_HOST_XRGB8888 &&
+ mode_cmd->pixel_format != DRM_FORMAT_HOST_ARGB8888)
+ return ERR_PTR(-ENOENT);
+
/* lookup object associated with res handle */
obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]);
if (!obj)
@@ -354,6 +358,7 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev)
int i;
drm_mode_config_init(vgdev->ddev);
+ vgdev->ddev->mode_config.quirk_addfb_prefer_host_byte_order = true;
vgdev->ddev->mode_config.funcs = &virtio_gpu_mode_funcs;
vgdev->ddev->mode_config.helper_private = &virtio_mode_config_helpers;
diff --git a/drivers/gpu/drm/virtio/virtgpu_fb.c b/drivers/gpu/drm/virtio/virtgpu_fb.c
index a121b1c795..9d87ebd645 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fb.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fb.c
@@ -233,7 +233,7 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,
mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height;
mode_cmd.pitches[0] = mode_cmd.width * 4;
- mode_cmd.pixel_format = drm_mode_legacy_fb_format(32, 24);
+ mode_cmd.pixel_format = DRM_FORMAT_HOST_XRGB8888;
format = virtio_gpu_translate_format(mode_cmd.pixel_format);
if (format == 0)
diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
index 0f2768eaca..82c817f37c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -90,7 +90,10 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
uint32_t resid;
uint32_t format;
- pitch = args->width * ((args->bpp + 1) / 8);
+ if (args->bpp != 32)
+ return -EINVAL;
+
+ pitch = args->width * 4;
args->size = pitch * args->height;
args->size = ALIGN(args->size, PAGE_SIZE);
@@ -99,7 +102,7 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
if (ret)
goto fail;
- format = virtio_gpu_translate_format(DRM_FORMAT_XRGB8888);
+ format = virtio_gpu_translate_format(DRM_FORMAT_HOST_XRGB8888);
virtio_gpu_resource_id_get(vgdev, &resid);
virtio_gpu_cmd_create_resource(vgdev, resid, format,
args->width, args->height);
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index dc5b5b2b7a..3221d50b9a 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -28,22 +28,11 @@
#include <drm/drm_atomic_helper.h>
static const uint32_t virtio_gpu_formats[] = {
- DRM_FORMAT_XRGB8888,
- DRM_FORMAT_ARGB8888,
- DRM_FORMAT_BGRX8888,
- DRM_FORMAT_BGRA8888,
- DRM_FORMAT_RGBX8888,
- DRM_FORMAT_RGBA8888,
- DRM_FORMAT_XBGR8888,
- DRM_FORMAT_ABGR8888,
+ DRM_FORMAT_HOST_XRGB8888,
};
static const uint32_t virtio_gpu_cursor_formats[] = {
-#ifdef __BIG_ENDIAN
- DRM_FORMAT_BGRA8888,
-#else
- DRM_FORMAT_ARGB8888,
-#endif
+ DRM_FORMAT_HOST_ARGB8888,
};
uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc)
@@ -51,32 +40,6 @@ uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc)
uint32_t format;
switch (drm_fourcc) {
-#ifdef __BIG_ENDIAN
- case DRM_FORMAT_XRGB8888:
- format = VIRTIO_GPU_FORMAT_X8R8G8B8_UNORM;
- break;
- case DRM_FORMAT_ARGB8888:
- format = VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM;
- break;
- case DRM_FORMAT_BGRX8888:
- format = VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM;
- break;
- case DRM_FORMAT_BGRA8888:
- format = VIRTIO_GPU_FORMAT_B8G8R8A8_UNORM;
- break;
- case DRM_FORMAT_RGBX8888:
- format = VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM;
- break;
- case DRM_FORMAT_RGBA8888:
- format = VIRTIO_GPU_FORMAT_R8G8B8A8_UNORM;
- break;
- case DRM_FORMAT_XBGR8888:
- format = VIRTIO_GPU_FORMAT_X8B8G8R8_UNORM;
- break;
- case DRM_FORMAT_ABGR8888:
- format = VIRTIO_GPU_FORMAT_A8B8G8R8_UNORM;
- break;
-#else
case DRM_FORMAT_XRGB8888:
format = VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM;
break;
@@ -89,19 +52,6 @@ uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc)
case DRM_FORMAT_BGRA8888:
format = VIRTIO_GPU_FORMAT_A8R8G8B8_UNORM;
break;
- case DRM_FORMAT_RGBX8888:
- format = VIRTIO_GPU_FORMAT_X8B8G8R8_UNORM;
- break;
- case DRM_FORMAT_RGBA8888:
- format = VIRTIO_GPU_FORMAT_A8B8G8R8_UNORM;
- break;
- case DRM_FORMAT_XBGR8888:
- format = VIRTIO_GPU_FORMAT_R8G8B8X8_UNORM;
- break;
- case DRM_FORMAT_ABGR8888:
- format = VIRTIO_GPU_FORMAT_R8G8B8A8_UNORM;
- break;
-#endif
default:
/*
* This should not happen, we handle everything listed
--
2.9.3
^ permalink raw reply related
* Re: [PATCH] bochs: convert to drm_fb_helper_fbdev_setup/teardown
From: Daniel Vetter @ 2018-09-05 14:46 UTC (permalink / raw)
To: Peter Wu; +Cc: David Airlie, virtualization, dri-devel, linux-kernel
In-Reply-To: <20180905144127.5690-1-peter@lekensteyn.nl>
On Wed, Sep 05, 2018 at 04:41:27PM +0200, Peter Wu wrote:
> Currently unloading bochs_drm (after unbinding the vtconsole) results in
> a warning about a leaked connector:
>
> [drm:drm_mode_config_cleanup] *ERROR* connector Virtual-3 leaked!
>
> While investigating a potential fix I noticed that a lot of open-coded
> functionality is already implemented elsewhere, so start converting it:
> bochs_fbdev_init -> drm_fb_helper_fbdev_setup: trivial (similar impl).
> bochs_fbdev_fini -> drm_fb_helper_fbdev_teardown: requires unembedding
> "struct drm_framebuffer" from "struct bochs_framebuffer".
>
> Unembedding drm_framebuffer is made easy using drm_gem_fbdev_fb_create
> which can replace bochs_fbdev_destroy and custom routines in bochs_mm.c.
> For this to work, the GEM object is moved into "drm_framebuffer". After
> that, "bochs_framebuffer" is no longer needed and therefore removed.
>
> Remove the unused "size" and "initialized" fields from fb, the latter is
> not necessary as drm_fb_helper_fbdev_teardown can be called even if
> bochsfb_create fails. This theory was tested by returning early and
> late (just before drm_gem_fbdev_fb_create). Both scenarios fail
> gracefully although the latter seems to leak the object from
> bochsfb_create_object (not a regression).
>
> Guess on the reason for the encoder leak: drm_framebuffer_cleanup was
> previously used, but did not destroy much. drm_fb_helper_fbdev_teardown
> is now used and calls drm_framebuffer_remove which does a bit more work.
>
> Tested with 'echo 0 > /sys/class/vtconsole/vtcon1/bind; rmmod bochs_drm'
> and also with Xorg + fbdev (startx -> xterm). The latter triggered a
> warning in ttm_bo_vm_open that existed before, see
> https://lkml.kernel.org/r/1464000533-13140-4-git-send-email-mstaudt@suse.de
You can probably get rid of this one if you're refactoring even more. The
generic fb_probe implementation (already merged) plus gem-shmem support
for it (still in flight) from Noralf should be able to pull that off. That
gives you the fb_mmap implementation, but with 100% generic code instead
of a driver specific hack like Max did.
>
> Signed-off-by: Peter Wu <peter@lekensteyn.nl>
lgtm. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
I'll leave merging to Gerd.
-Daniel
> ---
> drivers/gpu/drm/bochs/bochs.h | 19 ++-----
> drivers/gpu/drm/bochs/bochs_fbdev.c | 79 +++++++----------------------
> drivers/gpu/drm/bochs/bochs_kms.c | 7 +--
> drivers/gpu/drm/bochs/bochs_mm.c | 74 ---------------------------
> 4 files changed, 22 insertions(+), 157 deletions(-)
>
> diff --git a/drivers/gpu/drm/bochs/bochs.h b/drivers/gpu/drm/bochs/bochs.h
> index 375bf92cd04f..8514a84fbdbe 100644
> --- a/drivers/gpu/drm/bochs/bochs.h
> +++ b/drivers/gpu/drm/bochs/bochs.h
> @@ -51,11 +51,6 @@ enum bochs_types {
> BOCHS_UNKNOWN,
> };
>
> -struct bochs_framebuffer {
> - struct drm_framebuffer base;
> - struct drm_gem_object *obj;
> -};
> -
> struct bochs_device {
> /* hw */
> void __iomem *mmio;
> @@ -88,15 +83,11 @@ struct bochs_device {
>
> /* fbdev */
> struct {
> - struct bochs_framebuffer gfb;
> + struct drm_framebuffer *fb;
> struct drm_fb_helper helper;
> - int size;
> - bool initialized;
> } fb;
> };
>
> -#define to_bochs_framebuffer(x) container_of(x, struct bochs_framebuffer, base)
> -
> struct bochs_bo {
> struct ttm_buffer_object bo;
> struct ttm_placement placement;
> @@ -148,15 +139,9 @@ int bochs_dumb_create(struct drm_file *file, struct drm_device *dev,
> int bochs_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev,
> uint32_t handle, uint64_t *offset);
>
> -int bochs_framebuffer_init(struct drm_device *dev,
> - struct bochs_framebuffer *gfb,
> - const struct drm_mode_fb_cmd2 *mode_cmd,
> - struct drm_gem_object *obj);
> int bochs_bo_pin(struct bochs_bo *bo, u32 pl_flag, u64 *gpu_addr);
> int bochs_bo_unpin(struct bochs_bo *bo);
>
> -extern const struct drm_mode_config_funcs bochs_mode_funcs;
> -
> /* bochs_kms.c */
> int bochs_kms_init(struct bochs_device *bochs);
> void bochs_kms_fini(struct bochs_device *bochs);
> @@ -164,3 +149,5 @@ void bochs_kms_fini(struct bochs_device *bochs);
> /* bochs_fbdev.c */
> int bochs_fbdev_init(struct bochs_device *bochs);
> void bochs_fbdev_fini(struct bochs_device *bochs);
> +
> +extern const struct drm_mode_config_funcs bochs_mode_funcs;
> diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c
> index 14eb8d0d5a00..8f4d6c052f7b 100644
> --- a/drivers/gpu/drm/bochs/bochs_fbdev.c
> +++ b/drivers/gpu/drm/bochs/bochs_fbdev.c
> @@ -6,6 +6,7 @@
> */
>
> #include "bochs.h"
> +#include <drm/drm_gem_framebuffer_helper.h>
>
> /* ---------------------------------------------------------------------- */
>
> @@ -13,9 +14,7 @@ static int bochsfb_mmap(struct fb_info *info,
> struct vm_area_struct *vma)
> {
> struct drm_fb_helper *fb_helper = info->par;
> - struct bochs_device *bochs =
> - container_of(fb_helper, struct bochs_device, fb.helper);
> - struct bochs_bo *bo = gem_to_bochs_bo(bochs->fb.gfb.obj);
> + struct bochs_bo *bo = gem_to_bochs_bo(fb_helper->fb->obj[0]);
>
> return ttm_fbdev_mmap(vma, &bo->bo);
> }
> @@ -101,19 +100,20 @@ static int bochsfb_create(struct drm_fb_helper *helper,
>
> /* init fb device */
> info = drm_fb_helper_alloc_fbi(helper);
> - if (IS_ERR(info))
> + if (IS_ERR(info)) {
> + DRM_ERROR("Failed to allocate fbi: %ld\n", PTR_ERR(info));
> return PTR_ERR(info);
> + }
>
> info->par = &bochs->fb.helper;
>
> - ret = bochs_framebuffer_init(bochs->dev, &bochs->fb.gfb, &mode_cmd, gobj);
> - if (ret)
> - return ret;
> -
> - bochs->fb.size = size;
> + fb = drm_gem_fbdev_fb_create(bochs->dev, sizes, 0, gobj, NULL);
> + if (IS_ERR(fb)) {
> + DRM_ERROR("Failed to create framebuffer: %ld\n", PTR_ERR(fb));
> + return PTR_ERR(fb);
> + }
>
> /* setup helper */
> - fb = &bochs->fb.gfb.base;
> bochs->fb.helper.fb = fb;
>
> strcpy(info->fix.id, "bochsdrmfb");
> @@ -130,27 +130,6 @@ static int bochsfb_create(struct drm_fb_helper *helper,
> drm_vma_offset_remove(&bo->bo.bdev->vma_manager, &bo->bo.vma_node);
> info->fix.smem_start = 0;
> info->fix.smem_len = size;
> -
> - bochs->fb.initialized = true;
> - return 0;
> -}
> -
> -static int bochs_fbdev_destroy(struct bochs_device *bochs)
> -{
> - struct bochs_framebuffer *gfb = &bochs->fb.gfb;
> -
> - DRM_DEBUG_DRIVER("\n");
> -
> - drm_fb_helper_unregister_fbi(&bochs->fb.helper);
> -
> - if (gfb->obj) {
> - drm_gem_object_unreference_unlocked(gfb->obj);
> - gfb->obj = NULL;
> - }
> -
> - drm_framebuffer_unregister_private(&gfb->base);
> - drm_framebuffer_cleanup(&gfb->base);
> -
> return 0;
> }
>
> @@ -158,41 +137,17 @@ static const struct drm_fb_helper_funcs bochs_fb_helper_funcs = {
> .fb_probe = bochsfb_create,
> };
>
> +const struct drm_mode_config_funcs bochs_mode_funcs = {
> + .fb_create = drm_gem_fb_create,
> +};
> +
> int bochs_fbdev_init(struct bochs_device *bochs)
> {
> - int ret;
> -
> - drm_fb_helper_prepare(bochs->dev, &bochs->fb.helper,
> - &bochs_fb_helper_funcs);
> -
> - ret = drm_fb_helper_init(bochs->dev, &bochs->fb.helper, 1);
> - if (ret)
> - return ret;
> -
> - ret = drm_fb_helper_single_add_all_connectors(&bochs->fb.helper);
> - if (ret)
> - goto fini;
> -
> - drm_helper_disable_unused_functions(bochs->dev);
> -
> - ret = drm_fb_helper_initial_config(&bochs->fb.helper, 32);
> - if (ret)
> - goto fini;
> -
> - return 0;
> -
> -fini:
> - drm_fb_helper_fini(&bochs->fb.helper);
> - return ret;
> + return drm_fb_helper_fbdev_setup(bochs->dev, &bochs->fb.helper,
> + &bochs_fb_helper_funcs, 32, 1);
> }
>
> void bochs_fbdev_fini(struct bochs_device *bochs)
> {
> - if (bochs->fb.initialized)
> - bochs_fbdev_destroy(bochs);
> -
> - if (bochs->fb.helper.fbdev)
> - drm_fb_helper_fini(&bochs->fb.helper);
> -
> - bochs->fb.initialized = false;
> + drm_fb_helper_fbdev_teardown(bochs->dev);
> }
> diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
> index 233980a78591..c7e575511d2f 100644
> --- a/drivers/gpu/drm/bochs/bochs_kms.c
> +++ b/drivers/gpu/drm/bochs/bochs_kms.c
> @@ -35,14 +35,12 @@ static int bochs_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
> {
> struct bochs_device *bochs =
> container_of(crtc, struct bochs_device, crtc);
> - struct bochs_framebuffer *bochs_fb;
> struct bochs_bo *bo;
> u64 gpu_addr = 0;
> int ret;
>
> if (old_fb) {
> - bochs_fb = to_bochs_framebuffer(old_fb);
> - bo = gem_to_bochs_bo(bochs_fb->obj);
> + bo = gem_to_bochs_bo(old_fb->obj[0]);
> ret = ttm_bo_reserve(&bo->bo, true, false, NULL);
> if (ret) {
> DRM_ERROR("failed to reserve old_fb bo\n");
> @@ -55,8 +53,7 @@ static int bochs_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
> if (WARN_ON(crtc->primary->fb == NULL))
> return -EINVAL;
>
> - bochs_fb = to_bochs_framebuffer(crtc->primary->fb);
> - bo = gem_to_bochs_bo(bochs_fb->obj);
> + bo = gem_to_bochs_bo(crtc->primary->fb->obj[0]);
> ret = ttm_bo_reserve(&bo->bo, true, false, NULL);
> if (ret)
> return ret;
> diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c
> index 39cd08416773..cdbc3ca3ec51 100644
> --- a/drivers/gpu/drm/bochs/bochs_mm.c
> +++ b/drivers/gpu/drm/bochs/bochs_mm.c
> @@ -457,77 +457,3 @@ int bochs_dumb_mmap_offset(struct drm_file *file, struct drm_device *dev,
> drm_gem_object_unreference_unlocked(obj);
> return 0;
> }
> -
> -/* ---------------------------------------------------------------------- */
> -
> -static void bochs_user_framebuffer_destroy(struct drm_framebuffer *fb)
> -{
> - struct bochs_framebuffer *bochs_fb = to_bochs_framebuffer(fb);
> -
> - drm_gem_object_unreference_unlocked(bochs_fb->obj);
> - drm_framebuffer_cleanup(fb);
> - kfree(fb);
> -}
> -
> -static const struct drm_framebuffer_funcs bochs_fb_funcs = {
> - .destroy = bochs_user_framebuffer_destroy,
> -};
> -
> -int bochs_framebuffer_init(struct drm_device *dev,
> - struct bochs_framebuffer *gfb,
> - const struct drm_mode_fb_cmd2 *mode_cmd,
> - struct drm_gem_object *obj)
> -{
> - int ret;
> -
> - drm_helper_mode_fill_fb_struct(dev, &gfb->base, mode_cmd);
> - gfb->obj = obj;
> - ret = drm_framebuffer_init(dev, &gfb->base, &bochs_fb_funcs);
> - if (ret) {
> - DRM_ERROR("drm_framebuffer_init failed: %d\n", ret);
> - return ret;
> - }
> - return 0;
> -}
> -
> -static struct drm_framebuffer *
> -bochs_user_framebuffer_create(struct drm_device *dev,
> - struct drm_file *filp,
> - const struct drm_mode_fb_cmd2 *mode_cmd)
> -{
> - struct drm_gem_object *obj;
> - struct bochs_framebuffer *bochs_fb;
> - int ret;
> -
> - DRM_DEBUG_DRIVER("%dx%d, format %c%c%c%c\n",
> - mode_cmd->width, mode_cmd->height,
> - (mode_cmd->pixel_format) & 0xff,
> - (mode_cmd->pixel_format >> 8) & 0xff,
> - (mode_cmd->pixel_format >> 16) & 0xff,
> - (mode_cmd->pixel_format >> 24) & 0xff);
> -
> - if (mode_cmd->pixel_format != DRM_FORMAT_XRGB8888)
> - return ERR_PTR(-ENOENT);
> -
> - obj = drm_gem_object_lookup(filp, mode_cmd->handles[0]);
> - if (obj == NULL)
> - return ERR_PTR(-ENOENT);
> -
> - bochs_fb = kzalloc(sizeof(*bochs_fb), GFP_KERNEL);
> - if (!bochs_fb) {
> - drm_gem_object_unreference_unlocked(obj);
> - return ERR_PTR(-ENOMEM);
> - }
> -
> - ret = bochs_framebuffer_init(dev, bochs_fb, mode_cmd, obj);
> - if (ret) {
> - drm_gem_object_unreference_unlocked(obj);
> - kfree(bochs_fb);
> - return ERR_PTR(ret);
> - }
> - return &bochs_fb->base;
> -}
> -
> -const struct drm_mode_config_funcs bochs_mode_funcs = {
> - .fb_create = bochs_user_framebuffer_create,
> -};
> --
> 2.18.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply
* [RFC] UAPI: Check headers by compiling all together as C++
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
To: linux-api, linux-kbuild
Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
Mat Martineau, dri-devel, virtualization, dhowells,
Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
linux-arm-msm, Coly Li, linux-bcache, Dan Williams,
Jaroslav Kysela, Jan Harkes, Michal Marek, Takashi Iwai,
linux-kernel, Rob
Here's a set of patches that inserts a step into the build process to make
sure that the UAPI headers can all be built together with C++ (if the
compiler being used supports C++). All but the final patch perform fixups,
including:
(1) Fix member names that conflict with C++ reserved words by providing
alternates that can be used anywhere. An anonymous union is used so
that that the conflicting name is still available outside of C++.
(2) Fix the use of flexible arrays in structs that get embedded (which is
illegal in C++).
(3) Remove the use of internal kernel structs in UAPI structures.
(4) Fix symbol collisions.
(5) Replace usage of u32 and co. with __u32 and co.
(6) Fix use of sparsely initialised arrays (which g++ doesn't implement).
(7) Remove some use of PAGE_SIZE since this isn't valid outside of the
kernel.
And lastly:
(8) Compile all of the UAPI headers (with a few exceptions) together as
C++ to catch new errors occurring as part of the regular build
process.
The patches can also be found here:
http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=uapi-check
Thanks,
David
---
David Howells (11):
UAPI: drm: Fix use of C++ keywords as structural members
UAPI: keys: Fix use of C++ keywords as structural members
UAPI: virtio_net: Fix use of C++ keywords as structural members
UAPI: bcache: Fix use of embedded flexible array
UAPI: coda: Don't use internal kernel structs in UAPI
UAPI: netfilter: Fix symbol collision issues
UAPI: nilfs2: Fix use of undefined byteswapping functions
UAPI: sound: Fix use of u32 and co. in UAPI headers
UAPI: ndctl: Fix g++-unsupported initialisation in headers
UAPI: ndctl: Remove use of PAGE_SIZE
UAPI: Check headers build for C++
Makefile | 1
include/linux/ndctl.h | 22 ++++
include/uapi/drm/i810_drm.h | 7 +
include/uapi/drm/msm_drm.h | 7 +
include/uapi/linux/bcache.h | 2
include/uapi/linux/coda_psdev.h | 4 +
include/uapi/linux/keyctl.h | 7 +
include/uapi/linux/ndctl.h | 20 ++-
include/uapi/linux/netfilter/nfnetlink_cthelper.h | 2
include/uapi/linux/netfilter_ipv4/ipt_ECN.h | 9 --
include/uapi/linux/nilfs2_ondisk.h | 21 ++--
include/uapi/linux/virtio_net.h | 7 +
include/uapi/sound/skl-tplg-interface.h | 106 +++++++++---------
scripts/headers-c++.sh | 124 +++++++++++++++++++++
14 files changed, 255 insertions(+), 84 deletions(-)
create mode 100644 include/linux/ndctl.h
create mode 100755 scripts/headers-c++.sh
^ permalink raw reply
* [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
From: David Howells @ 2018-09-05 15:54 UTC (permalink / raw)
To: linux-api, linux-kbuild
Cc: dhowells, virtualization, linux-kernel, Michael S. Tsirkin
In-Reply-To: <153616286704.23468.584491117180383924.stgit@warthog.procyon.org.uk>
The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members. Fix
this by inserting an anonymous union that provides an alternative name and
then hide the reserved name in C++.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: "Michael S. Tsirkin" <mst@redhat.com>
cc: Jason Wang <jasowang@redhat.com>
cc: virtualization@lists.linux-foundation.org
---
include/uapi/linux/virtio_net.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index a3715a3224c1..967142bc0e05 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
* command goes in between.
*/
struct virtio_net_ctrl_hdr {
- __u8 class;
+ union {
+#ifndef __cplusplus
+ __u8 class;
+#endif
+ __u8 _class;
+ };
__u8 cmd;
} __attribute__((packed));
^ permalink raw reply related
* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
From: Greg KH @ 2018-09-05 16:54 UTC (permalink / raw)
To: David Howells
Cc: Michael S. Tsirkin, linux-api, linux-kbuild, linux-kernel,
virtualization
In-Reply-To: <153616289529.23468.7498785670556620808.stgit@warthog.procyon.org.uk>
On Wed, Sep 05, 2018 at 04:54:55PM +0100, David Howells wrote:
> The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members. Fix
> this by inserting an anonymous union that provides an alternative name and
> then hide the reserved name in C++.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: "Michael S. Tsirkin" <mst@redhat.com>
> cc: Jason Wang <jasowang@redhat.com>
> cc: virtualization@lists.linux-foundation.org
> ---
>
> include/uapi/linux/virtio_net.h | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
> index a3715a3224c1..967142bc0e05 100644
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
> * command goes in between.
> */
> struct virtio_net_ctrl_hdr {
> - __u8 class;
> + union {
> +#ifndef __cplusplus
> + __u8 class;
> +#endif
> + __u8 _class;
> + };
Ugh, ick, no!
Come on now, either put the whole C namespace stuff around the file, or
don't care about this at all. Doing this whack-a-mole style is a mess.
"class" is a fine variable name for C code, there's no reason this has
to change here at all.
greg k-h
^ permalink raw reply
* Re: [RFC] UAPI: Check headers by compiling all together as C++
From: Greg KH @ 2018-09-05 16:55 UTC (permalink / raw)
To: David Howells
Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
Mat Martineau, dri-devel, virtualization, Masahiro Yamada,
keyrings, Ryusuke Konishi, linux-nilfs, linux-nvdimm, codalist,
coda, coreteam, Kent Overstreet, linux-kbuild, linux-arm-msm,
Coly Li, linux-bcache, Dan Williams, Jaroslav Kysela, Jan Harkes,
Michal Marek, linux-api, Takashi Iwai
In-Reply-To: <153616286704.23468.584491117180383924.stgit@warthog.procyon.org.uk>
On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
>
> Here's a set of patches that inserts a step into the build process to make
> sure that the UAPI headers can all be built together with C++ (if the
> compiler being used supports C++). All but the final patch perform fixups,
> including:
Wait, why do we care? What has recently changed to start to directly
import kernel uapi files into C++ code?
And if userspace wants to do this, can't they do the C namespace trick
themselves when they do the import? That must be how they are doing it
today, right?
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
From: David Howells @ 2018-09-05 17:15 UTC (permalink / raw)
To: Greg KH
Cc: Michael S. Tsirkin, linux-api, linux-kbuild, linux-kernel,
virtualization, dhowells
In-Reply-To: <20180905165436.GA25206@kroah.com>
Greg KH <gregkh@linuxfoundation.org> wrote:
> Come on now, either put the whole C namespace stuff around the file,
You mean wrap it with 'extern "C" { ... }'? That doesn't fix it. That only
affects the symbols generated by the compiler.
> "class" is a fine variable name for C code, there's no reason this has
> to change here at all.
I'm trying to prevent future accidents like the one in linux/keyctl.h. The
easiest way to do this[**] is to pass the entire set of UAPI headers[*]
through the compiler together.
Besides I still have my dark plan to C++-ise the kernel[***] :-D
David
[*] with some obvious exceptions
[**] and it catches other errors too
[***] https://lkml.org/lkml/2018/4/1/116
^ permalink raw reply
* Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as structural members
From: Michael S. Tsirkin @ 2018-09-05 17:35 UTC (permalink / raw)
To: David Howells; +Cc: linux-api, virtualization, linux-kernel, linux-kbuild
In-Reply-To: <153616289529.23468.7498785670556620808.stgit@warthog.procyon.org.uk>
On Wed, Sep 05, 2018 at 04:54:55PM +0100, David Howells wrote:
> The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members. Fix
> this by inserting an anonymous union that provides an alternative name and
> then hide the reserved name in C++.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: "Michael S. Tsirkin" <mst@redhat.com>
> cc: Jason Wang <jasowang@redhat.com>
> cc: virtualization@lists.linux-foundation.org
> ---
>
> include/uapi/linux/virtio_net.h | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
> index a3715a3224c1..967142bc0e05 100644
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
> * command goes in between.
> */
> struct virtio_net_ctrl_hdr {
> - __u8 class;
> + union {
> +#ifndef __cplusplus
> + __u8 class;
> +#endif
> + __u8 _class;
> + };
> __u8 cmd;
> } __attribute__((packed));
As long as you do not intend to use any classes, how about
simply adding
-Dclass=_class
to your command line?
Seems to work fine with gcc 8.1.1 on Fedora.
--
MST
^ permalink raw reply
* Re: [RFC] UAPI: Check headers by compiling all together as C++
From: Michael S. Tsirkin @ 2018-09-05 17:42 UTC (permalink / raw)
To: Yann Droneaud
Cc: moderated for non-subscribers, David Airlie, Greg KH,
Mat Martineau, dri-devel, virtualization, David Howells,
Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
linux-kbuild, linux-arm-msm, Coly Li, linux-bcache, Dan Williams,
Jaroslav Kysela, Jan Harkes, Michal Marek, linux-api, Takashi
In-Reply-To: <a1efae8d26cc5b73b180e9521d6b62590c55aa86.camel@opteya.com>
On Wed, Sep 05, 2018 at 07:33:38PM +0200, Yann Droneaud wrote:
> Hi,
>
> Le mercredi 05 septembre 2018 à 18:55 +0200, Greg KH a écrit :
> > On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
> > >
> > > Here's a set of patches that inserts a step into the build process to make
> > > sure that the UAPI headers can all be built together with C++ (if the
> > > compiler being used supports C++). All but the final patch perform fixups,
> > > including:
> >
> > Wait, why do we care? What has recently changed to start to directly
> > import kernel uapi files into C++ code?
> >
> > And if userspace wants to do this, can't they do the C namespace trick
> > themselves when they do the import? That must be how they are doing it
> > today, right?
> >
>
> They can't.
>
>
> Adding extern "C" { } doesn't magically make "class" a non keyword.
> Even if it was the case, writing C++ code using whatever->class would
> probably broke because class is a keyword in C++.
I think it's a bug in the language TBH.
> --
> Yann Droneaud
> OPTEYA
>
^ permalink raw reply
* Re: [RFC] UAPI: Check headers by compiling all together as C++
From: David Howells @ 2018-09-05 17:50 UTC (permalink / raw)
To: Greg KH
Cc: alsa-devel, linux-kbuild, linux-api, linux-kernel, dri-devel,
virtualization, dhowells, keyrings, netfilter-devel,
linux-fsdevel, freedreno
In-Reply-To: <20180905165552.GB25206@kroah.com>
Greg KH <greg@kroah.com> wrote:
> > Here's a set of patches that inserts a step into the build process to make
> > sure that the UAPI headers can all be built together with C++ (if the
> > compiler being used supports C++). All but the final patch perform fixups,
> > including:
>
> Wait, why do we care? What has recently changed to start to directly
> import kernel uapi files into C++ code?
There's at least one outstanding bug due to a C++ identifier in the kernel
UAPI headers.
Are you saying you explicitly don't want people to be able to use the kernel
UAPI headers in C++?
> And if userspace wants to do this, can't they do the C namespace trick
> themselves when they do the import? That must be how they are doing it
> today, right?
No, because there's no such trick (except with the preprocessor).
David
^ permalink raw reply
* Re: [RFC] UAPI: Check headers by compiling all together as C++
From: Jan Engelhardt @ 2018-09-05 19:22 UTC (permalink / raw)
To: Greg KH
Cc: moderated for non-subscribers, Michael S. Tsirkin, David Airlie,
Mat Martineau, dri-devel, virtualization, David Howells,
Masahiro Yamada, keyrings, Ryusuke Konishi, linux-nilfs,
linux-nvdimm, codalist, coda, coreteam, Kent Overstreet,
linux-kbuild, linux-arm-msm, Coly Li, linux-bcache, Dan Williams,
Jaroslav Kysela, Jan Harkes, Michal Marek, linux-api
In-Reply-To: <20180905165552.GB25206@kroah.com>
On Wednesday 2018-09-05 18:55, Greg KH wrote:
>On Wed, Sep 05, 2018 at 04:54:27PM +0100, David Howells wrote:
>>
>> Here's a set of patches that inserts a step into the build process to make
>> sure that the UAPI headers can all be built together with C++ (if the
>> compiler being used supports C++). All but the final patch perform fixups,
>> including:
>
>Wait, why do we care? What has recently changed to start to directly
>import kernel uapi files into C++ code?
With C++11, C++ has become a much nicer language to use (for userspace, anyway).
>And if userspace wants to do this, can't they do the C namespace trick
>themselves when they do the import?
The only trick is to use an extra C source file and extensively wrap things.
^ permalink raw reply
* [PATCH net-next 00/11] Vhost_net TX batching
From: Jason Wang @ 2018-09-06 4:05 UTC (permalink / raw)
To: netdev, linux-kernel; +Cc: mst, kvm, virtualization
Hi all:
This series tries to batch submitting packets to underlayer socket
through msg_control during sendmsg(). This is done by:
1) Doing userspace copy inside vhost_net
2) Build XDP buff
3) Batch at most 64 (VHOST_NET_BATCH) XDP buffs and submit them once
through msg_control during sendmsg().
4) Underlayer sockets can use XDP buffs directly when XDP is enalbed,
or build skb based on XDP buff.
For the packet that can not be built easily with XDP or for the case
that batch submission is hard (e.g sndbuf is limited). We will go for
the previous slow path, passing iov iterator to underlayer socket
through sendmsg() once per packet.
This can help to improve cache utilization and avoid lots of indirect
calls with sendmsg(). It can also co-operate with the batching support
of the underlayer sockets (e.g the case of XDP redirection through
maps).
Testpmd(txonly) in guest shows obvious improvements:
Test /+pps%
XDP_DROP on TAP /+44.8%
XDP_REDIRECT on TAP /+29%
macvtap (skb) /+26%
Netperf TCP_STREAM TX from guest shows obvious improvements on small
packet:
size/session/+thu%/+normalize%
64/ 1/ +2%/ 0%
64/ 2/ +3%/ +1%
64/ 4/ +7%/ +5%
64/ 8/ +8%/ +6%
256/ 1/ +3%/ 0%
256/ 2/ +10%/ +7%
256/ 4/ +26%/ +22%
256/ 8/ +27%/ +23%
512/ 1/ +3%/ +2%
512/ 2/ +19%/ +14%
512/ 4/ +43%/ +40%
512/ 8/ +45%/ +41%
1024/ 1/ +4%/ 0%
1024/ 2/ +27%/ +21%
1024/ 4/ +38%/ +73%
1024/ 8/ +15%/ +24%
2048/ 1/ +10%/ +7%
2048/ 2/ +16%/ +12%
2048/ 4/ 0%/ +2%
2048/ 8/ 0%/ +2%
4096/ 1/ +36%/ +60%
4096/ 2/ -11%/ -26%
4096/ 4/ 0%/ +14%
4096/ 8/ 0%/ +4%
16384/ 1/ -1%/ +5%
16384/ 2/ 0%/ +2%
16384/ 4/ 0%/ -3%
16384/ 8/ 0%/ +4%
65535/ 1/ 0%/ +10%
65535/ 2/ 0%/ +8%
65535/ 4/ 0%/ +1%
65535/ 8/ 0%/ +3%
Please review.
Thanks
Jason Wang (11):
net: sock: introduce SOCK_XDP
tuntap: switch to use XDP_PACKET_HEADROOM
tuntap: enable bh early during processing XDP
tuntap: simplify error handling in tun_build_skb()
tuntap: tweak on the path of non-xdp case in tun_build_skb()
tuntap: split out XDP logic
tuntap: move XDP flushing out of tun_do_xdp()
tun: switch to new type of msg_control
tuntap: accept an array of XDP buffs through sendmsg()
tap: accept an array of XDP buffs through sendmsg()
vhost_net: batch submitting XDP buffers to underlayer sockets
drivers/net/tap.c | 87 +++++++++++++-
drivers/net/tun.c | 251 +++++++++++++++++++++++++++++++----------
drivers/vhost/net.c | 171 +++++++++++++++++++++++++---
include/linux/if_tun.h | 7 ++
include/net/sock.h | 1 +
5 files changed, 437 insertions(+), 80 deletions(-)
--
2.17.1
^ permalink raw reply
* [PATCH net-next 01/11] net: sock: introduce SOCK_XDP
From: Jason Wang @ 2018-09-06 4:05 UTC (permalink / raw)
To: netdev, linux-kernel; +Cc: mst, kvm, virtualization
In-Reply-To: <20180906040526.22518-1-jasowang@redhat.com>
This patch introduces a new sock flag - SOCK_XDP. This will be used
for notifying the upper layer that XDP program is attached on the
lower socket, and requires for extra headroom.
TUN will be the first user.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/tun.c | 19 +++++++++++++++++++
include/net/sock.h | 1 +
2 files changed, 20 insertions(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index ebd07ad82431..2c548bd20393 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -869,6 +869,9 @@ static int tun_attach(struct tun_struct *tun, struct file *file,
tun_napi_init(tun, tfile, napi);
}
+ if (rtnl_dereference(tun->xdp_prog))
+ sock_set_flag(&tfile->sk, SOCK_XDP);
+
tun_set_real_num_queues(tun);
/* device is allowed to go away first, so no need to hold extra
@@ -1241,13 +1244,29 @@ static int tun_xdp_set(struct net_device *dev, struct bpf_prog *prog,
struct netlink_ext_ack *extack)
{
struct tun_struct *tun = netdev_priv(dev);
+ struct tun_file *tfile;
struct bpf_prog *old_prog;
+ int i;
old_prog = rtnl_dereference(tun->xdp_prog);
rcu_assign_pointer(tun->xdp_prog, prog);
if (old_prog)
bpf_prog_put(old_prog);
+ for (i = 0; i < tun->numqueues; i++) {
+ tfile = rtnl_dereference(tun->tfiles[i]);
+ if (prog)
+ sock_set_flag(&tfile->sk, SOCK_XDP);
+ else
+ sock_reset_flag(&tfile->sk, SOCK_XDP);
+ }
+ list_for_each_entry(tfile, &tun->disabled, next) {
+ if (prog)
+ sock_set_flag(&tfile->sk, SOCK_XDP);
+ else
+ sock_reset_flag(&tfile->sk, SOCK_XDP);
+ }
+
return 0;
}
diff --git a/include/net/sock.h b/include/net/sock.h
index 433f45fc2d68..38cae35f6e16 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -800,6 +800,7 @@ enum sock_flags {
SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */
SOCK_RCU_FREE, /* wait rcu grace period in sk_destruct() */
SOCK_TXTIME,
+ SOCK_XDP, /* XDP is attached */
};
#define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE))
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 02/11] tuntap: switch to use XDP_PACKET_HEADROOM
From: Jason Wang @ 2018-09-06 4:05 UTC (permalink / raw)
To: netdev, linux-kernel; +Cc: mst, kvm, virtualization
In-Reply-To: <20180906040526.22518-1-jasowang@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/tun.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 2c548bd20393..d3677a544b56 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -113,7 +113,6 @@ do { \
} while (0)
#endif
-#define TUN_HEADROOM 256
#define TUN_RX_PAD (NET_IP_ALIGN + NET_SKB_PAD)
/* TUN device flags */
@@ -1654,7 +1653,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
rcu_read_lock();
xdp_prog = rcu_dereference(tun->xdp_prog);
if (xdp_prog)
- pad += TUN_HEADROOM;
+ pad += XDP_PACKET_HEADROOM;
buflen += SKB_DATA_ALIGN(len + pad);
rcu_read_unlock();
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 03/11] tuntap: enable bh early during processing XDP
From: Jason Wang @ 2018-09-06 4:05 UTC (permalink / raw)
To: netdev, linux-kernel; +Cc: mst, kvm, virtualization
In-Reply-To: <20180906040526.22518-1-jasowang@redhat.com>
This patch move the bh enabling a little bit earlier, this will be
used for factoring out the core XDP logic of tuntap.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/tun.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index d3677a544b56..372caf7d67d9 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1726,22 +1726,18 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
goto err_xdp;
}
}
+ rcu_read_unlock();
+ local_bh_enable();
skb = build_skb(buf, buflen);
- if (!skb) {
- rcu_read_unlock();
- local_bh_enable();
+ if (!skb)
return ERR_PTR(-ENOMEM);
- }
skb_reserve(skb, pad - delta);
skb_put(skb, len);
get_page(alloc_frag->page);
alloc_frag->offset += buflen;
- rcu_read_unlock();
- local_bh_enable();
-
return skb;
err_redirect:
--
2.17.1
^ permalink raw reply related
* [PATCH net-next 04/11] tuntap: simplify error handling in tun_build_skb()
From: Jason Wang @ 2018-09-06 4:05 UTC (permalink / raw)
To: netdev, linux-kernel; +Cc: mst, kvm, virtualization
In-Reply-To: <20180906040526.22518-1-jasowang@redhat.com>
There's no need to duplicate page get logic in each action. So this
patch tries to get page and calculate the offset before processing XDP
actions, and undo them when meet errors (we don't care the performance
on errors). This will be used for factoring out XDP logic.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/tun.c | 37 ++++++++++++++++---------------------
1 file changed, 16 insertions(+), 21 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 372caf7d67d9..f8cdcfa392c3 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1642,7 +1642,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
int len, int *skb_xdp)
{
struct page_frag *alloc_frag = ¤t->task_frag;
- struct sk_buff *skb;
+ struct sk_buff *skb = NULL;
struct bpf_prog *xdp_prog;
int buflen = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
unsigned int delta = 0;
@@ -1668,6 +1668,9 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
if (copied != len)
return ERR_PTR(-EFAULT);
+ get_page(alloc_frag->page);
+ alloc_frag->offset += buflen;
+
/* There's a small window that XDP may be set after the check
* of xdp_prog above, this should be rare and for simplicity
* we do XDP on skb in case the headroom is not enough.
@@ -1695,23 +1698,15 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
switch (act) {
case XDP_REDIRECT:
- get_page(alloc_frag->page);
- alloc_frag->offset += buflen;
err = xdp_do_redirect(tun->dev, &xdp, xdp_prog);
xdp_do_flush_map();
if (err)
- goto err_redirect;
- rcu_read_unlock();
- local_bh_enable();
- return NULL;
+ goto err_xdp;
+ goto out;
case XDP_TX:
- get_page(alloc_frag->page);
- alloc_frag->offset += buflen;
if (tun_xdp_tx(tun->dev, &xdp) < 0)
- goto err_redirect;
- rcu_read_unlock();
- local_bh_enable();
- return NULL;
+ goto err_xdp;
+ goto out;
case XDP_PASS:
delta = orig_data - xdp.data;
len = xdp.data_end - xdp.data;
@@ -1730,23 +1725,23 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
local_bh_enable();
skb = build_skb(buf, buflen);
- if (!skb)
- return ERR_PTR(-ENOMEM);
+ if (!skb) {
+ skb = ERR_PTR(-ENOMEM);
+ goto out;
+ }
skb_reserve(skb, pad - delta);
skb_put(skb, len);
- get_page(alloc_frag->page);
- alloc_frag->offset += buflen;
return skb;
-err_redirect:
- put_page(alloc_frag->page);
err_xdp:
+ alloc_frag->offset -= buflen;
+ put_page(alloc_frag->page);
+out:
rcu_read_unlock();
local_bh_enable();
- this_cpu_inc(tun->pcpu_stats->rx_dropped);
- return NULL;
+ return skb;
}
/* Get packet from user space buffer */
--
2.17.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox