Skip to contentSkip to conversation

KVM: x86: Update the version number of SDM in comments

PATCH In review Jun Miao 3 participants 3 messages Jun 15, 2023

Subsystems (3)
lore
Share & tools
lore

Jun Miao

author
#0 lore raw

PATCH 1/1 KVM: x86: Update the version number of SDM in comments

A little optimized update version number of SDM and corresponding public date, making it more accurate to retrieve.

---
 arch/x86/kvm/lapic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/lapic.c +1 -1
index d7639d126e6c..4c5493e08d2e 100644
@@ -2260,7 +2260,7 @@ static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
 	/*
 	 * APIC register must be aligned on 128-bits boundary.
 	 * 32/64/128 bits registers must be accessed thru 32 bits.
-	 * Refer SDM 8.4.1
+	 * Refer SDM 11.4.1 (March 2023).
 	 */
 	if (len != 4 || (offset & 0xf))
 		return 0;
Signature · 1 line
2.32.0
#1 lore raw
Quoted 13 lines · Jun Miao

A little optimized update version number of SDM and corresponding public date, making it more accurate to retrieve.

---
 arch/x86/kvm/lapic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/lapic.c +0 -0
index d7639d126e6c..4c5493e08d2e 100644

arch/x86/kvm/lapic.c static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this, · line 2263

Quoted 4 lines
arch/x86/kvm/lapic.c +0 -1
@@ -2260,7 +2260,7 @@ static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
 	/*
 	 * APIC register must be aligned on 128-bits boundary.
 	 * 32/64/128 bits registers must be accessed thru 32 bits.
-	 * Refer SDM 8.4.1

I would suggest just remove this line.
And maybe, add "According to Intel SDM, " at the beginning of the comments.

arch/x86/kvm/lapic.c static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this, · line 2263

Quoted 1 line
arch/x86/kvm/lapic.c +1 -0
+	 * Refer SDM 11.4.1 (March 2023).

Referring a specific section is not encouraged, as the numbers of SDM's sections always change.

B.R.
Yu

#2 lore raw
Quoted 9 lines · Yu Zhang
Quoted 8 lines · Jun Miao

A little optimized update version number of SDM and corresponding public date, making it more accurate to retrieve.

---
 arch/x86/kvm/lapic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines

arch/x86/kvm/lapic.c static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this, · line 2263

Quoted 9 lines
arch/x86/kvm/lapic.c +0 -1
index d7639d126e6c..4c5493e08d2e 100644
@@ -2260,7 +2260,7 @@ static int apic_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *this,
 	/*
 	 * APIC register must be aligned on 128-bits boundary.
 	 * 32/64/128 bits registers must be accessed thru 32 bits.
-	 * Refer SDM 8.4.1

I would suggest just remove this line.

+1, and clean up the other part too? The line about 32/64/128 bits registers is also flawed; there are no 128-bit registers, just 256-bit registers. I see no reason to precisely call out the sizes. And this would be a good opportunity to call out that KVM allows smaller reads, but not smaller writes.

E.g. something like this?

/*
* APIC registers must be aligned on 128-bit boundaries, and must be
* written using 32-bit stores regardless of the register size. Note,
* KVM allows smaller 8-bit and 16-bit loads to be compatible with
* guest software (some microarchitectures support such loads, even
* though only 32-bit loads are architecturally guaranteed to work). */

Quoted 1 line

And maybe, add "According to Intel SDM, " at the beginning of the comments.

Nah, not necessary. It's implied that KVM is implementing architecturally behavior unless otherwise stated. And this isn't Intel specific code, e.g. the APM (hopefully) says the same thing.