All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH 2/4] x86/HVM: replace plain numbers
Date: Fri, 23 Jan 2015 13:59:25 +0000	[thread overview]
Message-ID: <54C253BD.9050303@citrix.com> (raw)
In-Reply-To: <54C2617D0200007800058D77@mail.emea.novell.com>

On 23/01/15 13:58, Jan Beulich wrote:
>>>> On 23.01.15 at 14:41, <andrew.cooper3@citrix.com> wrote:
>> On 22/01/15 15:17, Jan Beulich wrote:
>>>>>> On 22.01.15 at 15:41, <andrew.cooper3@citrix.com> wrote:
>>>> On 22/01/15 13:57, Jan Beulich wrote:
>>>>> ... making the code better document itself. No functional change
>>>>> intended.
>>>>>
>>>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>>>>
>>>>> --- a/xen/arch/x86/hvm/vioapic.c
>>>>> +++ b/xen/arch/x86/hvm/vioapic.c
>>>>> @@ -53,18 +53,26 @@ static uint32_t vioapic_read_indirect(co
>>>>>      switch ( vioapic->ioregsel )
>>>>>      {
>>>>>      case VIOAPIC_REG_VERSION:
>>>>> -        result = ((((VIOAPIC_NUM_PINS-1) & 0xff) << 16)
>>>>> -                  | (VIOAPIC_VERSION_ID & 0xff));
>>>>> +        result = ((union IO_APIC_reg_01){
>>>>> +                  .bits = { .version = VIOAPIC_VERSION_ID,
>>>>> +                            .entries = VIOAPIC_NUM_PINS - 1 }
>>>>> +                  }).raw;
>>>>>          break;
>>>>>  
>>>>>      case VIOAPIC_REG_APIC_ID:
>>>>> +        /*
>>>>> +         * Using union IO_APIC_reg_02 for the ID register too, as
>>>>> +         * union IO_APIC_reg_00's ID field is 8 bits wide for some reason.
>>>>> +         */
>>>> Having looked into this, Intel has a 4 bit wide ID with the top 4 bits
>>>> reserved, while AMD has the top 4 bits as the Extended ID which may be
>>>> used if an appropriate northbridge register has been set.
>>>>
>>>> I think it might be better to use IO_APIC_reg_00 here and mask the write
>>>> operations, leaving a note about Intel vs AMD and the fact that emulate
>>>> an Intel IOAPIC to match the PIIX3 chipset in Qemu.
>>>>
>>>> Modifying IO_APIC_reg_00 is not appropriate as Xens IOAPIC code needs to
>>>> deal with AMD systems as well.
>>> I had it that way first, but for the purpose of making very clear that
>>> there is no functional change, I decided against doing such a conversion.
>> Ok, but please adjust the comment.
>>
>> "for some reason" is not helpful, whereas "because we emulate an Intel
>> IOAPIC which only has a 4 bit ID field, compared to 8 for AMD" would be
>> better.
> When I wrote the comment, I didn't have a clue why this was
> inconsistent. Now we have at least a guess. I'll therefore use
> your wording with "because" preceded by "presumably":
>
> +        /*
> +         * Presumably because we emulate an Intel IOAPIC which only has a
> +         * 4 bit ID field (compared to 8 for AMD), using union IO_APIC_reg_02
> +         * for the ID register (union IO_APIC_reg_00's ID field is 8 bits).
> +         */

Looks much better.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

  reply	other threads:[~2015-01-23 13:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 13:53 [PATCH 0/4] x86: replace plain numbers Jan Beulich
2015-01-22 13:57 ` [PATCH 1/4] x86/HVM: replace plain number in hvm_combine_hw_exceptions() Jan Beulich
2015-01-22 14:12   ` Andrew Cooper
2015-01-22 14:36     ` Jan Beulich
2015-01-22 14:42   ` Tim Deegan
2015-01-22 15:12     ` Jan Beulich
2015-01-22 15:27       ` Tim Deegan
2015-01-22 13:57 ` [PATCH 2/4] x86/HVM: replace plain numbers Jan Beulich
2015-01-22 14:41   ` Andrew Cooper
2015-01-22 15:17     ` Jan Beulich
2015-01-23 13:41       ` Andrew Cooper
2015-01-23 13:58         ` Jan Beulich
2015-01-23 13:59           ` Andrew Cooper [this message]
2015-01-22 14:00 ` [PATCH 3/4] x86/traps: " Jan Beulich
2015-01-22 14:45   ` Andrew Cooper
2015-01-22 14:01 ` [PATCH 4/4] VMX: " Jan Beulich
2015-01-22 15:21   ` Andrew Cooper
2015-01-23  6:25   ` Tian, Kevin

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=54C253BD.9050303@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.