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

Re: [Xen-ia64-devel] [Patch] [2/2] fix wrong emulation: set psr.i



Hi, Tristan

>>Quoting Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>:
>>
>>> Hi,
>>>
>>> we should not set psr.ic at setting psr.i.
>>
>>I think it was not wrong.  You can't set psr.i without setting psr.ic.  So
>>at least, this was harmless.
>>
>If so, should we check the psr.ic, and return something like Illegal 
>Operation  
>if psr.ic==0?
>
>>As this is an hyperprivop, the correct behaviour should be checked with linux
>>sources.
>Ok, I'll check it on native linux.
>
I tested setting only psr.i without psr.ic on native linux.
And I could set only psr.i.

I used the following module for the test.

-------- test code -----------
#include <linux/module.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <linux/init.h>
#include <linux/cpumask.h>
#include <asm/smp.h>

#define akio_ia64_ssm(mask)     asm volatile ("ssm %0;; srlz.i":: "i"((mask)) : 
"memory")
#define akio_ia64_rsm(mask)     asm volatile ("rsm %0;; srlz.i":: "i"((mask)) : 
"memory")

int __init psr_test_init(void)
{
        struct ia64_psr a_psr;
        struct ia64_psr b_psr;
        struct ia64_psr c_psr;
        struct ia64_psr d_psr;

        __asm__ __volatile("mov %0=psr;;":"=r"(a_psr)::"memory");
        printk("<before>: psr.i=0x%x psr.ic=0x%x\n",a_psr.i, a_psr.ic); 

        if (a_psr.i && a_psr.ic){
                akio_ia64_rsm(IA64_PSR_I|IA64_PSR_IC);
                __asm__ __volatile("mov %0=psr;;":"=r"(b_psr)::"memory");
                barrier();
                akio_ia64_ssm(IA64_PSR_I);
                __asm__ __volatile("mov %0=psr;;":"=r"(c_psr)::"memory");
                barrier();
                akio_ia64_ssm(IA64_PSR_I|IA64_PSR_IC);
                __asm__ __volatile("mov %0=psr;;":"=r"(d_psr)::"memory");
        }
        printk("<reset>: psr.i=0x%x psr.ic=0x%x\n",b_psr.i, b_psr.ic); 
        printk("<set i>: psr.i=0x%x psr.ic=0x%x\n",c_psr.i, c_psr.ic); 
        printk("<after>: psr.i=0x%x psr.ic=0x%x\n",d_psr.i, d_psr.ic); 
        return 0;
}

void __exit psr_test_exit(void)
{
 //       printk("psr_test_exit...\n");
}

module_init(psr_test_init);
module_exit(psr_test_exit);

MODULE_LICENSE("GPL");



-------- results -------------
<before>: psr.i=0x1 psr.ic=0x1
<reset>: psr.i=0x0 psr.ic=0x0
<set i>: psr.i=0x1 psr.ic=0x0
<after>: psr.i=0x1 psr.ic=0x1

Best Regards,

Akio Takebe


_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.