[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] [patch] msrset/msrclr support




Applied, but I nearly missed the request :-)

Jivin John Williams lays it down ...
> Hi folks,
> 
> The latest version of the microblaze core in EDK6.2 SP1 
> (microblaze_v2_10_a) has optional support for a new pair of instructions:
> 
> msrset rd, IMM  and   msrclr rd, IMM
> 
> this pair of instructions are basically an atomic test-and-set on the 
> microblaze status register.  We lobbied Xilinx to add these on the 
> grounds of the code size reduction:
> 
> mfs	rd, rmsr
> andi	rd, rd, ~2
> mts	rmsr, rd
> 
> becomes
> 
> msrclr	r0, ~2
> 
> to clear interrupts, and similarly for enable interrupts (and caches 
> too).  Also you no longer need a scratch register when doing these 
> manipulations on the MSR.
> 
> Even better (well, in fact by design!), the msrclr instruction maps 
> directly onto the very common save_flags_cli() macro, that is sprinkled 
> liberally throughout the kernel and drivers.
> 
> The attached patch (David or Greg would you please apply?) adds optional 
> support for these new instructions.  It is selectable from the 
> configuration menu (processor options, in kernel config).
> 
> Using this option saves roughly 15kbytes of code in a typical kernel 
> image, or about 1.5 percent.  I expect there's a small performance 
> improvement as well, but haven't tried to measure it yet.
> 
> The only catch is that a gremlin in EDK6.2 (and also SP1 alas) means 
> that you have to twiddle your microblaze.mpd file to allow you to set 
> the C_USE_MSR_INSTR parameter.  It's trivial:
> 
> edit
> /edk6.2/hw/XilinxProcessorIPLib/pcores/microblaze_v2_10_a/data/microblaze_v2_1_0.mpd
> 
> add a new line (somewhere around line 50, among the other PARAMETER 
> declarations, doesn't matter):
> 
> PARAMETER C_USE_MSR_INSTR = 0, DT = integer
> 
> Finally, edit the system.mhs file of your favourite mbvanilla target, 
> and add the following in the microblaze_0 block:
> 
> PARAMETER C_USE_MSR_INSTR = 1
> 
> Enable support in the kernel as described above, make dep etc, and off 
> you go!
> 
> Congratulations if you are still reading!  Any feedback welcome.
> 
> Cheers,
> 
> John

-- 
David McCullough, davidm@snapgear.com  Ph:+61 7 34352815 http://www.SnapGear.com
Custom Embedded Solutions + Security   Fx:+61 7 38913630 http://www.uCdot.org
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@itee.uq.edu.au
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/