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

Re: [PATCH v5 2/4] xen/riscv: introduce setup_initial_pages


  • To: Oleksii <oleksii.kurochko@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 24 Apr 2023 17:35:57 +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=8L1MefyeX44jGk7haZjaW+suQtvdSDuBGojG5wUjjN4=; b=b73IoAtDmqL2ZtcarKAeZOvrw/rHT6W40RxBpMUA/zSnODKsHyiJlsSP3lorXCei9OeLN9ceuDsx5qZ1E9YfcKSF4B2QMyHb4Ij15FFbTUOdj0dwe1dxolB9lmWYPXZtL5Mf4uY1G+BaaRf2iFCCD3Rip2QwbiCgrAkLg0I6z8PJukyXp8TCQQ+hDpA6Bq9+YA+5pkM+XkTDOytGjIqH11dZa2pjPsQipO98PECy0kkwTHMLHBH9wrTzM6ARwWrslW5gCjhgu9w8XtK4HhwH82yIEkaUBgYI4uaoxGNfLO+EOpx5TfWizMLz8DdFTyA5MNvW/FDnDsHqWp1sOPZCFA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sl+4jFKU0OunTLJlTcOcqp35j9UYF+0ny+R2F2/i5/emxCFQLOZx7NWB5+cvskzpDdqa7LIjp03M1hLdhpLJePEupFmZ6BTQikSqh+gWnyGKNVVvJN4NHQjYxB5rOsA+0m2FMTpmx7cicZo/JRF3tPE2LDWE+gAQiJeoGZJAFJIFl5GhFA+OPseRLMqR1H5H8EuaHZxuvbWnLiCXB80UOGZItEqw8JKwgjm6mWzipSrdnNWJENzmtnmxbm/9NJoTml9LnMyd2pOtlMb6Ko7HL4mBvTZyey8SPHxblQWpMFbNTb7HrS8D1nUGccFgSm08emVS3c8jls3DkZM+TmaabQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Gianluca Guida <gianluca@xxxxxxxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 24 Apr 2023 15:36:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24.04.2023 17:16, Oleksii wrote:
> On Mon, 2023-04-24 at 12:18 +0200, Jan Beulich wrote:
>> On 21.04.2023 18:01, Oleksii wrote:
>>> On Thu, 2023-04-20 at 16:36 +0200, Jan Beulich wrote:
>>>> On 19.04.2023 17:42, Oleksii Kurochko wrote:
>>>>> +    csr_write(CSR_SATP,
>>>>> +              ((unsigned long)stage1_pgtbl_root >> PAGE_SHIFT)
>>>>> |
>>>>> +              satp_mode << SATP_MODE_SHIFT);
>>>>> +
>>>>> +    if ( (csr_read(CSR_SATP) >> SATP_MODE_SHIFT) == satp_mode
>>>>> )
>>>>> +        is_mode_supported = true;
>>>>> +
>>>>> +    /* Clean MMU root page table and disable MMU */
>>>>> +    stage1_pgtbl_root[index] = paddr_to_pte(0x0, 0x0);
>>>>> +
>>>>> +    csr_write(CSR_SATP, 0);
>>>>> +    asm volatile("sfence.vma");
>>>>
>>>> I guess what you do in this function could do with some more
>>>> comments.
>>>> Looks like you're briefly enabling the MMU to check that what you
>>>> wrote
>>>> to SATP you can also read back. (Isn't there a register reporting
>>>> whether the feature is available?)
>>> I supposed that it has to be but I couldn't find a register in
>>> docs.
>>
>> Well, yes, interestingly the register is marked WARL, so apparently
>> intended to by used for probing like you do. (I find the definition
>> of
>> WARL a little odd though, as such writes supposedly aren't
>> necessarily
>> value preserving. For SATP this might mean that translation is
>> enabled
>> by a write of an unsupported mode, with a different number of levels.
>> This isn't going to work very well, I'm afraid.)
> Agree. It will be an issue in case of a different number of levels.
> 
> Then it looks there is no way to check if SATP mode is supported.
> 
> So we have to rely on the fact that the developer specified
> RV_STAGE1_MODE correctly in the config file.

Well, maybe the spec could be clarified in this regard. That WARL
behavior may be okay for some registers, but as said I think it isn't
enough of a guarantee for SATP probing. Alistair, Bob - any thoughts?

Jan



 


Rackspace

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