qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aditya Gupta <adityag@linux.ibm.com>
To: "Cédric Le Goater" <clg@kaod.org>,
	"Mahesh J Salgaonkar" <mahesh@linux.ibm.com>,
	"Madhavan Srinivasan" <maddy@linux.ibm.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Frédéric Barrat" <fbarrat@linux.ibm.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [PATCH v5 7/8] ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine
Date: Mon, 24 Mar 2025 12:43:32 +0530	[thread overview]
Message-ID: <337b1a39-ed5f-4737-a98a-1ed2784aef7b@linux.ibm.com> (raw)
In-Reply-To: <bce5dcfc-24d2-41e2-b11e-7cb5967f2132@kaod.org>

Hi Cedric,

On 09/03/25 19:38, Cédric Le Goater wrote:
> On 3/8/25 21:51, Aditya Gupta wrote:
>> <...snip...>
>>
>>   static void pnv_chip_power8_instance_init(Object *obj)
>>   {
>>       Pnv8Chip *chip8 = PNV8_CHIP(obj);
>> @@ -1966,6 +1996,20 @@ static void 
>> pnv_chip_power10_instance_init(Object *obj)
>>       PnvChipClass *pcc = PNV_CHIP_GET_CLASS(obj);
>>       int i;
>>   +    /*
>> +     * Power11 declares Power10 as it's parent class, to be able to 
>> reuse
>> +     * most of the Power10 code.
>> +     * But this causes Power10 and Power11's both instance init to be
>> +     * called for PowerNV11 chip
>> +     *
>> +     * Skip initialising Power10 specific child objects, if the chip is
>> +     * Power11 chip, in which case power11's instance init will 
>> initialise
>> +     * the child objects
>> +     */
>> +    if (!strcmp(object_get_typename(obj), TYPE_PNV_CHIP_POWER11)) {
>> +        return;
>> +    }
>> +
>
> This is a hack !  Please duplicate the code like done for other chips.
>
>
>> <...snip...>
>>
>>   +    /*
>> +     * P11 chip and variants
>> +     */
>> +    {
>> +        .name          = TYPE_PNV11_CHIP,
>> +        .parent        = TYPE_PNV10_CHIP,
>
> why is the parent not TYPE_PNV_CHIP like the other chips ?
>
> This is a hack which can be easily avoided with more work :)


When I do this, every function using Pnv10Chip* will need to be 
duplicated to use Pnv11Chip*.

I will do that.

But what do you say about changing Pnv10 chip to Pnv1x chip ? It may 
only be used by Pnv10 and Pnv11, not future chips. But is that 
unnecessary for just two versions of the chip ?

Just tried to think of some ways to reduce duplication, or having 
different files such as pnv10.c, pnv11.c ? I am not sure because these 
might be unnecessary things too.


Thanks,

- Aditya G



  parent reply	other threads:[~2025-03-24  7:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-08 20:51 [PATCH v5 0/8] Power11 support for QEMU [PowerNV] Aditya Gupta
2025-03-08 20:51 ` [PATCH v5 1/8] ppc/pnv: Add HOMER for POWER11 Aditya Gupta
2025-03-08 20:51 ` [PATCH v5 2/8] ppc/pnv: Add a LPC controller " Aditya Gupta
2025-03-08 20:51 ` [PATCH v5 3/8] ppc/pnv: Add OCC for Power11 Aditya Gupta
2025-03-08 20:51 ` [PATCH v5 4/8] ppc/pnv: Add a PSI bridge model " Aditya Gupta
2025-03-08 20:51 ` [PATCH v5 5/8] ppc/pnv: Add SBE " Aditya Gupta
2025-03-08 20:51 ` [PATCH v5 6/8] ppc/pnv: Add ChipTOD " Aditya Gupta
2025-03-08 20:51 ` [PATCH v5 7/8] ppc/pnv: Add a Power11 Pnv11Chip, and a Power11 Machine Aditya Gupta
2025-03-09 14:08   ` Cédric Le Goater
2025-03-10 10:29     ` Aditya Gupta
2025-03-24  7:13     ` Aditya Gupta [this message]
2025-03-24  7:35       ` Cédric Le Goater
2025-03-24  8:38         ` Aditya Gupta
2025-03-08 20:51 ` [PATCH v5 8/8] ppc/pnv: Update skiboot to support Power11 Aditya Gupta
2025-03-09 14:10   ` Cédric Le Goater
2025-03-10 10:31     ` Aditya Gupta
2025-03-10 11:45       ` Cédric Le Goater
2025-03-10 14:59         ` Aditya Gupta
2025-03-10 15:33           ` Cédric Le Goater
2025-03-11  8:39             ` Nicholas Piggin
2025-03-11  8:46               ` Cédric Le Goater
2025-03-11  8:50               ` Aditya Gupta
2025-03-24  7:41 ` [PATCH v5 0/8] Power11 support for QEMU [PowerNV] Cédric Le Goater
2025-03-25 11:28   ` Aditya Gupta
2025-03-25 12:07     ` Cédric Le Goater
2025-03-25 17:11       ` Aditya Gupta
2025-03-25 17:16         ` Cédric Le Goater

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=337b1a39-ed5f-4737-a98a-1ed2784aef7b@linux.ibm.com \
    --to=adityag@linux.ibm.com \
    --cc=clg@kaod.org \
    --cc=fbarrat@linux.ibm.com \
    --cc=harshpb@linux.ibm.com \
    --cc=maddy@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).