Skip to contentSkip to conversation

HYBRID: memory mapped IO

DISCUSSION Mukesh Rathor 2 participants 3 messages Feb 15, 2012

lore
Share & tools
lore
#0 lore raw

Hi Guys,

ich_force_enable_hpet() in linux wants to do mmio. It calls ioremap_pte_range to map phys addr to a VA. Xen then updates the PV dom0's L1 with requested io attributes. I'm trying to figure how to do this for PV in HVM container. I was hoping to update the EPT directly.

I was thinking of just doing guest_physmap_add_entry() but the mfn is not going to be valid. Is there any other code path that will let me do this?

Another possiblity would be handle_mmio().

thanks,
Mukesh

#1 lore raw
Quoted 6 lines · Mukesh Rathor

Hi Guys,

ich_force_enable_hpet() in linux wants to do mmio. It calls ioremap_pte_range to map phys addr to a VA. Xen then updates the PV dom0's L1 with requested io attributes. I'm trying to figure how to do this for PV in HVM container. I was hoping to update the EPT directly.

This issue is going to come up with all the PCI devices too, isn't it? Dom0 is going to read/write the PCI config space and ioremap the memory of the device, memory that is not part of the EPT pagetables yet. This issue also happens every time an HVM guest tries to remap a memory region of a passed through PCI device.
In this case QEMU calls xc_domain_memory_mapping, that in Xen becomes XEN_DOMCTL_memory_mapping, that is implemented as set_mmio_p2m_entry. So maybe you just need to call set_mmio_p2m_entry.

Quoted 2 lines

I was thinking of just doing guest_physmap_add_entry() but the mfn is not going to be valid. Is there any other code path that will let me do this?

Why the mfn is not going to be valid?
Shouldn't dom0 be able to find out exactly where the hpet is?

Quoted 1 line

Another possiblity would be handle_mmio().

I would avoid that if possible.

#2 lore raw
Quoted 3 lines · On Wed, 15 Feb 2012 11:49:59 +0000 Stefano Stabellini…

In this case QEMU calls xc_domain_memory_mapping, that in Xen becomes XEN_DOMCTL_memory_mapping, that is implemented as set_mmio_p2m_entry. So maybe you just need to call set_mmio_p2m_entry.

Exactly what I was looking for. I knew I had seen that somewhere :)...

thanks,
Mukesh