diff mbox series

[v2,11/12] hw/arm/raspi: Deprecate old raspiX machine names

Message ID 20250204002240.97830-12-philmd@linaro.org (mailing list archive)
State New
Headers show
Series hw/arm/raspi: Allow creating any Raspberry Pi machine | expand

Commit Message

Philippe Mathieu-Daudé Feb. 4, 2025, 12:22 a.m. UTC
All previous raspi machines can be created using the
generic machine. Deprecate the old names to maintain
a single one. Update the tests.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
QOM HMP introspection test fails because without the 'model'
argument set, no machine is created...

  $ qemu-system-aarch64 -M raspi
  qemu-system-aarch64: Missing model, try -M raspi,model=help
---
 docs/about/deprecated.rst               | 13 +++++++++++++
 hw/arm/raspi.c                          |  5 +++++
 tests/qtest/bcm2835-dma-test.c          |  2 +-
 tests/qtest/bcm2835-i2c-test.c          |  2 +-
 tests/qtest/boot-serial-test.c          |  3 ++-
 tests/functional/test_aarch64_raspi3.py |  5 ++---
 tests/functional/test_aarch64_raspi4.py |  4 ++--
 tests/functional/test_arm_raspi2.py     |  4 ++--
 8 files changed, 28 insertions(+), 10 deletions(-)

Comments

Peter Maydell Feb. 4, 2025, 9:22 a.m. UTC | #1
On Tue, 4 Feb 2025 at 00:23, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> All previous raspi machines can be created using the
> generic machine. Deprecate the old names to maintain
> a single one. Update the tests.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
> index 4a3c302962a..c9a11a52f78 100644
> --- a/docs/about/deprecated.rst
> +++ b/docs/about/deprecated.rst
> @@ -257,6 +257,19 @@ Big-Endian variants of MicroBlaze ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` ma
>  Both ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` were added for little endian
>  CPUs. Big endian support is not tested.
>
> +ARM ``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b`` and ``raspi4b`` machines (since 10.0)
> +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> +
> +The Raspberry Pi machines have been unified under the generic ``raspi`` machine,
> +which takes the model as argument.
> +
> +    - `raspi0`` is now an alias for ``raspi,model=Zero``
> +    - `raspi1ap`` is now an alias for ``raspi,model=1A+``
> +    - `raspi2b`` is now an alias for ``raspi,model=2B``
> +    - `raspi3ap`` is now an alias for ``raspi,model=3A+``
> +    - `raspi3b`` is now an alias for ``raspi,model=3B``
> +    - `raspi4b`` is now an alias for ``raspi,model=4B``

This is not how we typically handle "we have a bunch
of different devboards in one family". What's wrong with the
existing set of machine names?

Can we implement "support more than just the fixed amount
of RAM" by making '-m 2G' work, without changing the
machine names at all, please?

thanks
-- PMM
Philippe Mathieu-Daudé Feb. 4, 2025, 9:51 a.m. UTC | #2
On 4/2/25 10:22, Peter Maydell wrote:
> On Tue, 4 Feb 2025 at 00:23, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> All previous raspi machines can be created using the
>> generic machine. Deprecate the old names to maintain
>> a single one. Update the tests.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
>> diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
>> index 4a3c302962a..c9a11a52f78 100644
>> --- a/docs/about/deprecated.rst
>> +++ b/docs/about/deprecated.rst
>> @@ -257,6 +257,19 @@ Big-Endian variants of MicroBlaze ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` ma
>>   Both ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` were added for little endian
>>   CPUs. Big endian support is not tested.
>>
>> +ARM ``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b`` and ``raspi4b`` machines (since 10.0)
>> +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>> +
>> +The Raspberry Pi machines have been unified under the generic ``raspi`` machine,
>> +which takes the model as argument.
>> +
>> +    - `raspi0`` is now an alias for ``raspi,model=Zero``
>> +    - `raspi1ap`` is now an alias for ``raspi,model=1A+``
>> +    - `raspi2b`` is now an alias for ``raspi,model=2B``
>> +    - `raspi3ap`` is now an alias for ``raspi,model=3A+``
>> +    - `raspi3b`` is now an alias for ``raspi,model=3B``
>> +    - `raspi4b`` is now an alias for ``raspi,model=4B``
> 
> This is not how we typically handle "we have a bunch
> of different devboards in one family". What's wrong with the
> existing set of machine names?

Zoltan and you don't want to add more machine names, then you
don't want a generic machine. This is very confusing.

See previous patch:

   $ qemu-system-aarch64 -M raspi,model=help
   Available models (processor):
   - A          (BCM2835)
   - B          (BCM2835)
   - A+         (BCM2835)
   - B+         (BCM2835)
   - CM1        (BCM2835)
   - Zero       (BCM2835)
   - ZeroW      (BCM2835)
   - 2B         (BCM2836)
   - 3B         (BCM2837)
   - CM3        (BCM2837)
   - 3B+        (BCM2837)
   - 3A+        (BCM2837)
   - CM3+       (BCM2837)
   - 4B         (BCM2838)

Can we or not add the other raspi models?

> Can we implement "support more than just the fixed amount
> of RAM" by making '-m 2G' work, without changing the
> machine names at all, please?

We surely can if we find developers motivated to do the work.

Regards,

Phil.
Daniel P. Berrangé Feb. 4, 2025, 9:57 a.m. UTC | #3
On Tue, Feb 04, 2025 at 10:51:04AM +0100, Philippe Mathieu-Daudé wrote:
> On 4/2/25 10:22, Peter Maydell wrote:
> > On Tue, 4 Feb 2025 at 00:23, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> > > 
> > > All previous raspi machines can be created using the
> > > generic machine. Deprecate the old names to maintain
> > > a single one. Update the tests.
> > > 
> > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > 
> > > diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
> > > index 4a3c302962a..c9a11a52f78 100644
> > > --- a/docs/about/deprecated.rst
> > > +++ b/docs/about/deprecated.rst
> > > @@ -257,6 +257,19 @@ Big-Endian variants of MicroBlaze ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` ma
> > >   Both ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` were added for little endian
> > >   CPUs. Big endian support is not tested.
> > > 
> > > +ARM ``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b`` and ``raspi4b`` machines (since 10.0)
> > > +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > > +
> > > +The Raspberry Pi machines have been unified under the generic ``raspi`` machine,
> > > +which takes the model as argument.
> > > +
> > > +    - `raspi0`` is now an alias for ``raspi,model=Zero``
> > > +    - `raspi1ap`` is now an alias for ``raspi,model=1A+``
> > > +    - `raspi2b`` is now an alias for ``raspi,model=2B``
> > > +    - `raspi3ap`` is now an alias for ``raspi,model=3A+``
> > > +    - `raspi3b`` is now an alias for ``raspi,model=3B``
> > > +    - `raspi4b`` is now an alias for ``raspi,model=4B``
> > 
> > This is not how we typically handle "we have a bunch
> > of different devboards in one family". What's wrong with the
> > existing set of machine names?
> 
> Zoltan and you don't want to add more machine names, then you
> don't want a generic machine. This is very confusing.

IMHO we can have distinct machines for each model, but
*NOT* have further machines for each RAM size within a
model.


With regards,
Daniel
BALATON Zoltan Feb. 4, 2025, 9:58 a.m. UTC | #4
On Tue, 4 Feb 2025, Philippe Mathieu-Daudé wrote:
> On 4/2/25 10:22, Peter Maydell wrote:
>> On Tue, 4 Feb 2025 at 00:23, Philippe Mathieu-Daudé <philmd@linaro.org> 
>> wrote:
>>> 
>>> All previous raspi machines can be created using the
>>> generic machine. Deprecate the old names to maintain
>>> a single one. Update the tests.
>>> 
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> 
>>> diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
>>> index 4a3c302962a..c9a11a52f78 100644
>>> --- a/docs/about/deprecated.rst
>>> +++ b/docs/about/deprecated.rst
>>> @@ -257,6 +257,19 @@ Big-Endian variants of MicroBlaze ``petalogix-ml605`` 
>>> and ``xlnx-zynqmp-pmu`` ma
>>>   Both ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` were added for little 
>>> endian
>>>   CPUs. Big endian support is not tested.
>>> 
>>> +ARM ``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b`` and 
>>> ``raspi4b`` machines (since 10.0)
>>> +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>>> +
>>> +The Raspberry Pi machines have been unified under the generic ``raspi`` 
>>> machine,
>>> +which takes the model as argument.
>>> +
>>> +    - `raspi0`` is now an alias for ``raspi,model=Zero``
>>> +    - `raspi1ap`` is now an alias for ``raspi,model=1A+``
>>> +    - `raspi2b`` is now an alias for ``raspi,model=2B``
>>> +    - `raspi3ap`` is now an alias for ``raspi,model=3A+``
>>> +    - `raspi3b`` is now an alias for ``raspi,model=3B``
>>> +    - `raspi4b`` is now an alias for ``raspi,model=4B``
>> 
>> This is not how we typically handle "we have a bunch
>> of different devboards in one family". What's wrong with the
>> existing set of machine names?
>
> Zoltan and you don't want to add more machine names, then you
> don't want a generic machine. This is very confusing.

I said either rastpi4b,revision=1.4 or -machine raspi4b -memory 4g would 
be better IMHO. Peter perefers -memory which is also fine with me. I just 
don't think adding more machine names where only RAM size is different 
would be better than using -memory for that as usual.

Regards,
BALATON Zoltan

> See previous patch:
>
>  $ qemu-system-aarch64 -M raspi,model=help
>  Available models (processor):
>  - A          (BCM2835)
>  - B          (BCM2835)
>  - A+         (BCM2835)
>  - B+         (BCM2835)
>  - CM1        (BCM2835)
>  - Zero       (BCM2835)
>  - ZeroW      (BCM2835)
>  - 2B         (BCM2836)
>  - 3B         (BCM2837)
>  - CM3        (BCM2837)
>  - 3B+        (BCM2837)
>  - 3A+        (BCM2837)
>  - CM3+       (BCM2837)
>  - 4B         (BCM2838)
>
> Can we or not add the other raspi models?
>
>> Can we implement "support more than just the fixed amount
>> of RAM" by making '-m 2G' work, without changing the
>> machine names at all, please?
>
> We surely can if we find developers motivated to do the work.
>
> Regards,
>
> Phil.
>
>
Philippe Mathieu-Daudé Feb. 4, 2025, 10:48 a.m. UTC | #5
On 4/2/25 10:57, Daniel P. Berrangé wrote:
> On Tue, Feb 04, 2025 at 10:51:04AM +0100, Philippe Mathieu-Daudé wrote:
>> On 4/2/25 10:22, Peter Maydell wrote:
>>> On Tue, 4 Feb 2025 at 00:23, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>>>
>>>> All previous raspi machines can be created using the
>>>> generic machine. Deprecate the old names to maintain
>>>> a single one. Update the tests.
>>>>
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>
>>>> diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
>>>> index 4a3c302962a..c9a11a52f78 100644
>>>> --- a/docs/about/deprecated.rst
>>>> +++ b/docs/about/deprecated.rst
>>>> @@ -257,6 +257,19 @@ Big-Endian variants of MicroBlaze ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` ma
>>>>    Both ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` were added for little endian
>>>>    CPUs. Big endian support is not tested.
>>>>
>>>> +ARM ``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b`` and ``raspi4b`` machines (since 10.0)
>>>> +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>>>> +
>>>> +The Raspberry Pi machines have been unified under the generic ``raspi`` machine,
>>>> +which takes the model as argument.
>>>> +
>>>> +    - `raspi0`` is now an alias for ``raspi,model=Zero``
>>>> +    - `raspi1ap`` is now an alias for ``raspi,model=1A+``
>>>> +    - `raspi2b`` is now an alias for ``raspi,model=2B``
>>>> +    - `raspi3ap`` is now an alias for ``raspi,model=3A+``
>>>> +    - `raspi3b`` is now an alias for ``raspi,model=3B``
>>>> +    - `raspi4b`` is now an alias for ``raspi,model=4B``
>>>
>>> This is not how we typically handle "we have a bunch
>>> of different devboards in one family". What's wrong with the
>>> existing set of machine names?
>>
>> Zoltan and you don't want to add more machine names, then you
>> don't want a generic machine. This is very confusing.
> 
> IMHO we can have distinct machines for each model, but
> *NOT* have further machines for each RAM size within a
> model.

Got it. Unfortunately I spent more than my hobbyist time credit
doing this, so if I find the motivation to revisit, it'll be later.

Still, having machine memory size depending on the host config was
a bad design choice IMHO, as we test different setup depending on
the host being used, so not really a "reproducible" setup.
Daniel P. Berrangé Feb. 4, 2025, 10:51 a.m. UTC | #6
On Tue, Feb 04, 2025 at 11:48:10AM +0100, Philippe Mathieu-Daudé wrote:
> On 4/2/25 10:57, Daniel P. Berrangé wrote:
> > On Tue, Feb 04, 2025 at 10:51:04AM +0100, Philippe Mathieu-Daudé wrote:
> > > On 4/2/25 10:22, Peter Maydell wrote:
> > > > On Tue, 4 Feb 2025 at 00:23, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> > > > > 
> > > > > All previous raspi machines can be created using the
> > > > > generic machine. Deprecate the old names to maintain
> > > > > a single one. Update the tests.
> > > > > 
> > > > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > > > 
> > > > > diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
> > > > > index 4a3c302962a..c9a11a52f78 100644
> > > > > --- a/docs/about/deprecated.rst
> > > > > +++ b/docs/about/deprecated.rst
> > > > > @@ -257,6 +257,19 @@ Big-Endian variants of MicroBlaze ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` ma
> > > > >    Both ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` were added for little endian
> > > > >    CPUs. Big endian support is not tested.
> > > > > 
> > > > > +ARM ``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b`` and ``raspi4b`` machines (since 10.0)
> > > > > +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > > > > +
> > > > > +The Raspberry Pi machines have been unified under the generic ``raspi`` machine,
> > > > > +which takes the model as argument.
> > > > > +
> > > > > +    - `raspi0`` is now an alias for ``raspi,model=Zero``
> > > > > +    - `raspi1ap`` is now an alias for ``raspi,model=1A+``
> > > > > +    - `raspi2b`` is now an alias for ``raspi,model=2B``
> > > > > +    - `raspi3ap`` is now an alias for ``raspi,model=3A+``
> > > > > +    - `raspi3b`` is now an alias for ``raspi,model=3B``
> > > > > +    - `raspi4b`` is now an alias for ``raspi,model=4B``
> > > > 
> > > > This is not how we typically handle "we have a bunch
> > > > of different devboards in one family". What's wrong with the
> > > > existing set of machine names?
> > > 
> > > Zoltan and you don't want to add more machine names, then you
> > > don't want a generic machine. This is very confusing.
> > 
> > IMHO we can have distinct machines for each model, but
> > *NOT* have further machines for each RAM size within a
> > model.
> 
> Got it. Unfortunately I spent more than my hobbyist time credit
> doing this, so if I find the motivation to revisit, it'll be later.
> 
> Still, having machine memory size depending on the host config was
> a bad design choice IMHO, as we test different setup depending on
> the host being used, so not really a "reproducible" setup.

Yeah that one is a bit ugly. IMHO it would be valid to just leave
it defaulted to 2GB and ensure we get a nice error message on
32-bit hosts, letting users override RAM size if they desire. Or
its just another reason to kill 32-bit hosts

With regards,
Daniel
Peter Maydell Feb. 4, 2025, 11:13 a.m. UTC | #7
On Tue, 4 Feb 2025 at 09:57, Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Tue, Feb 04, 2025 at 10:51:04AM +0100, Philippe Mathieu-Daudé wrote:
> > On 4/2/25 10:22, Peter Maydell wrote:
> > > On Tue, 4 Feb 2025 at 00:23, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> > > >
> > > > All previous raspi machines can be created using the
> > > > generic machine. Deprecate the old names to maintain
> > > > a single one. Update the tests.
> > > >
> > > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > >
> > > > diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
> > > > index 4a3c302962a..c9a11a52f78 100644
> > > > --- a/docs/about/deprecated.rst
> > > > +++ b/docs/about/deprecated.rst
> > > > @@ -257,6 +257,19 @@ Big-Endian variants of MicroBlaze ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` ma
> > > >   Both ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` were added for little endian
> > > >   CPUs. Big endian support is not tested.
> > > >
> > > > +ARM ``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b`` and ``raspi4b`` machines (since 10.0)
> > > > +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> > > > +
> > > > +The Raspberry Pi machines have been unified under the generic ``raspi`` machine,
> > > > +which takes the model as argument.
> > > > +
> > > > +    - `raspi0`` is now an alias for ``raspi,model=Zero``
> > > > +    - `raspi1ap`` is now an alias for ``raspi,model=1A+``
> > > > +    - `raspi2b`` is now an alias for ``raspi,model=2B``
> > > > +    - `raspi3ap`` is now an alias for ``raspi,model=3A+``
> > > > +    - `raspi3b`` is now an alias for ``raspi,model=3B``
> > > > +    - `raspi4b`` is now an alias for ``raspi,model=4B``
> > >
> > > This is not how we typically handle "we have a bunch
> > > of different devboards in one family". What's wrong with the
> > > existing set of machine names?
> >
> > Zoltan and you don't want to add more machine names, then you
> > don't want a generic machine. This is very confusing.
>
> IMHO we can have distinct machines for each model, but
> *NOT* have further machines for each RAM size within a
> model.

Yes, this was what I was intending to suggest. Apologies
if I was confusing with what I said the previous time round.

thanks
-- PMM
Philippe Mathieu-Daudé Feb. 4, 2025, 1:40 p.m. UTC | #8
On 4/2/25 12:13, Peter Maydell wrote:
> On Tue, 4 Feb 2025 at 09:57, Daniel P. Berrangé <berrange@redhat.com> wrote:
>>
>> On Tue, Feb 04, 2025 at 10:51:04AM +0100, Philippe Mathieu-Daudé wrote:
>>> On 4/2/25 10:22, Peter Maydell wrote:
>>>> On Tue, 4 Feb 2025 at 00:23, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>>>>
>>>>> All previous raspi machines can be created using the
>>>>> generic machine. Deprecate the old names to maintain
>>>>> a single one. Update the tests.
>>>>>
>>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>>>
>>>>> diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
>>>>> index 4a3c302962a..c9a11a52f78 100644
>>>>> --- a/docs/about/deprecated.rst
>>>>> +++ b/docs/about/deprecated.rst
>>>>> @@ -257,6 +257,19 @@ Big-Endian variants of MicroBlaze ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` ma
>>>>>    Both ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` were added for little endian
>>>>>    CPUs. Big endian support is not tested.
>>>>>
>>>>> +ARM ``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b`` and ``raspi4b`` machines (since 10.0)
>>>>> +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>>>>> +
>>>>> +The Raspberry Pi machines have been unified under the generic ``raspi`` machine,
>>>>> +which takes the model as argument.
>>>>> +
>>>>> +    - `raspi0`` is now an alias for ``raspi,model=Zero``
>>>>> +    - `raspi1ap`` is now an alias for ``raspi,model=1A+``
>>>>> +    - `raspi2b`` is now an alias for ``raspi,model=2B``
>>>>> +    - `raspi3ap`` is now an alias for ``raspi,model=3A+``
>>>>> +    - `raspi3b`` is now an alias for ``raspi,model=3B``
>>>>> +    - `raspi4b`` is now an alias for ``raspi,model=4B``
>>>>
>>>> This is not how we typically handle "we have a bunch
>>>> of different devboards in one family". What's wrong with the
>>>> existing set of machine names?
>>>
>>> Zoltan and you don't want to add more machine names, then you
>>> don't want a generic machine. This is very confusing.
>>
>> IMHO we can have distinct machines for each model, but
>> *NOT* have further machines for each RAM size within a
>> model.
> 
> Yes, this was what I was intending to suggest. Apologies
> if I was confusing with what I said the previous time round.

OK, let's see if we understand each other correctly as developer,
before explaining to users, taking the 4B model as example.

The 4B come in 4 physical variants, depending on the amount of
DRAM: 1G, 2G, 4G and 8G.

We can not allocate 2G on 32-bit hosts, so to have a reproducible
guest behavior on 32/64-bit hosts, it makes sense to takes the
model with 1G of DRAM as default for the 'raspi4b' machine.

If an user specify -m 2G ... 8G, we can adapt the 'board_rev'
register to expose the corresponding amount of ram. Now, how /
where to tell the users 1/ the default is 1G, and 2/ they can use
2/4/8G?
Peter Maydell Feb. 4, 2025, 1:52 p.m. UTC | #9
On Tue, 4 Feb 2025 at 13:40, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 4/2/25 12:13, Peter Maydell wrote:
> > On Tue, 4 Feb 2025 at 09:57, Daniel P. Berrangé <berrange@redhat.com> wrote:
> >> IMHO we can have distinct machines for each model, but
> >> *NOT* have further machines for each RAM size within a
> >> model.
> >
> > Yes, this was what I was intending to suggest. Apologies
> > if I was confusing with what I said the previous time round.
>
> OK, let's see if we understand each other correctly as developer,
> before explaining to users, taking the 4B model as example.
>
> The 4B come in 4 physical variants, depending on the amount of
> DRAM: 1G, 2G, 4G and 8G.
>
> We can not allocate 2G on 32-bit hosts, so to have a reproducible
> guest behavior on 32/64-bit hosts, it makes sense to takes the
> model with 1G of DRAM as default for the 'raspi4b' machine.

At the moment we create the 1GB version on 32-bit hosts and
the 2GB version on 64-bit hosts. I dunno that that's ideal,
but I think it's probably best not to change that at this point.

> If an user specify -m 2G ... 8G, we can adapt the 'board_rev'
> register to expose the corresponding amount of ram. Now, how /
> where to tell the users 1/ the default is 1G, and 2/ they can use
> 2/4/8G?

In the documentation: docs/system/arm/raspi.rst .

-- PMM
Philippe Mathieu-Daudé Feb. 4, 2025, 2:59 p.m. UTC | #10
On 4/2/25 14:52, Peter Maydell wrote:
> On Tue, 4 Feb 2025 at 13:40, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> On 4/2/25 12:13, Peter Maydell wrote:
>>> On Tue, 4 Feb 2025 at 09:57, Daniel P. Berrangé <berrange@redhat.com> wrote:
>>>> IMHO we can have distinct machines for each model, but
>>>> *NOT* have further machines for each RAM size within a
>>>> model.
>>>
>>> Yes, this was what I was intending to suggest. Apologies
>>> if I was confusing with what I said the previous time round.
>>
>> OK, let's see if we understand each other correctly as developer,
>> before explaining to users, taking the 4B model as example.
>>
>> The 4B come in 4 physical variants, depending on the amount of
>> DRAM: 1G, 2G, 4G and 8G.
>>
>> We can not allocate 2G on 32-bit hosts, so to have a reproducible
>> guest behavior on 32/64-bit hosts, it makes sense to takes the
>> model with 1G of DRAM as default for the 'raspi4b' machine.
> 
> At the moment we create the 1GB version on 32-bit hosts and
> the 2GB version on 64-bit hosts. I dunno that that's ideal,
> but I think it's probably best not to change that at this point.

Well this is annoying in my "unify qemu-system-{arm/aarch64}" effort,
but not a blocker.

>> If an user specify -m 2G ... 8G, we can adapt the 'board_rev'
>> register to expose the corresponding amount of ram. Now, how /
>> where to tell the users 1/ the default is 1G, and 2/ they can use
>> 2/4/8G?
> 
> In the documentation: docs/system/arm/raspi.rst .

OK.

Back to this series, please tell me if patches 1-7 aren't useful or
if you prefer them in a separate series:

   hw/arm/raspi: Access SoC parent object using  BCM283X_BASE() macro
   hw/arm/raspi: Merge model 4B with other models
   hw/arm/raspi: Unify RASPI_MACHINE types
   hw/arm/raspi: Pass board_rev as argument to raspi_base_machine_init()
   hw/arm/raspi: Consider processor id in types[] array
   hw/arm/raspi: Consider network interface for B models
   hw/arm/raspi: Check ramsize is within chipset aperture

Thanks,

Phil.
diff mbox series

Patch

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 4a3c302962a..c9a11a52f78 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -257,6 +257,19 @@  Big-Endian variants of MicroBlaze ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` ma
 Both ``petalogix-ml605`` and ``xlnx-zynqmp-pmu`` were added for little endian
 CPUs. Big endian support is not tested.
 
+ARM ``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b`` and ``raspi4b`` machines (since 10.0)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+The Raspberry Pi machines have been unified under the generic ``raspi`` machine,
+which takes the model as argument.
+
+    - `raspi0`` is now an alias for ``raspi,model=Zero``
+    - `raspi1ap`` is now an alias for ``raspi,model=1A+``
+    - `raspi2b`` is now an alias for ``raspi,model=2B``
+    - `raspi3ap`` is now an alias for ``raspi,model=3A+``
+    - `raspi3b`` is now an alias for ``raspi,model=3B``
+    - `raspi4b`` is now an alias for ``raspi,model=4B``
+
 Backend options
 ---------------
 
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 8cae1ff6f93..86ecc988e06 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -637,6 +637,7 @@  static void raspi0_machine_class_init(ObjectClass *oc, void *data)
 
     rmc->board_rev = 0x920092; /* Revision 1.2 */
     raspi_machine_class_init(mc, rmc->board_rev);
+    mc->deprecation_reason = "-M raspi,model=Zero";
 };
 
 static void raspi1ap_machine_class_init(ObjectClass *oc, void *data)
@@ -646,6 +647,7 @@  static void raspi1ap_machine_class_init(ObjectClass *oc, void *data)
 
     rmc->board_rev = 0x900021; /* Revision 1.1 */
     raspi_machine_class_init(mc, rmc->board_rev);
+    mc->deprecation_reason = "-M raspi,model=A+ (-m 512m)";
 };
 
 static void raspi2b_machine_class_init(ObjectClass *oc, void *data)
@@ -655,6 +657,7 @@  static void raspi2b_machine_class_init(ObjectClass *oc, void *data)
 
     rmc->board_rev = 0xa21041;
     raspi_machine_class_init(mc, rmc->board_rev);
+    mc->deprecation_reason = "-M raspi,model=2B -m 1g";
 };
 
 #ifdef TARGET_AARCH64
@@ -665,6 +668,7 @@  static void raspi3ap_machine_class_init(ObjectClass *oc, void *data)
 
     rmc->board_rev = 0x9020e0; /* Revision 1.0 */
     raspi_machine_class_init(mc, rmc->board_rev);
+    mc->deprecation_reason = "-M raspi,model=3A+ -m 512m";
 };
 
 static void raspi3b_machine_class_init(ObjectClass *oc, void *data)
@@ -674,6 +678,7 @@  static void raspi3b_machine_class_init(ObjectClass *oc, void *data)
 
     rmc->board_rev = 0xa02082;
     raspi_machine_class_init(mc, rmc->board_rev);
+    mc->deprecation_reason = "-M raspi,model=3B -m 1g";
 };
 
 static void raspi4b_machine_class_init(ObjectClass *oc, void *data)
diff --git a/tests/qtest/bcm2835-dma-test.c b/tests/qtest/bcm2835-dma-test.c
index 18901b76d21..705e6b2362b 100644
--- a/tests/qtest/bcm2835-dma-test.c
+++ b/tests/qtest/bcm2835-dma-test.c
@@ -111,7 +111,7 @@  int main(int argc, char **argv)
     g_test_init(&argc, &argv, NULL);
     qtest_add_func("/bcm2835/dma/test_interrupts",
                    bcm2835_dma_test_interrupts);
-    qtest_start("-machine raspi3b");
+    qtest_start("-machine raspi,model=3B -m 1g");
     ret = g_test_run();
     qtest_end();
     return ret;
diff --git a/tests/qtest/bcm2835-i2c-test.c b/tests/qtest/bcm2835-i2c-test.c
index 15991949260..15904abf393 100644
--- a/tests/qtest/bcm2835-i2c-test.c
+++ b/tests/qtest/bcm2835-i2c-test.c
@@ -104,7 +104,7 @@  int main(int argc, char **argv)
     }
 
     /* Run I2C tests with TMP105 slaves on all three buses */
-    qtest_start("-M raspi3b "
+    qtest_start("-M raspi,model=3B -m 1g "
                 "-device tmp105,address=0x50,bus=i2c-bus.0 "
                 "-device tmp105,address=0x50,bus=i2c-bus.1 "
                 "-device tmp105,address=0x50,bus=i2c-bus.2");
diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c
index a05d26ee996..fbafd73facb 100644
--- a/tests/qtest/boot-serial-test.c
+++ b/tests/qtest/boot-serial-test.c
@@ -188,7 +188,8 @@  static const testdef_t tests[] = {
       sizeof(kernel_pls3adsp1800), kernel_pls3adsp1800 },
     { "microblazeel", "petalogix-ml605", "", "TT",
       sizeof(kernel_plml605), kernel_plml605 },
-    { "arm", "raspi2b", "", "TT", sizeof(bios_raspi2), 0, bios_raspi2 },
+    { "arm", "raspi,model=2B -m 1g", "", "TT",
+      sizeof(bios_raspi2), 0, bios_raspi2 },
     { "aarch64", "virt", "-cpu max", "TT", sizeof(kernel_aarch64),
       kernel_aarch64 },
     { "arm", "microbit", "", "T", sizeof(kernel_nrf51), kernel_nrf51 },
diff --git a/tests/functional/test_aarch64_raspi3.py b/tests/functional/test_aarch64_raspi3.py
index 74f6630ed26..05766d93b3f 100755
--- a/tests/functional/test_aarch64_raspi3.py
+++ b/tests/functional/test_aarch64_raspi3.py
@@ -21,10 +21,9 @@  def test_aarch64_raspi3_atf(self):
         efi_name = 'RPI_EFI.fd'
         efi_fd = self.archive_extract(self.ASSET_RPI3_UEFI, member=efi_name)
 
-        self.set_machine('raspi3b')
+        self.set_machine('raspi,model=3B -m 1g')
         self.vm.set_console(console_index=1)
-        self.vm.add_args('-cpu', 'cortex-a53',
-                         '-nodefaults',
+        self.vm.add_args('-nodefaults',
                          '-device', f'loader,file={efi_fd},force-raw=true')
         self.vm.launch()
         self.wait_for_console_pattern('version UEFI Firmware v1.15')
diff --git a/tests/functional/test_aarch64_raspi4.py b/tests/functional/test_aarch64_raspi4.py
index 7a4302b0c5a..3becee9333a 100755
--- a/tests/functional/test_aarch64_raspi4.py
+++ b/tests/functional/test_aarch64_raspi4.py
@@ -34,7 +34,7 @@  def test_arm_raspi4(self):
         dtb_path = self.archive_extract(self.ASSET_KERNEL_20190215,
                                         member='boot/bcm2711-rpi-4-b.dtb')
 
-        self.set_machine('raspi4b')
+        self.set_machine('raspi,model=4B -m 1g')
         self.vm.set_console()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
                                'earlycon=pl011,mmio32,0xfe201000 ' +
@@ -64,7 +64,7 @@  def test_arm_raspi4_initrd(self):
                                         member='boot/bcm2711-rpi-4-b.dtb')
         initrd_path = self.uncompress(self.ASSET_INITRD)
 
-        self.set_machine('raspi4b')
+        self.set_machine('raspi,model=4B -m 1g')
         self.vm.set_console()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
                                'earlycon=pl011,mmio32,0xfe201000 ' +
diff --git a/tests/functional/test_arm_raspi2.py b/tests/functional/test_arm_raspi2.py
index d3c7aaa39b0..37390a9c360 100755
--- a/tests/functional/test_arm_raspi2.py
+++ b/tests/functional/test_arm_raspi2.py
@@ -39,7 +39,7 @@  def do_test_arm_raspi2(self, uart_id):
         dtb_path = self.archive_extract(self.ASSET_KERNEL_20190215,
                                         member='boot/bcm2709-rpi-2-b.dtb')
 
-        self.set_machine('raspi2b')
+        self.set_machine('raspi,model=2B -m 1g')
         self.vm.set_console()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
                                serial_kernel_cmdline[uart_id] +
@@ -65,7 +65,7 @@  def test_arm_raspi2_initrd(self):
                                         member='boot/bcm2709-rpi-2-b.dtb')
         initrd_path = self.uncompress(self.ASSET_INITRD)
 
-        self.set_machine('raspi2b')
+        self.set_machine('raspi,model=2B -m 1g')
         self.vm.set_console()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
                                'earlycon=pl011,0x3f201000 console=ttyAMA0 '