|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] xen/arm: Map ITS doorbell register to IOMMU page tables
commit f9f6b22abf1d8d88c97fbc9925b274c0bb4ac881
Author: Rahul Singh <rahul.singh@xxxxxxx>
AuthorDate: Wed Jul 2 07:10:03 2025 +0000
Commit: Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Thu Jul 3 14:45:45 2025 -0700
xen/arm: Map ITS doorbell register to IOMMU page tables
When ITS is enabled and PCI devices that are behind an SMMU generate an
MSI interrupt, SMMU fault will be observed as there is currently no
mapping in p2m table for the ITS translation register (GITS_TRANSLATER).
A mapping is required in the iommu page tables so that the device can
generate the MSI interrupt writing to the GITS_TRANSLATER register.
The GITS_TRANSLATER register is a 32-bit register, and there is nothing
else in a page containing it, so map that page.
Add new host_addr parameter to vgic_v3_its_init_virtual to prepare the
foundation for DomU MSI support where guest doorbell address can differ
for the host's. Note that the 1:1 check in arm_iommu_map_page remains
for now, as virtual ITSes are currently only created for hwdom where the
doorbell mapping is always 1:1.
Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
xen/arch/arm/vgic-v3-its.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index c65c1dbf52..bc738614bb 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -1445,11 +1445,13 @@ static const struct mmio_handler_ops
vgic_its_mmio_handler = {
};
static int vgic_v3_its_init_virtual(struct domain *d, paddr_t guest_addr,
+ paddr_t host_addr,
unsigned int devid_bits,
unsigned int evid_bits)
{
struct virt_its *its;
uint64_t base_attr;
+ paddr_t host_doorbell_addr = host_addr + ITS_DOORBELL_OFFSET;
its = xzalloc(struct virt_its);
if ( !its )
@@ -1478,6 +1480,26 @@ static int vgic_v3_its_init_virtual(struct domain *d,
paddr_t guest_addr,
register_mmio_handler(d, &vgic_its_mmio_handler, guest_addr, SZ_64K, its);
+ if ( is_iommu_enabled(its->d) )
+ {
+ mfn_t mfn = maddr_to_mfn(host_doorbell_addr);
+ unsigned int flush_flags = 0;
+ int ret = iommu_map(its->d, _dfn(PFN_DOWN(its->doorbell_address)),
+ mfn, 1, IOMMUF_writable, &flush_flags);
+
+ if ( ret < 0 )
+ {
+ printk(XENLOG_G_ERR
+ "GICv3: Map ITS translation register for %pd failed.\n",
+ its->d);
+ return ret;
+ }
+
+ ret = iommu_iotlb_flush(its->d, _dfn(PFN_DOWN(its->doorbell_address)),
1, flush_flags);
+ if ( ret < 0 )
+ return ret;
+ }
+
/* Register the virtual ITS to be able to clean it up later. */
list_add_tail(&its->vits_list, &d->arch.vgic.vits_list);
@@ -1522,7 +1544,7 @@ int vgic_v3_its_init_domain(struct domain *d)
* base and thus doorbell address.
* Use the same number of device ID and event ID bits as the host.
*/
- ret = vgic_v3_its_init_virtual(d, hw_its->addr,
+ ret = vgic_v3_its_init_virtual(d, hw_its->addr, hw_its->addr,
hw_its->devid_bits,
hw_its->evid_bits);
if ( ret )
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |