From: cov@codeaurora.org (Christopher Covington)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2] arm64: KVM: Fix HCR_EL2 and VTCR_EL2 configuration bits
Date: Mon, 13 May 2013 13:16:51 -0400 [thread overview]
Message-ID: <51912003.6080406@codeaurora.org> (raw)
In-Reply-To: <fae8138d41c55928a3c71b7073aea3b0@localhost>
On 05/13/2013 12:02 PM, Marc Zyngier wrote:
> On Mon, 13 May 2013 11:23:05 -0400, Christopher Covington
> <cov@codeaurora.org> wrote:
>> Hi Pranavkumar,
>>
>> On 05/10/2013 03:23 AM, Pranavkumar Sawargaonkar wrote:
>>> This patch does following fixes:
>>>
>>> 1. Make HCR_* flags as unsigned long long constants
>>> Reason : By default, compiler assumes numeric constants as
>>> signed hence sign extending it when assigned to unsigned variable
>>> such as hcr_el2 (in VCPU context). This accidently sets HCR_ID and
>>> HCR_CD making entire guest memory non-cacheable. On real HW, this
>>> breaks Stage2 ttbl walks and also breaks VirtIO.
>>>
>>> 2. VTCR_EL2_ORGN0_WBWA and VTCR_EL2_IRGN0_WBWA macros.
>>>
>>> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
>>> Signed-off-by: Anup Patel <anup.patel@linaro.org>
>>> ---
>>> arch/arm64/include/asm/kvm_arm.h | 73
>>> +++++++++++++++++++-------------------
>>> 1 file changed, 37 insertions(+), 36 deletions(-)
>>>
>>> diff --git a/arch/arm64/include/asm/kvm_arm.h
>>> b/arch/arm64/include/asm/kvm_arm.h
>>> index 8ced0ca..14ead69 100644
>>> --- a/arch/arm64/include/asm/kvm_arm.h
>>> +++ b/arch/arm64/include/asm/kvm_arm.h
>>> @@ -18,44 +18,45 @@
>>> #ifndef __ARM64_KVM_ARM_H__
>>> #define __ARM64_KVM_ARM_H__
>>>
>>> +#include <linux/const.h>
>>> #include <asm/types.h>
>>>
>>> /* Hyp Configuration Register (HCR) bits */
>>> -#define HCR_ID (1 << 33)
>>> -#define HCR_CD (1 << 32)
>>> +#define HCR_ID (UL(0x1) << 33)
>>> +#define HCR_CD (UL(0x1) << 32)
>>
>> Consider using the BIT() macro from linux/bitops.h to improve
> readability.
>
> This would probably cause problems when using these macros from assembly
> code.
It does indeed cause problems. What a shame. How about a quick local
definition, to perhaps be eventually replaced by a more accessible shared
definition?
Christopher
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.
next prev parent reply other threads:[~2013-05-13 17:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-10 7:23 [PATCH V2] arm64: KVM: Fix HCR_EL2 and VTCR_EL2 configuration bits Pranavkumar Sawargaonkar
2013-05-13 15:23 ` Christopher Covington
2013-05-13 16:02 ` Marc Zyngier
2013-05-13 17:16 ` Christopher Covington [this message]
2013-05-14 6:52 ` Pranavkumar Sawargaonkar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51912003.6080406@codeaurora.org \
--to=cov@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).