All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lin Ming <mlin@ss.pku.edu.cn>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	Andrew Cooper <Andrew.Cooper3@citrix.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Xen-devel] [PATCH] xen/apic: implement io apic read with hypercall
Date: Tue, 24 Apr 2012 22:43:53 +0800	[thread overview]
Message-ID: <CAF1ivSY1GAkqU2gN0P22Tb0pmwagam5UUVMABSgnoH3+C+TY+A@mail.gmail.com> (raw)
In-Reply-To: <20120423151123.GC24481@phenom.dumpdata.com>

On Mon, Apr 23, 2012 at 11:11 PM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
>> >> > How about return -1 on error?
>> >> > The calling function can check -1 for error.
>> >>
>> >> Isn't -1 potentially (at least theoretically) a valid value to read from
>> >> one of these registers?
>> >
>> > Yeah, but then we are back to crashing at bootup (with dom0) :-)
>> >
>> > Perhaps the fallback is to emulate (so retain some of the original code)
>> > as we have been since .. uh 3.0?
>>
>> Do you mean the return value of io_apic_read in 3.0?
>
> No. I meant that we would continue to emulate. The improvement
> is that now we do:
>
>       if (reg == 0x1)
>               return 0x00170020;
>       else if (reg == 0x0)
>               return apic << 24;
>
> instead of 0xfdfdfdfd.
>
>> It's 0xffffffff.
>
> Now it is 0xfdfdfdfd.
>
> I am suggesting that instead of BUG_ON(), we fallback to do returning
> an emulatated IO_APIC values - like the ones that this original patch
> cooked up..

But we still need to return some value if the register is not emulated.

How about below?

unsigned int xen_io_apic_read(unsigned apic, unsigned reg)
{
        struct physdev_apic apic_op;
        int ret;

        apic_op.apic_physbase = mpc_ioapic_addr(apic);
        apic_op.reg = reg;
        ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
        if (!ret)
                return apic_op.value;

        /* emulate register */
        if (reg == 0x1)
                return 0x00170020;
        else if (reg == 0x0)
                return apic << 24;
        else
                return -1;
}

  reply	other threads:[~2012-04-24 14:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20  9:25 [PATCH] xen/apic: implement io apic read with hypercall Lin Ming
2012-04-20  9:58 ` [Xen-devel] " Andrew Cooper
2012-04-20 11:13   ` Lin Ming
2012-04-20 12:38     ` Ian Campbell
2012-04-20 12:52       ` Jan Beulich
2012-04-20 12:53       ` Andrew Cooper
2012-04-20 13:12         ` Ian Campbell
2012-04-20 13:20           ` Andrew Cooper
2012-04-20 14:50           ` Lin Ming
2012-04-20 14:50             ` Lin Ming
2012-04-20 14:59             ` [Xen-devel] " Jan Beulich
2012-04-20 15:06             ` Ian Campbell
2012-04-20 15:39               ` Lin Ming
2012-04-20 16:43                 ` Konrad Rzeszutek Wilk
2012-04-20 16:41       ` Konrad Rzeszutek Wilk
2012-04-23  8:42         ` Lin Ming
2012-04-23 15:11           ` Konrad Rzeszutek Wilk
2012-04-24 14:43             ` Lin Ming [this message]
2012-04-24 16:23               ` Konrad Rzeszutek Wilk
2012-04-25 10:06                 ` Lin Ming
2012-04-26 15:33                   ` Konrad Rzeszutek Wilk
2012-04-26 15:33                     ` Konrad Rzeszutek Wilk

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=CAF1ivSY1GAkqU2gN0P22Tb0pmwagam5UUVMABSgnoH3+C+TY+A@mail.gmail.com \
    --to=mlin@ss.pku.edu.cn \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /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.