Skip to contentSkip to conversation

KVM: s390: rename PROT_NONE to PROT_TYPE_DUMMY

PATCH RESEND Applied Lorenzo Stoakes 3 participants 6 messages May 19, 2025 – May 20, 2025

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

PATCH RESEND 1/1 KVM: s390: rename PROT_NONE to PROT_TYPE_DUMMY

The enum type prot_type declared in arch/s390/kvm/gaccess.c declares an unfortunate identifier within it - PROT_NONE.

This clashes with the protection bit define from the uapi for mmap() declared in include/uapi/asm-generic/mman-common.h, which is indeed what those casually reading this code would assume this to refer to.

This means that any changes which subsequently alter headers in any way which results in the uapi header being imported here will cause build errors.

Resolve the issue by renaming PROT_NONE to PROT_TYPE_DUMMY.

---
Separated out from [0] as problem found in other patch in series.

[0]: https://lore.kernel.org/all/[email protected]/

 arch/s390/kvm/gaccess.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/s390/kvm/gaccess.c +4 -4
index f6fded15633a..4e5654ad1604 100644
@@ -318,7 +318,7 @@ enum prot_type {
 	PROT_TYPE_DAT  = 3,
 	PROT_TYPE_IEP  = 4,
 	/* Dummy value for passing an initialized value when code != PGM_PROTECTION */
-	PROT_NONE,
+	PROT_TYPE_DUMMY,
 };
 
 static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar,
@@ -334,7 +334,7 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva,
 	switch (code) {
 	case PGM_PROTECTION:
 		switch (prot) {
-		case PROT_NONE:
+		case PROT_TYPE_DUMMY:
 			/* We should never get here, acts like termination */
 			WARN_ON_ONCE(1);
 			break;
@@ -804,7 +804,7 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
 			gpa = kvm_s390_real_to_abs(vcpu, ga);
 			if (!kvm_is_gpa_in_memslot(vcpu->kvm, gpa)) {
 				rc = PGM_ADDRESSING;
-				prot = PROT_NONE;
+				prot = PROT_TYPE_DUMMY;
 			}
 		}
 		if (rc)
@@ -962,7 +962,7 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
 		if (rc == PGM_PROTECTION)
 			prot = PROT_TYPE_KEYC;
 		else
-			prot = PROT_NONE;
+			prot = PROT_TYPE_DUMMY;
 		rc = trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate);
 	}
 out_unlock:

--
2.49.0

Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Lorenzo Stoakes

The enum type prot_type declared in arch/s390/kvm/gaccess.c declares an unfortunate identifier within it - PROT_NONE.

This clashes with the protection bit define from the uapi for mmap() declared in include/uapi/asm-generic/mman-common.h, which is indeed what those casually reading this code would assume this to refer to.

This means that any changes which subsequently alter headers in any way which results in the uapi header being imported here will cause build errors.

Resolve the issue by renaming PROT_NONE to PROT_TYPE_DUMMY.

Quoted 11 lines
Signature · 2 lines
Oscar Salvador
SUSE Labs
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Lorenzo Stoakes
Quoted 13 lines · On Mon, 19 May 2025 15:56:57 +0100 Lorenzo Stoakes…

The enum type prot_type declared in arch/s390/kvm/gaccess.c declares an unfortunate identifier within it - PROT_NONE.

This clashes with the protection bit define from the uapi for mmap() declared in include/uapi/asm-generic/mman-common.h, which is indeed what those casually reading this code would assume this to refer to.

This means that any changes which subsequently alter headers in any way which results in the uapi header being imported here will cause build errors.

Resolve the issue by renaming PROT_NONE to PROT_TYPE_DUMMY.

Quoted 11 lines

if you had put me in CC, you would have gotten this yesterday already:

Quoted 51 lines

---
Separated out from [0] as problem found in other patch in series.

[0]: https://lore.kernel.org/all/[email protected]/

 arch/s390/kvm/gaccess.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/s390/kvm/gaccess.c +4 -5
index f6fded15633a..4e5654ad1604 100644
@@ -318,7 +318,7 @@ enum prot_type {
 	PROT_TYPE_DAT  = 3,
 	PROT_TYPE_IEP  = 4,
 	/* Dummy value for passing an initialized value when code != PGM_PROTECTION */
-	PROT_NONE,
+	PROT_TYPE_DUMMY,
 };
 
 static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar,
@@ -334,7 +334,7 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva,
 	switch (code) {
 	case PGM_PROTECTION:
 		switch (prot) {
-		case PROT_NONE:
+		case PROT_TYPE_DUMMY:
 			/* We should never get here, acts like termination */
 			WARN_ON_ONCE(1);
 			break;
@@ -804,7 +804,7 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
 			gpa = kvm_s390_real_to_abs(vcpu, ga);
 			if (!kvm_is_gpa_in_memslot(vcpu->kvm, gpa)) {
 				rc = PGM_ADDRESSING;
-				prot = PROT_NONE;
+				prot = PROT_TYPE_DUMMY;
 			}
 		}
 		if (rc)
@@ -962,7 +962,7 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
 		if (rc == PGM_PROTECTION)
 			prot = PROT_TYPE_KEYC;
 		else
-			prot = PROT_NONE;
+			prot = PROT_TYPE_DUMMY;
 		rc = trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate);
 	}
 out_unlock:
--

2.49.0

#3 lore raw
Quoted 28 lines · Claudio Imbrenda
Quoted 13 lines · On Mon, 19 May 2025 15:56:57 +0100 Lorenzo Stoakes…

The enum type prot_type declared in arch/s390/kvm/gaccess.c declares an unfortunate identifier within it - PROT_NONE.

This clashes with the protection bit define from the uapi for mmap() declared in include/uapi/asm-generic/mman-common.h, which is indeed what those casually reading this code would assume this to refer to.

This means that any changes which subsequently alter headers in any way which results in the uapi header being imported here will cause build errors.

Resolve the issue by renaming PROT_NONE to PROT_TYPE_DUMMY.

Quoted 11 lines
Quoted 3 lines

if you had put me in CC, you would have gotten this yesterday already:

Thanks and apologies for not cc-ing you, clearly my mistake.

Though I would suggest your level of grumpiness here is a little over the top under the circumstances :) we maintainers must scale our grumpiness accordingly...

Quoted 53 lines
Quoted 52 lines

---
Separated out from [0] as problem found in other patch in series.

[0]: https://lore.kernel.org/all/[email protected]/

 arch/s390/kvm/gaccess.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/s390/kvm/gaccess.c +4 -5
index f6fded15633a..4e5654ad1604 100644
@@ -318,7 +318,7 @@ enum prot_type {
 	PROT_TYPE_DAT  = 3,
 	PROT_TYPE_IEP  = 4,
 	/* Dummy value for passing an initialized value when code != PGM_PROTECTION */
-	PROT_NONE,
+	PROT_TYPE_DUMMY,
 };
 
 static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar,
@@ -334,7 +334,7 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva,
 	switch (code) {
 	case PGM_PROTECTION:
 		switch (prot) {
-		case PROT_NONE:
+		case PROT_TYPE_DUMMY:
 			/* We should never get here, acts like termination */
 			WARN_ON_ONCE(1);
 			break;
@@ -804,7 +804,7 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
 			gpa = kvm_s390_real_to_abs(vcpu, ga);
 			if (!kvm_is_gpa_in_memslot(vcpu->kvm, gpa)) {
 				rc = PGM_ADDRESSING;
-				prot = PROT_NONE;
+				prot = PROT_TYPE_DUMMY;
 			}
 		}
 		if (rc)
@@ -962,7 +962,7 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
 		if (rc == PGM_PROTECTION)
 			prot = PROT_TYPE_KEYC;
 		else
-			prot = PROT_NONE;
+			prot = PROT_TYPE_DUMMY;
 		rc = trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate);
 	}
 out_unlock:
--

2.49.0

maintainer
#4 lore raw
Quoted 31 lines · On Tue, 20 May 2025 16:24:10 +0100 Lorenzo Stoakes…
Quoted 30 lines · Claudio Imbrenda
Quoted 13 lines · On Mon, 19 May 2025 15:56:57 +0100 Lorenzo Stoakes…

The enum type prot_type declared in arch/s390/kvm/gaccess.c declares an unfortunate identifier within it - PROT_NONE.

This clashes with the protection bit define from the uapi for mmap() declared in include/uapi/asm-generic/mman-common.h, which is indeed what those casually reading this code would assume this to refer to.

This means that any changes which subsequently alter headers in any way which results in the uapi header being imported here will cause build errors.

Resolve the issue by renaming PROT_NONE to PROT_TYPE_DUMMY.

Quoted 11 lines

if you had put me in CC, you would have gotten this yesterday already:

Quoted 7 lines
Quoted 1 line

Thanks and apologies for not cc-ing you, clearly my mistake.

Though I would suggest your level of grumpiness here is a little over the top under the circumstances :) we maintainers must scale our grumpiness accordingly...

it was not meant to be grumpy, sorry if it came through that way!

Quoted 54 lines
Quoted 54 lines
Quoted 53 lines

---
Separated out from [0] as problem found in other patch in series.

[0]: https://lore.kernel.org/all/[email protected]/

 arch/s390/kvm/gaccess.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/s390/kvm/gaccess.c +4 -5
index f6fded15633a..4e5654ad1604 100644
@@ -318,7 +318,7 @@ enum prot_type {
 	PROT_TYPE_DAT  = 3,
 	PROT_TYPE_IEP  = 4,
 	/* Dummy value for passing an initialized value when code != PGM_PROTECTION */
-	PROT_NONE,
+	PROT_TYPE_DUMMY,
 };
 
 static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar,
@@ -334,7 +334,7 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva,
 	switch (code) {
 	case PGM_PROTECTION:
 		switch (prot) {
-		case PROT_NONE:
+		case PROT_TYPE_DUMMY:
 			/* We should never get here, acts like termination */
 			WARN_ON_ONCE(1);
 			break;
@@ -804,7 +804,7 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
 			gpa = kvm_s390_real_to_abs(vcpu, ga);
 			if (!kvm_is_gpa_in_memslot(vcpu->kvm, gpa)) {
 				rc = PGM_ADDRESSING;
-				prot = PROT_NONE;
+				prot = PROT_TYPE_DUMMY;
 			}
 		}
 		if (rc)
@@ -962,7 +962,7 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
 		if (rc == PGM_PROTECTION)
 			prot = PROT_TYPE_KEYC;
 		else
-			prot = PROT_NONE;
+			prot = PROT_TYPE_DUMMY;
 		rc = trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate);
 	}
 out_unlock:
--

2.49.0

#5 lore raw
Quoted 36 lines · Claudio Imbrenda
Quoted 33 lines · On Tue, 20 May 2025 16:24:10 +0100 Lorenzo Stoakes…
Quoted 31 lines · Claudio Imbrenda
Quoted 13 lines · On Mon, 19 May 2025 15:56:57 +0100 Lorenzo Stoakes…

The enum type prot_type declared in arch/s390/kvm/gaccess.c declares an unfortunate identifier within it - PROT_NONE.

This clashes with the protection bit define from the uapi for mmap() declared in include/uapi/asm-generic/mman-common.h, which is indeed what those casually reading this code would assume this to refer to.

This means that any changes which subsequently alter headers in any way which results in the uapi header being imported here will cause build errors.

Resolve the issue by renaming PROT_NONE to PROT_TYPE_DUMMY.

Quoted 11 lines

if you had put me in CC, you would have gotten this yesterday already:

Quoted 7 lines
Quoted 5 lines

Thanks and apologies for not cc-ing you, clearly my mistake.

Though I would suggest your level of grumpiness here is a little over the top under the circumstances :) we maintainers must scale our grumpiness accordingly...

it was not meant to be grumpy, sorry if it came through that way!

Haha no worries, text is a bad medium, I should maybe have inferred a ':P' at the end of that line ;)

But absolutely my bad for not cc'in I'm normally good with that... and have moaned at people for not cc'ing me before :P

Anyway thanks to you guys for being helpful with this change in general, hoping we can land it either in RC7 or if not as a hotpatch for 6.16.

We shall see :)

Cheers, Lorenzo

Quoted 56 lines
Quoted 55 lines
Quoted 55 lines
Quoted 54 lines

---
Separated out from [0] as problem found in other patch in series.

[0]: https://lore.kernel.org/all/[email protected]/

 arch/s390/kvm/gaccess.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/s390/kvm/gaccess.c +4 -5
index f6fded15633a..4e5654ad1604 100644
@@ -318,7 +318,7 @@ enum prot_type {
 	PROT_TYPE_DAT  = 3,
 	PROT_TYPE_IEP  = 4,
 	/* Dummy value for passing an initialized value when code != PGM_PROTECTION */
-	PROT_NONE,
+	PROT_TYPE_DUMMY,
 };
 
 static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar,
@@ -334,7 +334,7 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva,
 	switch (code) {
 	case PGM_PROTECTION:
 		switch (prot) {
-		case PROT_NONE:
+		case PROT_TYPE_DUMMY:
 			/* We should never get here, acts like termination */
 			WARN_ON_ONCE(1);
 			break;
@@ -804,7 +804,7 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
 			gpa = kvm_s390_real_to_abs(vcpu, ga);
 			if (!kvm_is_gpa_in_memslot(vcpu->kvm, gpa)) {
 				rc = PGM_ADDRESSING;
-				prot = PROT_NONE;
+				prot = PROT_TYPE_DUMMY;
 			}
 		}
 		if (rc)
@@ -962,7 +962,7 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
 		if (rc == PGM_PROTECTION)
 			prot = PROT_TYPE_KEYC;
 		else
-			prot = PROT_NONE;
+			prot = PROT_TYPE_DUMMY;
 		rc = trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate);
 	}
 out_unlock:
--

2.49.0