All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksii <oleksii.kurochko@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Alistair Francis <alistair.francis@wdc.com>,
	Bob Eshleman <bobbyeshleman@gmail.com>,
	Connor Davis <connojdavis@gmail.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	 Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
	 xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 30/39] xen/riscv: define an address of frame table
Date: Thu, 21 Dec 2023 21:59:54 +0200	[thread overview]
Message-ID: <8deb45febe3d8061bca4a8376c280befeaa00fed.camel@gmail.com> (raw)
In-Reply-To: <abacb997-99f4-49c3-b146-320cc9ff1a90@suse.com>

On Mon, 2023-12-18 at 12:22 +0100, Jan Beulich wrote:
> On 18.12.2023 11:36, Oleksii wrote:
> > On Thu, 2023-12-14 at 16:48 +0100, Jan Beulich wrote:
> > > On 24.11.2023 11:30, Oleksii Kurochko wrote:
> > > > +#define SLOTN_ENTRY_SIZE        SLOTN(1)
> > > > +
> > > >  #define XEN_VIRT_START 0xFFFFFFFFC0000000 /* (_AC(-1, UL) + 1
> > > > -
> > > > GB(1)) */
> > > > +
> > > > +#define FRAMETABLE_VIRT_START   SLOTN(196)
> > > > +#define FRAMETABLE_SIZE         GB(3)
> > > > +#define FRAMETABLE_NR           (FRAMETABLE_SIZE /
> > > > sizeof(*frame_table))
> > > > +#define FRAMETABLE_VIRT_END     (FRAMETABLE_VIRT_START +
> > > > FRAMETABLE_SIZE - 1)
> > > > +
> > > > +#define VMAP_VIRT_START         SLOTN(194)
> > > > +#define VMAP_VIRT_SIZE          GB(1)
> > > 
> > > May I suggest that you keep these blocks sorted by slot number?
> > > Or
> > > wait,
> > > the layout comment further up is also in decreasing order, so
> > > that's
> > > fine here, but then can all of this please be moved next to the
> > > comment
> > > actually providing the necessary context (thus eliminating the
> > > need
> > > for
> > > new comments)?
> > Sure, I'll put this part close to layout comment.
> > 
> > >  You'll then also notice that the generalization here
> > > (keeping basically the same layout for e.g. SATP_MODE_SV48, just
> > > shifted
> > > by 9 bits) isn't in line with the comment there.
> > Does it make sense to add another one table with updated addresses
> > for
> > SATP_MODE_SV48?
> 
> Well, especially if you mean to support that mode, its layout surely
> wants writing down. I was hoping though that maybe you/we could get
> away
> without multiple tables, but e.g. use one having multiple columns.
I came up with the following but I am not sure that it is really
convient:
/*
 * RISC-V64 Layout:
 *
#if RV_STAGE1_MODE == SATP_MODE_SV39
 *
 * 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.
#endif
 *
 *       SATP_MODE_SV32   SATP_MODE_SV39   SATP_MODE_SV48  
SATP_MODE_SV57
 *     ----------------------------------------------------------------
-----------
 * BA0 | FFFFFFFFFFE00000 | FFFFFFFFC0000000 | FFFFFF8000000000 |
FFFF000000000000
 * BA1 | 0000000019000000 | 0000003200000000 | 0000640000000000 |
00C8000000000000
 * BA2 | 0000000018800000 | 0000003100000000 | 0000620000000000 |
00C4000000000000
 * BA3 | 0000000018400000 | 0000003080000000 | 0000610000000000 |
00C2000000000000
 * 
 *
=======================================================================
=====
 * Start addr    |   End addr           |  Size  | Slot       |area
description
 *
=======================================================================
=====
 * BA0 + 0x800000 |  FFFFFFFFFFFFFFFF   |1016 MB |
L${HYP_PT_ROOT_LEVEL} 511     | Unused
 * BA0 + 0x400000 |  BA0 + 0x800000     |  2 MB  |
L${HYP_PT_ROOT_LEVEL} 511     | Fixmap
 * BA0 + 0x200000 |  BA0 + 0x400000     |  4 MB  |
L${HYP_PT_ROOT_LEVEL} 511     | FDT
 * BA0            |  BA0 + 0x200000     |  2 MB  |
L${HYP_PT_ROOT_LEVEL} 511     | Xen
 *                 ...                  |  1 GB  |
L${HYP_PT_ROOT_LEVEL} 510     | Unused
 * BA1 + 0x000000 |  BA1 + 0x4D80000000 | 309 GB |
L${HYP_PT_ROOT_LEVEL} 200-509 | Direct map
 *                 ...                  |  1 GB  |
L${HYP_PT_ROOT_LEVEL} 199     | Unused
 * BA2 + 0x000000 |  BA2 + 0xC0000000   |  3 GB  |
L${HYP_PT_ROOT_LEVEL} 196-198 | Frametable
 *                 ...                  |  1 GB  |
L${HYP_PT_ROOT_LEVEL} 195     | Unused
 * BA3 + 0x000000 |  BA3 + 0x40000000   |  1 GB  |
L${HYP_PT_ROOT_LEVEL} 194     | VMAP
 *                 ...                  | 194 GB |
L${HYP_PT_ROOT_LEVEL} 0 - 193 | Unused
 *
=======================================================================
=====
 */

Do you have better ideas?

Thanks in advamce.

~ Oleksii
> 
> 
> > Microchip has h/w which requires SATP_MODE_SV48 ( at least ), so I
> > have
> > a patch which introduces SATP_MODE_SV48 and I planned to update the
> > layout table in this patch.
> 
> 
> 



  reply	other threads:[~2023-12-21 20:00 UTC|newest]

Thread overview: 140+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-24 10:30 [PATCH v2 00/39] Enable build of full Xen for RISC-V Oleksii Kurochko
2023-11-24 10:30 ` [PATCH v2 01/39] xen/riscv: disable unnecessary configs Oleksii Kurochko
2023-12-05 15:38   ` Jan Beulich
2023-12-07  9:22     ` Oleksii
2023-12-07 10:00       ` Jan Beulich
2023-12-07 13:44         ` Oleksii
2023-12-07 14:11           ` Jan Beulich
2023-12-07 14:51             ` Oleksii
2023-12-07 15:18               ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 02/39] xen/riscv: use some asm-generic headers Oleksii Kurochko
2023-12-05 15:40   ` Jan Beulich
2023-12-07  9:36     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 03/39] xen/riscv:introduce asm/byteorder.h Oleksii Kurochko
2023-12-05 15:48   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 04/39] xen/riscv: add public arch-riscv.h Oleksii Kurochko
2023-12-14 13:20   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 05/39] xen/riscv: introduce spinlock.h Oleksii Kurochko
2023-12-05 15:53   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 06/39] xen/riscv: introduce fence.h Oleksii Kurochko
2023-12-05 15:56   ` Jan Beulich
2023-12-07  9:42     ` Oleksii
2023-12-07  9:45       ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 07/39] xen/riscv: introduce arch-riscv/hvm/save.h Oleksii Kurochko
2023-12-05 15:59   ` Jan Beulich
2023-12-07 18:09     ` Shawn Anastasio
2023-12-20 20:05     ` Oleksii
2023-12-21  7:58       ` Jan Beulich
2023-12-21  9:42         ` Oleksii
2023-11-24 10:30 ` [PATCH v2 08/39] xen/riscv: introduce asm/cpufeature.h Oleksii Kurochko
2023-12-07 14:19   ` Jan Beulich
2023-12-07 14:25     ` Jan Beulich
2023-12-08  9:21       ` Oleksii
2023-11-24 10:30 ` [PATCH v2 09/39] xen/riscv: introduce asm/guest_atomics.h Oleksii Kurochko
2023-12-07 14:20   ` Jan Beulich
2023-12-08  9:22     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 10/39] xen/riscv: introduce asm/iommu.h Oleksii Kurochko
2023-12-07 14:22   ` Jan Beulich
2023-12-08  9:29     ` Oleksii
2023-12-08 10:21       ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 11/39] xen/riscv: introduce asm/nospec.h Oleksii Kurochko
2023-12-07 14:28   ` Jan Beulich
2023-12-08  9:33     ` Oleksii
2023-12-08 10:23       ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 12/39] xen/riscv: introduce asm/setup.h Oleksii Kurochko
2023-12-07 14:29   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 13/39] xen/riscv: introduce asm/system.h Oleksii Kurochko
2023-12-07 15:07   ` Jan Beulich
2023-12-08  9:43     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 14/39] xen/riscv: introduce bitops.h Oleksii Kurochko
2023-12-07 15:37   ` Jan Beulich
2023-12-08  9:50     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 15/39] xen/riscv: introduce flushtlb.h Oleksii Kurochko
2023-12-07 15:39   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 16/39] xen/riscv: introduce asm/smp.h Oleksii Kurochko
2023-12-07 15:43   ` Jan Beulich
2023-12-08  9:53     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 17/39] xen/riscv: introduce asm/atomic.h Oleksii Kurochko
2023-12-07 15:57   ` Jan Beulich
2023-12-21 15:11     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 18/39] xen/riscv: introduce cmpxchg.h Oleksii Kurochko
2023-12-12 16:51   ` Jan Beulich
2023-12-12 17:14     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 19/39] xen/riscv: introduce asm/io.h Oleksii Kurochko
2023-12-12 16:56   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 20/39] xen/riscv: define bug frame tables in xen.lds.S Oleksii Kurochko
2023-12-12 16:57   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 21/39] xen/riscv: introduce bit operations Oleksii Kurochko
2023-12-14 13:27   ` Jan Beulich
2023-12-18  9:56     ` Oleksii
2023-12-18 10:06       ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 22/39] xen/riscv: introduce asm/domain.h Oleksii Kurochko
2023-12-14 13:41   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 23/39] xen/riscv: introduce asm/guest_access.h Oleksii Kurochko
2023-12-14 14:06   ` Jan Beulich
2023-12-18 10:02     ` Oleksii
2023-12-18 10:10       ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 24/39] xen/riscv: introduce asm/irq.h Oleksii Kurochko
2023-12-14 14:09   ` Jan Beulich
2023-12-18 10:04     ` Oleksii
2023-12-18 10:12       ` Jan Beulich
2023-12-18 11:42         ` Oleksii
2023-11-24 10:30 ` [PATCH v2 25/39] xen/riscv: introduce asm/p2m.h Oleksii Kurochko
2023-12-14 14:19   ` Jan Beulich
2023-12-18 10:06     ` Oleksii
2023-12-14 15:01   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 26/39] xen/riscv: introduce asm/regs.h Oleksii Kurochko
2023-12-14 15:05   ` Jan Beulich
2023-12-18 10:08     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 27/39] xen/riscv: introduce asm/time.h Oleksii Kurochko
2023-12-14 15:06   ` Jan Beulich
2023-12-18 10:09     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 28/39] xen/riscv: introduce asm/event.h Oleksii Kurochko
2023-12-14 15:08   ` Jan Beulich
2023-12-18 10:10     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 29/39] xen/riscv: add definition of __read_mostly Oleksii Kurochko
2023-12-12 17:04   ` Jan Beulich
2023-12-21 15:23     ` Andrew Cooper
2024-01-04 13:56       ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 30/39] xen/riscv: define an address of frame table Oleksii Kurochko
2023-12-14 15:48   ` Jan Beulich
2023-12-18 10:36     ` Oleksii
2023-12-18 11:22       ` Jan Beulich
2023-12-21 19:59         ` Oleksii [this message]
2023-12-22  8:08           ` Jan Beulich
2023-12-22  9:16             ` Oleksii
2023-11-24 10:30 ` [PATCH v2 31/39] xen/riscv: add required things to asm/current.h Oleksii Kurochko
2023-12-14 15:55   ` Jan Beulich
2023-12-18 10:39     ` Oleksii
2023-12-18 11:28       ` Jan Beulich
2023-12-18 11:44         ` Oleksii
2023-11-24 10:30 ` [PATCH v2 32/39] xen/riscv: add minimal stuff to asm/page.h to build full Xen Oleksii Kurochko
2023-12-14 15:57   ` Jan Beulich
2023-12-18 10:45     ` Oleksii
2023-12-18 11:36       ` Jan Beulich
2023-12-18 11:57         ` Oleksii
2023-12-18 12:05           ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 33/39] xen/riscv: add minimal stuff to asm/processor.h " Oleksii Kurochko
2023-12-14 16:04   ` Jan Beulich
2023-12-18 10:49     ` Oleksii
2023-12-18 11:38       ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 34/39] xen: add RISCV support for pmu.h Oleksii Kurochko
2023-12-14 16:16   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 35/39] xen: add necessary headers to common to build full Xen for RISC-V Oleksii Kurochko
2023-12-14 16:20   ` Jan Beulich
2023-12-18 11:03     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 36/39] xen/riscv: add minimal stuff to asm/mm.h to build full Xen Oleksii Kurochko
2023-12-14 17:08   ` Jan Beulich
2023-12-18 11:35     ` Oleksii
2023-11-24 10:30 ` [PATCH v2 37/39] xen/rirscv: add minimal amount of stubs " Oleksii Kurochko
2023-12-18 17:00   ` Jan Beulich
2023-12-20 12:55     ` Oleksii
2023-12-21  8:02       ` Jan Beulich
2023-12-21 18:47         ` Oleksii
2023-11-24 10:30 ` [PATCH v2 38/39] xen/riscv: enable full Xen build Oleksii Kurochko
2023-12-18 15:28   ` Jan Beulich
2023-11-24 10:30 ` [PATCH v2 39/39] xen: fix compilation issue of serial.c Oleksii Kurochko
2023-12-14 16:24   ` Jan Beulich
2023-12-14 16:40     ` Oleksii
2023-12-07 14:30 ` [PATCH v2 00/39] Enable build of full Xen for RISC-V Jan Beulich
2023-12-08  9:56   ` Oleksii

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=8deb45febe3d8061bca4a8376c280befeaa00fed.camel@gmail.com \
    --to=oleksii.kurochko@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bobbyeshleman@gmail.com \
    --cc=connojdavis@gmail.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.