All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Documentation: document MCE ioctls
@ 2017-02-17 22:08 Luiz Capitulino
  2017-03-09 12:49 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Luiz Capitulino @ 2017-02-17 22:08 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, rkrcmar, ashok.raj, haozhong.zhang, ying.huang


Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 Documentation/virtual/kvm/api.txt | 60 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 03145b7..1620a2d 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -3201,6 +3201,66 @@ struct kvm_reinject_control {
 pit_reinject = 0 (!reinject mode) is recommended, unless running an old
 operating system that uses the PIT for timing (e.g. Linux 2.4.x).
 
+4.99 KVM_X86_GET_MCE_CAP_SUPPORTED
+
+Capability: KVM_CAP_MCE
+Architectures: x86
+Type: system ioctl
+Parameters: u64 mce_cap (in/out)
+Returns: 0 on success, -1 on error
+
+Returns supported MCE capabilities. The u64 mce_cap parameter
+has the same format as the MSR_IA32_MCG_CAP register. Supported
+capabilities will have the corresponding bits set.
+
+4.100 KVM_X86_SETUP_MCE
+
+Capability: KVM_CAP_MCE
+Architectures: x86
+Type: vcpu ioctl
+Parameters: u64 mcg_cap (in)
+Returns: 0 on success,
+         -EFAULT if u64 mcg_cap cannot be read,
+         -EINVAL if the requested number of banks is invalid,
+         -EINVAL if requested MCE capability is not supported.
+
+Initializes MCE support for use. The u64 mcg_cap parameter
+has the same format as the MSR_IA32_MCG_CAP register and
+specifies which capabilities should be enabled. The maximum
+supported number of error-reporting banks can be retreive when
+checking for KVM_CAP_MCE. The supported capabilities can be
+retrieved with KVM_X86_GET_MCE_CAP_SUPPORTED.
+
+4.101 KVM_X86_SET_MCE
+
+Capability: KVM_CAP_MCE
+Architectures: x86
+Type: vcpu ioctl
+Parameters: struct kvm_x86_mce (in)
+Returns: 0 on success,
+         -EFAULT if struct kvm_x86_mce cannot be read,
+         -EINVAL if the bank number is invalid,
+         -EINVAL if VAL bit is not set in status field.
+
+Inject an MCE into the guest. The input parameter is:
+
+struct kvm_x86_mce {
+	__u64 status;
+	__u64 addr;
+	__u64 misc;
+	__u64 mcg_status;
+	__u8 bank;
+	__u8 pad1[7];
+	__u64 pad2[3];
+};
+
+If the MCE being reported is an uncorrected error, KVM will
+inject it as a MCE exception into the guest (if an MCE
+is still in progress, a triple fault is be injected).
+Otherwise, if the MCE is a corrected error, KVM will just
+store it in the corresponding bank (provided this bank is
+not holding a previously reported uncorrected error).
+
 5. The kvm_run structure
 ------------------------
 
-- 
2.5.5

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

* Re: [PATCH] KVM: Documentation: document MCE ioctls
  2017-02-17 22:08 [PATCH] KVM: Documentation: document MCE ioctls Luiz Capitulino
@ 2017-03-09 12:49 ` Paolo Bonzini
  2017-03-09 19:03   ` Luiz Capitulino
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2017-03-09 12:49 UTC (permalink / raw)
  To: Luiz Capitulino, kvm; +Cc: rkrcmar, ashok.raj, haozhong.zhang, ying.huang


On 17/02/2017 23:08, Luiz Capitulino wrote:
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  Documentation/virtual/kvm/api.txt | 60 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 60 insertions(+)

Thanks Luiz---just a couple nits.

> diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
> index 03145b7..1620a2d 100644
> --- a/Documentation/virtual/kvm/api.txt
> +++ b/Documentation/virtual/kvm/api.txt
> @@ -3201,6 +3201,66 @@ struct kvm_reinject_control {
>  pit_reinject = 0 (!reinject mode) is recommended, unless running an old
>  operating system that uses the PIT for timing (e.g. Linux 2.4.x).
>  
> +4.99 KVM_X86_GET_MCE_CAP_SUPPORTED
> +
> +Capability: KVM_CAP_MCE
> +Architectures: x86
> +Type: system ioctl
> +Parameters: u64 mce_cap (in/out)
> +Returns: 0 on success, -1 on error
> +
> +Returns supported MCE capabilities. The u64 mce_cap parameter
> +has the same format as the MSR_IA32_MCG_CAP register. Supported
> +capabilities will have the corresponding bits set.
> +
> +4.100 KVM_X86_SETUP_MCE
> +
> +Capability: KVM_CAP_MCE
> +Architectures: x86
> +Type: vcpu ioctl
> +Parameters: u64 mcg_cap (in)
> +Returns: 0 on success,
> +         -EFAULT if u64 mcg_cap cannot be read,
> +         -EINVAL if the requested number of banks is invalid,
> +         -EINVAL if requested MCE capability is not supported.
> +
> +Initializes MCE support for use. The u64 mcg_cap parameter
> +has the same format as the MSR_IA32_MCG_CAP register and
> +specifies which capabilities should be enabled. The maximum
> +supported number of error-reporting banks can be retreive when

retrieved

> +checking for KVM_CAP_MCE. The supported capabilities can be
> +retrieved with KVM_X86_GET_MCE_CAP_SUPPORTED.
> +
> +4.101 KVM_X86_SET_MCE
> +
> +Capability: KVM_CAP_MCE
> +Architectures: x86
> +Type: vcpu ioctl
> +Parameters: struct kvm_x86_mce (in)
> +Returns: 0 on success,
> +         -EFAULT if struct kvm_x86_mce cannot be read,
> +         -EINVAL if the bank number is invalid,
> +         -EINVAL if VAL bit is not set in status field.
> +
> +Inject an MCE into the guest. The input parameter is:

Inject a machine check error (MCE) into the guest.  The input parameter is:

> +struct kvm_x86_mce {
> +	__u64 status;
> +	__u64 addr;
> +	__u64 misc;
> +	__u64 mcg_status;
> +	__u8 bank;
> +	__u8 pad1[7];
> +	__u64 pad2[3];
> +};
> +
> +If the MCE being reported is an uncorrected error, KVM will
> +inject it as a MCE exception into the guest (if an MCE
> +is still in progress, a triple fault is be injected).

If the guest MCG_STATUS register reports that an MCE is in progress, KVM
causes an KVM_EXIT_SHUTDOWN vmexit.

If the MCE being reported is an uncorrected error, KVM will
inject it as a MCE exception into the guest.

That's it,

Paolo

> +Otherwise, if the MCE is a corrected error, KVM will just
> +store it in the corresponding bank (provided this bank is
> +not holding a previously reported uncorrected error).
> +
>  5. The kvm_run structure
>  ------------------------
>  
> 

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

* Re: [PATCH] KVM: Documentation: document MCE ioctls
  2017-03-09 12:49 ` Paolo Bonzini
@ 2017-03-09 19:03   ` Luiz Capitulino
  2017-03-10  8:46     ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Luiz Capitulino @ 2017-03-09 19:03 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, rkrcmar, ashok.raj, haozhong.zhang, ying.huang

On Thu, 9 Mar 2017 13:49:06 +0100
Paolo Bonzini <pbonzini@redhat.com> wrote:

> > +struct kvm_x86_mce {
> > +	__u64 status;
> > +	__u64 addr;
> > +	__u64 misc;
> > +	__u64 mcg_status;
> > +	__u8 bank;
> > +	__u8 pad1[7];
> > +	__u64 pad2[3];
> > +};
> > +
> > +If the MCE being reported is an uncorrected error, KVM will
> > +inject it as a MCE exception into the guest (if an MCE
> > +is still in progress, a triple fault is be injected).  
> 
> If the guest MCG_STATUS register reports that an MCE is in progress, KVM
> causes an KVM_EXIT_SHUTDOWN vmexit.

Oh, that's correct. But it only happens for uncorrected errors.
So, My new paragraph would be:

If the MCE being reported is an uncorrected error, KVM will
inject it as an MCE exception into the guest. If the guest MCG_STATUS
register reports taht an MCE is in progress, KVM causes an
KVM_EXIT_SHUTDOWN vmexit.

Otherwise, if the MCE is an corrected error, KVM will just
store it in the corresponding bank (provided this bank is
not holding a previously reported uncorrected error).

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

* Re: [PATCH] KVM: Documentation: document MCE ioctls
  2017-03-09 19:03   ` Luiz Capitulino
@ 2017-03-10  8:46     ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2017-03-10  8:46 UTC (permalink / raw)
  To: Luiz Capitulino; +Cc: kvm, rkrcmar, ashok.raj, haozhong.zhang, ying.huang



On 09/03/2017 20:03, Luiz Capitulino wrote:
> On Thu, 9 Mar 2017 13:49:06 +0100
> Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
>>> +struct kvm_x86_mce {
>>> +	__u64 status;
>>> +	__u64 addr;
>>> +	__u64 misc;
>>> +	__u64 mcg_status;
>>> +	__u8 bank;
>>> +	__u8 pad1[7];
>>> +	__u64 pad2[3];
>>> +};
>>> +
>>> +If the MCE being reported is an uncorrected error, KVM will
>>> +inject it as a MCE exception into the guest (if an MCE
>>> +is still in progress, a triple fault is be injected).  
>>
>> If the guest MCG_STATUS register reports that an MCE is in progress, KVM
>> causes an KVM_EXIT_SHUTDOWN vmexit.
> 
> Oh, that's correct. But it only happens for uncorrected errors.
> So, My new paragraph would be:
> 
> If the MCE being reported is an uncorrected error, KVM will
> inject it as an MCE exception into the guest. If the guest MCG_STATUS
> register reports taht an MCE is in progress, KVM causes an
> KVM_EXIT_SHUTDOWN vmexit.
> 
> Otherwise, if the MCE is an corrected error, KVM will just
> store it in the corresponding bank (provided this bank is
> not holding a previously reported uncorrected error).

This is better, thanks!

Paolo

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

end of thread, other threads:[~2017-03-10  8:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 22:08 [PATCH] KVM: Documentation: document MCE ioctls Luiz Capitulino
2017-03-09 12:49 ` Paolo Bonzini
2017-03-09 19:03   ` Luiz Capitulino
2017-03-10  8:46     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.