From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v5 1/4] x86/HVM: fix miscellaneous aspects of x2APIC emulation
Date: Wed, 24 Sep 2014 16:57:46 +0100 [thread overview]
Message-ID: <5422E9FA.5050606@citrix.com> (raw)
In-Reply-To: <542300AF02000078000386B2@mail.emea.novell.com>
On 24/09/14 16:34, Jan Beulich wrote:
> - generate #GP on invalid APIC base MSR transitions
> - fail reads from the EOI and self-IPI registers (which are write-only)
> - handle self-IPI writes and the ICR2 half of ICR writes largely in
> hvm_x2apic_msr_write() and (for self-IPI only) vlapic_apicv_write()
> - don't permit MMIO-based access in x2APIC mode
> - filter writes to read-only registers in hvm_x2apic_msr_write(),
> allowing conditionals to be dropped from vlapic_reg_write()
> - don't ignore upper half of MSR-based write to ESR being non-zero
> - don't ignore other writes to reserved bits
> - VMX's EXIT_REASON_APIC_WRITE must not result in #GP (this exit being
> trap-like, this exception would get raised on the wrong RIP)
> - make hvm_x2apic_msr_read() produce X86EMUL_* return codes just like
> hvm_x2apic_msr_write() does (benign to the only caller)
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
One nit and one bug.
> @@ -877,8 +854,16 @@ static int vlapic_write(struct vcpu *v,
>
> int vlapic_apicv_write(struct vcpu *v, unsigned int offset)
> {
> - uint32_t val = vlapic_get_reg(vcpu_vlapic(v), offset);
> - return vlapic_reg_write(v, offset, val);
> + struct vlapic *vlapic = vcpu_vlapic(v);
> + uint32_t val = vlapic_get_reg(vlapic, offset);
> +
> + if ( !vlapic_x2apic_mode(vlapic) )
> + return vlapic_reg_write(v, offset, val);
> +
> + if ( offset != APIC_SELF_IPI )
> + return X86EMUL_UNHANDLEABLE;
> +
> + return vlapic_reg_write(v, APIC_ICR, APIC_DEST_SELF | (uint8_t)val);
(val & APIC_VECTOR_MASK) instead of a uint8_t cast?
> }
>
> int hvm_x2apic_msr_write(struct vcpu *v, unsigned int msr, uint64_t msr_content)
> @@ -891,16 +876,69 @@ int hvm_x2apic_msr_write(struct vcpu *v,
>
> switch ( offset )
> {
> - int rc;
> + case APIC_TASKPRI:
> + if ( msr_content & ~APIC_TPRI_MASK )
> + return X86EMUL_UNHANDLEABLE;
> + break;
> +
> + case APIC_SPIV:
> + if ( msr_content & ~(APIC_VECTOR_MASK | APIC_SPIV_APIC_ENABLED |
> + (VLAPIC_VERSION & APIC_LVR_DIRECTED_EOI
Need brackets for the logical (VLAPIC_VERSION & APIC_LVR_DIRECTED_EOI)
test to avoid making a constant expression with the precedence of the
ternary operator.
> + ? APIC_SPIV_DIRECTED_EOI : 0)) )
> + return X86EMUL_UNHANDLEABLE;
> + break;
> +
Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
next prev parent reply other threads:[~2014-09-24 15:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-24 15:28 [PATCH v5 0/4] x86/HVM: fix various aspects of APIC emulation Jan Beulich
2014-09-24 15:34 ` [PATCH v5 1/4] x86/HVM: fix miscellaneous aspects of x2APIC emulation Jan Beulich
2014-09-24 15:57 ` Andrew Cooper [this message]
2014-09-25 8:42 ` Jan Beulich
2014-09-25 11:26 ` Andrew Cooper
2014-09-24 15:35 ` [PATCH v5 2/4] x86/HVM: fix ID handling " Jan Beulich
2014-09-24 15:59 ` Andrew Cooper
2014-09-24 15:36 ` [PATCH v5 3/4] x86/vlapic: a few type adjustments Jan Beulich
2014-09-24 16:02 ` Andrew Cooper
2014-09-24 15:37 ` [PATCH v5 4/4] x86/vlapic: don't silently accept bad vectors Jan Beulich
2014-09-25 11:17 ` [PATCH v5 0/4] x86/HVM: fix various aspects of APIC emulation Tim Deegan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5422E9FA.5050606@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.