From: Auger Eric <eric.auger@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Eric Auger <eric.auger.pro@gmail.com>,
QEMU Developers <qemu-devel@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>, Andrew Jones <drjones@redhat.com>,
Wei Huang <wei@redhat.com>, Marc Zyngier <marc.zyngier@arm.com>,
Christoffer Dall <cdall@kernel.org>,
Shannon Zhao <zhaoshenglong@huawei.com>
Subject: Re: [Qemu-devel] [RFC 2/8] hw/intc/arm_gicv3: Use an array of redistributor regions
Date: Fri, 13 Apr 2018 15:36:14 +0200 [thread overview]
Message-ID: <f25aa530-3464-cf3d-a8bb-a143a757be72@redhat.com> (raw)
In-Reply-To: <CAFEAcA9nkLs3CF0=52DYWygrprgxexrz1_vf0r5RVfNYMA4H5A@mail.gmail.com>
Hi Peter,
On 13/04/18 15:27, Peter Maydell wrote:
> On 27 March 2018 at 15:15, Eric Auger <eric.auger@redhat.com> wrote:
>> In the prospect to support multiple redistributor regions,
>> let's introduce a GICv3RDISTRegion struct datatype and a
>> statically sized array of those. For the time being, only
>> one redistributor region is used.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> ---
>> hw/intc/arm_gicv3_common.c | 5 +++--
>> hw/intc/arm_gicv3_kvm.c | 3 ++-
>> include/hw/intc/arm_gicv3_common.h | 13 ++++++++++++-
>> 3 files changed, 17 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c
>> index 7b54d52..cb4ee0e 100644
>> --- a/hw/intc/arm_gicv3_common.c
>> +++ b/hw/intc/arm_gicv3_common.c
>> @@ -199,11 +199,12 @@ void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler,
>>
>> memory_region_init_io(&s->iomem_dist, OBJECT(s), ops, s,
>> "gicv3_dist", 0x10000);
>> - memory_region_init_io(&s->iomem_redist, OBJECT(s), ops ? &ops[1] : NULL, s,
>> + memory_region_init_io(&s->redist_region[0].mr, OBJECT(s),
>> + ops ? &ops[1] : NULL, s,
>> "gicv3_redist", 0x20000 * s->num_cpu);
>>
>> sysbus_init_mmio(sbd, &s->iomem_dist);
>> - sysbus_init_mmio(sbd, &s->iomem_redist);
>> + sysbus_init_mmio(sbd, &s->redist_region[0].mr);
>> }
>>
>> static void arm_gicv3_common_realize(DeviceState *dev, Error **errp)
>> diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
>> index ec37177..a07bc55 100644
>> --- a/hw/intc/arm_gicv3_kvm.c
>> +++ b/hw/intc/arm_gicv3_kvm.c
>> @@ -755,7 +755,8 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)
>>
>> kvm_arm_register_device(&s->iomem_dist, -1, KVM_DEV_ARM_VGIC_GRP_ADDR,
>> KVM_VGIC_V3_ADDR_TYPE_DIST, s->dev_fd);
>> - kvm_arm_register_device(&s->iomem_redist, -1, KVM_DEV_ARM_VGIC_GRP_ADDR,
>> + kvm_arm_register_device(&s->redist_region[0].mr, -1,
>> + KVM_DEV_ARM_VGIC_GRP_ADDR,
>> KVM_VGIC_V3_ADDR_TYPE_REDIST, s->dev_fd);
>>
>> if (kvm_has_gsi_routing()) {
>> diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h
>> index bccdfe1..3cf132f 100644
>> --- a/include/hw/intc/arm_gicv3_common.h
>> +++ b/include/hw/intc/arm_gicv3_common.h
>> @@ -137,12 +137,20 @@ typedef struct GICv3CPUState GICv3CPUState;
>> #define GICV3_S 0
>> #define GICV3_NS 1
>>
>> +#define GICV3_MAX_RDIST_REGIONS 8
>
> Where does 8 come from? Is it a limit in the kernel, or just
> a random number?
Kernel has no limit as the redist regions are handled through a list
there. 8 is purely arbitrate. I thought it was overkill to handle a list
here.
>
>> +
>> typedef struct {
>> int irq;
>> uint8_t prio;
>> int grp;
>> } PendingIrq;
>>
>> +typedef struct GICv3RDISTRegion {
>
> "GICv3RedistRegion"
>
>> + hwaddr base;
>> + uint32_t count; /* number or redistributors */
>
> "of"
>
>> + MemoryRegion mr;
>> +} GICv3RDISTRegion ;
>> +
>> struct GICv3CPUState {
>> GICv3State *gic;
>> CPUState *cpu;
>> @@ -210,7 +218,8 @@ struct GICv3State {
>> /*< public >*/
>>
>> MemoryRegion iomem_dist; /* Distributor */
>> - MemoryRegion iomem_redist; /* Redistributors */
>> + GICv3RDISTRegion redist_region[GICV3_MAX_RDIST_REGIONS];
>> + uint32_t nb_redist_regions;
>>
>> uint32_t num_cpu;
>> uint32_t num_irq;
>> @@ -288,6 +297,8 @@ typedef struct ARMGICv3CommonClass {
>>
>> void (*pre_save)(GICv3State *s);
>> void (*post_load)(GICv3State *s);
>> + /* register an RDIST region at @base, containing @pfns 64kB pages */
>> + int (*register_redist_region)(GICv3State *s, hwaddr base, uint32_t pfns);
>
> "pfn" is a kernelism (and I can never remember what it means) -- can you
> use a more comprehensible variable name, please ?
In pratice it has become count (number of redistributors within the
region) but I forgot to update the declaration here, sorry.
Thanks
Eric
>
>> } ARMGICv3CommonClass;
>>
>> void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler,
>> --
>
> thanks
> -- PMM
>
next prev parent reply other threads:[~2018-04-13 13:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 14:15 [Qemu-devel] [RFC 0/8] KVM/ARM: Relax the max 123 vcpus limitation along with KVM GICv3 Eric Auger
2018-03-27 14:15 ` [Qemu-devel] [RFC 1/8] linux-headers: Partial update for KVM/ARM multiple redistributor region registration Eric Auger
2018-03-27 14:15 ` [Qemu-devel] [RFC 2/8] hw/intc/arm_gicv3: Use an array of redistributor regions Eric Auger
2018-04-13 13:27 ` Peter Maydell
2018-04-13 13:36 ` Auger Eric [this message]
2018-03-27 14:15 ` [Qemu-devel] [RFC 3/8] kvm: Expose kvm_max_vcpus() Eric Auger
2018-03-27 14:15 ` [Qemu-devel] [RFC 4/8] hw/intc/arm_gicv3: Implement register_redist_region API Eric Auger
2018-04-13 13:34 ` Peter Maydell
2018-04-13 13:44 ` Auger Eric
2018-04-13 13:46 ` Peter Maydell
2018-04-13 13:56 ` Auger Eric
2018-03-27 14:15 ` [Qemu-devel] [RFC 5/8] hw/intc/arm_gicv3_kvm: Allow multiple redistributor regions Eric Auger
2018-03-27 14:15 ` [Qemu-devel] [RFC 6/8] hw/arm/virt: Allow GICv3 DT node with " Eric Auger
2018-04-13 13:36 ` Peter Maydell
2018-04-13 13:45 ` Auger Eric
2018-03-27 14:15 ` [Qemu-devel] [RFC 7/8] hw/arm/virt-acpi-build: Handle multiple GICR structures Eric Auger
2018-04-13 13:47 ` Andrew Jones
2018-04-13 13:55 ` Auger Eric
2018-03-27 14:15 ` [Qemu-devel] [RFC 8/8] hw/arm/virt: Allow up to 512 vcpus along with KVM VGICv3 Eric Auger
2018-03-28 4:02 ` Shannon Zhao
2018-03-28 6:47 ` Auger Eric
2018-04-13 13:41 ` Peter Maydell
2018-04-13 14:01 ` Auger Eric
2018-04-13 14:06 ` Peter Maydell
2018-04-13 14:11 ` Auger Eric
2018-04-16 9:19 ` Andrew Jones
2018-04-16 10:58 ` Peter Maydell
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=f25aa530-3464-cf3d-a8bb-a143a757be72@redhat.com \
--to=eric.auger@redhat.com \
--cc=cdall@kernel.org \
--cc=drjones@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=marc.zyngier@arm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wei@redhat.com \
--cc=zhaoshenglong@huawei.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 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).