On 19.11.2024 15:13, Carlo Nonato wrote: > Add the cache coloring support for Xen physical space. > > Since Xen must be relocated to a new physical space, some relocation > functionalities must be brought back: > - the virtual address of the new space is taken from 0c18fb76323b > ("xen/arm: Remove unused BOOT_RELOC_VIRT_START"). > - relocate_xen() and get_xen_paddr() are taken from f60658c6ae47 > ("xen/arm: Stop relocating Xen"). > > setup_pagetables() must be adapted for coloring and for relocation. Runtime > page tables are used to map the colored space, but they are also linked in > boot tables so that the new space is temporarily available for relocation. > This implies that Xen protection must happen after the copy. > > Finally, since the alternative framework needs to remap the Xen text and > inittext sections, this operation must be done in a coloring-aware way. > The function xen_remap_colored() is introduced for that. > > Signed-off-by: Carlo Nonato <carlo.non...@minervasys.tech> > Signed-off-by: Marco Solieri <marco.soli...@minervasys.tech>
Reviewed-by: Jan Beulich <jbeul...@suse.com> # common preferably with ... > @@ -353,6 +355,22 @@ unsigned int get_max_nr_llc_colors(void) > return max_nr_colors; > } > > +mfn_t __init xen_colored_mfn(mfn_t mfn) > +{ > + unsigned int i, color = mfn_to_color(mfn); > + > + for ( i = 0; i < xen_num_colors; i++ ) > + { > + if ( color == xen_colors[i] ) > + return mfn; > + else if ( color < xen_colors[i] ) ... "else" dropped from here. Jan