public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 2/3 v2] x2APIC interface to local apic
Date: Mon, 29 Jun 2009 12:42:02 +0300	[thread overview]
Message-ID: <4A488C6A.2040703@redhat.com> (raw)
In-Reply-To: <1246191331-31085-3-git-send-email-gleb@redhat.com>

On 06/28/2009 03:15 PM, Gleb Natapov wrote:
> This patch implements MSR interface to a local apic as defines by x2APIC
> Intel specification.
>
> @@ -269,7 +275,12 @@ int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest)
>   int kvm_apic_match_logical_addr(struct kvm_lapic *apic, u8 mda)
>   {
>   	int result = 0;
> -	u8 logical_id;
> +	u32 logical_id;
> +
> +	if (apic_x2apic_mode(apic)) {
> +		logical_id = apic_get_reg(apic, APIC_LDR);
> +		return logical_id&  (uint16_t)mda;
> +	}
>    

mda is u8, why cast it?

> +static int apic_reg_read(struct kvm_lapic *apic, u32 offset, int len,
> +		void *data)
>   {
> -	struct kvm_lapic *apic = to_lapic(this);
> -	unsigned int offset = address - apic->base_address;
>   	unsigned char alignment = offset&  0xf;
>   	u32 result;
> +	/* this bitmask has a bit cleared for each reserver register */
> +	static const uint64_t rmask = 0x43ff01ffffffe70c;
>    

s/uint64_t/u64/, add ULL to avoid warnings on i386?

> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 5a66bb9..8ead54d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -817,6 +817,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
>   	case MSR_IA32_APICBASE:
>   		kvm_set_apic_base(vcpu, data);
>   		break;
> +	case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
> +		return kvm_x2apic_msr_write(vcpu, msr, data);
>    

Might be a good idea to special cases these in arch code to avoid the 
long if-trees the switches generate.  Only after profiling though.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2009-06-29  9:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-28 12:15 [PATCH 0/3 v2] x2APIC emulation for kvm Gleb Natapov
2009-06-28 12:15 ` [PATCH 1/3 v2] Add Directed EOI support to APIC emulation Gleb Natapov
2009-06-29  9:18   ` Avi Kivity
2009-06-29  9:29     ` Gleb Natapov
2009-06-29  9:49       ` Avi Kivity
2009-06-29  9:52         ` Gleb Natapov
2009-06-29 10:01           ` Avi Kivity
2009-06-28 12:15 ` [PATCH 2/3 v2] x2APIC interface to local apic Gleb Natapov
2009-06-29  9:42   ` Avi Kivity [this message]
2009-06-29  9:51     ` Gleb Natapov
2009-06-29  9:54       ` Avi Kivity
2009-06-28 12:15 ` [PATCH 3/3 v2] Add x2APIC support to qemu-kvm Gleb Natapov

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=4A488C6A.2040703@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox