From: Julien Grall <julien.grall@arm.com>
To: xen-devel@lists.xenproject.org
Cc: andre.przywara@arm.com, Julien Grall <julien.grall@arm.com>,
sstabellini@kernel.org, shameerali.kolothum.thodi@huawei.com
Subject: [PATCH 2/3] xen/arm: vgic-v3: Don't create empty re-distributor regions
Date: Tue, 4 Sep 2018 20:21:52 +0100 [thread overview]
Message-ID: <20180904192153.17210-3-julien.grall@arm.com> (raw)
In-Reply-To: <20180904192153.17210-1-julien.grall@arm.com>
At the moment, Xen is assuming the hardware domain will have the same
number of re-distributor regions as the host. However, as the
number of CPUs or the stride (e.g on GICv4) may be different we end up
exposing regions which does not contain any re-distributors.
When booting, Linux will go through all the re-distributor region to
check whether a property (e.g vPLIs) is available accross all the
re-distributors. This will result to a data abort on empty regions
because there are no underlying re-distributor.
So we need to limit the number of regions exposed to the hardware
domain. The code reworked to only expose the minimun number of regions
required by the hardware domain. It is assumed the regions will be
populated starting from the first one.
Reported-by: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
xen/arch/arm/gic-v3.c | 10 ++++++++--
xen/arch/arm/vgic-v3.c | 11 +++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index b2ed0f8b55..4a984cfb12 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1274,8 +1274,10 @@ static int gicv3_make_hwdom_dt_node(const struct domain *d,
* GIC has two memory regions: Distributor + rdist regions
* CPU interface and virtual cpu interfaces accessesed as System registers
* So cells are created only for Distributor and rdist regions
+ * The hardware domain may not used all the regions. So only copy
+ * what is necessary.
*/
- new_len = new_len * (gicv3.rdist_count + 1);
+ new_len = new_len * (d->arch.vgic.nr_regions + 1);
hw_reg = dt_get_property(gic, "reg", &len);
if ( !hw_reg )
@@ -1503,7 +1505,11 @@ static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)
/* Add Generic Redistributor */
size = sizeof(struct acpi_madt_generic_redistributor);
- for ( i = 0; i < gicv3.rdist_count; i++ )
+ /*
+ * The hardware domain may not used all the regions. So only copy
+ * what is necessary.
+ */
+ for ( i = 0; i < d->arch.vgic.nr_regions; i++ )
{
gicr = (struct acpi_madt_generic_redistributor *)(base_ptr + table_len);
gicr->header.type = ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR;
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index df1bab3a35..9f729862da 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -1695,8 +1695,19 @@ static int vgic_v3_real_domain_init(struct domain *d)
d->arch.vgic.rdist_regions[i].first_cpu = first_cpu;
first_cpu += size / GICV3_GICR_SIZE;
+
+ if ( first_cpu >= d->max_vcpus )
+ break;
}
+ /*
+ * The hardware domain may not used all the re-distributors
+ * regions (e.g when the number of vCPUs does not match the
+ * number of pCPUs). Update the number of regions to avoid
+ * exposing unused region as they will not get emulated.
+ */
+ d->arch.vgic.nr_regions = i + 1;
+
d->arch.vgic.intid_bits = vgic_v3_hw.intid_bits;
}
else
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-09-04 19:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-04 19:21 [PATCH 0/3] xen/arm: vgic-v3: Bug fixes Julien Grall
2018-09-04 19:21 ` [PATCH 1/3] [not-for-unstable] xen/arm: vgic-v3: Delay the initialization of the domain information Julien Grall
2018-09-04 19:35 ` Julien Grall
2018-09-04 19:53 ` Andrew Cooper
2018-09-05 13:25 ` Julien Grall
2018-09-25 20:45 ` Stefano Stabellini
2018-09-26 20:14 ` Julien Grall
2018-09-27 23:11 ` Stefano Stabellini
2018-09-28 20:35 ` Julien Grall
2018-09-28 23:38 ` Andrew Cooper
2018-09-28 23:45 ` Stefano Stabellini
2018-09-28 23:48 ` Andrew Cooper
2018-10-01 9:43 ` Julien Grall
2018-10-01 9:53 ` Andrew Cooper
2018-10-01 11:31 ` Julien Grall
2018-09-04 19:21 ` Julien Grall [this message]
2018-09-25 20:38 ` [PATCH 2/3] xen/arm: vgic-v3: Don't create empty re-distributor regions Stefano Stabellini
2018-09-26 20:36 ` Julien Grall
2018-09-27 23:34 ` Stefano Stabellini
2018-09-28 20:37 ` Julien Grall
2018-09-28 23:46 ` Stefano Stabellini
2018-09-04 19:21 ` [PATCH 3/3] xen/arm: vgic-v3-its: Make vgic_v3_its_free_domain idempotent Julien Grall
2018-09-25 20:08 ` Stefano Stabellini
2018-09-06 15:49 ` [PATCH 0/3] xen/arm: vgic-v3: Bug fixes Shameerali Kolothum Thodi
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=20180904192153.17210-3-julien.grall@arm.com \
--to=julien.grall@arm.com \
--cc=andre.przywara@arm.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=sstabellini@kernel.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 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).