On 07.09.21 15:39, Dongjiu Geng wrote:
> Hi,
>        sorry to disturb you,  I have a question to consult  with you,
> why does Jailhouse not call paging_destroy() to unmap the address when
> it finishes accessing the physical address?  as shown in [1] that
> handing mmio subpage access.
> I think it is better to unmap the address after finishing MMIO access.
> 
> [1]:
> static enum mmio_result mmio_handle_subpage(void *arg, struct mmio_access 
> *mmio)
> {
>        ........
>         err = paging_create(&this_cpu_data()->pg_structs, page_phys, 
> PAGE_SIZE,
>                             TEMPORARY_MAPPING_BASE,
>                             PAGE_DEFAULT_FLAGS | PAGE_FLAG_DEVICE,
>                             PAGING_NON_COHERENT | PAGING_NO_HUGE);
>         if (err)
>                 goto invalid_access;
>         ....................
>         return MMIO_HANDLED;
> 
> invalid_access:
>         panic_printk("FATAL: Invalid MMIO %s, address: %lx, size: %x\n",
>                      mmio->is_write ? "write" : "read",
>                      (unsigned long)mem->phys_start + mmio->address,
>                      mmio->size);
>         return MMIO_ERROR;
> }
> 

We never unmap those CPU-local temporary mappings, we only overwrite
them as needed. Theoretically, we could invalidate the mapping after
use, but that would also require related TLB invalidation and would add
to the overhead. Without a significant gain on robustness, this step is
not really desirable. It's always a trade-off...

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/184b52e1-2ebe-6b4d-39e4-d7861f3001cc%40siemens.com.

Reply via email to