From: Julien Grall <julien.grall@linaro.org>
To: Vijay Kilari <vijay.kilari@gmail.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Prasun Kapoor <Prasun.Kapoor@caviumnetworks.com>,
Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>,
Andrii Anisov <andrii.anisov@globallogic.com>,
xen-devel@lists.xen.org,
Stefano Stabellini <stefano.stabellini@citrix.com>
Subject: Re: [PATCH v2 01/15] xen/arm: register mmio handler at runtime
Date: Fri, 04 Apr 2014 13:59:28 +0100 [thread overview]
Message-ID: <533EACB0.6070604@linaro.org> (raw)
In-Reply-To: <CALicx6u-6Gz=LcsDjH+Pb_FG2GzXxMHJOqHCZrfDdwBtqR8dQQ@mail.gmail.com>
On 04/04/2014 01:30 PM, Vijay Kilari wrote:
> On Fri, Apr 4, 2014 at 5:48 PM, Julien Grall <julien.grall@linaro.org> wrote:
>> Hello vijay,
>>
>> Thank your for the patch.
>>
>> On 04/04/2014 12:56 PM, vijay.kilari@gmail.com wrote:
>>
>> [..]
>>
>>> -#define MMIO_HANDLER_NR ARRAY_SIZE(mmio_handlers)
>>> +static DEFINE_SPINLOCK(handler_lock);
>>
>> Why a global lock rather than a domain lock?
>>
> OK can move into domain io_handler structure
>> [..]
>>
>>> +
>>> +void register_mmio_handler(struct domain *d, struct mmio_handler * handle)
>>> +{
>>> + unsigned long flags;
>>> + struct io_handler *handler = d->arch.io_handlers;
>>> + BUG_ON(handler->num_entries >= MAX_IO_HANDLER);
>>> +
>>> + spin_lock_irqsave(&handler_lock, flags);
>>
>> You don't need to disable the IRQ here.
> My first version is without IRQ disable. I remember Andrii suggested it
(Adding Andrii in the mail).
Unless you are planning to use it in interrupt context, IHMO irqsave is
not needed.
>>
>>> + handler->mmio_handlers[handler->num_entries++] = handle;
>>> + spin_unlock_irqrestore(&handler_lock, flags);
>>> +}
>>> /*
>>> * Local variables:
>>> * mode: C
>>> diff --git a/xen/arch/arm/io.h b/xen/arch/arm/io.h
>>> index 8d252c0..5fc1660 100644
>>> --- a/xen/arch/arm/io.h
>>> +++ b/xen/arch/arm/io.h
>>
>> As you are modifying this header. Can you move it in include/asm-arm?
> OK.
>
>>
>>> @@ -40,10 +40,14 @@ struct mmio_handler {
>>> mmio_write_t write_handler;
>>> };
>>>
>>> -extern const struct mmio_handler vgic_distr_mmio_handler;
>>> -extern const struct mmio_handler vuart_mmio_handler;
>>> +#define MAX_IO_HANDLER 16
>>> +struct io_handler {
>>> + int num_entries;
>>> + struct mmio_handler *mmio_handlers[MAX_IO_HANDLER];
>>> +};
>>>
>>> extern int handle_mmio(mmio_info_t *info);
>>> +void register_mmio_handler(struct domain *d, struct mmio_handler * handle);
>>
>> As I said on the previous version, it would be nice to remove check
>> callback in the mmio_handler and replace it by addr/size. It's better if
>> we might want to change the place in the memory following the guest.
>>
>> So the result function would be:
>>
>> register_mmio_handler(struct domain *d, read_t read, write_t write,
>> addr, size);
>>
> OK.
>>>
>>> #endif
>>>
>>> diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
>>> index 8616534..77b561e 100644
>>> --- a/xen/arch/arm/vgic.c
>>> +++ b/xen/arch/arm/vgic.c
>>> @@ -35,6 +35,7 @@
>>> /* Number of ranks of interrupt registers for a domain */
>>> #define DOMAIN_NR_RANKS(d) (((d)->arch.vgic.nr_lines+31)/32)
>>>
>>> +static struct mmio_handler vgic_distr_mmio_handler;
>>> /*
>>> * Rank containing GICD_<FOO><n> for GICD_<FOO> with
>>> * <b>-bits-per-interrupt
>>> @@ -107,6 +108,7 @@ int domain_vgic_init(struct domain *d)
>>> }
>>> for (i=0; i<DOMAIN_NR_RANKS(d); i++)
>>> spin_lock_init(&d->arch.vgic.shared_irqs[i].lock);
>>> + register_mmio_handler(d, &vgic_distr_mmio_handler);
>>> return 0;
>>> }
>>>
>>> @@ -673,7 +675,7 @@ static int vgic_distr_mmio_check(struct vcpu *v, paddr_t addr)
>>> return (addr >= (d->arch.vgic.dbase)) && (addr < (d->arch.vgic.dbase + PAGE_SIZE));
>>> }
>>>
>>> -const struct mmio_handler vgic_distr_mmio_handler = {
>>> +static struct mmio_handler vgic_distr_mmio_handler = {
>>
>> Why did you remove the const?
>
> I think, compiler is allowing forward declaration with const
You meant doesn't allow? If so, please move the whole structure. I'd
prefer code movement rather than removing a const because of compiler issue.
>
>>
>> [..]
>>
>>> diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
>>> index 50b9b54..23dac85 100644
>>> --- a/xen/include/asm-arm/domain.h
>>> +++ b/xen/include/asm-arm/domain.h
>>> @@ -116,6 +116,7 @@ struct arch_domain
>>> struct hvm_domain hvm_domain;
>>> xen_pfn_t *grant_table_gpfn;
>>>
>>> + struct io_handler *io_handlers;
>>
>> Why do you need a pointer here? I think can can directly use
>> struct io_handler iohandlers.
>>
> I just adds to increase the size of this arch_domain struct.
> so allocated memory at runtime.
Do you hit the page size?
Regards,
--
Julien Grall
next prev parent reply other threads:[~2014-04-04 12:59 UTC|newest]
Thread overview: 100+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-04 11:56 [PATCH v2 00/15] xen/arm: Add GICv3 support vijay.kilari
2014-04-04 11:56 ` [PATCH v2 01/15] xen/arm: register mmio handler at runtime vijay.kilari
2014-04-04 12:18 ` Julien Grall
2014-04-04 12:30 ` Vijay Kilari
2014-04-04 12:42 ` Ian Campbell
2014-04-04 12:54 ` Julien Grall
2014-04-04 12:59 ` Ian Campbell
2014-04-04 13:06 ` Julien Grall
2014-04-04 12:59 ` Julien Grall [this message]
2014-04-08 4:47 ` Vijay Kilari
2014-04-08 10:17 ` Julien Grall
2014-04-08 10:34 ` Vijay Kilari
2014-04-08 10:51 ` Julien Grall
2014-04-08 11:41 ` Vijay Kilari
2014-04-08 12:29 ` Ian Campbell
2014-04-04 15:24 ` Vijay Kilari
2014-04-04 15:27 ` Julien Grall
2014-04-08 6:35 ` Vijay Kilari
2014-04-08 10:25 ` Julien Grall
2014-04-09 15:34 ` Ian Campbell
2014-04-04 11:56 ` [PATCH v2 02/15] xen/arm: move vgic rank data to gic header file vijay.kilari
2014-04-04 13:16 ` Julien Grall
2014-04-04 15:27 ` Vijay Kilari
2014-04-04 11:56 ` [PATCH v2 03/15] arm/xen: move gic save and restore registers to gic driver vijay.kilari
2014-04-04 13:23 ` Julien Grall
2014-04-09 16:51 ` Ian Campbell
2014-04-10 4:50 ` Vijay Kilari
2014-04-10 8:32 ` Ian Campbell
2014-04-04 11:56 ` [PATCH v2 04/15] xen/arm: move gic definitions to seperate file vijay.kilari
2014-04-04 13:27 ` Julien Grall
2014-04-04 15:29 ` Vijay Kilari
2014-04-04 15:37 ` Julien Grall
2014-04-09 15:41 ` Ian Campbell
2014-04-04 11:56 ` [PATCH v2 05/15] xen/arm: segregate GIC low level functionality vijay.kilari
2014-04-04 13:55 ` Julien Grall
2014-04-09 7:43 ` Vijay Kilari
2014-04-09 8:36 ` Julien Grall
2014-04-09 15:55 ` Ian Campbell
2014-04-09 17:00 ` Ian Campbell
2014-04-09 17:07 ` Julien Grall
2014-04-10 5:24 ` Vijay Kilari
2014-04-10 8:59 ` Ian Campbell
2014-04-09 8:50 ` Julien Grall
2014-04-09 11:34 ` Vijay Kilari
2014-04-09 12:10 ` Julien Grall
2014-04-09 15:54 ` Ian Campbell
2014-04-04 11:56 ` [PATCH v2 06/15] xen/arm: move gic lock out of gic data structure vijay.kilari
2014-04-10 8:52 ` Ian Campbell
2014-04-10 9:24 ` Vijay Kilari
2014-04-10 10:02 ` Ian Campbell
2014-04-10 10:12 ` Vijay Kilari
2014-04-10 10:31 ` Ian Campbell
2014-04-04 11:56 ` [PATCH v2 07/15] xen/arm: split gic driver into generic and gic-v2 driver vijay.kilari
2014-04-10 8:58 ` Ian Campbell
2014-04-10 9:27 ` Vijay Kilari
2014-04-04 11:56 ` [PATCH v2 08/15] xen/arm: use device api to detect GIC version vijay.kilari
2014-04-04 14:07 ` Julien Grall
2014-04-09 14:28 ` Vijay Kilari
2014-04-09 14:32 ` Julien Grall
2014-04-10 9:05 ` Ian Campbell
2014-04-04 11:56 ` [PATCH v2 09/15] xen/arm: segregate VGIC low level functionality vijay.kilari
2014-04-04 14:13 ` Julien Grall
2014-04-10 9:08 ` Ian Campbell
2014-04-04 11:56 ` [PATCH v2 10/15] xen/arm: split vgic driver into generic and vgic-v2 driver vijay.kilari
2014-04-10 9:12 ` Ian Campbell
2014-04-04 11:56 ` [PATCH v2 11/15] xen/arm: make GIC context data version specific vijay.kilari
2014-04-04 14:09 ` Julien Grall
2014-04-10 9:14 ` Ian Campbell
2014-04-04 11:56 ` [PATCH v2 12/15] xen/arm: move GIC data to driver from domain structure vijay.kilari
2014-04-10 9:21 ` Ian Campbell
2014-04-04 11:56 ` [PATCH v2 13/15] xen/arm: Add support for GIC v3 vijay.kilari
2014-04-10 9:25 ` Ian Campbell
2014-04-10 10:00 ` Ian Campbell
2014-04-10 10:34 ` Julien Grall
2014-04-10 11:06 ` Vijay Kilari
2014-04-10 11:21 ` Julien Grall
2014-04-10 11:24 ` Julien Grall
2014-04-11 12:59 ` Vijay Kilari
2014-04-14 8:27 ` Ian Campbell
2014-04-14 9:52 ` Vijay Kilari
2014-04-04 11:56 ` [PATCH v2 14/15] xen/arm: Add vgic " vijay.kilari
2014-04-10 10:23 ` Ian Campbell
2014-04-10 10:43 ` Vijay Kilari
2014-04-10 10:51 ` Ian Campbell
2014-04-10 11:19 ` Vijay Kilari
2014-04-10 11:26 ` Ian Campbell
2014-04-10 11:38 ` Vijay Kilari
2014-04-10 12:08 ` Ian Campbell
2014-04-10 13:14 ` Vijay Kilari
2014-04-04 11:56 ` [PATCH v2 15/15] xen/arm: update GIC dt node with GIC v3 information vijay.kilari
2014-04-04 14:22 ` Julien Grall
2014-04-04 15:45 ` Vijay Kilari
2014-04-04 16:00 ` Julien Grall
2014-04-04 16:13 ` Vijay Kilari
2014-04-04 16:42 ` Julien Grall
2014-04-10 10:28 ` Ian Campbell
2014-04-04 13:01 ` [PATCH v2 00/15] xen/arm: Add GICv3 support Julien Grall
2014-04-04 15:56 ` Vijay Kilari
2014-04-04 16:03 ` Julien Grall
2014-04-10 8:45 ` Ian Campbell
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=533EACB0.6070604@linaro.org \
--to=julien.grall@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=Prasun.Kapoor@caviumnetworks.com \
--cc=andrii.anisov@globallogic.com \
--cc=stefano.stabellini@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=vijay.kilari@gmail.com \
--cc=vijaya.kumar@caviumnetworks.com \
--cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).