[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH v2 24/26] ARM: vITS: create and initialize virtual ITSes for Dom0
For each hardware ITS create and initialize a virtual ITS for Dom0. We use the same memory mapped address to keep the doorbell working. Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> --- xen/arch/arm/vgic-its.c | 22 ++++++++++++++++++++++ xen/arch/arm/vgic-v3.c | 12 ++++++++++++ xen/include/asm-arm/domain.h | 1 + xen/include/asm-arm/gic-its.h | 13 +++++++++++++ 4 files changed, 48 insertions(+) diff --git a/xen/arch/arm/vgic-its.c b/xen/arch/arm/vgic-its.c index c130d98..2eec468 100644 --- a/xen/arch/arm/vgic-its.c +++ b/xen/arch/arm/vgic-its.c @@ -810,6 +810,28 @@ static const struct mmio_handler_ops vgic_its_mmio_handler = { .write = vgic_v3_its_mmio_write, }; +int vgic_v3_its_init_virtual(struct domain *d, struct host_its *hw_its, + paddr_t guest_addr) +{ + struct virt_its *its; + + its = xzalloc(struct virt_its); + if ( ! its ) + return -ENOMEM; + + its->d = d; + its->hw_its = hw_its; + its->baser0 = 0x7917000000000400; + its->baser1 = 0x3c01000000000400; + its->cbaser = 0x380e000000000400; + spin_lock_init(&its->vcmd_lock); + spin_lock_init(&its->its_lock); + + register_mmio_handler(d, &vgic_its_mmio_handler, guest_addr, SZ_64K, its); + + return 0; +} + /* * Local variables: * mode: C diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index a9b04ab..1c682d1 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -31,6 +31,7 @@ #include <asm/current.h> #include <asm/mmio.h> #include <asm/gic_v3_defs.h> +#include <asm/gic-its.h> #include <asm/vgic.h> #include <asm/vgic-emul.h> #include <asm/vreg.h> @@ -1644,6 +1645,7 @@ static int vgic_v3_domain_init(struct domain *d) */ if ( is_hardware_domain(d) ) { + struct host_its *hw_its; unsigned int first_cpu = 0; d->arch.vgic.dbase = vgic_v3_hw.dbase; @@ -1669,6 +1671,16 @@ static int vgic_v3_domain_init(struct domain *d) first_cpu += size / d->arch.vgic.rdist_stride; } + d->arch.vgic.nr_regions = vgic_v3_hw.nr_rdist_regions; + + list_for_each_entry(hw_its, &host_its_list, entry) + { + /* Emulate the control registers frame (lower 64K). */ + vgic_v3_its_init_virtual(d, hw_its, hw_its->addr); + + d->arch.vgic.has_its = true; + } + } else { diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index 543d058..6890b3b 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -114,6 +114,7 @@ struct arch_domain uint8_t *proptable; struct list_head its_devices; /* devices mapped to an ITS */ spinlock_t its_devices_lock; /* protects the its_devices list */ + bool has_its; #endif } vgic; diff --git a/xen/include/asm-arm/gic-its.h b/xen/include/asm-arm/gic-its.h index c5355f9..9956afb 100644 --- a/xen/include/asm-arm/gic-its.h +++ b/xen/include/asm-arm/gic-its.h @@ -130,6 +130,13 @@ void gicv3_set_redist_addr(paddr_t address, int redist_id); /* Map a collection for this host CPU to each host ITS. */ void gicv3_its_setup_collection(int cpu); +/* Create and register a virtual ITS at the given guest address. + * If a host ITS is specified, a hardware domain can reach out to that host + * ITS to deal with devices and LPI mappings and can enable/disable LPIs. + */ +int vgic_v3_its_init_virtual(struct domain *d, struct host_its *hw_its, + paddr_t guest_addr); + /* Map a device on the host by allocating an ITT on the host (ITS). * "bits" specifies how many events (interrupts) this device will need. * Setting "valid" to false deallocates the device. @@ -175,6 +182,12 @@ static inline int gicv3_its_map_device(struct domain *d, int host_devid, { return -ENODEV; } +static inline int vgic_v3_its_init_virtual(struct domain *d, + struct host_its *hw_its, + paddr_t guest_addr) +{ + return 0; +} #endif /* CONFIG_HAS_ITS */ -- 2.9.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |