[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/4] ARM: ACPI: Add ITS to hardware domain MADT
This patch adds ITS information in hardware domain's MADT table. Also this patch introduces .get_hwdom_madt_size in gic_hw_operations, to return the complete size of MADT table for hardware domain. Signed-off-by: Manish Jaggi <mjaggi@xxxxxxxxxx> --- xen/arch/arm/domain_build.c | 7 +------ xen/arch/arm/gic-v2.c | 6 ++++++ xen/arch/arm/gic-v3-its.c | 34 ++++++++++++++++++++++++++++++++++ xen/arch/arm/gic-v3.c | 18 ++++++++++++++++++ xen/arch/arm/gic.c | 11 +++++++++++ xen/include/asm-arm/gic.h | 3 +++ xen/include/asm-arm/gic_v3_its.h | 12 ++++++++++++ 7 files changed, 85 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 3abacc0..15c7f9b 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c@@ -1802,12 +1802,7 @@ static int estimate_acpi_efi_size(struct domain *d, struct kernel_info *kinfo) acpi_size = ROUNDUP(sizeof(struct acpi_table_fadt), 8); acpi_size += ROUNDUP(sizeof(struct acpi_table_stao), 8); - madt_size = sizeof(struct acpi_table_madt) - + sizeof(struct acpi_madt_generic_interrupt) * d->max_vcpus - + sizeof(struct acpi_madt_generic_distributor); - if ( d->arch.vgic.version == GIC_V3 ) - madt_size += sizeof(struct acpi_madt_generic_redistributor) - * d->arch.vgic.nr_regions; + madt_size = gic_get_hwdom_madt_size(d); acpi_size += ROUNDUP(madt_size, 8); addr = acpi_os_get_root_pointer(); diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index ffbe47c..e92dc3d 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c@@ -1012,6 +1012,11 @@ static int gicv2_iomem_deny_access(const struct domain *d) return iomem_deny_access(d, mfn, mfn + nr); } +static u32 gicv2_get_hwdom_madt_size(const struct domain *d) +{ + return 0; +} + #ifdef CONFIG_ACPI static int gicv2_make_hwdom_madt(const struct domain *d, u32 offset) { @@ -1248,6 +1253,7 @@ const static struct gic_hw_operations gicv2_ops = { .read_apr = gicv2_read_apr, .make_hwdom_dt_node = gicv2_make_hwdom_dt_node, .make_hwdom_madt = gicv2_make_hwdom_madt, + .get_hwdom_madt_size = gicv2_get_hwdom_madt_size, .map_hwdom_extra_mappings = gicv2_map_hwdown_extra_mappings, .iomem_deny_access = gicv2_iomem_deny_access, .do_LPI = gicv2_do_LPI, diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c index 98c8f46..7f8ff34 100644 --- a/xen/arch/arm/gic-v3-its.c +++ b/xen/arch/arm/gic-v3-its.c @@ -924,6 +924,40 @@ int gicv3_its_deny_access(const struct domain *d) return rc; } +#ifdef CONFIG_ACPI +u32 gicv3_its_madt_generic_translator_size(void) +{ + const struct host_its *its_data; + u32 size = 0; + + list_for_each_entry(its_data, &host_its_list, entry) + size += sizeof(struct acpi_madt_generic_translator); + + return size; +} + +u32 gicv3_its_make_hwdom_madt(u8 *base_ptr, u32 offset) +{ + struct acpi_madt_generic_translator *gic_its; + const struct host_its *its_data; + u32 table_len = offset, size; + + /* Update GIC ITS information in hardware domain's MADT */ + list_for_each_entry(its_data, &host_its_list, entry) + { + size = sizeof(struct acpi_madt_generic_translator); + gic_its = (struct acpi_madt_generic_translator *)(base_ptr + + table_len); + gic_its->header.type = ACPI_MADT_TYPE_GENERIC_TRANSLATOR; + gic_its->header.length = size; + gic_its->base_address = its_data->addr; + gic_its->translation_id = its_data->translation_id; + table_len += size; + } + + return table_len; +} +#endif /* * Create the respective guest DT nodes from a list of host ITSes.* This copies the reg property, so the guest sees the ITS at the same address diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index f6fbf2f..c7a8c1c 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c@@ -1407,9 +1407,21 @@ static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset) table_len += size; } + table_len = gicv3_its_make_hwdom_madt(base_ptr, table_len); return table_len; } +static u32 gicv3_get_hwdom_madt_size(const struct domain *d) +{ + u32 size; + size = sizeof(struct acpi_madt_generic_redistributor) + * d->arch.vgic.nr_regions; + if ( gicv3_its_host_has_its() ) + size += gicv3_its_madt_generic_translator_size(); + + return size; +} + static int __init gic_acpi_parse_madt_cpu(struct acpi_subtable_header *header, const unsigned long end)@@ -1605,6 +1617,11 @@ static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset) { return 0; } + +static u32 gicv3_get_hwdom_madt_size(const struct domain *d) +{ + return 0; +} #endif /* Set up the GIC */ @@ -1706,6 +1723,7 @@ static const struct gic_hw_operations gicv3_ops = { .secondary_init = gicv3_secondary_cpu_init, .make_hwdom_dt_node = gicv3_make_hwdom_dt_node, .make_hwdom_madt = gicv3_make_hwdom_madt, + .get_hwdom_madt_size = gicv3_get_hwdom_madt_size, .iomem_deny_access = gicv3_iomem_deny_access, .do_LPI = gicv3_do_LPI, }; diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 288e740..0bfb877 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c@@ -847,6 +847,17 @@ int gic_make_hwdom_madt(const struct domain *d, u32 offset) return gic_hw_ops->make_hwdom_madt(d, offset); } +u32 gic_get_hwdom_madt_size(const struct domain *d) +{ + u32 madt_size; + madt_size = sizeof(struct acpi_table_madt) + + sizeof(struct acpi_madt_generic_interrupt) * d->max_vcpus + + sizeof(struct acpi_madt_generic_distributor) + + gic_hw_ops->get_hwdom_madt_size(d); + + return madt_size; +} + int gic_iomem_deny_access(const struct domain *d) { return gic_hw_ops->iomem_deny_access(d); diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index 6203dc5..a766e42 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -365,6 +365,8 @@ struct gic_hw_operations { int (*make_hwdom_madt)(const struct domain *d, u32 offset);/* Map extra GIC MMIO, irqs and other hw stuffs to the hardware domain. */ int (*map_hwdom_extra_mappings)(struct domain *d); + /* Query the size of hardware domain madt table */ + u32 (*get_hwdom_madt_size)(const struct domain *d); /* Deny access to GIC regions */ int (*iomem_deny_access)(const struct domain *d); /* Handle LPIs, which require special handling */ @@ -376,6 +378,7 @@ int gic_make_hwdom_dt_node(const struct domain *d, const struct dt_device_node *gic, void *fdt); int gic_make_hwdom_madt(const struct domain *d, u32 offset); +u32 gic_get_hwdom_madt_size(const struct domain *d); int gic_map_hwdom_extra_mappings(struct domain *d); int gic_iomem_deny_access(const struct domain *d);diff --git a/xen/include/asm-arm/gic_v3_its.h b/xen/include/asm-arm/gic_v3_its.h index 84dbb9c..a629dbe 100644 --- a/xen/include/asm-arm/gic_v3_its.h +++ b/xen/include/asm-arm/gic_v3_its.h@@ -141,6 +141,8 @@ void gicv3_its_dt_init(const struct dt_device_node *node); #ifdef CONFIG_ACPI int gicv3_its_acpi_init(struct acpi_subtable_header *header, const unsigned long end); +u32 gicv3_its_madt_generic_translator_size(void); +u32 gicv3_its_make_hwdom_madt(u8 *base_ptr, u32 offset); #endif /* Deny iomem access for its */@@ -213,6 +215,16 @@ static inline int gicv3_its_acpi_init(struct acpi_subtable_header *header, { return false; } + +static inline u32 gicv3_its_madt_generic_translator_size(void) +{ + return 0; +} + +static inline u32 gicv3_its_make_hwdom_madt(u8 *base_ptr, u32 offset) +{ + return 0; +} #endif static inline int gicv3_its_deny_access(const struct domain *d) -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |