|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 04/16] xen/riscv: add ioremap_*() variants using ioremap_attr()
Hello,
Le 06/05/2025 à 18:53, Oleksii Kurochko a écrit :
> Introduce ioremap_attr() as a shared helper to implement architecture-specific
> +#include <xen/vmap.h>
>
> #include <asm/early_printk.h>
> #include <asm/csr.h>
> @@ -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)
you probably want __iomem here
> +{
> + 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);
> +}
> +
> +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)
also here
> +{
> + return ioremap_attr(pa, len, PAGE_HYPERVISOR_NOCACHE);
> +}
Teddy
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |