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

Re: [PATCH v3 4/7] xen/arm: Add handler for ID registers on arm64


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 10 Dec 2020 15:18:36 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZASlVesH782+AFLniPdwPzkyWVtP5yPWZKKhLBduk+Y=; b=kpps6bk5NCwgPd/aBdPK51dcN5ImvqP8GePpda+xrkYxxkjoUE9/c9VpCk0yKJGyqB9Mh3Bfu4ByBd/sDL+XD2nA3wIGDq17Ka2A3oyHy7hh7JvyOjqCi/eK55dqSq2tM/uAp0qSEab5K07jgHhRSooojSQcd6KozLdfthfI4Ugp6n+a58vQONBC6cq7U+hlRp2E0T8kMFN31TQYM8ox18JYq8SLAvHzxpG4jQtPdUBZLAyLMQTdfBFwGmu/YwfyX8j2hxsMN8zM4/iawIxxVfRY60MCcu14ke72gmvdO6YCSSH9JVtWSiXtS/bEshWhrjx6xIzmiNw6Dm0WCVJ8fg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oZPEWYbryKy86hAqihxwVg6TDOhnoNOZ2OOrJv5ArU209qt0MERgz2FZfwUNF6jsMIwmbJmLnQettafT43NGCwSh9txK8bVNFpJ8nPFQH7KRmnoAaLAh/wrs827Qu1j2u0T5TmmijFqQdSHWoT9MZ9AaZTEJuw1tT6J8CvWhq3xASmiOPWiSCIZ2hlDSAhu21xkE4ZNqzmEPXN/vO98I5J1WzEgerSyH0UFbpZXQ/VSDG12kW9+HXjriGkqDbhJfIEuxKCWBfzimMUvNFG1SvZKywof5k+0m/e/hMKp9Is438+RT8D7RUA6jzHrOF40FrLjinauAdJZw2pxCvGD3IA==
  • Authentication-results-original: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 10 Dec 2020 15:18:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHWzkloLLvBmqE820eVrJEh4IHR0KnvKSEAgAFJwQA=
  • Thread-topic: [PATCH v3 4/7] xen/arm: Add handler for ID registers on arm64

Hi Stefano,

> On 9 Dec 2020, at 19:38, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> On Wed, 9 Dec 2020, Bertrand Marquis wrote:
>> Add vsysreg emulation for registers trapped when TID3 bit is activated
>> in HSR.
>> The emulation is returning the value stored in cpuinfo_guest structure
>> for know registers and is handling reserved registers as RAZ.
>> 
>> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>> ---
>> Changes in V2: Rebase
>> Changes in V3:
>>  Fix commit message
>>  Fix code style for GENERATE_TID3_INFO declaration
>>  Add handling of reserved registers as RAZ.
>> 
>> ---
>> xen/arch/arm/arm64/vsysreg.c | 53 ++++++++++++++++++++++++++++++++++++
>> 1 file changed, 53 insertions(+)
>> 
>> diff --git a/xen/arch/arm/arm64/vsysreg.c b/xen/arch/arm/arm64/vsysreg.c
>> index 8a85507d9d..ef7a11dbdd 100644
>> --- a/xen/arch/arm/arm64/vsysreg.c
>> +++ b/xen/arch/arm/arm64/vsysreg.c
>> @@ -69,6 +69,14 @@ TVM_REG(CONTEXTIDR_EL1)
>>         break;                                                          \
>>     }
>> 
>> +/* Macro to generate easily case for ID co-processor emulation */
>> +#define GENERATE_TID3_INFO(reg, field, offset)                          \
>> +    case HSR_SYSREG_##reg:                                              \
>> +    {                                                                   \
>> +        return handle_ro_read_val(regs, regidx, hsr.sysreg.read, hsr,   \
>> +                          1, guest_cpuinfo.field.bits[offset]);         \
> 
> [...]
> 
>> +    HSR_SYSREG_TID3_RESERVED_CASE:
>> +        /* Handle all reserved registers as RAZ */
>> +        return handle_ro_raz(regs, regidx, hsr.sysreg.read, hsr, 1);
> 
> 
> We are implementing both the known and the implementation defined
> registers as read-as-zero. On write, we inject an exception.
> 
> However, reading the manual, it looks like the implementation defined
> registers should be read-as-zero/write-ignore, is that right?

In the documentation, I did find all those defined as RO (Arm Architecture
reference manual, chapter D12.3.1). Do you think we should handle Read
only register as write ignore ? now i think of it RO does not explicitely mean
if writes are ignored or should generate an exception.

> 
> I couldn't easily find in the manual if it is OK to inject an exception
> on write to a known register.

I am actually unsure if it should or not.
I will try to run a test to check what is happening if this is done on the
real hardware and come back to you on this one.

Cheers
Bertrand





 


Rackspace

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