--- /dev/null
+/*
+ * xen/arch/arm/vgic-v3-its.c
+ *
+ * ARM Interrupt Translation Service (ITS) emulation
+ *
+ * Andre Przywara <andre.przywara@arm.com>
+ * 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 CWRITER and CREADR 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;
+};
+
+int vgic_v3_its_init_domain(struct domain *d)
+{
+ return 0;
+}
+
+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:
+ */
#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>
#include <asm/vreg.h>
static int vgic_v3_domain_init(struct domain *d)
{
struct vgic_rdist_region *rdist_regions;
- int rdist_count, i;
+ int rdist_count, i, ret;
/* Allocate memory for Re-distributor regions */
rdist_count = vgic_v3_rdist_count(d);
d->arch.vgic.rdist_regions[0].first_cpu = 0;
}
+ ret = vgic_v3_its_init_domain(d);
+ if ( ret )
+ return ret;
+
/* Register mmio handle for the Distributor */
register_mmio_handler(d, &vgic_distr_mmio_handler, d->arch.vgic.dbase,
SZ_64K, NULL);
static void vgic_v3_domain_free(struct domain *d)
{
+ vgic_v3_its_free_domain(d);
xfree(d->arch.vgic.rdist_regions);
}
/* 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. */
+int 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);
BUG();
}
+static inline int vgic_v3_its_init_domain(struct domain *d)
+{
+ return 0;
+}
+
+static inline void vgic_v3_its_free_domain(struct domain *d)
+{
+}
+
#endif /* CONFIG_HAS_ITS */
#endif