Commit Graph

1108092 Commits

Author SHA1 Message Date
Greg Kroah-Hartman
b7876c8b7d Merge 67850b7bdc ("Merge tag 'ptrace_stop-cleanup-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I24c33bd2bd16545f814b1b6a615ae1f0d8faee94
2022-07-07 13:25:59 +02:00
Greg Kroah-Hartman
eb6d937732 Merge 1ec6574a3c ("Merge tag 'kthread-cleanups-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4aa2a25bd0b5815a9284abdcc00c406a6e18d0e0
2022-07-07 13:25:46 +02:00
Greg Kroah-Hartman
285f9042a7 Merge 1888e9b4bb ("Merge tag 'per-namespace-ipc-sysctls-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I17b8e471a1f36bb9ccce4d80574094de0a8b101d
2022-07-07 13:25:36 +02:00
Greg Kroah-Hartman
6ad4e9656a Merge 744983d878 ("Merge tag 'for-linus-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4946065d856cabeaa0a469294dfecba33797c3d4
2022-07-07 12:42:28 +02:00
Greg Kroah-Hartman
a447e4c8ac Merge 4e583ff9df ("Merge tag 'for-linus-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If828d125563f4adf1dc2b176d63979ac17eed237
2022-07-07 12:42:19 +02:00
Greg Kroah-Hartman
8c1b846b44 Merge a01fe7ec42 ("Merge tag 'devicetree-fixes-for-5.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I32b25002a785c71817532079a384e4f716d04e76
2022-07-07 12:42:11 +02:00
Greg Kroah-Hartman
e00b356672 Merge 9af13088ab ("Merge tag 'arm-multiplatform-5.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I9b5f146947d6676c33e439e10549c2973a56f913
2022-07-07 12:42:02 +02:00
Greg Kroah-Hartman
af456cd375 Merge c6f2f3e2c8 ("Merge tag 'loongarch-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I05ae19048cc94eff6829c07421b885713e0945f4
2022-07-07 09:36:16 +02:00
Greg Kroah-Hartman
0968c481bc Merge 21873bd66b ("Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If311727467bac64a2f4295ce67b1d86f26e55185
2022-07-07 09:36:03 +02:00
Greg Kroah-Hartman
a69024c967 Merge f66e797b40 ("Merge tag 'riscv-for-linus-5.19-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ibc74189be232d4bd98a291a70aac08886ded9dcd
2022-07-07 09:35:48 +02:00
Greg Kroah-Hartman
e2b7083040 Merge 500a434fc5 ("Merge tag 'driver-core-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ie6de144a337f7e16e38738a1487e9885480ddfa2
2022-07-06 19:53:36 +02:00
Greg Kroah-Hartman
4a77dcca5c Revert "ANDROID: sched: add vendor hook for correcting cpu capacity"
This reverts commit e209b3b88d.

The hooks in arch_topology break in 5.19-rc1 so revert them for now.  If
they are still needed, we can add them back in later on.

Bug: 163935827
Cc: Yun Hsiang <yun.hsiang@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ibb0c787934107ecf1882615c9002a2b91a38e5a3
2022-07-06 19:53:00 +02:00
Greg Kroah-Hartman
903a9a5ed0 Revert "ANDROID: sched: add cpumask parameter to cpu capacity vendor hook"
This reverts commit 07f80e7c1e.

Hooks in arch_topology.h conflict with upstream changes in 5.19-rc1 so
revert them for now.  If they are still needed they can come back in
later.

Bug: 167126223
Cc: Yun Hsiang <yun.hsiang@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I5f794ccbbc6ef51baf8e32d08c220d551bab3164
2022-07-06 19:53:00 +02:00
Greg Kroah-Hartman
834285e43d Revert "ANDROID: sched: Add vendor hooks for update_topology"
This reverts commit 93c605314b.

There are problems with how the hooks work with the upstream changes in
5.19-rc1.  If these are still needed, they can be added back later, but
revert them for now to get the build working properly.

Bug: 200103201
Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Cc: Ashay Jaiswal <quic_ashayj@quicinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iaf2cc76822240af4fa9e7090b47d5d7a84bff6dc
2022-07-06 19:21:18 +02:00
Greg Kroah-Hartman
b9bca6992d Revert "ANDROID: topology: Add flag to indicate topology has been updated"
This reverts commit e5aa1a481e.

There are problems with hooks in the topology code changes in 5.19-rc1,
so revert them for now.  If they are still needed in the future, they
can be brought back.

Bug: 187234873
Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7d41c7af7d4582319937f818e0bde25cedd47610
2022-07-06 19:21:15 +02:00
Greg Kroah-Hartman
c18e2df05b Revert "ANDROID: arch_topology: Export thermal pressure symbol"
This reverts commit d7db9dc74f.

This should no longer be needed to be exported.  If so, please submit
the needed driver upstream.

Bug: 175847109
Cc: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I21751d44a1c28b22eec53f5f6212b1934c84febb
2022-07-06 19:21:13 +02:00
Treehugger Robot
90b20e9248 Merge "Merge 6f9b5ed8ca ("Merge tag 'char-misc-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc") into android-mainline" into android-mainline 2022-07-02 13:14:55 +00:00
Treehugger Robot
6af59ed151 Merge "Merge 54c2cc7919 ("Merge tag 'usb-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb") into android-mainline" into android-mainline 2022-07-02 13:13:28 +00:00
Treehugger Robot
bcc702a63f Merge "Merge 932c2989b5 ("Merge tag 'tty-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty") into android-mainline" into android-mainline 2022-07-02 13:11:42 +00:00
Treehugger Robot
229095a2b5 Merge "Merge 78c6499c92 ("Merge tag 'for-5.19/drivers-2022-06-02' of git://git.kernel.dk/linux-block") into android-mainline" into android-mainline 2022-07-01 22:35:35 +00:00
Treehugger Robot
31414f8bd2 Merge "Merge 72fbbc3d0e ("Merge tag 'for-5.19/block-exec-2022-06-02' of git://git.kernel.dk/linux-block") into android-mainline" into android-mainline 2022-07-01 22:32:15 +00:00
Treehugger Robot
d75fe523d0 Merge "Merge 4ad680f083 ("Merge tag 'staging-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging") into android-mainline" into android-mainline 2022-07-01 22:29:23 +00:00
Greg Kroah-Hartman
3b6d09b4a7 Merge 6f9b5ed8ca ("Merge tag 'char-misc-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc") into android-mainline
Steps on the way to 5.19-rc1

Resolves merge conflicts in:
	drivers/android/binder.c

Cc: Carlos Llamas <cmllamas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ifcc17a51f95579eb91e23a2c3940cecad5582f15
2022-07-01 22:46:48 +02:00
Greg Kroah-Hartman
2825770ce3 Merge 54c2cc7919 ("Merge tag 'usb-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I276fa015c31114e7fdd76ce8bec6e66c25b9fc0d
2022-07-01 22:46:00 +02:00
Greg Kroah-Hartman
2919b774ff Merge 78c6499c92 ("Merge tag 'for-5.19/drivers-2022-06-02' of git://git.kernel.dk/linux-block") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8ebc847ccfb6190c7bd1c03e712e5c042677c26d
2022-07-01 22:43:36 +02:00
Greg Kroah-Hartman
63bd557bb8 Merge 72fbbc3d0e ("Merge tag 'for-5.19/block-exec-2022-06-02' of git://git.kernel.dk/linux-block") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I75d5d66bcaf65819af32dcece0085363e7d94174
2022-07-01 22:43:19 +02:00
Greg Kroah-Hartman
2031c74ede Merge 34845d92bc ("Merge tag 'for-5.19/block-2022-06-02' of git://git.kernel.dk/linux-block") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I809f84ca1baedbc84ae30f5c26a12dced1223216
2022-07-01 22:43:00 +02:00
Greg Kroah-Hartman
d1343179cf Merge 5ac8bdb9ad ("Merge tag 'io_uring-5.19-2022-06-02' of git://git.kernel.dk/linux-block") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ifb1cca96ab3d0a83719c780afb9f2d05dc9a95b4
2022-07-01 22:42:43 +02:00
Greg Kroah-Hartman
38c9e76513 Merge 932c2989b5 ("Merge tag 'tty-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty") into android-mainline
Steps on the way to 5.19-rc1

Resolves merge conflicts in:
	drivers/tty/hvc/hvc_dcc.c

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I11d3fa88102b8efda85d2c37fee3138b211e4afa
2022-07-01 22:38:32 +02:00
Greg Kroah-Hartman
2b869d8965 Merge 4ad680f083 ("Merge tag 'staging-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging") into android-mainline
Steps on the way to 5.19-rc1

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ib8ea92592ccd22820e027da7ec71c650b73ba84f
2022-07-01 22:34:06 +02:00
Deming Wang
d712ca5a16 UPSTREAM: virtio_ring: make vring_create_virtqueue_split prettier
Add some spaces to vring_alloc_queue(make it look prettier).

Signed-off-by: Deming Wang <wangdeming@inspur.com>
Message-Id: <20220622192306.4371-1-wangdeming@inspur.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit c7cc29aaeb)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I13a21cf962980ae6cdb84f5564c43b2506448baf
2022-07-01 20:24:03 +00:00
Stefano Garzarella
e14dde1bce UPSTREAM: vhost-vdpa: call vhost_vdpa_cleanup during the release
Before commit 3d56987938 ("vhost-vdpa: introduce asid based IOTLB")
we call vhost_vdpa_iotlb_free() during the release to clean all regions
mapped in the iotlb.

That commit removed vhost_vdpa_iotlb_free() and added vhost_vdpa_cleanup()
to do some cleanup, including deleting all mappings, but we forgot to call
it in vhost_vdpa_release().

This causes that if an application does not remove all mappings explicitly
(or it crashes), the mappings remain in the iotlb and subsequent
applications may fail if they map the same addresses.

Calling vhost_vdpa_cleanup() also fixes a memory leak since we are not
freeing `v->vdev.vqs` during the release from the same commit.

Since vhost_vdpa_cleanup() calls vhost_dev_cleanup() we can remove its
call from vhost_vdpa_release().

Fixes: 3d56987938 ("vhost-vdpa: introduce asid based IOTLB")
Cc: gautam.dawar@xilinx.com
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20220622151407.51232-1-sgarzare@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit 037d430556)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ia2101b1b45143c342bc85a379a8859474f7c5128
2022-07-01 20:24:03 +00:00
Stephan Gerhold
f9cd6692e7 UPSTREAM: virtio_mmio: Restore guest page size on resume
Virtio devices might lose their state when the VMM is restarted
after a suspend to disk (hibernation) cycle. This means that the
guest page size register must be restored for the virtio_mmio legacy
interface, since otherwise the virtio queues are not functional.

This is particularly problematic for QEMU that currently still defaults
to using the legacy interface for virtio_mmio. Write the guest page
size register again in virtio_mmio_restore() to make legacy virtio_mmio
devices work correctly after hibernation.

Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
Message-Id: <20220621110621.3638025-3-stephan.gerhold@kernkonzept.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit e0c2ce8217)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I8dc514a699d9fbc4a209ef9523e3bc25dbe6a3d5
2022-07-01 20:24:03 +00:00
Stephan Gerhold
f94739ce6c UPSTREAM: virtio_mmio: Add missing PM calls to freeze/restore
Most virtio drivers provide freeze/restore callbacks to finish up
device usage before suspend and to reinitialize the virtio device after
resume. However, these callbacks are currently only called when using
virtio_pci. virtio_mmio does not have any PM ops defined.

This causes problems for example after suspend to disk (hibernation),
since the virtio devices might lose their state after the VMM is
restarted. Calling virtio_device_freeze()/restore() ensures that
the virtio devices are re-initialized correctly.

Fix this by implementing the dev_pm_ops for virtio_mmio,
similar to virtio_pci_common.

Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
Message-Id: <20220621110621.3638025-2-stephan.gerhold@kernkonzept.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit ed7ac37fde)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6be577fb90dd9c444b11676b0baf80d1c5c20de6
2022-07-01 20:24:03 +00:00
Jason Wang
b05f74c17b UPSTREAM: caif_virtio: fix race between virtio_device_ready() and ndo_open()
We currently depend on probe() calling virtio_device_ready() -
which happens after netdev
registration. Since ndo_open() can be called immediately
after register_netdev, this means there exists a race between
ndo_open() and virtio_device_ready(): the driver may start to use the
device (e.g. TX) before DRIVER_OK which violates the spec.

Fix this by switching to use register_netdevice() and protect the
virtio_device_ready() with rtnl_lock() to make sure ndo_open() can
only be called after virtio_device_ready().

Fixes: 0d2e1a2926 ("caif_virtio: Introduce caif over virtio")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220620051115.3142-3-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 11a37eb668)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7abe77d08c92c561676def322baf54fa1fce58a8
2022-07-01 20:24:03 +00:00
Jason Wang
b9cbf0fa67 UPSTREAM: virtio-net: fix race between ndo_open() and virtio_device_ready()
We currently call virtio_device_ready() after netdev
registration. Since ndo_open() can be called immediately
after register_netdev, this means there exists a race between
ndo_open() and virtio_device_ready(): the driver may start to use the
device before DRIVER_OK which violates the spec.

Fix this by switching to use register_netdevice() and protect the
virtio_device_ready() with rtnl_lock() to make sure ndo_open() can
only be called after virtio_device_ready().

Fixes: 4baf1e33d0 ("virtio_net: enable VQs early")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220617072949.30734-1-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 50c0ada627)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iab222236dcc22d51befa98831c5306264aea09e5
2022-07-01 20:24:03 +00:00
Jason Wang
5104213da6 UPSTREAM: virtio: disable notification hardening by default
We try to harden virtio device notifications in 8b4ec69d7e ("virtio:
harden vring IRQ"). It works with the assumption that the driver or
core can properly call virtio_device_ready() at the right
place. Unfortunately, this seems to be not true and uncover various
bugs of the existing drivers, mainly the issue of using
virtio_device_ready() incorrectly.

So let's add a Kconfig option and disable it by default. It gives
us time to fix the drivers and then we can consider re-enabling it.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220622012940.21441-1-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
(cherry picked from commit c346dae4f3)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I614cddfdac6e456b7786d3949d7ec793720c4e14
2022-07-01 20:24:03 +00:00
Bo Liu
f9146ba081 UPSTREAM: virtio: Remove unnecessary variable assignments
In function vp_modern_probe(), "pci_dev" is initialized with the
value of "mdev->pci_dev", so assigning "pci_dev" to "mdev->pci_dev"
is unnecessary since they store the same value.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Message-Id: <20220617055952.5364-1-liubo03@inspur.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
(cherry picked from commit 03d9571706)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Iac1a1f5d53f6514ff8bb97e6f85fdb63bbdd166d
2022-07-01 20:24:03 +00:00
huangjie.albert
d5dc8b022f UPSTREAM: virtio_ring : keep used_wrap_counter in vq->last_used_idx
the used_wrap_counter and the vq->last_used_idx may get
out of sync if they are separate assignment,and interrupt
might use an incorrect value to check for the used index.

for example:OOB access
ksoftirqd may consume the packet and it will call:
virtnet_poll
	-->virtnet_receive
		-->virtqueue_get_buf_ctx
			-->virtqueue_get_buf_ctx_packed
and in virtqueue_get_buf_ctx_packed:

vq->last_used_idx += vq->packed.desc_state[id].num;
if (unlikely(vq->last_used_idx >= vq->packed.vring.num)) {
         vq->last_used_idx -= vq->packed.vring.num;
         vq->packed.used_wrap_counter ^= 1;
}

if at the same time, there comes a vring interrupt,in vring_interrupt:
we will call:
vring_interrupt
	-->more_used
		-->more_used_packed
			-->is_used_desc_packed
in is_used_desc_packed, the last_used_idx maybe >= vq->packed.vring.num.
so this could case a memory out of bounds bug.

this patch is to keep the used_wrap_counter in vq->last_used_idx
so we can get the correct value to check for used index in interrupt.

v3->v4:
- use READ_ONCE/WRITE_ONCE to get/set vq->last_used_idx

v2->v3:
- add inline function to get used_wrap_counter and last_used
- when use vq->last_used_idx, only read once
  if vq->last_used_idx is read twice, the values can be inconsistent.
- use last_used_idx & ~(-(1 << VRING_PACKED_EVENT_F_WRAP_CTR))
  to get the all bits below VRING_PACKED_EVENT_F_WRAP_CTR

v1->v2:
- reuse the VRING_PACKED_EVENT_F_WRAP_CTR
- Remove parameter judgment in is_used_desc_packed,
because it can't be illegal

Signed-off-by: huangjie.albert <huangjie.albert@bytedance.com>
Message-Id: <20220617020411.80367-1-huangjie.albert@bytedance.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit a7722890fd)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6589c086af4d1048921e8e325ba950c1ef657235
2022-07-01 20:24:03 +00:00
Parav Pandit
19b65fb9e9 UPSTREAM: vduse: Tie vduse mgmtdev and its device
vduse devices are not backed by any real devices such as PCI. Hence it
doesn't have any parent device linked to it.

Kernel driver model in [1] suggests to avoid an empty device
release callback.

Hence tie the mgmtdevice object's life cycle to an allocate dummy struct
device instead of static one.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/core-api/kobject.rst?h=v5.18-rc7#n284

Signed-off-by: Parav Pandit <parav@nvidia.com>
Message-Id: <20220613195223.473966-1-parav@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Xie Yongji <xieyongji@bytedance.com>
Acked-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit 0e0348ac3f)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I47bea6b5102209b0f2b32ae3306158330e0047ac
2022-07-01 20:24:03 +00:00
Eli Cohen
3051728004 UPSTREAM: vdpa/mlx5: Initialize CVQ vringh only once
Currently, CVQ vringh is initialized inside setup_virtqueues() which is
called every time a memory update is done. This is undesirable since it
resets all the context of the vring, including the available and used
indices.

Move the initialization to mlx5_vdpa_set_status() when
VIRTIO_CONFIG_S_DRIVER_OK is set.

Signed-off-by: Eli Cohen <elic@nvidia.com>
Message-Id: <20220613075958.511064-2-elic@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Eugenio Pérez <eperezma@redhat.com>
(cherry picked from commit ace9252446)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I03105745cb12c261c49a4fdf4deb87780c035001
2022-07-01 20:24:03 +00:00
Eli Cohen
48a36966fc UPSTREAM: vdpa/mlx5: Update Control VQ callback information
The control VQ specific information is stored in the dedicated struct
mlx5_control_vq. When the callback is updated through
mlx5_vdpa_set_vq_cb(), make sure to update the control VQ struct.

Fixes: 5262912ef3 ("vdpa/mlx5: Add support for control VQ and MAC setting")
Signed-off-by: Eli Cohen <elic@nvidia.com>
Message-Id: <20220613075958.511064-1-elic@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com)
(cherry picked from commit 40f2f3e941)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4ef42d0ff2f8b3e5156b54473ebc5ebb877c22d2
2022-07-01 20:24:03 +00:00
Jason Wang
3063325104 UPSTREAM: vdpa: make get_vq_group and set_group_asid optional
This patch makes get_vq_group and set_group_asid optional. This is
needed to unbreak the vDPA parent that doesn't support multiple
address spaces.

Cc: Gautam Dawar <gautam.dawar@xilinx.com>
Fixes: aaca8373c4 ("vhost-vdpa: support ASID based IOTLB API")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220609041901.2029-1-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 00d1f54647)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I83cce7173bc7ec6dd00479932d5515bfacb50fe1
2022-07-01 20:24:03 +00:00
Bo Liu
b9e82f6f75 UPSTREAM: virtio: Fix all occurences of the "the the" typo
There are double "the" in message in file virtio_mmio.c
and virtio_pci_modern_dev.c, fix it.

Signed-off-by: Bo Liu <liubo03@inspur.com>
Message-Id: <20220609031106.2161-1-liubo03@inspur.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit acb0055e18)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6fdd050cb1e41a7e1b396b3bfbbdcad011cae877
2022-07-01 20:24:03 +00:00
Xie Yongji
de5826385d UPSTREAM: vduse: Fix NULL pointer dereference on sysfs access
The control device has no drvdata. So we will get a
NULL pointer dereference when accessing control
device's msg_timeout attribute via sysfs:

[ 132.841881][ T3644] BUG: kernel NULL pointer dereference, address: 00000000000000f8
[ 132.850619][ T3644] RIP: 0010:msg_timeout_show (drivers/vdpa/vdpa_user/vduse_dev.c:1271)
[ 132.869447][ T3644] dev_attr_show (drivers/base/core.c:2094)
[ 132.870215][ T3644] sysfs_kf_seq_show (fs/sysfs/file.c:59)
[ 132.871164][ T3644] ? device_remove_bin_file (drivers/base/core.c:2088)
[ 132.872082][ T3644] kernfs_seq_show (fs/kernfs/file.c:164)
[ 132.872838][ T3644] seq_read_iter (fs/seq_file.c:230)
[ 132.873578][ T3644] ? __vmalloc_area_node (mm/vmalloc.c:3041)
[ 132.874532][ T3644] kernfs_fop_read_iter (fs/kernfs/file.c:238)
[ 132.875513][ T3644] __kernel_read (fs/read_write.c:440 (discriminator 1))
[ 132.876319][ T3644] kernel_read (fs/read_write.c:459)
[ 132.877129][ T3644] kernel_read_file (fs/kernel_read_file.c:94)
[ 132.877978][ T3644] kernel_read_file_from_fd (include/linux/file.h:45 fs/kernel_read_file.c:186)
[ 132.879019][ T3644] __do_sys_finit_module (kernel/module.c:4207)
[ 132.879930][ T3644] __ia32_sys_finit_module (kernel/module.c:4189)
[ 132.880930][ T3644] do_int80_syscall_32 (arch/x86/entry/common.c:112 arch/x86/entry/common.c:132)
[ 132.881847][ T3644] entry_INT80_compat (arch/x86/entry/entry_64_compat.S:419)

To fix it, don't create the unneeded attribute for
control device anymore.

Fixes: c8a6153b6c ("vduse: Introduce VDUSE - vDPA Device in Userspace")
Reported-by: kernel test robot <oliver.sang@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Message-Id: <20220426073656.229-1-xieyongji@bytedance.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit b27ee76c74)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ib9abf1e60e0dad878ba20f2c2987c443476925e9
2022-07-01 20:24:03 +00:00
Xie Yongji
fa4bbdf264 UPSTREAM: vringh: Fix loop descriptors check in the indirect cases
We should use size of descriptor chain to test loop condition
in the indirect case. And another statistical count is also introduced
for indirect descriptors to avoid conflict with the statistical count
of direct descriptors.

Fixes: f87d0fbb57 ("vringh: host-side implementation of virtio rings.")
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Signed-off-by: Fam Zheng <fam.zheng@bytedance.com>
Message-Id: <20220505100910.137-1-xieyongji@bytedance.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit dbd29e0752)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I989cc3d74401507f6b9c282971e60ecb21785895
2022-07-01 20:24:03 +00:00
Dan Carpenter
6e2a35571a UPSTREAM: vdpa/mlx5: clean up indenting in handle_ctrl_vlan()
These lines were supposed to be indented.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Message-Id: <Yp71IYMP+QfuCJ8t@kili>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Eli Cohen <elic@nvidia.com>
Acked-by: Si-Wei Liu <si-wei.liu@oracle.com>
(cherry picked from commit f38b3c6a78)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I92310051004e413b6ffbf9f89e7e4ce939614fcf
2022-07-01 20:24:03 +00:00
Dan Carpenter
acdb4bfe37 UPSTREAM: vdpa/mlx5: fix error code for deleting vlan
Return success if we were able to delete a vlan.  The current code
always returns failure.

Fixes: baf2ad3f6a ("vdpa/mlx5: Add RX MAC VLAN filter support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Message-Id: <Yp709f1g9NcMBCHg@kili>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Eli Cohen <elic@nvidia.com>
Acked-by: Si-Wei Liu <si-wei.liu@oracle.com>
(cherry picked from commit f766c409fc)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ibaa57311cd2e123688f6261dc09bb547dd82c504
2022-07-01 20:24:03 +00:00
chengkaitao
2e977b72c0 UPSTREAM: virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
The reference must be released when device_register(&vm_cmdline_parent)
failed. Add the corresponding 'put_device()' in the error handling path.

Signed-off-by: chengkaitao <pilgrimtao@gmail.com>
Message-Id: <20220602005542.16489-1-chengkaitao@didiglobal.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit a58a7f97ba)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6ccf7cba3458dd3402ce0bb39d2b110a599ad7ee
2022-07-01 20:24:03 +00:00
Xiang wangx
5571a91668 UPSTREAM: vdpa/mlx5: Fix syntax errors in comments
Delete the redundant word 'is'.

Signed-off-by: Xiang wangx <wangxiang@cdjrlc.com>
Message-Id: <20220604143858.16073-1-wangxiang@cdjrlc.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit 2f72b2262d)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3a2338d51fc8c4b6e710c454c5b788cdc94fdde5
2022-07-01 20:24:03 +00:00