[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k0b1vs7q.fsf@mpe.ellerman.id.au>
Date: Wed, 04 May 2022 14:26:17 +1000
From: Michael Ellerman <mpe@...erman.id.au>
To: Fabiano Rosas <farosas@...ux.ibm.com>,
Laurent Dufour <ldufour@...ux.ibm.com>
Cc: linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org, Nicholas Piggin <npiggin@...il.com>
Subject: Re: [PATCH v2] powerpc/rtas: Keep MSR[RI] set when calling RTAS
Fabiano Rosas <farosas@...ux.ibm.com> writes:
> Michael Ellerman <mpe@...erman.id.au> writes:
>>> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
>>> index 9581906b5ee9..65cb14b56f8d 100644
>>> --- a/arch/powerpc/kernel/entry_64.S
>>> +++ b/arch/powerpc/kernel/entry_64.S
>>> @@ -330,22 +330,18 @@ _GLOBAL(enter_rtas)
>>> clrldi r4,r4,2 /* convert to realmode address */
>>> mtlr r4
>>>
>>> - li r0,0
>>> - ori r0,r0,MSR_EE|MSR_SE|MSR_BE|MSR_RI
>>> - andc r0,r6,r0
>>> -
>>> - li r9,1
>>> - rldicr r9,r9,MSR_SF_LG,(63-MSR_SF_LG)
>>> - ori r9,r9,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP|MSR_RI|MSR_LE
>>> - andc r6,r0,r9
>>
>> One advantage of the old method is it can adapt to new MSR bits being
>> set by the kernel.
>>
>> For example we used to use RTAS on powernv, and this code didn't need
>> updating to cater to MSR_HV being set. We will probably never use RTAS
>> on bare-metal again, so that's OK.
>>
>> But your change might break secure virtual machines, because it clears
>> MSR_S whereas the old code didn't. I think SVMs did use RTAS, but I
>> don't know whether it matters if it's called with MSR_S set or not?
>>
>> Not sure if anyone will remember, or has a working setup they can test.
>> Maybe for now we just copy MSR_S from the kernel MSR the way the
>> current code does.
>
> Would the kernel even be able to change the bit? I think only urfid can
> clear MSR_S.
Good point :)
cheers
Powered by blists - more mailing lists