linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] KVM: arm64: Documentation updates
@ 2020-09-24 12:37 Alexandru Elisei
  2020-09-24 12:37 ` [PATCH v2 1/2] KVM: arm64: Add undocumented return values for PMU device control group Alexandru Elisei
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alexandru Elisei @ 2020-09-24 12:37 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm
  Cc: maz, drjones, james.morse, julien.thierry.kdev, suzuki.poulose

I noticed some discrepancies between the error codes returned by KVM PMU
emulation and the documentation, this is my attempt at fixing them.

The code is from the original implementation of KVM PMU, and I thought it
would be more prudent to modify the documentation to match the code instead
of the other way around.

Changes since v1:
- Added Reviewed-by from Andrew Jones for #1. Thank you!
- Changed -ENXIO description for KVM_ARM_VCPU_PMU_V3_IRQ in #2 to take into
  account the case where KVM_GET_DEVICE_ATTR is called and the irq number
  is not set.

Alexandru Elisei (2):
  KVM: arm64: Add undocumented return values for PMU device control
    group
  KVM: arm64: Match PMU error code descriptions with error conditions

 Documentation/virt/kvm/devices/vcpu.rst | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

-- 
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] KVM: arm64: Add undocumented return values for PMU device control group
  2020-09-24 12:37 [PATCH v2 0/2] KVM: arm64: Documentation updates Alexandru Elisei
@ 2020-09-24 12:37 ` Alexandru Elisei
  2020-09-24 12:37 ` [PATCH v2 2/2] KVM: arm64: Match PMU error code descriptions with error conditions Alexandru Elisei
  2020-09-30  7:31 ` [PATCH v2 0/2] KVM: arm64: Documentation updates Marc Zyngier
  2 siblings, 0 replies; 5+ messages in thread
From: Alexandru Elisei @ 2020-09-24 12:37 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm
  Cc: maz, drjones, james.morse, julien.thierry.kdev, suzuki.poulose

KVM_ARM_VCPU_PMU_V3_IRQ returns -EFAULT if get_user() fails when reading
the interrupt number from kvm_device_attr.addr.

KVM_ARM_VCPU_PMU_V3_INIT returns the error value from kvm_vgic_set_owner().
kvm_arm_pmu_v3_init() checks that the vgic has been initialized and the
interrupt number is valid, but kvm_vgic_set_owner() can still return the
error code -EEXIST if another device has already claimed the interrupt.

Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
---
 Documentation/virt/kvm/devices/vcpu.rst | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/virt/kvm/devices/vcpu.rst b/Documentation/virt/kvm/devices/vcpu.rst
index ca374d3fe085..96d6cf77cb1e 100644
--- a/Documentation/virt/kvm/devices/vcpu.rst
+++ b/Documentation/virt/kvm/devices/vcpu.rst
@@ -25,6 +25,7 @@ Returns:
 
 	 =======  ========================================================
 	 -EBUSY   The PMU overflow interrupt is already set
+	 -EFAULT  Error reading interrupt number
 	 -ENXIO   The overflow interrupt not set when attempting to get it
 	 -ENODEV  PMUv3 not supported
 	 -EINVAL  Invalid PMU overflow interrupt number supplied or
@@ -45,6 +46,7 @@ all vcpus, while as an SPI it must be a separate number per vcpu.
 Returns:
 
 	 =======  ======================================================
+	 -EEXIST  Interrupt number already used
 	 -ENODEV  PMUv3 not supported or GIC not initialized
 	 -ENXIO   PMUv3 not properly configured or in-kernel irqchip not
 		  configured as required prior to calling this attribute
-- 
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] KVM: arm64: Match PMU error code descriptions with error conditions
  2020-09-24 12:37 [PATCH v2 0/2] KVM: arm64: Documentation updates Alexandru Elisei
  2020-09-24 12:37 ` [PATCH v2 1/2] KVM: arm64: Add undocumented return values for PMU device control group Alexandru Elisei
@ 2020-09-24 12:37 ` Alexandru Elisei
  2020-09-24 12:59   ` Andrew Jones
  2020-09-30  7:31 ` [PATCH v2 0/2] KVM: arm64: Documentation updates Marc Zyngier
  2 siblings, 1 reply; 5+ messages in thread
From: Alexandru Elisei @ 2020-09-24 12:37 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm
  Cc: maz, drjones, james.morse, julien.thierry.kdev, suzuki.poulose

Update the description of the PMU KVM_{GET, SET}_DEVICE_ATTR error codes
to be a better match for the code that returns them.

Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
---
 Documentation/virt/kvm/devices/vcpu.rst | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/virt/kvm/devices/vcpu.rst b/Documentation/virt/kvm/devices/vcpu.rst
index 96d6cf77cb1e..8c24411ece2e 100644
--- a/Documentation/virt/kvm/devices/vcpu.rst
+++ b/Documentation/virt/kvm/devices/vcpu.rst
@@ -26,8 +26,9 @@ Returns:
 	 =======  ========================================================
 	 -EBUSY   The PMU overflow interrupt is already set
 	 -EFAULT  Error reading interrupt number
-	 -ENXIO   The overflow interrupt not set when attempting to get it
-	 -ENODEV  PMUv3 not supported
+	 -ENXIO   PMUv3 not supported or the overflow interrupt not set
+		  when attempting to get it
+	 -ENODEV  KVM_ARM_VCPU_PMU_V3 feature missing from VCPU
 	 -EINVAL  Invalid PMU overflow interrupt number supplied or
 		  trying to set the IRQ number without using an in-kernel
 		  irqchip.
@@ -48,8 +49,8 @@ Returns:
 	 =======  ======================================================
 	 -EEXIST  Interrupt number already used
 	 -ENODEV  PMUv3 not supported or GIC not initialized
-	 -ENXIO   PMUv3 not properly configured or in-kernel irqchip not
-		  configured as required prior to calling this attribute
+	 -ENXIO   PMUv3 not supported, missing VCPU feature or interrupt
+		  number not set
 	 -EBUSY   PMUv3 already initialized
 	 =======  ======================================================
 
-- 
2.28.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] KVM: arm64: Match PMU error code descriptions with error conditions
  2020-09-24 12:37 ` [PATCH v2 2/2] KVM: arm64: Match PMU error code descriptions with error conditions Alexandru Elisei
@ 2020-09-24 12:59   ` Andrew Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Jones @ 2020-09-24 12:59 UTC (permalink / raw)
  To: Alexandru Elisei
  Cc: suzuki.poulose, maz, james.morse, linux-arm-kernel, kvmarm,
	julien.thierry.kdev

On Thu, Sep 24, 2020 at 01:37:31PM +0100, Alexandru Elisei wrote:
> Update the description of the PMU KVM_{GET, SET}_DEVICE_ATTR error codes
> to be a better match for the code that returns them.
> 
> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
> ---
>  Documentation/virt/kvm/devices/vcpu.rst | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/virt/kvm/devices/vcpu.rst b/Documentation/virt/kvm/devices/vcpu.rst
> index 96d6cf77cb1e..8c24411ece2e 100644
> --- a/Documentation/virt/kvm/devices/vcpu.rst
> +++ b/Documentation/virt/kvm/devices/vcpu.rst
> @@ -26,8 +26,9 @@ Returns:
>  	 =======  ========================================================
>  	 -EBUSY   The PMU overflow interrupt is already set
>  	 -EFAULT  Error reading interrupt number
> -	 -ENXIO   The overflow interrupt not set when attempting to get it
> -	 -ENODEV  PMUv3 not supported
> +	 -ENXIO   PMUv3 not supported or the overflow interrupt not set
> +		  when attempting to get it
> +	 -ENODEV  KVM_ARM_VCPU_PMU_V3 feature missing from VCPU
>  	 -EINVAL  Invalid PMU overflow interrupt number supplied or
>  		  trying to set the IRQ number without using an in-kernel
>  		  irqchip.
> @@ -48,8 +49,8 @@ Returns:
>  	 =======  ======================================================
>  	 -EEXIST  Interrupt number already used
>  	 -ENODEV  PMUv3 not supported or GIC not initialized
> -	 -ENXIO   PMUv3 not properly configured or in-kernel irqchip not
> -		  configured as required prior to calling this attribute
> +	 -ENXIO   PMUv3 not supported, missing VCPU feature or interrupt
> +		  number not set
>  	 -EBUSY   PMUv3 already initialized
>  	 =======  ======================================================
>  
> -- 
> 2.28.0
>

Reviewed-by: Andrew Jones <drjones@redhat.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] KVM: arm64: Documentation updates
  2020-09-24 12:37 [PATCH v2 0/2] KVM: arm64: Documentation updates Alexandru Elisei
  2020-09-24 12:37 ` [PATCH v2 1/2] KVM: arm64: Add undocumented return values for PMU device control group Alexandru Elisei
  2020-09-24 12:37 ` [PATCH v2 2/2] KVM: arm64: Match PMU error code descriptions with error conditions Alexandru Elisei
@ 2020-09-30  7:31 ` Marc Zyngier
  2 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2020-09-30  7:31 UTC (permalink / raw)
  To: linux-arm-kernel, Alexandru Elisei, kvmarm

On Thu, 24 Sep 2020 13:37:29 +0100, Alexandru Elisei wrote:
> I noticed some discrepancies between the error codes returned by KVM PMU
> emulation and the documentation, this is my attempt at fixing them.
> 
> The code is from the original implementation of KVM PMU, and I thought it
> would be more prudent to modify the documentation to match the code instead
> of the other way around.
> 
> [...]

Applied to next, thanks!

[1/2] KVM: arm64: Add undocumented return values for PMU device control group
      commit: af130d0adc8e48c73030c0d71a59ce1f7809a8fa
[2/2] KVM: arm64: Match PMU error code descriptions with error conditions
      commit: 51dd2eb98c72c1ff4cdb1526fff9a259a563c257

Cheers,

	M.
-- 
Without deviation from the norm, progress is not possible.



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-30  7:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24 12:37 [PATCH v2 0/2] KVM: arm64: Documentation updates Alexandru Elisei
2020-09-24 12:37 ` [PATCH v2 1/2] KVM: arm64: Add undocumented return values for PMU device control group Alexandru Elisei
2020-09-24 12:37 ` [PATCH v2 2/2] KVM: arm64: Match PMU error code descriptions with error conditions Alexandru Elisei
2020-09-24 12:59   ` Andrew Jones
2020-09-30  7:31 ` [PATCH v2 0/2] KVM: arm64: Documentation updates Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).