All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Romain Caritey" <Romain.Caritey@microchip.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Connor Davis" <connojdavis@gmail.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 06/23] xen/riscv: introduce guest riscv,isa string
Date: Wed, 24 Jun 2026 12:43:16 +0200	[thread overview]
Message-ID: <29fbbfe2-579c-4506-96d8-930c03a65c61@gmail.com> (raw)
In-Reply-To: <aa19d6b0-9407-423b-a786-a43a72b50df5@suse.com>



On 6/22/26 4:09 PM, Jan Beulich wrote:
> On 17.06.2026 13:17, Oleksii Kurochko wrote:
>> Introduce generation of the riscv,isa string passed to the guest via the
>> Device Tree riscv,isa property.
>>
>> Introduce the per-domain isa string and guest isa bitmap, populated
>> during domain creation by calling init_guest_isa().
>>
>> Introduce guest_unsupp to filter out ISA extensions that should not be
>> exposed to guests:
>>
>> - f/d/q/v: FPU and vector context save/restore are not yet implemented
>>    for guests.
> 
> I may have asked before - what about Zfinx, Zdinx (and the supposed Zqinx)?
> They aren't in riscv_isa_ext[], yes, but perhaps wrongly so? And hence they
> may want at least mentioning?

They are not supported by Xen so they aren't in riscv_isa_ext so it 
looks fine for me.

They are not in guest_unsupp as they aren't present in riscv_isa_ext and 
so it won't be propagated to guest anyway because of:
   +    bitmap_andnot(d->arch.isa, riscv_isa, guest_unsupp,
   +                  RISCV_ISA_EXT_MAX);

While it isn't in riscv_isa_ext[] I think it is fine not to add them to 
guest_unsupp, so I will add to the commit message that:
```
- Zfinx, Zdinx and Zqinx are not implemented for guests either; as they 
are not present in the riscv_isa_ext[] array, they can never be set in 
riscv_isa and thus are never exposed to a guest, so there is no need to 
list them explicitly in guest_unsupp.
```

I think it is fine for now but probably it will need to be reworked in 
future.


> 
>> @@ -480,6 +489,78 @@ bool riscv_isa_extension_available(const unsigned long *isa_bitmap,
>>       return test_bit(id, isa_bitmap);
>>   }
>>   
>> +static int build_guest_isa_str(char *buf, size_t size,
>> +                               const unsigned long *isa_bitmap)
>> +{
>> +    int total;
>> +
>> +#if defined(CONFIG_RISCV_32)
>> +    total = snprintf(buf, size, "rv32");
>> +#elif defined(CONFIG_RISCV_64)
>> +    total = snprintf(buf, size, "rv64");
>> +#else
>> +#   error "Unsupported RISC-V bitness"
>> +#endif
>> +
>> +    if ( total < 0 )
>> +        return total;
>> +
>> +    for ( unsigned int i = 0; i < ARRAY_SIZE(riscv_isa_ext); i++ )
>> +    {
>> +        const struct riscv_isa_ext_data *ext = &riscv_isa_ext[i];
>> +        int ret;
>> +
>> +        if ( !riscv_isa_extension_available(isa_bitmap, ext->id) )
>> +            continue;
>> +
>> +        ret = snprintf(buf ? buf + total : NULL,
>> +                       buf ? size - total : 0, "%s%s",
> 
> If total > size this subtraction will underflow and a huge value will be
> passed to snprintf().

I will add the check before for():

if ( buf && ((size_t)total >= size) )
     return -ENOSPC;

Thanks.

~ Oleksii


  reply	other threads:[~2026-06-24 10:43 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 11:17 [PATCH v3 00/23] Introduce enablemenant of dom0less Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 01/23] xen: arm: move declaration of map_device_irqs_to_domain() to common header Oleksii Kurochko
2026-06-24  7:02   ` Orzel, Michal
2026-06-24  9:00     ` Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 02/23] xen: arm: update p2m_set_allocation() prototype Oleksii Kurochko
2026-06-23 11:29   ` Andrew Cooper
2026-06-24  9:31     ` Oleksii Kurochko
2026-06-24  7:32   ` Orzel, Michal
2026-06-24  9:40     ` Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 03/23] xen/riscv: Implement ARCH_PAGING_MEMPOOL Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 04/23] xen/riscv: Implement construct_domain() Oleksii Kurochko
2026-06-17 11:26   ` Jan Beulich
2026-06-17 11:48     ` Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 05/23] xen/riscv: implement prerequisites for domain_create() Oleksii Kurochko
2026-06-22 13:34   ` Jan Beulich
2026-06-17 11:17 ` [PATCH v3 06/23] xen/riscv: introduce guest riscv,isa string Oleksii Kurochko
2026-06-22 14:09   ` Jan Beulich
2026-06-24 10:43     ` Oleksii Kurochko [this message]
2026-06-24 12:40       ` Jan Beulich
2026-06-17 11:17 ` [PATCH v3 07/23] xen/riscv: implement make_cpus_node() Oleksii Kurochko
2026-06-22 14:23   ` Jan Beulich
2026-06-24 10:45     ` Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 08/23] xen/riscv: implement make_timer_node() Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 09/23] xen/riscv: implement make_arch_nodes() Oleksii Kurochko
2026-06-17 11:30   ` Jan Beulich
2026-06-17 11:49     ` Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 10/23] xen/riscv: introduce init interrupt controller operations Oleksii Kurochko
2026-06-22 14:30   ` Jan Beulich
2026-06-24 11:34     ` Oleksii Kurochko
2026-06-24 12:47       ` Jan Beulich
2026-06-17 11:17 ` [PATCH v3 11/23] xen/riscv: implement make_intc_domU_node() Oleksii Kurochko
2026-06-22 14:34   ` Jan Beulich
2026-06-24 11:36     ` Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 12/23] xen/riscv: introduce aia_init() and aia_usable() Oleksii Kurochko
2026-06-22 14:36   ` Jan Beulich
2026-06-17 11:17 ` [PATCH v3 13/23] xen/riscv: introduce per-vCPU IMSIC state Oleksii Kurochko
2026-06-22 14:46   ` Jan Beulich
2026-06-24 11:55     ` Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 14/23] xen/riscv: add very early virtual APLIC (vAPLIC) initialization support Oleksii Kurochko
2026-06-22 14:55   ` Jan Beulich
2026-06-24 12:33     ` Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 15/23] xen/riscv: introduce (de)initialization helpers for vINTC Oleksii Kurochko
2026-06-22 15:01   ` Jan Beulich
2026-06-24 13:19     ` Oleksii Kurochko
2026-06-24 13:27       ` Jan Beulich
2026-06-17 11:17 ` [PATCH v3 16/23] xen/riscv: generate IMSIC DT node for guest domains Oleksii Kurochko
2026-06-17 11:24   ` Oleksii Kurochko
2026-06-22 15:12   ` Jan Beulich
2026-06-24 13:25     ` Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 17/23] xen/riscv: create APLIC " Oleksii Kurochko
2026-06-17 11:24   ` Oleksii Kurochko
2026-06-22 15:23   ` Jan Beulich
2026-06-24 13:44     ` Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 18/23] xen/riscv: implement IRQ routing for device passthrough Oleksii Kurochko
2026-06-22 15:57   ` Jan Beulich
2026-06-17 11:17 ` [PATCH v3 19/23] xen/riscv: implement init_intc_phandle() Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 20/23] xen/riscv: initialize RCU, scheduler, and system domains in start_xen() Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 21/23] xen/riscv: provide init_vuart() Oleksii Kurochko
2026-06-17 11:17 ` [PATCH v3 22/23] xen/Kconfig: introduce HAS_STATIC_MEMORY Oleksii Kurochko
2026-06-23  8:26   ` Jan Beulich
2026-06-17 11:17 ` [PATCH v3 23/23] xen/riscv: add initial dom0less infrastructure support Oleksii Kurochko
2026-06-23  8:36   ` Jan Beulich

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=29fbbfe2-579c-4506-96d8-930c03a65c61@gmail.com \
    --to=oleksii.kurochko@gmail.com \
    --cc=Romain.Caritey@microchip.com \
    --cc=alistair.francis@wdc.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=connojdavis@gmail.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.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.