On 06.05.2025 18:51, Oleksii Kurochko wrote:
> @@ -583,3 +584,36 @@ void *__init arch_vmap_virt_end(void)
>  {
>      return (void *)(VMAP_VIRT_START + VMAP_VIRT_SIZE);
>  }
> +
> +static void *ioremap_attr(paddr_t start, size_t len, pte_attr_t attributes)
> +{
> +    mfn_t mfn = _mfn(PFN_DOWN(start));
> +    unsigned int offs = start & (PAGE_SIZE - 1);
> +    unsigned int nr = PFN_UP(offs + len);
> +    void *ptr = __vmap(&mfn, nr, 1, 1, attributes, VMAP_DEFAULT);
> +
> +    if ( ptr == NULL )
> +        return NULL;
> +
> +    return ptr + offs;
> +}
> +
> +void __iomem *ioremap_nocache(paddr_t start, size_t len)
> +{
> +    return ioremap_attr(start, len, PAGE_HYPERVISOR_NOCACHE);
> +}

Why do you need both this and ...

> +void __iomem *ioremap_cache(paddr_t start, size_t len)
> +{
> +    return ioremap_attr(start, len, PAGE_HYPERVISOR);
> +}
> +
> +void __iomem *ioremap_wc(paddr_t start, size_t len)
> +{
> +    return ioremap_attr(start, len, PAGE_HYPERVISOR_WC);
> +}
> +
> +void *ioremap(paddr_t pa, size_t len)
> +{
> +    return ioremap_attr(pa, len, PAGE_HYPERVISOR_NOCACHE);
> +}

... this? And why's the 1st parameter named differently for this last
one? Can't they all be in sync in this regard?

Jan

Reply via email to