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

Re: [PATCH v6 01/12] xen/arm: enable SVE extension for Xen


  • To: Julien Grall <julien@xxxxxxx>, Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 22 May 2023 09:50:49 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=O3a09+NcwZlsRC0FzSblUFOnpkhP1QbMO8h39Tfq+F4=; b=VQcsbsROlbUlKEjZgPF5P6PF2FckjYz27x5a2xYkSSw8OiGhXHdFsBZY9dHuNK6J7x96uB6dYzm7QVhZUZw0QVsqd2I2YGLuKGzlXfhaOMI2MjCTaPhY743Iy7j23Q8oM35a8yG8PR0uMLxmAhDT+f/9win1Zn+/9MC5Qcq1QgE+chHQDKjCTNwT1YKGRro21ubRQD/Y1WGoApaEaFiRp+LPIhhA4+D16b/xFEtpKLBR5ANlWFlvRKW0sqm4Uk41kWKVQmCcuzHSeRFryyKadwGXbIz0X7yxPYe6AiYhHeXg+Ppvi1qynyNvQXXg1OV8/L+Ymq1TnUtSAL3l2rw/tw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eY0voXm2Dofmia7GeueNl11ivS6rDJ1Vky3pnsHXKX1YjgHpVU9NMTWEUn6WZwkKzN2FOfqX0o59ZeI9UXW+JQiBiyTMDi/gxaZmRXX49It9xC8OVl6i0EUjY63SYExCU1YnLZdsaVOvJYGRW0ZyfOM878TGCRlAPgzh0SOe7Md0yGMmwgiI19Na9Y5uLwqaCRNpTGzhkdgeKKwY/bFx9jCzgTFefxrpSi2pscZC1/H9wS7BnScvEbUSOdihR49+b6Md2GSpBUbHuWTXEkv3uHet2XjCYTiweQ302OG/+OGFz9owAADM4G870ugoSUy8s42VUwWp8ybqAE9mjpHZtA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 22 May 2023 07:51:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.05.2023 16:46, Julien Grall wrote:
> On 19/05/2023 15:26, Luca Fancellu wrote:
>>> On 18 May 2023, at 10:35, Julien Grall <julien@xxxxxxx> wrote:
>>>> +/*
>>>> + * Arm SVE feature code
>>>> + *
>>>> + * Copyright (C) 2022 ARM Ltd.
>>>> + */
>>>> +
>>>> +#include <xen/types.h>
>>>> +#include <asm/arm64/sve.h>
>>>> +#include <asm/arm64/sysregs.h>
>>>> +#include <asm/processor.h>
>>>> +#include <asm/system.h>
>>>> +
>>>> +extern unsigned int sve_get_hw_vl(void);
>>>> +
>>>> +register_t compute_max_zcr(void)
>>>> +{
>>>> +    register_t cptr_bits = get_default_cptr_flags();
>>>> +    register_t zcr = vl_to_zcr(SVE_VL_MAX_BITS);
>>>> +    unsigned int hw_vl;
>>>> +
>>>> +    /* Remove trap for SVE resources */
>>>> +    WRITE_SYSREG(cptr_bits & ~HCPTR_CP(8), CPTR_EL2);
>>>> +    isb();
>>>> +
>>>> +    /*
>>>> +     * Set the maximum SVE vector length, doing that we will know the VL
>>>> +     * supported by the platform, calling sve_get_hw_vl()
>>>> +     */
>>>> +    WRITE_SYSREG(zcr, ZCR_EL2);
>>>
>>>  From my reading of the Arm (D19-6331, ARM DDI 0487J.a), a direct write to 
>>> a system register would need to be followed by an context synchronization 
>>> event (e.g. isb()) before the software can rely on the value.
>>>
>>> In this situation, AFAICT, the instruciton in sve_get_hw_vl() will use the 
>>> content of ZCR_EL2. So don't we need an ISB() here?
>>
>>  From what I’ve read in the manual for ZCR_ELx:
>>
>> An indirect read of ZCR_EL2.LEN appears to occur in program order relative 
>> to a direct write of
>> the same register, without the need for explicit synchronization
>>
>> I’ve interpreted it as “there is no need to sync before write” and I’ve 
>> looked into Linux and it does not
>> Appear any synchronisation mechanism after a write to that register, but if 
>> I am wrong I can for sure
>> add an isb if you prefer.
> 
> Ah, I was reading the generic section about synchronization and didn't 
> realize there was a paragraph in the ZCR_EL2 section as well.
> 
> Reading the new section, I agree with your understanding. The isb() is 
> not necessary.

And RDVL counts as an "indirect read"? I'm pretty sure "normal" SVE insn
use is falling in that category, but RDVL might also be viewed as more
similar to MRS in this regard? While the construct CurrentVL is used in
either case, I'm still not sure this goes without saying.

Jan



 


Rackspace

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