[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v5 10/30] ARM: vGICv3: introduce ITS emulation stub
Create a new file to hold the emulation code for the ITS widget. This just holds the data structure and a init and free function for now. Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> --- xen/arch/arm/Makefile | 1 + xen/arch/arm/vgic-v3-its.c | 85 ++++++++++++++++++++++++++++++++++++++++ xen/arch/arm/vgic-v3.c | 3 ++ xen/include/asm-arm/gic_v3_its.h | 12 ++++++ 4 files changed, 101 insertions(+) create mode 100644 xen/arch/arm/vgic-v3-its.c diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 6be85ab..49e1fb2 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -47,6 +47,7 @@ obj-y += traps.o obj-y += vgic.o obj-y += vgic-v2.o obj-$(CONFIG_HAS_GICV3) += vgic-v3.o +obj-$(CONFIG_HAS_ITS) += vgic-v3-its.o obj-y += vm_event.o obj-y += vtimer.o obj-y += vpsci.o diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c new file mode 100644 index 0000000..94c3c44 --- /dev/null +++ b/xen/arch/arm/vgic-v3-its.c @@ -0,0 +1,85 @@ +/* + * xen/arch/arm/vgic-v3-its.c + * + * ARM Interrupt Translation Service (ITS) emulation + * + * Andre Przywara <andre.przywara@xxxxxxx> + * Copyright (c) 2016,2017 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see <http://www.gnu.org/licenses/>. + */ + +#include <xen/bitops.h> +#include <xen/config.h> +#include <xen/domain_page.h> +#include <xen/lib.h> +#include <xen/init.h> +#include <xen/softirq.h> +#include <xen/irq.h> +#include <xen/sched.h> +#include <xen/sizes.h> +#include <asm/current.h> +#include <asm/mmio.h> +#include <asm/gic_v3_defs.h> +#include <asm/gic_v3_its.h> +#include <asm/vgic.h> +#include <asm/vgic-emul.h> + +/* + * Data structure to describe a virtual ITS. + * If both the vcmd_lock and the its_lock are required, the vcmd_lock must + * be taken first. + */ +struct virt_its { + struct domain *d; + unsigned int devid_bits; + unsigned int intid_bits; + spinlock_t vcmd_lock; /* Protects the virtual command buffer, which */ + uint64_t cwriter; /* consists of CBASER and CWRITER and those */ + uint64_t creadr; /* shadow variables cwriter and creadr. */ + /* Protects the rest of this structure, including the ITS tables. */ + spinlock_t its_lock; + uint64_t cbaser; + uint64_t baser_dev, baser_coll; /* BASER0 and BASER1 for the guest */ + unsigned int max_collections; + unsigned int max_devices; + bool enabled; +}; + +/* + * An Interrupt Translation Table Entry: this is indexed by a + * DeviceID/EventID pair and is located in guest memory. + */ +struct vits_itte +{ + uint32_t vlpi; + uint16_t collection; + uint16_t pad; +}; + +void vgic_v3_its_init_domain(struct domain *d) +{ +} + +void vgic_v3_its_free_domain(struct domain *d) +{ +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index 0679e76..142eb64 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -1449,6 +1449,8 @@ static int vgic_v3_domain_init(struct domain *d) d->arch.vgic.nr_regions = rdist_count; d->arch.vgic.rdist_regions = rdist_regions; + vgic_v3_its_init_domain(d); + /* * Domain 0 gets the hardware address. * Guests get the virtual platform layout. @@ -1521,6 +1523,7 @@ static int vgic_v3_domain_init(struct domain *d) static void vgic_v3_domain_free(struct domain *d) { + vgic_v3_its_free_domain(d); xfree(d->arch.vgic.rdist_regions); } diff --git a/xen/include/asm-arm/gic_v3_its.h b/xen/include/asm-arm/gic_v3_its.h index 13b3e14..9b0c0ec 100644 --- a/xen/include/asm-arm/gic_v3_its.h +++ b/xen/include/asm-arm/gic_v3_its.h @@ -149,6 +149,10 @@ uint64_t gicv3_get_redist_address(unsigned int cpu, bool use_pta); /* Map a collection for this host CPU to each host ITS. */ int gicv3_its_setup_collection(unsigned int cpu); +/* Initialize and destroy the per-domain parts of the virtual ITS support. */ +void vgic_v3_its_init_domain(struct domain *d); +void vgic_v3_its_free_domain(struct domain *d); + int gicv3_allocate_host_lpi_block(struct domain *d, uint32_t *first_lpi); void gicv3_free_host_lpi_block(uint32_t first_lpi); @@ -191,6 +195,14 @@ static inline int gicv3_its_setup_collection(unsigned int cpu) BUG(); } +static inline void vgic_v3_its_init_domain(struct domain *d) +{ +} + +static inline void vgic_v3_its_free_domain(struct domain *d) +{ +} + #endif /* CONFIG_HAS_ITS */ #endif -- 2.8.2 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |