Skip to contentSkip to conversation

vfio-ccw: Implement request notifier

PATCH Applied Eric Farman 6 participants 19 messages Jan 4, 2021 – Jan 13, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover vfio-ccw: Implement request notifier

Conny, et al,

Here is an updated (final?) version of the QEMU series for the vfio-ccw request notifier now that the kernel code landed upstream [1]. The actual meat (patch 3) is identical to its counterpart in v2 [2].

Earlier versions didn't use update-linux-headers.sh; they just carried a dummy patch with the define that was needed to work, without the noise. Here, I have run the script properly and patch 2 is its output.

Of course it wasn't that simple, as a change on the kernel side of things breaks the script and causes processing to end prematurely as cp_portable() takes its error exit. So I am adding a small patch to the front of this series to accommodate that, and hopefully isn't goofed up too badly. :)

[1] https://lore.kernel.org/kvm/[email protected]/
[2] https://lore.kernel.org/qemu-devel/[email protected]/

Eric Farman (3):
update-linux-headers: Include const.h
Update linux headers to 5.11-rc2
vfio-ccw: Connect the device request notifier

 hw/vfio/ccw.c                                 |  40 +++-
 .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
 include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
 include/standard-headers/linux/const.h        |  36 ++++
 include/standard-headers/linux/ethtool.h      |   2 +-
 include/standard-headers/linux/fuse.h         |  30 ++-
 include/standard-headers/linux/kernel.h       |   9 +-
 include/standard-headers/linux/pci_regs.h     |  16 ++
 include/standard-headers/linux/vhost_types.h  |   9 +
 include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
 include/standard-headers/linux/virtio_ids.h   |  44 +++--
 linux-headers/asm-arm64/kvm.h                 |   3 -
 linux-headers/asm-generic/unistd.h            |   6 +-
 linux-headers/asm-mips/unistd_n32.h           |   1 +
 linux-headers/asm-mips/unistd_n64.h           |   1 +
 linux-headers/asm-mips/unistd_o32.h           |   1 +
 linux-headers/asm-powerpc/unistd_32.h         |   1 +
 linux-headers/asm-powerpc/unistd_64.h         |   1 +
 linux-headers/asm-s390/unistd_32.h            |   1 +
 linux-headers/asm-s390/unistd_64.h            |   1 +
 linux-headers/asm-x86/kvm.h                   |   1 +
 linux-headers/asm-x86/unistd_32.h             |   1 +
 linux-headers/asm-x86/unistd_64.h             |   1 +
 linux-headers/asm-x86/unistd_x32.h            |   1 +
 linux-headers/linux/kvm.h                     |  56 +++++-
 linux-headers/linux/userfaultfd.h             |   9 +
 linux-headers/linux/vfio.h                    |   1 +
 linux-headers/linux/vhost.h                   |   4 +
 scripts/update-linux-headers.sh               |   5 +-
 30 files changed, 501 insertions(+), 53 deletions(-)
 create mode 100644 include/standard-headers/linux/const.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH v3 1/3 update-linux-headers: Include const.h

Kernel commit a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to <linux/const.h>") breaks our script because of the unrecognized include. Let's add that to our processing.

---
 scripts/update-linux-headers.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/update-linux-headers.sh +4 -1
index 9efbaf2f84..fa6f2b6272 100755
@@ -41,6 +41,7 @@ cp_portable() {
                                      -e 'pvrdma_verbs' \
                                      -e 'drm.h' \
                                      -e 'limits' \
+                                     -e 'linux/const' \
                                      -e 'linux/kernel' \
                                      -e 'linux/sysinfo' \
                                      -e 'asm-generic/kvm_para' \
@@ -190,7 +191,9 @@ for i in "$tmpdir"/include/linux/*virtio*.h \
          "$tmpdir/include/linux/input.h" \
          "$tmpdir/include/linux/input-event-codes.h" \
          "$tmpdir/include/linux/pci_regs.h" \
-         "$tmpdir/include/linux/ethtool.h" "$tmpdir/include/linux/kernel.h" \
+         "$tmpdir/include/linux/ethtool.h" \
+         "$tmpdir/include/linux/const.h" \
+         "$tmpdir/include/linux/kernel.h" \
          "$tmpdir/include/linux/vhost_types.h" \
          "$tmpdir/include/linux/sysinfo.h"; do
     cp_portable "$i" "$output/include/standard-headers/linux"
Signature · 1 line
2.17.1
Reviewed-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] update-linux-headers: Include const.h

Quoted 35 lines · Eric Farman

Kernel commit a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to <linux/const.h>") breaks our script because of the unrecognized include. Let's add that to our processing.

---
 scripts/update-linux-headers.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/update-linux-headers.sh +4 -1
index 9efbaf2f84..fa6f2b6272 100755
@@ -41,6 +41,7 @@ cp_portable() {
                                      -e 'pvrdma_verbs' \
                                      -e 'drm.h' \
                                      -e 'limits' \
+                                     -e 'linux/const' \
                                      -e 'linux/kernel' \
                                      -e 'linux/sysinfo' \
                                      -e 'asm-generic/kvm_para' \
@@ -190,7 +191,9 @@ for i in "$tmpdir"/include/linux/*virtio*.h \
          "$tmpdir/include/linux/input.h" \
          "$tmpdir/include/linux/input-event-codes.h" \
          "$tmpdir/include/linux/pci_regs.h" \
-         "$tmpdir/include/linux/ethtool.h" "$tmpdir/include/linux/kernel.h" \
+         "$tmpdir/include/linux/ethtool.h" \
+         "$tmpdir/include/linux/const.h" \
+         "$tmpdir/include/linux/kernel.h" \
          "$tmpdir/include/linux/vhost_types.h" \
          "$tmpdir/include/linux/sysinfo.h"; do
     cp_portable "$i" "$output/include/standard-headers/linux"
Signature · 1 line
2.17.1

So I think I came to the same change when trying to update the headers. :)

Could I ask why the const.h is installed into include/standard-headers/linux rather than linux-headers/linux? When I was working on my version I failed to figure out the difference.

One answer is ethtool.h is there which included const.h, but I guess that's not the real one.

Thanks,

Signature · 1 line
Peter Xu
#3 lore raw

Re: [PATCH v3 1/3] update-linux-headers: Include const.h

Quoted 39 lines · Peter Xu
Quoted 35 lines · Eric Farman

Kernel commit a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to <linux/const.h>") breaks our script because of the unrecognized include. Let's add that to our processing.

---
  scripts/update-linux-headers.sh | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
scripts/update-linux-headers.sh +4 -1
index 9efbaf2f84..fa6f2b6272 100755
@@ -41,6 +41,7 @@ cp_portable() {
                                       -e 'pvrdma_verbs' \
                                       -e 'drm.h' \
                                       -e 'limits' \
+                                     -e 'linux/const' \
                                       -e 'linux/kernel' \
                                       -e 'linux/sysinfo' \
                                       -e 'asm-generic/kvm_para' \
@@ -190,7 +191,9 @@ for i in "$tmpdir"/include/linux/*virtio*.h \
           "$tmpdir/include/linux/input.h" \
           "$tmpdir/include/linux/input-event-codes.h" \
           "$tmpdir/include/linux/pci_regs.h" \
-         "$tmpdir/include/linux/ethtool.h" "$tmpdir/include/linux/kernel.h" \
+         "$tmpdir/include/linux/ethtool.h" \
+         "$tmpdir/include/linux/const.h" \
+         "$tmpdir/include/linux/kernel.h" \
           "$tmpdir/include/linux/vhost_types.h" \
           "$tmpdir/include/linux/sysinfo.h"; do
      cp_portable "$i" "$output/include/standard-headers/linux"
Signature · 1 line
2.17.1

So I think I came to the same change when trying to update the headers. :)

Quoted 1 line

Thank you! :)

Quoted 4 lines

Could I ask why the const.h is installed into include/standard-headers/linux rather than linux-headers/linux? When I was working on my version I failed to figure out the difference.

Considering the main difference is whether the header file is copied directly or edited with a bunch of substitutions, and const.h doesn't get modified by those substitutions, I suppose it could go in linux-headers itself. But I opted to just keep it near its friends (ethtool.h and kernel.h both include const.h, and end up including if_ether.h, sysinfo.h, and types.h) in include/standard-headers.

Quoted 6 lines

One answer is ethtool.h is there which included const.h, but I guess that's not the real one.

Thanks,

#4 lore raw

Re: [PATCH v3 1/3] update-linux-headers: Include const.h

Quoted 9 lines · Eric Farman
Quoted 3 lines · Peter Xu

Could I ask why the const.h is installed into include/standard-headers/linux rather than linux-headers/linux? When I was working on my version I failed to figure out the difference.

Considering the main difference is whether the header file is copied directly or edited with a bunch of substitutions, and const.h doesn't get modified by those substitutions, I suppose it could go in linux-headers itself.

No, it can't, because linux-headers/ only goes on the include path when on a Linux host and on a CPU architecture with KVM support, whereas include/standard-headers/ headers are available and used on all host OSes/architectures.

Because include/standard-headers/linux/ethtool.h will end up with a line
#include "standard-headers/linux/const.h"
we need to provide a const.h in that location so that the #include pulls in the file correctly.

thanks
-- PMM

#5 lore raw

Re: [PATCH v3 1/3] update-linux-headers: Include const.h

Quoted 16 lines · Peter Maydell
Quoted 9 lines · Eric Farman
Quoted 3 lines · Peter Xu

Could I ask why the const.h is installed into include/standard-headers/linux rather than linux-headers/linux? When I was working on my version I failed to figure out the difference.

Considering the main difference is whether the header file is copied directly or edited with a bunch of substitutions, and const.h doesn't get modified by those substitutions, I suppose it could go in linux-headers itself.

No, it can't, because linux-headers/ only goes on the include path when on a Linux host and on a CPU architecture with KVM support, whereas include/standard-headers/ headers are available and used on all host OSes/architectures.

Quoted 5 lines

Because include/standard-headers/linux/ethtool.h will end up with a line
#include "standard-headers/linux/const.h"
we need to provide a const.h in that location so that the #include pulls in the file correctly.

Ah, today I learned. Thanks, Peter.

- Eric

Quoted 4 lines

thanks
-- PMM

#6 lore raw

Re: [PATCH v3 1/3] update-linux-headers: Include const.h

Quoted 19 lines · Eric Farman
Quoted 16 lines · Peter Maydell
Quoted 9 lines · Eric Farman
Quoted 3 lines · Peter Xu

Could I ask why the const.h is installed into include/standard-headers/linux rather than linux-headers/linux? When I was working on my version I failed to figure out the difference.

Considering the main difference is whether the header file is copied directly or edited with a bunch of substitutions, and const.h doesn't get modified by those substitutions, I suppose it could go in linux-headers itself.

No, it can't, because linux-headers/ only goes on the include path when on a Linux host and on a CPU architecture with KVM support, whereas include/standard-headers/ headers are available and used on all host OSes/architectures.

Quoted 7 lines
Quoted 5 lines

Because include/standard-headers/linux/ethtool.h will end up with a line
#include "standard-headers/linux/const.h"
we need to provide a const.h in that location so that the #include pulls in the file correctly.

Ah, today I learned. Thanks, Peter.

Yeah. Peter taught me the rules on IRC after I posted the email, and I didn't update later. So I guess my r-b stands. :) Thanks,

Signature · 1 line
Peter Xu
Reviewed-by on v3 1/3
#7 lore raw

Re: [PATCH v3 1/3] update-linux-headers: Include const.h

In reply to Eric Farman
Quoted 9 lines · Eric Farman

Kernel commit a85cbe6159ff ("uapi: move constants from <linux/kernel.h> to <linux/const.h>") breaks our script because of the unrecognized include. Let's add that to our processing.

---
 scripts/update-linux-headers.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
#8 lore raw

PATCH v3 2/3 Update linux headers to 5.11-rc2

In reply to Eric Farman
---
 .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
 include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
 include/standard-headers/linux/const.h        |  36 ++++
 include/standard-headers/linux/ethtool.h      |   2 +-
 include/standard-headers/linux/fuse.h         |  30 ++-
 include/standard-headers/linux/kernel.h       |   9 +-
 include/standard-headers/linux/pci_regs.h     |  16 ++
 include/standard-headers/linux/vhost_types.h  |   9 +
 include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
 include/standard-headers/linux/virtio_ids.h   |  44 +++--
 linux-headers/asm-arm64/kvm.h                 |   3 -
 linux-headers/asm-generic/unistd.h            |   6 +-
 linux-headers/asm-mips/unistd_n32.h           |   1 +
 linux-headers/asm-mips/unistd_n64.h           |   1 +
 linux-headers/asm-mips/unistd_o32.h           |   1 +
 linux-headers/asm-powerpc/unistd_32.h         |   1 +
 linux-headers/asm-powerpc/unistd_64.h         |   1 +
 linux-headers/asm-s390/unistd_32.h            |   1 +
 linux-headers/asm-s390/unistd_64.h            |   1 +
 linux-headers/asm-x86/kvm.h                   |   1 +
 linux-headers/asm-x86/unistd_32.h             |   1 +
 linux-headers/asm-x86/unistd_64.h             |   1 +
 linux-headers/asm-x86/unistd_x32.h            |   1 +
 linux-headers/linux/kvm.h                     |  56 +++++-
 linux-headers/linux/userfaultfd.h             |   9 +
 linux-headers/linux/vfio.h                    |   1 +
 linux-headers/linux/vhost.h                   |   4 +
 28 files changed, 461 insertions(+), 48 deletions(-)
 create mode 100644 include/standard-headers/linux/const.h
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +7 -7
index 7b4062a1a1..acd4c8346d 100644
@@ -68,7 +68,7 @@ static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems)
 
 static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
 {
-	const unsigned int idx = qatomic_read(var);
+	const unsigned int idx = atomic_read(var);
 
 	if (pvrdma_idx_valid(idx, max_elems))
 		return idx & (max_elems - 1);
@@ -77,17 +77,17 @@ static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
 
 static inline void pvrdma_idx_ring_inc(int *var, uint32_t max_elems)
 {
-	uint32_t idx = qatomic_read(var) + 1;	/* Increment. */
+	uint32_t idx = atomic_read(var) + 1;	/* Increment. */
 
 	idx &= (max_elems << 1) - 1;		/* Modulo size, flip gen. */
-	qatomic_set(var, idx);
+	atomic_set(var, idx);
 }
 
 static inline int32_t pvrdma_idx_ring_has_space(const struct pvrdma_ring *r,
 					      uint32_t max_elems, uint32_t *out_tail)
 {
-	const uint32_t tail = qatomic_read(&r->prod_tail);
-	const uint32_t head = qatomic_read(&r->cons_head);
+	const uint32_t tail = atomic_read(&r->prod_tail);
+	const uint32_t head = atomic_read(&r->cons_head);
 
 	if (pvrdma_idx_valid(tail, max_elems) &&
 	    pvrdma_idx_valid(head, max_elems)) {
@@ -100,8 +100,8 @@ static inline int32_t pvrdma_idx_ring_has_space(const struct pvrdma_ring *r,
 static inline int32_t pvrdma_idx_ring_has_data(const struct pvrdma_ring *r,
 					     uint32_t max_elems, uint32_t *out_head)
 {
-	const uint32_t tail = qatomic_read(&r->prod_tail);
-	const uint32_t head = qatomic_read(&r->cons_head);
+	const uint32_t tail = atomic_read(&r->prod_tail);
+	const uint32_t head = atomic_read(&r->cons_head);
 
 	if (pvrdma_idx_valid(tail, max_elems) &&
 	    pvrdma_idx_valid(head, max_elems)) {
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h +1 -1
index 0a8c7c9311..1677208a41 100644
@@ -176,7 +176,7 @@ struct pvrdma_port_attr {
 	uint8_t			subnet_timeout;
 	uint8_t			init_type_reply;
 	uint8_t			active_width;
-	uint16_t			active_speed;
+	uint8_t			active_speed;
 	uint8_t			phys_state;
 	uint8_t			reserved[2];
 };
include/standard-headers/drm/drm_fourcc.h +174 -1

205 lines not on this page · raw message

include/standard-headers/linux/const.h new file +36 -0
new file mode 100644
index 0000000000..5e48987251
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/* const.h: Macros for dealing with constants.  */
+
+#ifndef _LINUX_CONST_H
+#define _LINUX_CONST_H
+
+/* Some constant macros are used in both assembler and
+ * C code.  Therefore we cannot annotate them always with
+ * 'UL' and other type specifiers unilaterally.  We
+ * use the following macros to deal with this.
+ *
+ * Similarly, _AT() will cast an expression with a type in C, but
+ * leave it unchanged in asm.
+ */
+
+#ifdef __ASSEMBLY__
+#define _AC(X,Y)	X
+#define _AT(T,X)	X
+#else
+#define __AC(X,Y)	(X##Y)
+#define _AC(X,Y)	__AC(X,Y)
+#define _AT(T,X)	((T)(X))
+#endif
+
+#define _UL(x)		(_AC(x, UL))
+#define _ULL(x)		(_AC(x, ULL))
+
+#define _BITUL(x)	(_UL(1) << (x))
+#define _BITULL(x)	(_ULL(1) << (x))
+
+#define __ALIGN_KERNEL(x, a)		__ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
+#define __ALIGN_KERNEL_MASK(x, mask)	(((x) + (mask)) & ~(mask))
+
+#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+
+#endif /* _LINUX_CONST_H */
include/standard-headers/linux/ethtool.h +1 -1
index 0df22f7538..8bfd01d230 100644
@@ -16,7 +16,7 @@
 
 #include "net/eth.h"
 
-#include "standard-headers/linux/kernel.h"
+#include "standard-headers/linux/const.h"
 #include "standard-headers/linux/types.h"
 #include "standard-headers/linux/if_ether.h"
 
include/standard-headers/linux/fuse.h +25 -5
index 82c0a38b59..950d7edb7e 100644
@@ -175,6 +175,10 @@
  *
  *  7.32
  *  - add flags to fuse_attr, add FUSE_ATTR_SUBMOUNT, add FUSE_SUBMOUNTS
+ *
+ *  7.33
+ *  - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID
+ *  - add FUSE_OPEN_KILL_SUIDGID
  */
 
 #ifndef _LINUX_FUSE_H
@@ -206,7 +210,7 @@
 #define FUSE_KERNEL_VERSION 7
 
 /** Minor version number of this interface */
-#define FUSE_KERNEL_MINOR_VERSION 32
+#define FUSE_KERNEL_MINOR_VERSION 33
 
 /** The node ID of the root inode */
 #define FUSE_ROOT_ID 1
@@ -267,6 +271,7 @@ struct fuse_file_lock {
 #define FATTR_MTIME_NOW	(1 << 8)
 #define FATTR_LOCKOWNER	(1 << 9)
 #define FATTR_CTIME	(1 << 10)
+#define FATTR_KILL_SUIDGID	(1 << 11)
 
 /**
  * Flags returned by the OPEN request
@@ -316,6 +321,11 @@ struct fuse_file_lock {
  *		       foffset and moffset fields in struct
  *		       fuse_setupmapping_out and fuse_removemapping_one.
  * FUSE_SUBMOUNTS: kernel supports auto-mounting directory submounts
+ * FUSE_HANDLE_KILLPRIV_V2: fs kills suid/sgid/cap on write/chown/trunc.
+ *			Upon write/truncate suid/sgid is only killed if caller
+ *			does not have CAP_FSETID. Additionally upon
+ *			write/truncate sgid is killed only if file has group
+ *			execute permission. (Same as Linux VFS behavior).
  */
 #define FUSE_ASYNC_READ		(1 << 0)
 #define FUSE_POSIX_LOCKS	(1 << 1)
@@ -345,6 +355,7 @@ struct fuse_file_lock {
 #define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
 #define FUSE_MAP_ALIGNMENT	(1 << 26)
 #define FUSE_SUBMOUNTS		(1 << 27)
+#define FUSE_HANDLE_KILLPRIV_V2	(1 << 28)
 
 /**
  * CUSE INIT request/reply flags
@@ -374,11 +385,14 @@ struct fuse_file_lock {
  *
  * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
  * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
- * FUSE_WRITE_KILL_PRIV: kill suid and sgid bits
+ * FUSE_WRITE_KILL_SUIDGID: kill suid and sgid bits
  */
 #define FUSE_WRITE_CACHE	(1 << 0)
 #define FUSE_WRITE_LOCKOWNER	(1 << 1)
-#define FUSE_WRITE_KILL_PRIV	(1 << 2)
+#define FUSE_WRITE_KILL_SUIDGID (1 << 2)
+
+/* Obsolete alias; this flag implies killing suid/sgid only. */
+#define FUSE_WRITE_KILL_PRIV	FUSE_WRITE_KILL_SUIDGID
 
 /**
  * Read flags
@@ -427,6 +441,12 @@ struct fuse_file_lock {
  */
 #define FUSE_ATTR_SUBMOUNT      (1 << 0)
 
+/**
+ * Open flags
+ * FUSE_OPEN_KILL_SUIDGID: Kill suid and sgid if executable
+ */
+#define FUSE_OPEN_KILL_SUIDGID	(1 << 0)
+
 enum fuse_opcode {
 	FUSE_LOOKUP		= 1,
 	FUSE_FORGET		= 2,  /* no reply */
@@ -588,14 +608,14 @@ struct fuse_setattr_in {
 
 struct fuse_open_in {
 	uint32_t	flags;
-	uint32_t	unused;
+	uint32_t	open_flags;	/* FUSE_OPEN_... */
 };
 
 struct fuse_create_in {
 	uint32_t	flags;
 	uint32_t	mode;
 	uint32_t	umask;
-	uint32_t	padding;
+	uint32_t	open_flags;	/* FUSE_OPEN_... */
 };
 
 struct fuse_open_out {
include/standard-headers/linux/kernel.h +1 -8
index 1eeba2ef92..7848c5ae25 100644
@@ -3,13 +3,6 @@
 #define _LINUX_KERNEL_H
 
 #include "standard-headers/linux/sysinfo.h"
-
-/*
- * 'kernel.h' contains some often-used function prototypes etc
- */
-#define __ALIGN_KERNEL(x, a)		__ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
-#define __ALIGN_KERNEL_MASK(x, mask)	(((x) + (mask)) & ~(mask))
-
-#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#include "standard-headers/linux/const.h"
 
 #endif /* _LINUX_KERNEL_H */
include/standard-headers/linux/pci_regs.h +16 -0
index a95d55f9f2..e709ae8235 100644
@@ -531,6 +531,7 @@
 #define  PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003 /* LNKCAP2 SLS Vector bit 2 */
 #define  PCI_EXP_LNKCAP_SLS_16_0GB 0x00000004 /* LNKCAP2 SLS Vector bit 3 */
 #define  PCI_EXP_LNKCAP_SLS_32_0GB 0x00000005 /* LNKCAP2 SLS Vector bit 4 */
+#define  PCI_EXP_LNKCAP_SLS_64_0GB 0x00000006 /* LNKCAP2 SLS Vector bit 5 */
 #define  PCI_EXP_LNKCAP_MLW	0x000003f0 /* Maximum Link Width */
 #define  PCI_EXP_LNKCAP_ASPMS	0x00000c00 /* ASPM Support */
 #define  PCI_EXP_LNKCAP_ASPM_L0S 0x00000400 /* ASPM L0s Support */
@@ -562,6 +563,7 @@
 #define  PCI_EXP_LNKSTA_CLS_8_0GB 0x0003 /* Current Link Speed 8.0GT/s */
 #define  PCI_EXP_LNKSTA_CLS_16_0GB 0x0004 /* Current Link Speed 16.0GT/s */
 #define  PCI_EXP_LNKSTA_CLS_32_0GB 0x0005 /* Current Link Speed 32.0GT/s */
+#define  PCI_EXP_LNKSTA_CLS_64_0GB 0x0006 /* Current Link Speed 64.0GT/s */
 #define  PCI_EXP_LNKSTA_NLW	0x03f0	/* Negotiated Link Width */
 #define  PCI_EXP_LNKSTA_NLW_X1	0x0010	/* Current Link Width x1 */
 #define  PCI_EXP_LNKSTA_NLW_X2	0x0020	/* Current Link Width x2 */
@@ -670,6 +672,7 @@
 #define  PCI_EXP_LNKCAP2_SLS_8_0GB	0x00000008 /* Supported Speed 8GT/s */
 #define  PCI_EXP_LNKCAP2_SLS_16_0GB	0x00000010 /* Supported Speed 16GT/s */
 #define  PCI_EXP_LNKCAP2_SLS_32_0GB	0x00000020 /* Supported Speed 32GT/s */
+#define  PCI_EXP_LNKCAP2_SLS_64_0GB	0x00000040 /* Supported Speed 64GT/s */
 #define  PCI_EXP_LNKCAP2_CROSSLINK	0x00000100 /* Crosslink supported */
 #define PCI_EXP_LNKCTL2		48	/* Link Control 2 */
 #define  PCI_EXP_LNKCTL2_TLS		0x000f
@@ -678,6 +681,7 @@
 #define  PCI_EXP_LNKCTL2_TLS_8_0GT	0x0003 /* Supported Speed 8GT/s */
 #define  PCI_EXP_LNKCTL2_TLS_16_0GT	0x0004 /* Supported Speed 16GT/s */
 #define  PCI_EXP_LNKCTL2_TLS_32_0GT	0x0005 /* Supported Speed 32GT/s */
+#define  PCI_EXP_LNKCTL2_TLS_64_0GT	0x0006 /* Supported Speed 64GT/s */
 #define  PCI_EXP_LNKCTL2_ENTER_COMP	0x0010 /* Enter Compliance */
 #define  PCI_EXP_LNKCTL2_TX_MARGIN	0x0380 /* Transmit Margin */
 #define  PCI_EXP_LNKCTL2_HASD		0x0020 /* HW Autonomous Speed Disable */
@@ -723,6 +727,7 @@
 #define PCI_EXT_CAP_ID_DPC	0x1D	/* Downstream Port Containment */
 #define PCI_EXT_CAP_ID_L1SS	0x1E	/* L1 PM Substates */
 #define PCI_EXT_CAP_ID_PTM	0x1F	/* Precision Time Measurement */
+#define PCI_EXT_CAP_ID_DVSEC	0x23	/* Designated Vendor-Specific */
 #define PCI_EXT_CAP_ID_DLF	0x25	/* Data Link Feature */
 #define PCI_EXT_CAP_ID_PL_16GT	0x26	/* Physical Layer 16.0 GT/s */
 #define PCI_EXT_CAP_ID_MAX	PCI_EXT_CAP_ID_PL_16GT
@@ -831,6 +836,13 @@
 #define  PCI_PWR_CAP_BUDGET(x)	((x) & 1)	/* Included in system budget */
 #define PCI_EXT_CAP_PWR_SIZEOF	16
 
+/* Root Complex Event Collector Endpoint Association  */
+#define PCI_RCEC_RCIEP_BITMAP	4	/* Associated Bitmap for RCiEPs */
+#define PCI_RCEC_BUSN		8	/* RCEC Associated Bus Numbers */
+#define  PCI_RCEC_BUSN_REG_VER	0x02	/* Least version with BUSN present */
+#define  PCI_RCEC_BUSN_NEXT(x)	(((x) >> 8) & 0xff)
+#define  PCI_RCEC_BUSN_LAST(x)	(((x) >> 16) & 0xff)
+
 /* Vendor-Specific (VSEC, PCI_EXT_CAP_ID_VNDR) */
 #define PCI_VNDR_HEADER		4	/* Vendor-Specific Header */
 #define  PCI_VNDR_HEADER_ID(x)	((x) & 0xffff)
@@ -1066,6 +1078,10 @@
 #define  PCI_L1SS_CTL1_LTR_L12_TH_SCALE	0xe0000000  /* LTR_L1.2_THRESHOLD_Scale */
 #define PCI_L1SS_CTL2		0x0c	/* Control 2 Register */
 
+/* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */
+#define PCI_DVSEC_HEADER1		0x4 /* Designated Vendor-Specific Header1 */
+#define PCI_DVSEC_HEADER2		0x8 /* Designated Vendor-Specific Header2 */
+
 /* Data Link Feature */
 #define PCI_DLF_CAP		0x04	/* Capabilities Register */
 #define  PCI_DLF_EXCHANGE_ENABLE	0x80000000  /* Data Link Feature Exchange Enable */
include/standard-headers/linux/vhost_types.h +9 -0
index 486630b332..0bd2684a2a 100644
@@ -138,6 +138,15 @@ struct vhost_vdpa_config {
 	uint8_t buf[0];
 };
 
+/* vhost vdpa IOVA range
+ * @first: First address that can be mapped by vhost-vDPA
+ * @last: Last address that can be mapped by vhost-vDPA
+ */
+struct vhost_vdpa_iova_range {
+	uint64_t first;
+	uint64_t last;
+};
+
 /* Feature bits */
 /* Log all write descriptors. Can be changed while device is active. */
 #define VHOST_F_LOG_ALL 26
include/standard-headers/linux/virtio_gpu.h +82 -0

116 lines not on this page · raw message

include/standard-headers/linux/virtio_ids.h +25 -19

49 lines not on this page · raw message

linux-headers/asm-arm64/kvm.h +0 -3
index a72de1ae4c..b6a0eaa32a 100644
@@ -156,9 +156,6 @@ struct kvm_sync_regs {
 	__u64 device_irq_level;
 };
 
-struct kvm_arch_memory_slot {
-};
-
 /*
  * PMU filter structure. Describe a range of events with a particular
  * action. To be used with KVM_ARM_VCPU_PMU_V3_FILTER.
linux-headers/asm-generic/unistd.h +4 -2
index 2056318988..7287529177 100644
@@ -517,7 +517,7 @@ __SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
 __SC_3264(__NR_adjtimex, sys_adjtimex_time32, sys_adjtimex)
 #endif
 
-/* kernel/timer.c */
+/* kernel/sys.c */
 #define __NR_getpid 172
 __SYSCALL(__NR_getpid, sys_getpid)
 #define __NR_getppid 173
@@ -859,9 +859,11 @@ __SYSCALL(__NR_pidfd_getfd, sys_pidfd_getfd)
 __SYSCALL(__NR_faccessat2, sys_faccessat2)
 #define __NR_process_madvise 440
 __SYSCALL(__NR_process_madvise, sys_process_madvise)
+#define __NR_epoll_pwait2 441
+__SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2)
 
 #undef __NR_syscalls
-#define __NR_syscalls 441
+#define __NR_syscalls 442
 
 /*
  * 32 bit systems traditionally used different
linux-headers/asm-mips/unistd_n32.h +1 -0
index aba284d190..59e53b6e07 100644
@@ -370,6 +370,7 @@
 #define __NR_pidfd_getfd	(__NR_Linux + 438)
 #define __NR_faccessat2	(__NR_Linux + 439)
 #define __NR_process_madvise	(__NR_Linux + 440)
+#define __NR_epoll_pwait2	(__NR_Linux + 441)
 
 
 #endif /* _ASM_MIPS_UNISTD_N32_H */
linux-headers/asm-mips/unistd_n64.h +1 -0
index 0465ab94db..683558a7f8 100644
@@ -346,6 +346,7 @@
 #define __NR_pidfd_getfd	(__NR_Linux + 438)
 #define __NR_faccessat2	(__NR_Linux + 439)
 #define __NR_process_madvise	(__NR_Linux + 440)
+#define __NR_epoll_pwait2	(__NR_Linux + 441)
 
 
 #endif /* _ASM_MIPS_UNISTD_N64_H */
linux-headers/asm-mips/unistd_o32.h +1 -0
index 5222a0dd50..ca6a7e5c0b 100644
@@ -416,6 +416,7 @@
 #define __NR_pidfd_getfd	(__NR_Linux + 438)
 #define __NR_faccessat2	(__NR_Linux + 439)
 #define __NR_process_madvise	(__NR_Linux + 440)
+#define __NR_epoll_pwait2	(__NR_Linux + 441)
 
 
 #endif /* _ASM_MIPS_UNISTD_O32_H */
linux-headers/asm-powerpc/unistd_32.h +1 -0
index 21066a3d5f..4624c90043 100644
@@ -423,6 +423,7 @@
 #define __NR_pidfd_getfd	438
 #define __NR_faccessat2	439
 #define __NR_process_madvise	440
+#define __NR_epoll_pwait2	441
 
 
 #endif /* _ASM_POWERPC_UNISTD_32_H */
linux-headers/asm-powerpc/unistd_64.h +1 -0
index c153da29f2..7e851b30bb 100644
@@ -395,6 +395,7 @@
 #define __NR_pidfd_getfd	438
 #define __NR_faccessat2	439
 #define __NR_process_madvise	440
+#define __NR_epoll_pwait2	441
 
 
 #endif /* _ASM_POWERPC_UNISTD_64_H */
linux-headers/asm-s390/unistd_32.h +1 -0
index 3b4f2dda60..c94d2c3a22 100644
@@ -413,5 +413,6 @@
 #define __NR_pidfd_getfd 438
 #define __NR_faccessat2 439
 #define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
 
 #endif /* _ASM_S390_UNISTD_32_H */
linux-headers/asm-s390/unistd_64.h +1 -0
index 030a51fa38..984a06b7eb 100644
@@ -361,5 +361,6 @@
 #define __NR_pidfd_getfd 438
 #define __NR_faccessat2 439
 #define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
 
 #endif /* _ASM_S390_UNISTD_64_H */
linux-headers/asm-x86/kvm.h +1 -0
index 89e5f3d1bb..8e76d3701d 100644
@@ -12,6 +12,7 @@
 
 #define KVM_PIO_PAGE_OFFSET 1
 #define KVM_COALESCED_MMIO_PAGE_OFFSET 2
+#define KVM_DIRTY_LOG_PAGE_OFFSET 64
 
 #define DE_VECTOR 0
 #define DB_VECTOR 1
linux-headers/asm-x86/unistd_32.h +1 -0
index cfba368f9d..18fb99dfa2 100644
@@ -431,6 +431,7 @@
 #define __NR_pidfd_getfd 438
 #define __NR_faccessat2 439
 #define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
 
 
 #endif /* _ASM_X86_UNISTD_32_H */
linux-headers/asm-x86/unistd_64.h +1 -0
index 61af725095..bde959328d 100644
@@ -353,6 +353,7 @@
 #define __NR_pidfd_getfd 438
 #define __NR_faccessat2 439
 #define __NR_process_madvise 440
+#define __NR_epoll_pwait2 441
 
 
 #endif /* _ASM_X86_UNISTD_64_H */
linux-headers/asm-x86/unistd_x32.h +1 -0
index a6890cb1f5..4ff6b17d3b 100644
@@ -306,6 +306,7 @@
 #define __NR_pidfd_getfd (__X32_SYSCALL_BIT + 438)
 #define __NR_faccessat2 (__X32_SYSCALL_BIT + 439)
 #define __NR_process_madvise (__X32_SYSCALL_BIT + 440)
+#define __NR_epoll_pwait2 (__X32_SYSCALL_BIT + 441)
 #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
 #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
 #define __NR_ioctl (__X32_SYSCALL_BIT + 514)
linux-headers/linux/kvm.h +55 -1

84 lines not on this page · raw message

linux-headers/linux/userfaultfd.h +9 -0
index 8d3996eb82..1ba9a9feeb 100644
@@ -257,4 +257,13 @@ struct uffdio_writeprotect {
 	__u64 mode;
 };
 
+/*
+ * Flags for the userfaultfd(2) system call itself.
+ */
+
+/*
+ * Create a userfaultfd that can handle page faults only in user mode.
+ */
+#define UFFD_USER_MODE_ONLY 1
+
 #endif /* _LINUX_USERFAULTFD_H */
linux-headers/linux/vfio.h +1 -0
index b92dcc4daf..609099e455 100644
@@ -820,6 +820,7 @@ enum {
 enum {
 	VFIO_CCW_IO_IRQ_INDEX,
 	VFIO_CCW_CRW_IRQ_INDEX,
+	VFIO_CCW_REQ_IRQ_INDEX,
 	VFIO_CCW_NUM_IRQS
 };
 
linux-headers/linux/vhost.h +4 -0
index 7523218532..c998860d7b 100644
@@ -146,4 +146,8 @@
 
 /* Set event fd for config interrupt*/
 #define VHOST_VDPA_SET_CONFIG_CALL	_IOW(VHOST_VIRTIO, 0x77, int)
+
+/* Get the valid iova range */
+#define VHOST_VDPA_GET_IOVA_RANGE	_IOR(VHOST_VIRTIO, 0x78, \
+					     struct vhost_vdpa_iova_range)
 #endif
Signature · 1 line
2.17.1
#9 lore raw

Re: [PATCH v3 2/3] Update linux headers to 5.11-rc2

Quoted 38 lines · On Mon, 4 Jan 2021 21:20:56 +0100 Eric Farman <[email protected]> wrote:
---
 .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
 include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
 include/standard-headers/linux/const.h        |  36 ++++
 include/standard-headers/linux/ethtool.h      |   2 +-
 include/standard-headers/linux/fuse.h         |  30 ++-
 include/standard-headers/linux/kernel.h       |   9 +-
 include/standard-headers/linux/pci_regs.h     |  16 ++
 include/standard-headers/linux/vhost_types.h  |   9 +
 include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
 include/standard-headers/linux/virtio_ids.h   |  44 +++--
 linux-headers/asm-arm64/kvm.h                 |   3 -
 linux-headers/asm-generic/unistd.h            |   6 +-
 linux-headers/asm-mips/unistd_n32.h           |   1 +
 linux-headers/asm-mips/unistd_n64.h           |   1 +
 linux-headers/asm-mips/unistd_o32.h           |   1 +
 linux-headers/asm-powerpc/unistd_32.h         |   1 +
 linux-headers/asm-powerpc/unistd_64.h         |   1 +
 linux-headers/asm-s390/unistd_32.h            |   1 +
 linux-headers/asm-s390/unistd_64.h            |   1 +
 linux-headers/asm-x86/kvm.h                   |   1 +
 linux-headers/asm-x86/unistd_32.h             |   1 +
 linux-headers/asm-x86/unistd_64.h             |   1 +
 linux-headers/asm-x86/unistd_x32.h            |   1 +
 linux-headers/linux/kvm.h                     |  56 +++++-
 linux-headers/linux/userfaultfd.h             |   9 +
 linux-headers/linux/vfio.h                    |   1 +
 linux-headers/linux/vhost.h                   |   4 +
 28 files changed, 461 insertions(+), 48 deletions(-)
 create mode 100644 include/standard-headers/linux/const.h
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +0 -0
index 7b4062a1a1..acd4c8346d 100644

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems) · line 71

Quoted 5 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +1 -1
@@ -68,7 +68,7 @@ static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems)
 
 static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
 {
-	const unsigned int idx = qatomic_read(var);
+	const unsigned int idx = atomic_read(var);

Hm, what was the state of these qatomic* instances in this header? Is it ok to rename them, or do we need to do some munging in the import script?

(Sorry, it's been a while.)

Quoted 36 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +6 -6
 	if (pvrdma_idx_valid(idx, max_elems))
 		return idx & (max_elems - 1);
@@ -77,17 +77,17 @@ static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
 
 static inline void pvrdma_idx_ring_inc(int *var, uint32_t max_elems)
 {
-	uint32_t idx = qatomic_read(var) + 1;	/* Increment. */
+	uint32_t idx = atomic_read(var) + 1;	/* Increment. */
 
 	idx &= (max_elems << 1) - 1;		/* Modulo size, flip gen. */
-	qatomic_set(var, idx);
+	atomic_set(var, idx);
 }
 
 static inline int32_t pvrdma_idx_ring_has_space(const struct pvrdma_ring *r,
 					      uint32_t max_elems, uint32_t *out_tail)
 {
-	const uint32_t tail = qatomic_read(&r->prod_tail);
-	const uint32_t head = qatomic_read(&r->cons_head);
+	const uint32_t tail = atomic_read(&r->prod_tail);
+	const uint32_t head = atomic_read(&r->cons_head);
 
 	if (pvrdma_idx_valid(tail, max_elems) &&
 	    pvrdma_idx_valid(head, max_elems)) {
@@ -100,8 +100,8 @@ static inline int32_t pvrdma_idx_ring_has_space(const struct pvrdma_ring *r,
 static inline int32_t pvrdma_idx_ring_has_data(const struct pvrdma_ring *r,
 					     uint32_t max_elems, uint32_t *out_head)
 {
-	const uint32_t tail = qatomic_read(&r->prod_tail);
-	const uint32_t head = qatomic_read(&r->cons_head);
+	const uint32_t tail = atomic_read(&r->prod_tail);
+	const uint32_t head = atomic_read(&r->cons_head);
 
 	if (pvrdma_idx_valid(tail, max_elems) &&
 	    pvrdma_idx_valid(head, max_elems)) {
#10 lore raw

Re: [PATCH v3 2/3] Update linux headers to 5.11-rc2

Quoted 51 lines · Cornelia Huck
Quoted 38 lines · On Mon, 4 Jan 2021 21:20:56 +0100 Eric Farman <[email protected]> wrote:
---
 .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
 include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
 include/standard-headers/linux/const.h        |  36 ++++
 include/standard-headers/linux/ethtool.h      |   2 +-
 include/standard-headers/linux/fuse.h         |  30 ++-
 include/standard-headers/linux/kernel.h       |   9 +-
 include/standard-headers/linux/pci_regs.h     |  16 ++
 include/standard-headers/linux/vhost_types.h  |   9 +
 include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
 include/standard-headers/linux/virtio_ids.h   |  44 +++--
 linux-headers/asm-arm64/kvm.h                 |   3 -
 linux-headers/asm-generic/unistd.h            |   6 +-
 linux-headers/asm-mips/unistd_n32.h           |   1 +
 linux-headers/asm-mips/unistd_n64.h           |   1 +
 linux-headers/asm-mips/unistd_o32.h           |   1 +
 linux-headers/asm-powerpc/unistd_32.h         |   1 +
 linux-headers/asm-powerpc/unistd_64.h         |   1 +
 linux-headers/asm-s390/unistd_32.h            |   1 +
 linux-headers/asm-s390/unistd_64.h            |   1 +
 linux-headers/asm-x86/kvm.h                   |   1 +
 linux-headers/asm-x86/unistd_32.h             |   1 +
 linux-headers/asm-x86/unistd_64.h             |   1 +
 linux-headers/asm-x86/unistd_x32.h            |   1 +
 linux-headers/linux/kvm.h                     |  56 +++++-
 linux-headers/linux/userfaultfd.h             |   9 +
 linux-headers/linux/vfio.h                    |   1 +
 linux-headers/linux/vhost.h                   |   4 +
 28 files changed, 461 insertions(+), 48 deletions(-)
 create mode 100644 include/standard-headers/linux/const.h
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +0 -0
index 7b4062a1a1..acd4c8346d 100644

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems) · line 71

Quoted 5 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +1 -1
@@ -68,7 +68,7 @@ static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems)
 
 static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
 {
-	const unsigned int idx = qatomic_read(var);
+	const unsigned int idx = atomic_read(var);

Hm, what was the state of these qatomic* instances in this header? Is it ok to rename them, or do we need to do some munging in the import script?

Quoted 1 line

(Sorry, it's been a while.)

Yea looks like it was done manually last time:

commit d73415a315471ac0b127ed3fad45c8ec5d711de1

Author: Stefan Hajnoczi <[email protected]>
Date:   Wed Sep 23 11:56:46 2020 +0100

qemu/atomic.h: rename atomic_ to qatomic_

Quoted 36 lines
Quoted 36 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +6 -6
 	if (pvrdma_idx_valid(idx, max_elems))
 		return idx & (max_elems - 1);
@@ -77,17 +77,17 @@ static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
 
 static inline void pvrdma_idx_ring_inc(int *var, uint32_t max_elems)
 {
-	uint32_t idx = qatomic_read(var) + 1;	/* Increment. */
+	uint32_t idx = atomic_read(var) + 1;	/* Increment. */
 
 	idx &= (max_elems << 1) - 1;		/* Modulo size, flip gen. */
-	qatomic_set(var, idx);
+	atomic_set(var, idx);
 }
 
 static inline int32_t pvrdma_idx_ring_has_space(const struct pvrdma_ring *r,
 					      uint32_t max_elems, uint32_t *out_tail)
 {
-	const uint32_t tail = qatomic_read(&r->prod_tail);
-	const uint32_t head = qatomic_read(&r->cons_head);
+	const uint32_t tail = atomic_read(&r->prod_tail);
+	const uint32_t head = atomic_read(&r->cons_head);
 
 	if (pvrdma_idx_valid(tail, max_elems) &&
 	    pvrdma_idx_valid(head, max_elems)) {
@@ -100,8 +100,8 @@ static inline int32_t pvrdma_idx_ring_has_space(const struct pvrdma_ring *r,
 static inline int32_t pvrdma_idx_ring_has_data(const struct pvrdma_ring *r,
 					     uint32_t max_elems, uint32_t *out_head)
 {
-	const uint32_t tail = qatomic_read(&r->prod_tail);
-	const uint32_t head = qatomic_read(&r->cons_head);
+	const uint32_t tail = atomic_read(&r->prod_tail);
+	const uint32_t head = atomic_read(&r->cons_head);
 
 	if (pvrdma_idx_valid(tail, max_elems) &&
 	    pvrdma_idx_valid(head, max_elems)) {
#11 lore raw

Re: [PATCH v3 2/3] Update linux headers to 5.11-rc2

Quoted 55 lines · On Mon, 11 Jan 2021 08:00:45 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 51 lines · Cornelia Huck
Quoted 38 lines · On Mon, 4 Jan 2021 21:20:56 +0100 Eric Farman <[email protected]> wrote:
---
 .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
 include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
 include/standard-headers/linux/const.h        |  36 ++++
 include/standard-headers/linux/ethtool.h      |   2 +-
 include/standard-headers/linux/fuse.h         |  30 ++-
 include/standard-headers/linux/kernel.h       |   9 +-
 include/standard-headers/linux/pci_regs.h     |  16 ++
 include/standard-headers/linux/vhost_types.h  |   9 +
 include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
 include/standard-headers/linux/virtio_ids.h   |  44 +++--
 linux-headers/asm-arm64/kvm.h                 |   3 -
 linux-headers/asm-generic/unistd.h            |   6 +-
 linux-headers/asm-mips/unistd_n32.h           |   1 +
 linux-headers/asm-mips/unistd_n64.h           |   1 +
 linux-headers/asm-mips/unistd_o32.h           |   1 +
 linux-headers/asm-powerpc/unistd_32.h         |   1 +
 linux-headers/asm-powerpc/unistd_64.h         |   1 +
 linux-headers/asm-s390/unistd_32.h            |   1 +
 linux-headers/asm-s390/unistd_64.h            |   1 +
 linux-headers/asm-x86/kvm.h                   |   1 +
 linux-headers/asm-x86/unistd_32.h             |   1 +
 linux-headers/asm-x86/unistd_64.h             |   1 +
 linux-headers/asm-x86/unistd_x32.h            |   1 +
 linux-headers/linux/kvm.h                     |  56 +++++-
 linux-headers/linux/userfaultfd.h             |   9 +
 linux-headers/linux/vfio.h                    |   1 +
 linux-headers/linux/vhost.h                   |   4 +
 28 files changed, 461 insertions(+), 48 deletions(-)
 create mode 100644 include/standard-headers/linux/const.h
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +0 -0
index 7b4062a1a1..acd4c8346d 100644

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems) · line 71

Quoted 5 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +1 -1
@@ -68,7 +68,7 @@ static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems)
 
 static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
 {
-	const unsigned int idx = qatomic_read(var);
+	const unsigned int idx = atomic_read(var);  

Hm, what was the state of these qatomic* instances in this header? Is it ok to rename them, or do we need to do some munging in the import script?

Quoted 1 line

(Sorry, it's been a while.)

Quoted 7 lines

Yea looks like it was done manually last time:

commit d73415a315471ac0b127ed3fad45c8ec5d711de1

Author: Stefan Hajnoczi <[email protected]>
Date:   Wed Sep 23 11:56:46 2020 +0100

qemu/atomic.h: rename atomic_ to qatomic_

It seems that this hunk was dropped manually last time:

commit 53ba2eee52bff5a746e96835539a1079f6bcadd1

Author: Matthew Rosato <[email protected]>
Date:   Mon Oct 26 11:34:30 2020 -0400

linux-headers: update against 5.10-rc1

commit 3650b228f83adda7e5ee532e2b90429c03f7b9ec

[aw: drop pvrdma_ring.h changes to avoid revert of d73415a31547 ("qemu/atomic.h: rename atomic_ to qatomic_")]

I can do that as well, but I'm not sure that this is the best way forward.

Quoted 40 lines
Quoted 39 lines
Quoted 39 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +6 -6
 	if (pvrdma_idx_valid(idx, max_elems))
 		return idx & (max_elems - 1);
@@ -77,17 +77,17 @@ static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
 
 static inline void pvrdma_idx_ring_inc(int *var, uint32_t max_elems)
 {
-	uint32_t idx = qatomic_read(var) + 1;	/* Increment. */
+	uint32_t idx = atomic_read(var) + 1;	/* Increment. */
 
 	idx &= (max_elems << 1) - 1;		/* Modulo size, flip gen. */
-	qatomic_set(var, idx);
+	atomic_set(var, idx);
 }
 
 static inline int32_t pvrdma_idx_ring_has_space(const struct pvrdma_ring *r,
 					      uint32_t max_elems, uint32_t *out_tail)
 {
-	const uint32_t tail = qatomic_read(&r->prod_tail);
-	const uint32_t head = qatomic_read(&r->cons_head);
+	const uint32_t tail = atomic_read(&r->prod_tail);
+	const uint32_t head = atomic_read(&r->cons_head);
 
 	if (pvrdma_idx_valid(tail, max_elems) &&
 	    pvrdma_idx_valid(head, max_elems)) {
@@ -100,8 +100,8 @@ static inline int32_t pvrdma_idx_ring_has_space(const struct pvrdma_ring *r,
 static inline int32_t pvrdma_idx_ring_has_data(const struct pvrdma_ring *r,
 					     uint32_t max_elems, uint32_t *out_head)
 {
-	const uint32_t tail = qatomic_read(&r->prod_tail);
-	const uint32_t head = qatomic_read(&r->cons_head);
+	const uint32_t tail = atomic_read(&r->prod_tail);
+	const uint32_t head = atomic_read(&r->cons_head);
 
 	if (pvrdma_idx_valid(tail, max_elems) &&
 	    pvrdma_idx_valid(head, max_elems)) {  
#12 lore raw

Re: [PATCH v3 2/3] Update linux headers to 5.11-rc2

Quoted 74 lines · Cornelia Huck
Quoted 55 lines · On Mon, 11 Jan 2021 08:00:45 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 51 lines · Cornelia Huck
Quoted 38 lines · On Mon, 4 Jan 2021 21:20:56 +0100 Eric Farman <[email protected]> wrote:
---
 .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
 include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
 include/standard-headers/linux/const.h        |  36 ++++
 include/standard-headers/linux/ethtool.h      |   2 +-
 include/standard-headers/linux/fuse.h         |  30 ++-
 include/standard-headers/linux/kernel.h       |   9 +-
 include/standard-headers/linux/pci_regs.h     |  16 ++
 include/standard-headers/linux/vhost_types.h  |   9 +
 include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
 include/standard-headers/linux/virtio_ids.h   |  44 +++--
 linux-headers/asm-arm64/kvm.h                 |   3 -
 linux-headers/asm-generic/unistd.h            |   6 +-
 linux-headers/asm-mips/unistd_n32.h           |   1 +
 linux-headers/asm-mips/unistd_n64.h           |   1 +
 linux-headers/asm-mips/unistd_o32.h           |   1 +
 linux-headers/asm-powerpc/unistd_32.h         |   1 +
 linux-headers/asm-powerpc/unistd_64.h         |   1 +
 linux-headers/asm-s390/unistd_32.h            |   1 +
 linux-headers/asm-s390/unistd_64.h            |   1 +
 linux-headers/asm-x86/kvm.h                   |   1 +
 linux-headers/asm-x86/unistd_32.h             |   1 +
 linux-headers/asm-x86/unistd_64.h             |   1 +
 linux-headers/asm-x86/unistd_x32.h            |   1 +
 linux-headers/linux/kvm.h                     |  56 +++++-
 linux-headers/linux/userfaultfd.h             |   9 +
 linux-headers/linux/vfio.h                    |   1 +
 linux-headers/linux/vhost.h                   |   4 +
 28 files changed, 461 insertions(+), 48 deletions(-)
 create mode 100644 include/standard-headers/linux/const.h
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +0 -0
index 7b4062a1a1..acd4c8346d 100644

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems) · line 71

Quoted 5 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +1 -1
@@ -68,7 +68,7 @@ static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems)
 
 static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
 {
-	const unsigned int idx = qatomic_read(var);
+	const unsigned int idx = atomic_read(var);  

Hm, what was the state of these qatomic* instances in this header? Is it ok to rename them, or do we need to do some munging in the import script?

Quoted 1 line

(Sorry, it's been a while.)

Quoted 7 lines

Yea looks like it was done manually last time:

commit d73415a315471ac0b127ed3fad45c8ec5d711de1

Author: Stefan Hajnoczi <[email protected]>
Date:   Wed Sep 23 11:56:46 2020 +0100

qemu/atomic.h: rename atomic_ to qatomic_

It seems that this hunk was dropped manually last time:

commit 53ba2eee52bff5a746e96835539a1079f6bcadd1

Author: Matthew Rosato <[email protected]>
Date:   Mon Oct 26 11:34:30 2020 -0400

linux-headers: update against 5.10-rc1

Quoted 8 lines

commit 3650b228f83adda7e5ee532e2b90429c03f7b9ec

[aw: drop pvrdma_ring.h changes to avoid revert of d73415a31547 ("qemu/atomic.h: rename atomic_ to qatomic_")]

I can do that as well, but I'm not sure that this is the best way forward.

Probably as easy as the following:

scripts/update-linux-headers.sh +2 -0
index 9efbaf2f84..c1b4f468d3 100755
@@ -70,6 +70,8 @@ cp_portable() {
         -e 's/__kernel_long_t/long/' \
         -e 's/__kernel_ulong_t/unsigned long/' \
         -e 's/struct ethhdr/struct eth_header/' \
+        -e 's/atomic_read/qatomic_read/' \
+        -e 's/atomic_set/qatomic_set/' \
         -e '/\#define _LINUX_ETHTOOL_H/a \\n\#include "net/eth.h"' \
         "$f" > "$to/$header";
 }
Signature · 1 line
MST
#13 lore raw

Re: [PATCH v3 2/3] Update linux headers to 5.11-rc2

Quoted 96 lines · Michael S. Tsirkin
Quoted 74 lines · Cornelia Huck
Quoted 55 lines · On Mon, 11 Jan 2021 08:00:45 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 51 lines · Cornelia Huck
Quoted 38 lines · On Mon, 4 Jan 2021 21:20:56 +0100 Eric Farman <[email protected]> wrote:
---
  .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
  .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
  include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
  include/standard-headers/linux/const.h        |  36 ++++
  include/standard-headers/linux/ethtool.h      |   2 +-
  include/standard-headers/linux/fuse.h         |  30 ++-
  include/standard-headers/linux/kernel.h       |   9 +-
  include/standard-headers/linux/pci_regs.h     |  16 ++
  include/standard-headers/linux/vhost_types.h  |   9 +
  include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
  include/standard-headers/linux/virtio_ids.h   |  44 +++--
  linux-headers/asm-arm64/kvm.h                 |   3 -
  linux-headers/asm-generic/unistd.h            |   6 +-
  linux-headers/asm-mips/unistd_n32.h           |   1 +
  linux-headers/asm-mips/unistd_n64.h           |   1 +
  linux-headers/asm-mips/unistd_o32.h           |   1 +
  linux-headers/asm-powerpc/unistd_32.h         |   1 +
  linux-headers/asm-powerpc/unistd_64.h         |   1 +
  linux-headers/asm-s390/unistd_32.h            |   1 +
  linux-headers/asm-s390/unistd_64.h            |   1 +
  linux-headers/asm-x86/kvm.h                   |   1 +
  linux-headers/asm-x86/unistd_32.h             |   1 +
  linux-headers/asm-x86/unistd_64.h             |   1 +
  linux-headers/asm-x86/unistd_x32.h            |   1 +
  linux-headers/linux/kvm.h                     |  56 +++++-
  linux-headers/linux/userfaultfd.h             |   9 +
  linux-headers/linux/vfio.h                    |   1 +
  linux-headers/linux/vhost.h                   |   4 +
  28 files changed, 461 insertions(+), 48 deletions(-)

create mode 100644 include/standard-headers/linux/const.h

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +0 -0
index 7b4062a1a1..acd4c8346d 100644

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems) · line 71

Quoted 5 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +1 -1
@@ -68,7 +68,7 @@ static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems)
 
  static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
  {
-	const unsigned int idx = qatomic_read(var);
+	const unsigned int idx = atomic_read(var);

Hm, what was the state of these qatomic* instances in this header? Is it ok to rename them, or do we need to do some munging in the import script?

Quoted 1 line

(Sorry, it's been a while.)

Quoted 7 lines

Yea looks like it was done manually last time:

commit d73415a315471ac0b127ed3fad45c8ec5d711de1

Author: Stefan Hajnoczi <[email protected]>
Date:   Wed Sep 23 11:56:46 2020 +0100

qemu/atomic.h: rename atomic_ to qatomic_

It seems that this hunk was dropped manually last time:

commit 53ba2eee52bff5a746e96835539a1079f6bcadd1

Author: Matthew Rosato <[email protected]>
Date:   Mon Oct 26 11:34:30 2020 -0400

linux-headers: update against 5.10-rc1

Quoted 8 lines

commit 3650b228f83adda7e5ee532e2b90429c03f7b9ec

[aw: drop pvrdma_ring.h changes to avoid revert of d73415a31547 ("qemu/atomic.h: rename atomic_ to qatomic_")]

I can do that as well, but I'm not sure that this is the best way forward.

Probably as easy as the following:

scripts/update-linux-headers.sh +0 -0
index 9efbaf2f84..c1b4f468d3 100755

scripts/update-linux-headers.sh cp_portable() { · line 77

Quoted 8 lines
scripts/update-linux-headers.sh +2 -0
@@ -70,6 +70,8 @@ cp_portable() {
          -e 's/__kernel_long_t/long/' \
          -e 's/__kernel_ulong_t/unsigned long/' \
          -e 's/struct ethhdr/struct eth_header/' \
+        -e 's/atomic_read/qatomic_read/' \
+        -e 's/atomic_set/qatomic_set/' \
          -e '/\#define _LINUX_ETHTOOL_H/a \\n\#include "net/eth.h"' \
          "$f" > "$to/$header";
  }

Possibly, but Paolo mentioned the problem in this space some months ago:

"""

Quoted 2 lines

It looks like the changes in this file are going to get reverted the next time someone does a linux header sync.

Source code should not be at all imported from Linux. The hacks that accomodate pvrdma in update-linux-headers.sh (like s/atomic_t/u32/) really have no place there; the files in include/standard-headers/drivers/infiniband/hw/vmw_pvrdma should all be moved in hw/.

Paolo
"""

https://lore.kernel.org/qemu-devel/[email protected]/

#14 lore raw

Re: [PATCH v3 2/3] Update linux headers to 5.11-rc2

Quoted 116 lines · Eric Farman
Quoted 92 lines · Michael S. Tsirkin
Quoted 70 lines · Cornelia Huck
Quoted 53 lines · On Mon, 11 Jan 2021 08:00:45 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 49 lines · Cornelia Huck
Quoted 38 lines · On Mon, 4 Jan 2021 21:20:56 +0100 Eric Farman <[email protected]> wrote:
---
  .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
  .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
  include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
  include/standard-headers/linux/const.h        |  36 ++++
  include/standard-headers/linux/ethtool.h      |   2 +-
  include/standard-headers/linux/fuse.h         |  30 ++-
  include/standard-headers/linux/kernel.h       |   9 +-
  include/standard-headers/linux/pci_regs.h     |  16 ++
  include/standard-headers/linux/vhost_types.h  |   9 +
  include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
  include/standard-headers/linux/virtio_ids.h   |  44 +++--
  linux-headers/asm-arm64/kvm.h                 |   3 -
  linux-headers/asm-generic/unistd.h            |   6 +-
  linux-headers/asm-mips/unistd_n32.h           |   1 +
  linux-headers/asm-mips/unistd_n64.h           |   1 +
  linux-headers/asm-mips/unistd_o32.h           |   1 +
  linux-headers/asm-powerpc/unistd_32.h         |   1 +
  linux-headers/asm-powerpc/unistd_64.h         |   1 +
  linux-headers/asm-s390/unistd_32.h            |   1 +
  linux-headers/asm-s390/unistd_64.h            |   1 +
  linux-headers/asm-x86/kvm.h                   |   1 +
  linux-headers/asm-x86/unistd_32.h             |   1 +
  linux-headers/asm-x86/unistd_64.h             |   1 +
  linux-headers/asm-x86/unistd_x32.h            |   1 +
  linux-headers/linux/kvm.h                     |  56 +++++-
  linux-headers/linux/userfaultfd.h             |   9 +
  linux-headers/linux/vfio.h                    |   1 +
  linux-headers/linux/vhost.h                   |   4 +
  28 files changed, 461 insertions(+), 48 deletions(-)

create mode 100644 include/standard-headers/linux/const.h

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +0 -0
index 7b4062a1a1..acd4c8346d 100644

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems) · line 70

Quoted 4 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +1 -1
@@ -68,7 +68,7 @@ static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems)
  static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
  {
-	const unsigned int idx = qatomic_read(var);
+	const unsigned int idx = atomic_read(var);

Hm, what was the state of these qatomic* instances in this header? Is it ok to rename them, or do we need to do some munging in the import script?

Quoted 1 line

(Sorry, it's been a while.)

Quoted 7 lines

Yea looks like it was done manually last time:

commit d73415a315471ac0b127ed3fad45c8ec5d711de1

Author: Stefan Hajnoczi <[email protected]>
Date:   Wed Sep 23 11:56:46 2020 +0100

qemu/atomic.h: rename atomic_ to qatomic_

It seems that this hunk was dropped manually last time:

commit 53ba2eee52bff5a746e96835539a1079f6bcadd1

Author: Matthew Rosato <[email protected]>
Date:   Mon Oct 26 11:34:30 2020 -0400
Quoted 8 lines

linux-headers: update against 5.10-rc1 commit 3650b228f83adda7e5ee532e2b90429c03f7b9ec

[aw: drop pvrdma_ring.h changes to avoid revert of d73415a31547 ("qemu/atomic.h: rename atomic_ to qatomic_")]

I can do that as well, but I'm not sure that this is the best way forward.

Probably as easy as the following:

scripts/update-linux-headers.sh +0 -0
index 9efbaf2f84..c1b4f468d3 100755

scripts/update-linux-headers.sh cp_portable() { · line 77

Quoted 8 lines
scripts/update-linux-headers.sh +2 -0
@@ -70,6 +70,8 @@ cp_portable() {
          -e 's/__kernel_long_t/long/' \
          -e 's/__kernel_ulong_t/unsigned long/' \
          -e 's/struct ethhdr/struct eth_header/' \
+        -e 's/atomic_read/qatomic_read/' \
+        -e 's/atomic_set/qatomic_set/' \
          -e '/\#define _LINUX_ETHTOOL_H/a \\n\#include "net/eth.h"' \
          "$f" > "$to/$header";
  }

Possibly, but Paolo mentioned the problem in this space some months ago:

"""

Quoted 2 lines

It looks like the changes in this file are going to get reverted the next time someone does a linux header sync.

Source code should not be at all imported from Linux. The hacks that accomodate pvrdma in update-linux-headers.sh (like s/atomic_t/u32/) really have no place there; the files in include/standard-headers/drivers/infiniband/hw/vmw_pvrdma should all be moved in hw/.

Quoted 4 lines

Paolo
"""

https://lore.kernel.org/qemu-devel/[email protected]/

Oh right. I think they really should be moved to UAPI in Linux. Any takers? Maybe it's just this basically:

drivers/infiniband/hw/vmw_pvrdma/pvrdma.h +2 -2
index c142f5e7f25f..4a4834de9677 100644
@@ -57,9 +57,9 @@
 #include <rdma/ib_verbs.h>
 #include <rdma/vmw_pvrdma-abi.h>
 
-#include "pvrdma_ring.h"
+#include <linux/pvrdma_ring.h>
 #include "pvrdma_dev_api.h"
-#include "pvrdma_verbs.h"
+#include <linux/pvrdma_verbs.h>
 
 /* NOT the same as BIT_MASK(). */
 #define PVRDMA_MASK(n) ((n << 1) - 1)
drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h +1 -1
index 86a6c054ea26..d9a8ee79b9c0 100644
@@ -48,7 +48,7 @@
 
 #include <linux/types.h>
 
-#include "pvrdma_verbs.h"
+#include <linux/pvrdma_verbs.h>
 
 /*
  * PVRDMA version macros. Some new features require updates to PVRDMA_VERSION.
include/uapi/linux/pvrdma_ring.h renamed from drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +0 -0
similarity index 100%
rename from drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h
rename to include/uapi/linux/pvrdma_ring.h
include/uapi/linux/pvrdma_verbs.h renamed from drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h +0 -0
similarity index 100%
rename from drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h
rename to include/uapi/linux/pvrdma_verbs.h
Signature · 1 line
MST
#15 lore raw

Re: [PATCH v3 2/3] Update linux headers to 5.11-rc2

Quoted 108 lines · On Mon, 11 Jan 2021 10:18:28 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 107 lines · Eric Farman
Quoted 92 lines · Michael S. Tsirkin
Quoted 70 lines · Cornelia Huck
Quoted 53 lines · On Mon, 11 Jan 2021 08:00:45 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 49 lines · Cornelia Huck
Quoted 38 lines · On Mon, 4 Jan 2021 21:20:56 +0100 Eric Farman <[email protected]> wrote:
---
  .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
  .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
  include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
  include/standard-headers/linux/const.h        |  36 ++++
  include/standard-headers/linux/ethtool.h      |   2 +-
  include/standard-headers/linux/fuse.h         |  30 ++-
  include/standard-headers/linux/kernel.h       |   9 +-
  include/standard-headers/linux/pci_regs.h     |  16 ++
  include/standard-headers/linux/vhost_types.h  |   9 +
  include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
  include/standard-headers/linux/virtio_ids.h   |  44 +++--
  linux-headers/asm-arm64/kvm.h                 |   3 -
  linux-headers/asm-generic/unistd.h            |   6 +-
  linux-headers/asm-mips/unistd_n32.h           |   1 +
  linux-headers/asm-mips/unistd_n64.h           |   1 +
  linux-headers/asm-mips/unistd_o32.h           |   1 +
  linux-headers/asm-powerpc/unistd_32.h         |   1 +
  linux-headers/asm-powerpc/unistd_64.h         |   1 +
  linux-headers/asm-s390/unistd_32.h            |   1 +
  linux-headers/asm-s390/unistd_64.h            |   1 +
  linux-headers/asm-x86/kvm.h                   |   1 +
  linux-headers/asm-x86/unistd_32.h             |   1 +
  linux-headers/asm-x86/unistd_64.h             |   1 +
  linux-headers/asm-x86/unistd_x32.h            |   1 +
  linux-headers/linux/kvm.h                     |  56 +++++-
  linux-headers/linux/userfaultfd.h             |   9 +
  linux-headers/linux/vfio.h                    |   1 +
  linux-headers/linux/vhost.h                   |   4 +
  28 files changed, 461 insertions(+), 48 deletions(-)

create mode 100644 include/standard-headers/linux/const.h

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +0 -0
index 7b4062a1a1..acd4c8346d 100644

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems) · line 70

Quoted 4 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +1 -1
@@ -68,7 +68,7 @@ static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems)
  static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
  {
-	const unsigned int idx = qatomic_read(var);
+	const unsigned int idx = atomic_read(var);  

Hm, what was the state of these qatomic* instances in this header? Is it ok to rename them, or do we need to do some munging in the import script?

Quoted 1 line

(Sorry, it's been a while.)

Quoted 7 lines

Yea looks like it was done manually last time:

commit d73415a315471ac0b127ed3fad45c8ec5d711de1

Author: Stefan Hajnoczi <[email protected]>
Date:   Wed Sep 23 11:56:46 2020 +0100

qemu/atomic.h: rename atomic_ to qatomic_

It seems that this hunk was dropped manually last time:

commit 53ba2eee52bff5a746e96835539a1079f6bcadd1

Author: Matthew Rosato <[email protected]>
Date:   Mon Oct 26 11:34:30 2020 -0400
Quoted 8 lines

linux-headers: update against 5.10-rc1 commit 3650b228f83adda7e5ee532e2b90429c03f7b9ec

[aw: drop pvrdma_ring.h changes to avoid revert of d73415a31547 ("qemu/atomic.h: rename atomic_ to qatomic_")]

I can do that as well, but I'm not sure that this is the best way forward.

Probably as easy as the following:

scripts/update-linux-headers.sh +0 -0
index 9efbaf2f84..c1b4f468d3 100755

scripts/update-linux-headers.sh cp_portable() { · line 77

Quoted 8 lines
scripts/update-linux-headers.sh +2 -0
@@ -70,6 +70,8 @@ cp_portable() {
          -e 's/__kernel_long_t/long/' \
          -e 's/__kernel_ulong_t/unsigned long/' \
          -e 's/struct ethhdr/struct eth_header/' \
+        -e 's/atomic_read/qatomic_read/' \
+        -e 's/atomic_set/qatomic_set/' \
          -e '/\#define _LINUX_ETHTOOL_H/a \\n\#include "net/eth.h"' \
          "$f" > "$to/$header";
  }

Possibly, but Paolo mentioned the problem in this space some months ago:

"""

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

It looks like the changes in this file are going to get reverted the next time someone does a linux header sync.

Source code should not be at all imported from Linux. The hacks that accomodate pvrdma in update-linux-headers.sh (like s/atomic_t/u32/) really have no place there; the files in include/standard-headers/drivers/infiniband/hw/vmw_pvrdma should all be moved in hw/.

I'm not sure about the other headers, but the contents in pvrdma_ring.h really do not look like an api to me.

include/uapi/linux/pvrdma_verbs.h

Quoted 50 lines
Quoted 5 lines

Paolo
"""

https://lore.kernel.org/qemu-devel/[email protected]/

Oh right. I think they really should be moved to UAPI in Linux. Any takers? Maybe it's just this basically:

drivers/infiniband/hw/vmw_pvrdma/pvrdma.h +2 -2
index c142f5e7f25f..4a4834de9677 100644
@@ -57,9 +57,9 @@
 #include <rdma/ib_verbs.h>
 #include <rdma/vmw_pvrdma-abi.h>
 
-#include "pvrdma_ring.h"
+#include <linux/pvrdma_ring.h>
 #include "pvrdma_dev_api.h"
-#include "pvrdma_verbs.h"
+#include <linux/pvrdma_verbs.h>
 
 /* NOT the same as BIT_MASK(). */
 #define PVRDMA_MASK(n) ((n << 1) - 1)
drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h +1 -1
index 86a6c054ea26..d9a8ee79b9c0 100644
@@ -48,7 +48,7 @@
 
 #include <linux/types.h>
 
-#include "pvrdma_verbs.h"
+#include <linux/pvrdma_verbs.h>
 
 /*
  * PVRDMA version macros. Some new features require updates to PVRDMA_VERSION.
include/uapi/linux/pvrdma_ring.h renamed from drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +0 -0
similarity index 100%
rename from drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h
rename to include/uapi/linux/pvrdma_ring.h
include/uapi/linux/pvrdma_verbs.h renamed from drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h +0 -0
similarity index 100%
rename from drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h
rename to include/uapi/linux/pvrdma_verbs.h

How api-like are these? The verbs look like something that might be, but the rest?

#16 lore raw

Re: [PATCH v3 2/3] Update linux headers to 5.11-rc2

In reply to Cornelia Huck
Quoted 74 lines · On Mon, 11 Jan 2021 14:43:22 +0100 Cornelia Huck <[email protected]> wrote:
Quoted 55 lines · On Mon, 11 Jan 2021 08:00:45 -0500 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 51 lines · Cornelia Huck
Quoted 38 lines · On Mon, 4 Jan 2021 21:20:56 +0100 Eric Farman <[email protected]> wrote:
---
 .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
 include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
 include/standard-headers/linux/const.h        |  36 ++++
 include/standard-headers/linux/ethtool.h      |   2 +-
 include/standard-headers/linux/fuse.h         |  30 ++-
 include/standard-headers/linux/kernel.h       |   9 +-
 include/standard-headers/linux/pci_regs.h     |  16 ++
 include/standard-headers/linux/vhost_types.h  |   9 +
 include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
 include/standard-headers/linux/virtio_ids.h   |  44 +++--
 linux-headers/asm-arm64/kvm.h                 |   3 -
 linux-headers/asm-generic/unistd.h            |   6 +-
 linux-headers/asm-mips/unistd_n32.h           |   1 +
 linux-headers/asm-mips/unistd_n64.h           |   1 +
 linux-headers/asm-mips/unistd_o32.h           |   1 +
 linux-headers/asm-powerpc/unistd_32.h         |   1 +
 linux-headers/asm-powerpc/unistd_64.h         |   1 +
 linux-headers/asm-s390/unistd_32.h            |   1 +
 linux-headers/asm-s390/unistd_64.h            |   1 +
 linux-headers/asm-x86/kvm.h                   |   1 +
 linux-headers/asm-x86/unistd_32.h             |   1 +
 linux-headers/asm-x86/unistd_64.h             |   1 +
 linux-headers/asm-x86/unistd_x32.h            |   1 +
 linux-headers/linux/kvm.h                     |  56 +++++-
 linux-headers/linux/userfaultfd.h             |   9 +
 linux-headers/linux/vfio.h                    |   1 +
 linux-headers/linux/vhost.h                   |   4 +
 28 files changed, 461 insertions(+), 48 deletions(-)
 create mode 100644 include/standard-headers/linux/const.h
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +0 -0
index 7b4062a1a1..acd4c8346d 100644

include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems) · line 71

Quoted 5 lines
include/standard-headers/drivers/infiniband/hw/vmw_pvrdma/pvrdma_ring.h +1 -1
@@ -68,7 +68,7 @@ static inline int pvrdma_idx_valid(uint32_t idx, uint32_t max_elems)
 
 static inline int32_t pvrdma_idx(int *var, uint32_t max_elems)
 {
-	const unsigned int idx = qatomic_read(var);
+	const unsigned int idx = atomic_read(var);    

Hm, what was the state of these qatomic* instances in this header? Is it ok to rename them, or do we need to do some munging in the import script?

Quoted 1 line

(Sorry, it's been a while.)

Quoted 7 lines

Yea looks like it was done manually last time:

commit d73415a315471ac0b127ed3fad45c8ec5d711de1

Author: Stefan Hajnoczi <[email protected]>
Date:   Wed Sep 23 11:56:46 2020 +0100

qemu/atomic.h: rename atomic_ to qatomic_

It seems that this hunk was dropped manually last time:

commit 53ba2eee52bff5a746e96835539a1079f6bcadd1

Author: Matthew Rosato <[email protected]>
Date:   Mon Oct 26 11:34:30 2020 -0400

linux-headers: update against 5.10-rc1

Quoted 8 lines

commit 3650b228f83adda7e5ee532e2b90429c03f7b9ec

[aw: drop pvrdma_ring.h changes to avoid revert of d73415a31547 ("qemu/atomic.h: rename atomic_ to qatomic_")]

I can do that as well, but I'm not sure that this is the best way forward.

I think I'll do that anyway for now, just to get this series unstuck.

#17 lore raw

PATCH v3 3/3 vfio-ccw: Connect the device request notifier

In reply to Eric Farman

Now that the vfio-ccw code has a notifier interface to request that a device be unplugged, let's wire that together.

---
 hw/vfio/ccw.c | 40 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 4 deletions(-)
hw/vfio/ccw.c +36 -4
index d2755d7fc5..bc78a0ad76 100644
@@ -49,6 +49,7 @@ struct VFIOCCWDevice {
     struct ccw_crw_region *crw_region;
     EventNotifier io_notifier;
     EventNotifier crw_notifier;
+    EventNotifier req_notifier;
     bool force_orb_pfch;
     bool warned_orb_pfch;
 };
@@ -287,6 +288,21 @@ static void vfio_ccw_crw_read(VFIOCCWDevice *vcdev)
     } while (1);
 }
 
+static void vfio_ccw_req_notifier_handler(void *opaque)
+{
+    VFIOCCWDevice *vcdev = opaque;
+    Error *err = NULL;
+
+    if (!event_notifier_test_and_clear(&vcdev->req_notifier)) {
+        return;
+    }
+
+    qdev_unplug(DEVICE(vcdev), &err);
+    if (err) {
+        warn_reportf_err(err, VFIO_MSG_PREFIX, vcdev->vdev.name);
+    }
+}
+
 static void vfio_ccw_crw_notifier_handler(void *opaque)
 {
     VFIOCCWDevice *vcdev = opaque;
@@ -386,6 +402,10 @@ static void vfio_ccw_register_irq_notifier(VFIOCCWDevice *vcdev,
         notifier = &vcdev->crw_notifier;
         fd_read = vfio_ccw_crw_notifier_handler;
         break;
+    case VFIO_CCW_REQ_IRQ_INDEX:
+        notifier = &vcdev->req_notifier;
+        fd_read = vfio_ccw_req_notifier_handler;
+        break;
     default:
         error_setg(errp, "vfio: Unsupported device irq(%d)", irq);
         return;
@@ -440,6 +460,9 @@ static void vfio_ccw_unregister_irq_notifier(VFIOCCWDevice *vcdev,
     case VFIO_CCW_CRW_IRQ_INDEX:
         notifier = &vcdev->crw_notifier;
         break;
+    case VFIO_CCW_REQ_IRQ_INDEX:
+        notifier = &vcdev->req_notifier;
+        break;
     default:
         error_report("vfio: Unsupported device irq(%d)", irq);
         return;
@@ -661,20 +684,28 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
 
     vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX, &err);
     if (err) {
-        goto out_notifier_err;
+        goto out_io_notifier_err;
     }
 
     if (vcdev->crw_region) {
         vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_CRW_IRQ_INDEX, &err);
         if (err) {
-            vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX);
-            goto out_notifier_err;
+            goto out_crw_notifier_err;
         }
     }
 
+    vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_REQ_IRQ_INDEX, &err);
+    if (err) {
+        goto out_req_notifier_err;
+    }
+
     return;
 
-out_notifier_err:
+out_req_notifier_err:
+    vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_CRW_IRQ_INDEX);
+out_crw_notifier_err:
+    vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX);
+out_io_notifier_err:
     vfio_ccw_put_region(vcdev);
 out_region_err:
     vfio_ccw_put_device(vcdev);
@@ -696,6 +727,7 @@ static void vfio_ccw_unrealize(DeviceState *dev)
     S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev);
     VFIOGroup *group = vcdev->vdev.group;
 
+    vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_REQ_IRQ_INDEX);
     vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_CRW_IRQ_INDEX);
     vfio_ccw_unregister_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX);
     vfio_ccw_put_region(vcdev);
Signature · 1 line
2.17.1
#18 lore raw
In reply to Eric Farman
Quoted 48 lines · On Mon, 4 Jan 2021 21:20:54 +0100 Eric Farman <[email protected]> wrote:

Conny, et al,

Here is an updated (final?) version of the QEMU series for the vfio-ccw request notifier now that the kernel code landed upstream [1]. The actual meat (patch 3) is identical to its counterpart in v2 [2].

Earlier versions didn't use update-linux-headers.sh; they just carried a dummy patch with the define that was needed to work, without the noise. Here, I have run the script properly and patch 2 is its output.

Of course it wasn't that simple, as a change on the kernel side of things breaks the script and causes processing to end prematurely as cp_portable() takes its error exit. So I am adding a small patch to the front of this series to accommodate that, and hopefully isn't goofed up too badly. :)

[1] https://lore.kernel.org/kvm/[email protected]/
[2] https://lore.kernel.org/qemu-devel/[email protected]/

Eric Farman (3):
update-linux-headers: Include const.h
Update linux headers to 5.11-rc2
vfio-ccw: Connect the device request notifier

 hw/vfio/ccw.c                                 |  40 +++-
 .../infiniband/hw/vmw_pvrdma/pvrdma_ring.h    |  14 +-
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   2 +-
 include/standard-headers/drm/drm_fourcc.h     | 175 +++++++++++++++++-
 include/standard-headers/linux/const.h        |  36 ++++
 include/standard-headers/linux/ethtool.h      |   2 +-
 include/standard-headers/linux/fuse.h         |  30 ++-
 include/standard-headers/linux/kernel.h       |   9 +-
 include/standard-headers/linux/pci_regs.h     |  16 ++
 include/standard-headers/linux/vhost_types.h  |   9 +
 include/standard-headers/linux/virtio_gpu.h   |  82 ++++++++
 include/standard-headers/linux/virtio_ids.h   |  44 +++--
 linux-headers/asm-arm64/kvm.h                 |   3 -
 linux-headers/asm-generic/unistd.h            |   6 +-
 linux-headers/asm-mips/unistd_n32.h           |   1 +
 linux-headers/asm-mips/unistd_n64.h           |   1 +
 linux-headers/asm-mips/unistd_o32.h           |   1 +
 linux-headers/asm-powerpc/unistd_32.h         |   1 +
 linux-headers/asm-powerpc/unistd_64.h         |   1 +
 linux-headers/asm-s390/unistd_32.h            |   1 +
 linux-headers/asm-s390/unistd_64.h            |   1 +
 linux-headers/asm-x86/kvm.h                   |   1 +
 linux-headers/asm-x86/unistd_32.h             |   1 +
 linux-headers/asm-x86/unistd_64.h             |   1 +
Quoted 9 lines
 linux-headers/asm-x86/unistd_x32.h            |   1 +
 linux-headers/linux/kvm.h                     |  56 +++++-
 linux-headers/linux/userfaultfd.h             |   9 +
 linux-headers/linux/vfio.h                    |   1 +
 linux-headers/linux/vhost.h                   |   4 +
 scripts/update-linux-headers.sh               |   5 +-
 30 files changed, 501 insertions(+), 53 deletions(-)
 create mode 100644 include/standard-headers/linux/const.h

Thanks, applied.