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

Re: [PATCH v6 1/4] xen/riscv: add VM space layout


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 4 May 2023 10:10:52 +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=x8lYMg19hUZpAHP16/2jCnOsXiBiDA/1TpD45NDmil0=; b=UQVeJ8fq9plHWzZyGFLpAjVkLEGYaAxrDlKsUDTg6KQjdalxClqL+Y/zgx6TKG8IpPDYpnjlu2toX2eIgePGKFQO6y+NqmXkorQKBBX7DnAPiqMGVo++Fpua2we7uC2BbXJWsWMT5WY0yt1oj2mgG5iKqqVrjBhtGKvjbA36SpmzQTFgKrMkccjCbmXa1ayzZfKg9SDH8Pgm2Gw617Os1rR1hmotUyW603xkHy7Ogwfqrps/TUE9r/VM6hKnbTOKidcLQb8k3aLmi5tJonmssTL6miAejKG9LGWgY6xp82Vl9yx9WxOo1vDCLcRmHiTc4qA1dwT477LYDCN/L9+sSQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AFoLyuR9hyHT2W5nm8VTPIDjrmNv4CbA15hI38VL2cUiNV3g5vQJZP9+AZSj3zpGYjQKg6fIFTIvzHKAtTPKwBg3uhTnqDBN04gT4TIAZHD+vKOE4r0aR3SssZ0eXCOf0Pi0cdq/u9ELgXzdJqGkx+CX7zSFjsOyO0OVv+VMsAoo/ybu8FwvHjbMdlDp39aj5KeQTLKihI0VnbNWwekplTl/05y+G65SY67HCsXRIGUc39JlpFUWU/suFBPSD2sZNIvJDuZ5y8SuGRS9ZlVCQD8A0uzrd0kXWJNnF1NvG7YEjI7WjcnO7Qjriln7vdOD9Rmg1lW9oz6xcjw09Xrdlg==
  • 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>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 04 May 2023 08:11:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03.05.2023 18:31, Oleksii Kurochko wrote:
> --- a/xen/arch/riscv/include/asm/config.h
> +++ b/xen/arch/riscv/include/asm/config.h
> @@ -4,6 +4,37 @@
>  #include <xen/const.h>
>  #include <xen/page-size.h>
>  
> +/*
> + * RISC-V64 Layout:
> + *
> + * From the riscv-privileged doc:
> + *   When mapping between narrower and wider addresses,
> + *   RISC-V zero-extends a narrower physical address to a wider size.
> + *   The mapping between 64-bit virtual addresses and the 39-bit usable
> + *   address space of Sv39 is not based on zero-extension but instead
> + *   follows an entrenched convention that allows an OS to use one or
> + *   a few of the most-significant bits of a full-size (64-bit) virtual
> + *   address to quickly distinguish user and supervisor address regions.
> + *
> + * It means that:
> + *   top VA bits are simply ignored for the purpose of translating to PA.
> + *
> + * 
> ============================================================================
> + *    Start addr    |   End addr        |  Size  | Slot       |area 
> description
> + * 
> ============================================================================
> + * FFFFFFFFC0000000 |  FFFFFFFFC0200000 |  2 MB  | L2 511     | Xen
> + * FFFFFFFFC0200000 |  FFFFFFFFC0600000 |  4 MB  | L2 511     | FDT
> + * FFFFFFFFC0600000 |  FFFFFFFFC0800000 |  2 MB  | L2 511     | Fixmap
> + *                 ...                  |  1 GB  | L2 510     | Unused
> + * 0000003200000000 |  0000007f40000000 | 331 GB | L2 200-609 | Direct map

I guess the upper value is 509 here?

> + *                 ...                  |  1 GB  | L2 199     | Unused
> + * 0000003100000000 |  0000003140000000 |  3 GB  | L2 196-198 | Frametable

The two leftmost columns cover 1Gb only.

> + *                 ...                  |  1 GB  | L2 195     | Unused
> + * 0000003080000000 |  00000030c0000000 |  1 GB  | L2 194     | VMAP
> + *     .................. unused ..................
> + * 
> ============================================================================
> + */

Two more remarks: This map is, aiui, Sv39-specific. The quotation from the
doc doesn't really imply that, so I'd suggest to add something to make this
explicit. This might be as simple as a suitable #ifdef around or inside
the comment (even inside I think it'll be easily understood what it means;
see e.g. the CONFIG_BIGMEM conditional in x86'es table).

The other oddity here is the sorting of entries: You sort downwards by L2
slot, but upwards within slot 511. Once suitably re-ordered it'll become
apparent that there's another "unused" row missing (or perhaps even two).

Jan



 


Rackspace

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